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
This commit is contained in:
Andrzej Kapolka
2004-10-22 17:50:03 +00:00
parent 5dab3011e0
commit 5c8e1f10af
2 changed files with 37 additions and 19 deletions
@@ -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 // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // 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 * provided to the server as part of an invitation or via some other
* matchmaking mechanism. * 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 /** The usernames of the players involved in this game, or an empty
* array if such information is not needed by this particular game. */ * array if such information is not needed by this particular game. */
public Name[] players = new Name[0]; public Name[] players = new Name[0];
@@ -50,6 +50,18 @@ public abstract class GameConfig extends PlaceConfig
/** Indicates whether or not this game is rated. */ /** Indicates whether or not this game is rated. */
public boolean rated = true; 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 * Returns the class that should be used to create a user interface
* that can be used to configure this instance prior to starting the * 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! // look ma, it's so sophisticated!
return getClass().hashCode() + (rated ? 1 : 0); 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;
}
}
} }
@@ -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 // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -30,10 +30,10 @@ public abstract class PuzzleConfig extends GameConfig
implements Cloneable implements Cloneable
{ {
/** /**
* Returns a translatable label describing this puzzle. * Returns a translatable label describing this game.
*/ */
public abstract String getPuzzleName (); public abstract String getPuzzleName ();
/** /**
* Returns the puzzle rating type. * Returns the puzzle rating type.
*/ */
@@ -56,6 +56,12 @@ public abstract class PuzzleConfig extends GameConfig
return PuzzleCodes.SYNC_BOARD_STATE; return PuzzleCodes.SYNC_BOARD_STATE;
} }
// Documentation inherited.
public String getGameName ()
{
return getPuzzleName();
}
/** /**
* Returns the message bundle identifier for the bundle that should be * Returns the message bundle identifier for the bundle that should be
* used to translate the translatable strings used to describe the * 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; 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;
}
}
} }