Originally Posted by Anitarf
Well, it has to be an array since I can't use individual variables in a loop. If there is such a big difference between local and global arrays, I could make it global.
As far as I know, when using a local array, 32 kilobytes of memory (4 bytes per array slot, 8192 slots) would be allocated each time the function starts, and deallocated when the function returns. In the case of a global array, 32 kilobytes of memory would be allocated upon map initialization, and never deallocated.
But local variables are quite faster than globals, so I think that the use of a local array is absolutely justified, at least in this case.
Perhaps you could use a linked list (similar to the one in grim001
) instead of an array when looping through the struct instances in the Transition library.
This should most definitely see some good usage, although WC3 modding is slowly dying.