Added a server managed notion of which client is controlling the game.

Doing this on the client, while theoretically possible, is more complex. We
have a server, we use it to provide commonly needed services, the assignment of
a single client to control the game is a commonly needed service. This also
matches the way other services like turn change and game start and end are
implemented.

A side note: the client-side code was not properly handling disconnected
players, which the server code properly handles.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@224 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2007-03-04 20:05:58 +00:00
parent 3c595d85a5
commit d77b8363f7
8 changed files with 318 additions and 268 deletions
@@ -189,6 +189,7 @@ public class GameControlBackend
o["sendMessage_v2"] = sendMessage_v2;
o["getOccupants_v1"] = getOccupants_v1;
o["getMyId_v1"] = getMyId_v1;
o["getControllerId_v1"] = getControllerId_v1;
o["getUserCookie_v2"] = getUserCookie_v2;
o["endTurn_v2"] = endTurn_v2;
o["endGame_v2"] = endGame_v2;
@@ -316,6 +317,11 @@ public class GameControlBackend
return _ctx.getClient().getClientObject().getOid();
}
public function getControllerId_v1 () :int
{
return _ezObj.controllerOid;
}
// TODO: table games only
public function getPlayerPosition_v1 (playerId :int) :int
{
@@ -659,6 +665,14 @@ public class GameControlBackend
}
}
/**
* Called by the EZGameController when the controller changes.
*/
public function controlDidChange () :void
{
callUserCode("controlDidChange_v1");
}
/**
* Called by the EZGameController when the turn changes.
*/