Why is player initially set to -1 and then a few lines later set to the player from the passed in object?
Code: Select all
node.player = -1;
node.funcName = context->argument(0).toString();
node.engine = engine;
node.player = objv.property("player").toInt32();
As mentioned elsewhere, game objects are stored in several lists, one for each player. Would it be worth adding an optional "player" param to objFromId() ?
Syntax becomes:
Code: Select all
objFromId(id[,player])
This change won't break existing JS scripts that are using objFromId() because if the player param isn't given the current code deals with that already. And, if the object lists are merged in to a single list at some later date, it's easy to deprecate the player param without breaking scripts that have made use of it.
In my "valut" library I'll always have both the object id and player id, so would prefer to be able to objFromId(id,player) to get best performance.