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:
@@ -570,15 +570,16 @@ public class GameManager extends PlaceManager
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
protected void bodyLeft (int bodyOid)
|
protected void bodyLeft (int bodyOid)
|
||||||
{
|
{
|
||||||
super.bodyLeft(bodyOid);
|
// first resign the player from the game
|
||||||
|
|
||||||
// deal with disappearing players
|
|
||||||
int pidx = IntListUtil.indexOf(_playerOids, bodyOid);
|
int pidx = IntListUtil.indexOf(_playerOids, bodyOid);
|
||||||
if (pidx != -1 && _gameobj.isInPlay() &&
|
if (pidx != -1 && _gameobj.isInPlay() && _gameobj.isActivePlayer(pidx)) {
|
||||||
_gameobj.isActivePlayer(pidx)) {
|
|
||||||
// end the player's game if they bail on an in-progress game
|
// end the player's game if they bail on an in-progress game
|
||||||
endPlayerGame(pidx);
|
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);
|
return (_gameobj.isInPlay() && _gameobj.getActivePlayerCount() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the game is known to be over. This will call some
|
* Called when the game is known to be over. This will call some
|
||||||
* calldown functions to determine the winner of the game and then
|
* calldown functions to determine the winner of the game and then
|
||||||
|
|||||||
Reference in New Issue
Block a user