From 338e9e789b0a05e680547ef2913785cd49e4c0ad Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 25 Jun 2007 20:38:45 +0000 Subject: [PATCH] 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 --- src/java/com/threerings/parlor/game/server/GameManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/parlor/game/server/GameManager.java b/src/java/com/threerings/parlor/game/server/GameManager.java index e46cd344..4131f2eb 100644 --- a/src/java/com/threerings/parlor/game/server/GameManager.java +++ b/src/java/com/threerings/parlor/game/server/GameManager.java @@ -832,7 +832,7 @@ public class GameManager extends PlaceManager protected void playersAllHere () { // 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(); } } @@ -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 int winnerCount = _gameobj.getWinnerCount(); if (shouldConcludeGame() && winnerCount > 0 && !_gameobj.isDraw()) {