09-24-2012, 09:21 PM
We already have an efficient way for looping through online player Ids:
This does roughly the same as what Y_Less implemented, just more verbose. In the old LVP 3 code we had a separate player iterator, which can be found in "gamemode\tags\lvp-3.0.0-pre-cleanup\Sources\Entities\PlayerIterator.pwn". We could update the syntax to allow looping like..
Do you think this would address your use-case? That would be even faster than Y_Less' implementation, and more readable as well in terms of predictability. The PlayerGroupIterator.pwn file in the same directory is an implementation of a generalized way of doing this, but still specific to player Ids.
I'd like to understand what you're trying to do, that will make it easier to find the right solution. If that is importing Y_Less' script, we can do that
.
Code:
for (new playerId = 0; playerId <= PlayerManager->highestPlayerId(); ++playerId) {
if (Player(playerId)->isConnected() == false)
continue;
doMyProcessing();
}This does roughly the same as what Y_Less implemented, just more verbose. In the old LVP 3 code we had a separate player iterator, which can be found in "gamemode\tags\lvp-3.0.0-pre-cleanup\Sources\Entities\PlayerIterator.pwn". We could update the syntax to allow looping like..
Code:
for (new playerId = PlayerIterator->first(); playerId != PlayerIterator::InvalidId; playerId = PlayerIterator->next()) {
doMyProcessing();
}Do you think this would address your use-case? That would be even faster than Y_Less' implementation, and more readable as well in terms of predictability. The PlayerGroupIterator.pwn file in the same directory is an implementation of a generalized way of doing this, but still specific to player Ids.
I'd like to understand what you're trying to do, that will make it easier to find the right solution. If that is importing Y_Less' script, we can do that
.