diff --git a/src/java/com/threerings/parlor/game/GameConfig.java b/src/java/com/threerings/parlor/game/GameConfig.java index 5fe60c0b4..1e503a068 100644 --- a/src/java/com/threerings/parlor/game/GameConfig.java +++ b/src/java/com/threerings/parlor/game/GameConfig.java @@ -1,5 +1,5 @@ // -// $Id: GameConfig.java,v 1.13 2002/10/06 00:53:15 mdb Exp $ +// $Id: GameConfig.java,v 1.14 2003/02/12 05:34:53 mdb Exp $ package com.threerings.parlor.game; @@ -40,15 +40,6 @@ public abstract class GameConfig extends PlaceConfig */ public abstract Class getConfiguratorClass (); - /** - * Returns whether this game is a party game. The default - * implementation returns false. - */ - public boolean isPartyGame () - { - return false; - } - /** * Returns true if this game config object is equal to the supplied * object (meaning it is also a game config object and its diff --git a/src/java/com/threerings/parlor/game/GameController.java b/src/java/com/threerings/parlor/game/GameController.java index 164308b56..60ee82357 100644 --- a/src/java/com/threerings/parlor/game/GameController.java +++ b/src/java/com/threerings/parlor/game/GameController.java @@ -1,5 +1,5 @@ // -// $Id: GameController.java,v 1.20 2002/09/20 04:53:42 mdb Exp $ +// $Id: GameController.java,v 1.21 2003/02/12 05:34:53 mdb Exp $ package com.threerings.parlor.game; @@ -236,6 +236,15 @@ public abstract class GameController extends PlaceController }); } + /** + * Used to determine if this game is a party game. + */ + protected boolean isPartyGame () + { + return ((_config instanceof PartyGameConfig) && + ((PartyGameConfig)_config).isPartyGame()); + } + /** A reference to the active parlor context. */ protected ParlorContext _ctx; diff --git a/src/java/com/threerings/parlor/game/GameManager.java b/src/java/com/threerings/parlor/game/GameManager.java index 47239e0b8..e9bdd4dc0 100644 --- a/src/java/com/threerings/parlor/game/GameManager.java +++ b/src/java/com/threerings/parlor/game/GameManager.java @@ -1,5 +1,5 @@ // -// $Id: GameManager.java,v 1.59 2003/01/03 02:47:33 shaper Exp $ +// $Id: GameManager.java,v 1.60 2003/02/12 05:34:53 mdb Exp $ package com.threerings.parlor.game; @@ -414,7 +414,7 @@ public class GameManager extends PlaceManager */ protected boolean needsNoShowTimer () { - return !_gameconfig.isPartyGame(); + return !isPartyGame(); } // documentation inherited @@ -474,7 +474,7 @@ public class GameManager extends PlaceManager { // start up the game if we're not a party game and if we haven't // already done so - if (!_gameconfig.isPartyGame() && + if (!isPartyGame() && _gameobj.state == GameObject.AWAITING_PLAYERS) { startGame(); } @@ -773,7 +773,7 @@ public class GameManager extends PlaceManager // perfectly normal to receive a player ready notification // from a user entering a party game in which they're not yet // a participant - if (!_gameconfig.isPartyGame()) { + if (!isPartyGame()) { Log.warning("Received playerReady() from non-player? " + "[caller=" + caller + "]."); } @@ -820,7 +820,7 @@ public class GameManager extends PlaceManager public void startPartyGame (ClientObject caller) { // make sure this is a party game - if (!_gameconfig.isPartyGame()) { + if (!isPartyGame()) { Log.warning("Attempt to player-start a non-party game " + "[game=" + _gameobj.which() + ", caller=" + caller + "]."); @@ -928,6 +928,15 @@ public class GameManager extends PlaceManager protected byte _level; } + /** + * Used to determine if this game is a party game. + */ + protected boolean isPartyGame () + { + return ((_gameconfig instanceof PartyGameConfig) && + ((PartyGameConfig)_gameconfig).isPartyGame()); + } + /** A reference to our game config. */ protected GameConfig _gameconfig; diff --git a/src/java/com/threerings/parlor/game/PartyGameConfig.java b/src/java/com/threerings/parlor/game/PartyGameConfig.java new file mode 100644 index 000000000..58e92771c --- /dev/null +++ b/src/java/com/threerings/parlor/game/PartyGameConfig.java @@ -0,0 +1,32 @@ +// +// $Id: PartyGameConfig.java,v 1.1 2003/02/12 05:34:53 mdb Exp $ + +package com.threerings.parlor.game; + +import com.threerings.parlor.data.TableConfig; + +/** + * Provides additional information for party games. + */ +public interface PartyGameConfig extends TableConfig +{ + /** + * Returns true if this party game is being played in party game mode, + * false if it is not. + */ + public boolean isPartyGame (); + + /** + * Configures this game config as a party game or not. + */ + public void setPartyGame (boolean isPartyGame); + + /** + * Returns an array of strings that describe the configuration of this + * party game. This should eventually be rolled into a more general + * purpose mechanism for generating descriptions of game + * configurations as well as editors for game configurations (which + * already exists in rudimentary form). + */ + public String[] getPartyDescription (); +}