- Joined
- Feb 6, 2014
- Messages
- 2,466
As of now, what I did was to keep track of the max Instance and used
But it feels inefficient and I can't figure out how to keep track of the max Instance.
Now, if there is a better way to pick all struct instance, please let me know, if not then how can I keep track of the maxInstace? On allocation, I used:
but in deallocation, how will the maxInstance change? The method I currently have in mind is keep decrementing maxInstance and checking if a certain member is null or not. If it is not null, then that is the maxInstance but again, I feel there is a better way to do that.
JASS:
set tempStruct = this //temporarily store current instance
loop
exitwhen i > maxInstance
set this = i
//Do Struct actions here
//.....
//end struct actions
set i = i + 1
endloop
set this = tempStruct //restore current instance
Now, if there is a better way to pick all struct instance, please let me know, if not then how can I keep track of the maxInstace? On allocation, I used:
JASS:
set i = this
if i > maxInstance then
set maxInstance = i
endif