- Joined
- Feb 23, 2007
- Messages
- 1,030
Firstly I guess I'm wondering if this is better than using unit groups. Second, I think there's a problem with it. If unit groups are better, then I don't need any help on this and I'll just scrap it. Also I know that H2I will be gone with new patch.
JASS:
globals
unit array ProjectileList
integer array HandleIdList
integer array PlaceList
integer ListCount = 0
endglobals
function H2I takes handle h returns integer
return h
return 0
endfunction
function AddListItem takes unit u returns nothing
local integer a = H2I(u)
set ProjectileList[a] = u
set PlaceList[a] = ListCount
set HandleIdList[ListCount] = a
set ListCount = ListCount + 1
endfunction
function RemoveListItem takes unit u returns nothing
local integer a = H2I(u)
local integer b = PlaceList[a]
set ListCount = ListCount - 1
loop
exitwhen b >= ListCount
set HandleIdList[b] = HandleIdList[b + 1]
set PlaceList[HandleList[b]] = PlaceList[HandleList[b + 1]]
set ProjectileList[HandleList[b]] = ProjectileList[HandleList[b + 1]]
set b = b + 1
endloop
endfunction