XGM Forum
Сайт - Статьи - Проекты - Ресурсы - Блоги

Форуме в режиме ТОЛЬКО ЧТЕНИЕ. Вы можете задать вопросы в Q/A на сайте, либо создать свой проект или ресурс.
Вернуться   XGM Forum > Warcraft> Академия: форум для вопросов> Jass
Ник
Пароль
Войти через VK в один клик
Сайт использует только имя.

Закрытая тема
 
Warden
:::...
offline
Опыт: 26,106
Активность:
Warden's Cache API
Аналог SCV, в упрощенном варианте =)

Код:
// --- START of Warden's Cache API stuff ---

//===========================================================================
//
//   i2u  - [integer to unit]      (convert integer to unit)
//   i2p  - [integer to player]    (convert integer to player)
//
//   b2i  - [boolean to integer]   (convert boolean to integer)
//   i2b  - [integer to boolean]   (convert integer to boolean)
//
//   h2i  - [handle to integer]    (convert handle to integer)
//
//   gc   - [get cache]            (take utility cache variable)
//
//   sss  - [set string string]    (attach string to string)
//   gss  - [get string string]    (take string attached from string)
//   gsi  - [get string integer]   (take integer attached from string)
//   gsr  - [get string real]      (take real attached from string)
//
//   shi  - [get handle integer]   (attach integer to handle)
//   ghi  - [get handle integer]   (take integer attached from handle)
//
//   shr  - [set handle real]      (attach real to handle)
//   ghr  - [get handle real]      (take real attached from handle)
//
//   shs  - [set handle string]    (attach string to handle)
//   ghs  - [get handle string]    (take string attached from handle)
//
//   fhd  - [flush handle data]    (flush all data atttached from handle)
//
//===========================================================================
constant function i2u takes integer i returns unit
          return i
          return null
endfunction
constant function i2p takes integer i returns player
          return i
          return null
endfunction

//===========================================================================
function b2i takes boolean b returns integer
 if b then
  return 1
 else
  return 0
 endif
endfunction
function i2b takes integer i returns boolean
 if i==1 then
  return true
 else
  return false
 endif
endfunction

//===========================================================================
constant function h2i takes handle h returns integer
          return h
          return 0
endfunction

//===========================================================================
function gc takes nothing returns gamecache
 if udg_gc==null then
  call FlushGameCache(InitGameCache("temp.w3v"))
  set udg_gc=InitGameCache("tem.w3v")
 endif
 return udg_gc
endfunction

//===========================================================================
function sss takes string k, string s returns nothing
 call StoreString(gc(),"cfg",k,s)
endfunction
function gss takes string k returns string
 return GetStoredString(gc(),"cfg",k)
endfunction
function gsi takes string k returns integer
 return S2I(gss(k))
endfunction
function gsr takes string k returns real
 return S2R(gss(k))
endfunction

//===========================================================================
function ghi takes handle h, string k returns integer
 return GetStoredInteger(gc(),I2S(h2i(h)),k)
endfunction
function shi takes handle h, string k, integer i returns nothing
 call StoreInteger(gc(),I2S(h2i(h)),k,i)
endfunction

//===========================================================================
function ghr takes handle h, string k returns real
 return GetStoredReal(gc(),I2S(h2i(h)),k)
endfunction
function shr takes handle h, string k, real r returns nothing
 call StoreReal(gc(),I2S(h2i(h)),k,r)
endfunction

//===========================================================================
function ghs takes handle h, string k returns string
 return GetStoredString(gc(),I2S(h2i(h)),k)
endfunction
function shs takes handle h, string k, string s returns nothing
 call StoreString(gc(),I2S(h2i(h)),k,s)
endfunction

//===========================================================================
function fhd takes handle h returns nothing
 call FlushStoredMission(gc(),I2S(h2i(h)))
endfunction

//===========================================================================

// --- END of Warden's Cache Utility stuff ---
Старый 17.08.2007, 15:53
Dragon27

offline
Опыт: 6,779
Активность:
Для новичков сойдёт.
Старый 17.08.2007, 15:55
J
expert
offline
Опыт: 48,447
Активность:
однако я непойму чем именно этот вариаент "упрощенее" :&
Старый 17.08.2007, 16:00
Инквизитор

offline
Опыт: 7,037
Активность:
OMG что это? =)
Старый 17.08.2007, 16:04
J
expert
offline
Опыт: 48,447
Активность:
Incvizitor это к сожалению ништо...

Отредактировано Jon, 17.08.2007 в 16:23.
Старый 17.08.2007, 16:14
Hormonij

offline
Опыт: 1,350
Активность:
Что это вообще такое?
Старый 17.08.2007, 16:25
DFlyer
<3 MJ
offline
Опыт: 42,879
Активность:
Цитата:
Аналог SCV, в упрощенном варианте

А что такое, смотри в статьях.
Старый 17.08.2007, 16:28
Alex_Hell
Mapmaker 'N' Programmer
offline
Опыт: 6,885
Активность:
Warden, на мой взгляд тут ничего упрощенного нету...даже запутано немного...если кому-нибудь будут нужны функции RB + Cache, он создаст их...если он конечно умеет этим пользоваться...а если не умеет, то даже твоя система ему не поможет...к томуже тут их много, чаще всего такое количество не нужно, нужно только 2-3 функции(преобразования)...
Старый 17.08.2007, 17:24
J
expert
offline
Опыт: 48,447
Активность:
функции sss() и gss() и им подобные я вообще отношу к разряду ненужных.
и сам по себе я привык не юзать спецальные функции SCV а использовать Store**** и GetStored**** напрямую.
Старый 17.08.2007, 17:28
Alex_Hell
Mapmaker 'N' Programmer
offline
Опыт: 6,885
Активность:
Jon, я делаю также...
Старый 17.08.2007, 17:37
Void

offline
Опыт: 1,632
Активность:
Эта система немного поставила в тупиковое положение, особенно ничего нового не предлагает.
Старый 17.08.2007, 21:08
Закрытая тема

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы можете скачивать файлы

BB-коды Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход



Часовой пояс GMT +3, время: 11:24.