diff --git a/src/java/com/threerings/parlor/game/server/GameManager.java b/src/java/com/threerings/parlor/game/server/GameManager.java index 4e1b0564..8bad5106 100644 --- a/src/java/com/threerings/parlor/game/server/GameManager.java +++ b/src/java/com/threerings/parlor/game/server/GameManager.java @@ -607,6 +607,9 @@ public class GameManager extends PlaceManager // make a note of this player's oid _playerOids[pidx] = caller.getOid(); + + // this player is not necessarily ready to play yet + _pendingOids.add(caller.getOid()); } /** @@ -617,6 +620,9 @@ public class GameManager extends PlaceManager { playerInRoom(caller); + // This player is no longer pending + _pendingOids.remove(caller.getOid()); + // if everyone is now ready to go, get things underway if (allPlayersReady()) { playersAllHere(); @@ -644,9 +650,10 @@ public class GameManager extends PlaceManager */ public boolean playerIsReady (int pidx) { - return (!_gameobj.isOccupiedPlayer(pidx) || // unoccupied slot - _playerOids[pidx] != 0 || // player is ready - isAI(pidx)); // player is AI + return (!_gameobj.isOccupiedPlayer(pidx) || // unoccupied slot + // player is ready + (_playerOids[pidx] != 0 && !_pendingOids.contains(_playerOids[pidx])) || + isAI(pidx)); // player is AI } /** @@ -767,6 +774,9 @@ public class GameManager extends PlaceManager // instantiate a player oid array which we'll fill in later _playerOids = new int[getPlayerSlots()]; + // instantiate the pending player list + _pendingOids = new ArrayIntSet(); + // give delegates a chance to do their thing super.didStartup(); @@ -1285,6 +1295,9 @@ public class GameManager extends PlaceManager /** The oids of our player and AI body objects. */ protected int[] _playerOids; + /** The list of players that have arrived in the room, but are not ready to play. */ + protected ArrayIntSet _pendingOids; + /** If AIs are present, contains their configuration, or null at human player indexes. */ protected GameAI[] _AIs;