diff --git a/src/as/com/threerings/ezgame/SeatingControl.as b/src/as/com/threerings/ezgame/SeatingControl.as index c8c93068..0fd599ed 100644 --- a/src/as/com/threerings/ezgame/SeatingControl.as +++ b/src/as/com/threerings/ezgame/SeatingControl.as @@ -36,6 +36,15 @@ public class SeatingControl extends SubControl return int(_ctrl.callEZCodeFriend("getPlayerPosition_v1", playerId)); } + /** + * A convenient function to get our own player position, + * or -1 if we're not a player. + */ + public function getMyPosition () :int + { + return int(_ctrl.callEZCodeFriend("getMyPosition_v1")); + } + /** * Get all the players at the table, in their seated position. * Absent players will be represented by a 0. diff --git a/src/as/com/threerings/ezgame/client/GameControlBackend.as b/src/as/com/threerings/ezgame/client/GameControlBackend.as index 81dd47f5..17522523 100644 --- a/src/as/com/threerings/ezgame/client/GameControlBackend.as +++ b/src/as/com/threerings/ezgame/client/GameControlBackend.as @@ -196,6 +196,7 @@ public class GameControlBackend o["getOccupantName_v1"] = getOccupantName_v1; o["getPlayers_v1"] = getPlayers_v1; o["getPlayerPosition_v1"] = getPlayerPosition_v1; + o["getMyPosition_v1"] = getMyPosition_v1; } /** @@ -326,6 +327,13 @@ public class GameControlBackend return _ezObj.getPlayerIndex(occInfo.username); } + // TODO: table only + public function getMyPosition_v1 () :int + { + return _ezObj.getPlayerIndex( + (_ctx.getClient().getClientObject() as BodyObject).getVisibleName()); + } + // TODO: table only public function getTurnHolder_v1 () :int {