Is there any way of 'remembering' which object in a type array I'm currently working on? Currently, I'm using a boolean flag within the array, but I'm dealing with something a bit more complex - here goes:
I've got an array of units, and I'm increasing an initiative number on each of these units until it matches a target number, after which that unit's "selected" variable is toggled 'on'. If I run my NextActiveUnit function again afterwards, it starts with the first unit in the list- meaning that units near the end of the list might rarely or never see an increment.
I can think of a lot of workarounds (storing the unit's ID in a function, or searching through until I find the selected unit and then starting my search from there) but these seem to be wasteful of processor cycles/memory. Is there a way to store the direct pointer/index of an object in a type array so that I don't have to do this?
Thanks,
Telemental
I've got an array of units, and I'm increasing an initiative number on each of these units until it matches a target number, after which that unit's "selected" variable is toggled 'on'. If I run my NextActiveUnit function again afterwards, it starts with the first unit in the list- meaning that units near the end of the list might rarely or never see an increment.
I can think of a lot of workarounds (storing the unit's ID in a function, or searching through until I find the selected unit and then starting my search from there) but these seem to be wasteful of processor cycles/memory. Is there a way to store the direct pointer/index of an object in a type array so that I don't have to do this?
Thanks,
Telemental