scope LimitlessArray initializer Init
globals
private gamecache cache
private integer array data1
private integer array data2
endglobals
public function Set takes integer index, integer value returns nothing
if (index < 8191) then
set data1[index] = value
elseif (index < 16382) then
set data2[index-8191] = value
else
call StoreInteger(cache, "data", I2S(index), value)
endif
endfunction
public function Get takes integer index returns value
if (index < 8191) then
return data1[index]
elseif (index < 16382) then
return data2[index-8191]
endif
return GetStoredInteger(cache, "data", I2S(index))
endfunction
private function Init takes nothing returns nothing
set cache = InitGameCache("arraydata.w3v")
endfunction
endscope
I need it as every unit which appears on the map throughout the entire game requires its own array index as part of a battalions system I'm creating for my map - I had thought 8192 would be plenty until I just had a very long test game during which 8.192k units were spawned and everything then fell apart ,