Moderator
M
Moderator
16:17, 3rd Aug 2012
Magtheridon96: Okay, there aren't any major problems at this point.
I'll still leave the Indexing tip in this review in case you want to update it to use a better form of indexing.
Still, good job.
Magtheridon96: Okay, there aren't any major problems at this point.
I'll still leave the Indexing tip in this review in case you want to update it to use a better form of indexing.
Still, good job.
Your indexing is pretty much the same way I do indexing in vJass, but the iteration isn't as good as it could be. There are cases in which you'd be iterating over dead instances when you don't need to.
Try using a stack instead. All you need is one variable to store the number of running instances and arrays for all your data. (And another integer to use in the For each loop)
Allocation is done by incrementing the integer simply.
Deallocation is done like this:
set data1[currentInstanceInLoop] = data1[instancesRunningCount]
set data2[currentInstanceInLoop] = data2[instancesRunningCount]
etc...
set currentInstanceInLoop = currentInstanceInLoop - 1
set instancesRunningCount = instancesRunningCount - 1
Try using a stack instead. All you need is one variable to store the number of running instances and arrays for all your data. (And another integer to use in the For each loop)
Allocation is done by incrementing the integer simply.
Deallocation is done like this:
set data1[currentInstanceInLoop] = data1[instancesRunningCount]
set data2[currentInstanceInLoop] = data2[instancesRunningCount]
etc...
set currentInstanceInLoop = currentInstanceInLoop - 1
set instancesRunningCount = instancesRunningCount - 1