- Joined
- Nov 30, 2007
- Messages
- 1,202
For some reason it loads 0... or only loops 1 time event though more units should be in the group.
This time I'm 100% sure the hashtable is intitalized...
*EDIT: AH.... Solved it...
JASS:
private function UpdateBlacksmith takes integer city returns nothing
local group g1 = CityGroup[city]
local group g2 = CreateGroup()
local unit u
local integer array count
local integer load
local integer i = 1
if (IsUnitGroupEmptyBJ(CityGroup[city]) == true) then
call BJDebugMsg("CityGroup = Empty")
else
call BJDebugMsg("CityGroup = NotEmpty")
endif
if (IsUnitGroupEmptyBJ(g1) == true) then
call BJDebugMsg("g1 = Empty")
else
call BJDebugMsg("g1 = NotEmpty")
endif
if (IsUnitGroupEmptyBJ(g2) == true) then
call BJDebugMsg("g2 = Empty")
else
call BJDebugMsg("g2 = NotEmpty")
endif
loop
set u = FirstOfGroup(g1)
exitwhen u == null
if (GetUnitState(u, UNIT_STATE_LIFE) > 0) then
set load = LoadInteger(hash, GetUnitTypeId(u), 'hbla')
//set load = LoadInteger(hash, 'hbla', GetUnitTypeId(u))
call BJDebugMsg("l: " + I2S(load))
if (load > 0) then
set count[load] = count[load] + 1
call GroupAddUnit(g2,u)
endif
endif
call GroupRemoveUnit(g1,u)
endloop
call BJDebugMsg("----------")
loop
exitwhen blacksmith[i] == null
call BJDebugMsg(I2S(count[i]))
set i = i + 1
endloop
call BJDebugMsg("----------")
set u = null
endfunction
JASS:
set blacksmith[1] = 'h00B'
call SaveInteger(hash, blacksmith[1], 'hbla', 1)
etc...
This time I'm 100% sure the hashtable is intitalized...
*EDIT: AH.... Solved it...
JASS:
local group g1 = CreateGroup()
call GroupAddGroup(CityGroup[city], g1)