Call endPlayerGame() before we finish the bodyLeft() processing because if the

leaving player was the last human player in the room, bodyLeft() will result in
a call to placeBecameEmpty() which will shut the game manager down before it
has a chance to end the game cleanly as a result of said player leaving.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3708 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2005-09-22 19:52:58 +00:00
parent 5fe4dc5a37
commit 88e72fbbf6
@@ -570,15 +570,16 @@ public class GameManager extends PlaceManager
// documentation inherited
protected void bodyLeft (int bodyOid)
{
super.bodyLeft(bodyOid);
// deal with disappearing players
// first resign the player from the game
int pidx = IntListUtil.indexOf(_playerOids, bodyOid);
if (pidx != -1 && _gameobj.isInPlay() &&
_gameobj.isActivePlayer(pidx)) {
if (pidx != -1 && _gameobj.isInPlay() && _gameobj.isActivePlayer(pidx)) {
// end the player's game if they bail on an in-progress game
endPlayerGame(pidx);
}
// then complete the bodyLeft() processing which may result in a call
// to placeBecameEmpty() which will shut the game down
super.bodyLeft(bodyOid);
}
/**
@@ -876,7 +877,6 @@ public class GameManager extends PlaceManager
return (_gameobj.isInPlay() && _gameobj.getActivePlayerCount() == 1);
}
/**
* Called when the game is known to be over. This will call some
* calldown functions to determine the winner of the game and then