Added seating.getMyPosition(), cuz it's so darn convenient, and we can

do it on the backend more efficiently than seating.getPlayerPosition(getMyId());


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@216 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2007-02-26 22:59:56 +00:00
parent be388eaccf
commit c459a337ab
2 changed files with 17 additions and 0 deletions
@@ -36,6 +36,15 @@ public class SeatingControl extends SubControl
return int(_ctrl.callEZCodeFriend("getPlayerPosition_v1", playerId)); 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. * Get all the players at the table, in their seated position.
* Absent players will be represented by a 0. * Absent players will be represented by a 0.
@@ -196,6 +196,7 @@ public class GameControlBackend
o["getOccupantName_v1"] = getOccupantName_v1; o["getOccupantName_v1"] = getOccupantName_v1;
o["getPlayers_v1"] = getPlayers_v1; o["getPlayers_v1"] = getPlayers_v1;
o["getPlayerPosition_v1"] = getPlayerPosition_v1; o["getPlayerPosition_v1"] = getPlayerPosition_v1;
o["getMyPosition_v1"] = getMyPosition_v1;
} }
/** /**
@@ -326,6 +327,13 @@ public class GameControlBackend
return _ezObj.getPlayerIndex(occInfo.username); 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 // TODO: table only
public function getTurnHolder_v1 () :int public function getTurnHolder_v1 () :int
{ {