gameDidEnd():

Clear out _playerOids when a game ends so that all players must re-call
playerReady() to restart the game.

playersAllhere();
Start the game if all players call playerReady() when the game is not in play
(previously this only happened if the game was in the pre-game state).

I know of one place this will affect Yohoho which I will fix, but if there's
anywhere else where we are restarting an ended game, fixes will be needed.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@329 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2007-06-25 20:38:45 +00:00
parent b87eacd9d6
commit 338e9e789b
@@ -832,7 +832,7 @@ public class GameManager extends PlaceManager
protected void playersAllHere () protected void playersAllHere ()
{ {
// if we're a seated game and we haven't already started, start. // if we're a seated game and we haven't already started, start.
if ((getMatchType() == GameConfig.SEATED_GAME) && (_gameobj.state == GameObject.PRE_GAME)) { if ((getMatchType() == GameConfig.SEATED_GAME) && !_gameobj.isInPlay()) {
startGame(); startGame();
} }
} }
@@ -1110,6 +1110,9 @@ public class GameManager extends PlaceManager
} }
}); });
// clear out player readiness; everyone must report as ready again to restart the game
Arrays.fill(_playerOids, 0);
// report the winners and losers if appropriate // report the winners and losers if appropriate
int winnerCount = _gameobj.getWinnerCount(); int winnerCount = _gameobj.getWinnerCount();
if (shouldConcludeGame() && winnerCount > 0 && !_gameobj.isDraw()) { if (shouldConcludeGame() && winnerCount > 0 && !_gameobj.isDraw()) {