From 5c8e1f10af07e2f5efe1d4265b3ffa09e0eeebcf Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Fri, 22 Oct 2004 17:50:03 +0000 Subject: [PATCH] Moved getClone, getBundle name from PuzzleConfig to GameConfig; added getGameName to GameConfig (but retained getPuzzleName for now--will change soon). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3161 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/parlor/game/GameConfig.java | 31 +++++++++++++++++-- .../threerings/puzzle/data/PuzzleConfig.java | 25 ++++++--------- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/src/java/com/threerings/parlor/game/GameConfig.java b/src/java/com/threerings/parlor/game/GameConfig.java index 764a5526f..6b08a9422 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.18 2004/08/27 02:20:14 mdb Exp $ +// $Id: GameConfig.java,v 1.19 2004/10/22 17:50:03 andrzej Exp $ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -41,8 +41,8 @@ import com.threerings.util.Name; * provided to the server as part of an invitation or via some other * matchmaking mechanism. */ -public abstract class GameConfig extends PlaceConfig -{ +public abstract class GameConfig extends PlaceConfig implements Cloneable +{ /** The usernames of the players involved in this game, or an empty * array if such information is not needed by this particular game. */ public Name[] players = new Name[0]; @@ -50,6 +50,18 @@ public abstract class GameConfig extends PlaceConfig /** Indicates whether or not this game is rated. */ public boolean rated = true; + /** + * Returns a translatable label describing this game. + */ + public abstract String getGameName (); + + /** + * Returns the message bundle identifier for the bundle that should be + * used to translate the translatable strings used to describe the + * game config parameters. + */ + public abstract String getBundleName (); + /** * Returns the class that should be used to create a user interface * that can be used to configure this instance prior to starting the @@ -85,4 +97,17 @@ public abstract class GameConfig extends PlaceConfig // look ma, it's so sophisticated! return getClass().hashCode() + (rated ? 1 : 0); } + + /** + * Returns a clone of this game config. + */ + public GameConfig getClone () + { + try { + return (GameConfig)clone(); + } catch (CloneNotSupportedException cnse) { + // something has gone horribly awry + return null; + } + } } diff --git a/src/java/com/threerings/puzzle/data/PuzzleConfig.java b/src/java/com/threerings/puzzle/data/PuzzleConfig.java index 3741a409d..77fcdcfeb 100644 --- a/src/java/com/threerings/puzzle/data/PuzzleConfig.java +++ b/src/java/com/threerings/puzzle/data/PuzzleConfig.java @@ -1,5 +1,5 @@ // -// $Id: PuzzleConfig.java,v 1.2 2004/08/27 02:20:28 mdb Exp $ +// $Id: PuzzleConfig.java,v 1.3 2004/10/22 17:50:03 andrzej Exp $ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -30,10 +30,10 @@ public abstract class PuzzleConfig extends GameConfig implements Cloneable { /** - * Returns a translatable label describing this puzzle. + * Returns a translatable label describing this game. */ public abstract String getPuzzleName (); - + /** * Returns the puzzle rating type. */ @@ -56,6 +56,12 @@ public abstract class PuzzleConfig extends GameConfig return PuzzleCodes.SYNC_BOARD_STATE; } + // Documentation inherited. + public String getGameName () + { + return getPuzzleName(); + } + /** * Returns the message bundle identifier for the bundle that should be * used to translate the translatable strings used to describe the @@ -68,17 +74,4 @@ public abstract class PuzzleConfig extends GameConfig { return PuzzleCodes.PUZZLE_MESSAGE_BUNDLE; } - - /** - * Returns a clone of this puzzle config. - */ - public PuzzleConfig getClone () - { - try { - return (PuzzleConfig)clone(); - } catch (CloneNotSupportedException cnse) { - // something has gone horribly awry - return null; - } - } }