#Removing an ID from an array only works once.

1 messages · Page 1 of 1 (latest)

nova gust
#

Gonna get off here to work in a sec, but couldn't you modify TurnListRemove to accept 3 arguments to just do the loop once? then you could add all the entities you want to remove in that one single call, and only break out of the loop once all entities have been cleared. You could have a 4th argument to tell it exactly how many entities you'll be deleting as well.

fallen leaf
#

What does TurnListSort do? Like what's the goal with it?

#

TurnListRemove looks fine to me, so I'm guessing the problem is in TurnListSort

#

looking at it, I suspect the problem is with tmpList, I don't see anywhere where it gets reset between runs of the function
But also, this looks like a complex way to get rid of the 0 in the middle, which could be solved much easier by using array_delete instead of setting the removed entry to 0 and then sorting it out