Rejiggered things to provide facilities for checking whether a game is in
play, rather than whether a game is over. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1709 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: GameManager.java,v 1.40 2002/09/06 22:52:27 shaper Exp $
|
||||
// $Id: GameManager.java,v 1.41 2002/09/18 04:01:29 shaper Exp $
|
||||
|
||||
package com.threerings.parlor.game;
|
||||
|
||||
@@ -235,14 +235,6 @@ public class GameManager extends PlaceManager
|
||||
return (_AIs != null && _AIs[pidx] != -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the game is over.
|
||||
*/
|
||||
public boolean isGameOver ()
|
||||
{
|
||||
return (_gameobj.state == GameObject.GAME_OVER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unique round identifier for the current round.
|
||||
*/
|
||||
@@ -344,8 +336,8 @@ public class GameManager extends PlaceManager
|
||||
Log.info("Game room empty. Going away. " +
|
||||
"[gameOid=" + _gameobj.getOid() + "].");
|
||||
|
||||
// cancel the game if it wasn't over.
|
||||
if (_gameobj.state != GameObject.GAME_OVER) {
|
||||
// cancel the game if it was in play
|
||||
if (_gameobj.state == GameObject.IN_PLAY) {
|
||||
_gameobj.setState(GameObject.CANCELLED);
|
||||
}
|
||||
|
||||
@@ -485,6 +477,12 @@ public class GameManager extends PlaceManager
|
||||
*/
|
||||
public void endGame ()
|
||||
{
|
||||
if (_gameobj.state != GameObject.IN_PLAY) {
|
||||
Log.debug("Refusing to end game that was not in play " +
|
||||
"[game=" + _gameobj.which() + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
// figure out who won...
|
||||
|
||||
// transition to the game over state
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: GameObject.dobj,v 1.11 2002/08/14 19:07:53 mdb Exp $
|
||||
// $Id: GameObject.dobj,v 1.12 2002/09/18 04:01:29 shaper Exp $
|
||||
|
||||
package com.threerings.parlor.game;
|
||||
|
||||
@@ -58,4 +58,13 @@ public class GameObject extends PlaceObject
|
||||
return (players == null) ? -1 :
|
||||
ListUtil.indexOfEqual(players, username);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the game is in play. A game that is not in play
|
||||
* could either be awaiting players, ended, or cancelled.
|
||||
*/
|
||||
public boolean isInPlay ()
|
||||
{
|
||||
return (state == IN_PLAY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: GameObject.java,v 1.6 2002/08/14 19:07:53 mdb Exp $
|
||||
// $Id: GameObject.java,v 1.7 2002/09/18 04:01:29 shaper Exp $
|
||||
|
||||
package com.threerings.parlor.game;
|
||||
|
||||
@@ -74,6 +74,15 @@ public class GameObject extends PlaceObject
|
||||
ListUtil.indexOfEqual(players, username);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the game is in play. A game that is not in play
|
||||
* could either be awaiting players, ended, or cancelled.
|
||||
*/
|
||||
public boolean isInPlay ()
|
||||
{
|
||||
return (state == IN_PLAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>service</code> field be set to the specified
|
||||
* value. The local value will be updated immediately and an event
|
||||
|
||||
Reference in New Issue
Block a user