Prevent infinite loops if there is no qualified player to become the
new turn holder. Log a warning. This is how we do things here. Additionally, something I didn't change that is redundant is checking to see if the player name is null, when the default implementation of the active player check will return false if the name is null. It seems to me that the movement of the active player business into the base game package can result in some cleanup that hasn't been done, but I don't want to look into it any further. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3398 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -190,6 +190,13 @@ public class TurnGameManagerDelegate extends GameManagerDelegate
|
||||
int oturnIdx = _turnIdx;
|
||||
do {
|
||||
_turnIdx = (_turnIdx + 1) % size;
|
||||
if (_turnIdx == oturnIdx) {
|
||||
// if we've wrapped all the way around, stop where we are
|
||||
// even if the current player is not active.
|
||||
Log.warning("1 or less active players. Unable to properly " +
|
||||
"change turn.");
|
||||
break;
|
||||
}
|
||||
} while (_tgmgr.getPlayerName(_turnIdx) == null ||
|
||||
!_tgmgr.isActivePlayer(_turnIdx));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user