405 modified source files and 17,367 lines of diffs later we now enforce

more discipline when handling names in our code base. Any user entered
name should find its way into a Name object as soon as it comes out of a
text field or whatnot, and stay that way until it makes its way into a
text field or into a database record (for which String objects are vastly
simpler because of JORA magic).

Dear God, let me never again make a change this large for the rest of my
mortal life.

Unfortunately, this means we have to keep an eye out for funny business
pretty much everywhere. However, since we will absolutely want to test
market stalls and so forth on Azure, we'll have an opportunity to iron out
any funny business that might fall under the radar during our internal
testing.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2980 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2004-03-06 11:29:19 +00:00
parent 92b716d790
commit 32dee3cbaf
58 changed files with 335 additions and 286 deletions
@@ -1,8 +1,10 @@
//
// $Id: Invitation.java,v 1.2 2004/02/25 14:44:54 mdb Exp $
// $Id: Invitation.java,v 1.3 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.client;
import com.threerings.util.Name;
import com.threerings.parlor.Log;
import com.threerings.parlor.data.ParlorCodes;
import com.threerings.parlor.game.GameConfig;
@@ -21,14 +23,14 @@ public class Invitation
public int inviteId = -1;
/** The name of the other user involved in this invitation. */
public String opponent;
public Name opponent;
/** The configuration of the game to be created. */
public GameConfig config;
/** Constructs a new invitation record. */
public Invitation (ParlorContext ctx, ParlorService pservice,
String opponent, GameConfig config,
Name opponent, GameConfig config,
InvitationResponseObserver observer)
{
_ctx = ctx;
@@ -1,18 +1,15 @@
//
// $Id: ParlorDecoder.java,v 1.2 2002/08/20 19:38:14 mdb Exp $
// $Id: ParlorDecoder.java,v 1.3 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.client;
import com.threerings.parlor.client.ParlorReceiver;
import com.threerings.parlor.game.GameConfig;
import com.threerings.presents.client.InvocationDecoder;
import com.threerings.util.Name;
/**
* Dispatches calls to a {@link ParlorReceiver} instance.
*
* <p> Generated from <code>
* $Id: ParlorDecoder.java,v 1.2 2002/08/20 19:38:14 mdb Exp $
* </code>
*/
public class ParlorDecoder extends InvocationDecoder
{
@@ -62,7 +59,7 @@ public class ParlorDecoder extends InvocationDecoder
case RECEIVED_INVITE:
((ParlorReceiver)receiver).receivedInvite(
((Integer)args[0]).intValue(), (String)args[1], (GameConfig)args[2]
((Integer)args[0]).intValue(), (Name)args[1], (GameConfig)args[2]
);
return;
@@ -82,6 +79,4 @@ public class ParlorDecoder extends InvocationDecoder
super.dispatchNotification(methodId, args);
}
}
// Generated on 12:37:00 08/20/02.
}
@@ -1,10 +1,12 @@
//
// $Id: ParlorDirector.java,v 1.19 2004/02/25 14:44:54 mdb Exp $
// $Id: ParlorDirector.java,v 1.20 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.client;
import java.util.ArrayList;
import com.samskivert.util.HashIntMap;
import com.threerings.util.Name;
import com.threerings.presents.client.BasicDirector;
import com.threerings.presents.client.Client;
@@ -87,7 +89,7 @@ public class ParlorDirector extends BasicDirector
* @return an invitation object that can be used to manage the
* outstanding invitation.
*/
public Invitation invite (String invitee, GameConfig config,
public Invitation invite (Name invitee, GameConfig config,
InvitationResponseObserver observer)
{
// create the invitation record
@@ -134,8 +136,7 @@ public class ParlorDirector extends BasicDirector
}
// documentation inherited from interface
public void receivedInvite (
int remoteId, String inviter, GameConfig config)
public void receivedInvite (int remoteId, Name inviter, GameConfig config)
{
// create an invitation record for this invitation
Invitation invite = new Invitation(
@@ -1,8 +1,10 @@
//
// $Id: ParlorReceiver.java,v 1.2 2004/02/25 14:44:54 mdb Exp $
// $Id: ParlorReceiver.java,v 1.3 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.client;
import com.threerings.util.Name;
import com.threerings.presents.client.InvocationReceiver;
import com.threerings.parlor.game.GameConfig;
@@ -34,8 +36,7 @@ public interface ParlorReceiver extends InvocationReceiver
* @param config the configuration information for the game to which
* we've been invited.
*/
public void receivedInvite (
int remoteId, String inviter, GameConfig config);
public void receivedInvite (int remoteId, Name inviter, GameConfig config);
/**
* Called by the invocation services when another user has responded
@@ -52,8 +53,7 @@ public interface ParlorReceiver extends InvocationReceiver
* provided). In the case of a countered invitation, a new game config
* object with the modified game configuration.
*/
public void receivedInviteResponse (
int remoteId, int code, Object arg);
public void receivedInviteResponse (int remoteId, int code, Object arg);
/**
* Called by the invocation services when an outstanding invitation
@@ -1,8 +1,10 @@
//
// $Id: ParlorService.java,v 1.14 2002/10/27 18:49:51 mdb Exp $
// $Id: ParlorService.java,v 1.15 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.client;
import com.threerings.util.Name;
import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationService;
@@ -41,7 +43,7 @@ public interface ParlorService extends InvocationService
* configuration of the game to be created.
* @param listener will receive and process the response.
*/
public void invite (Client client, String invitee, GameConfig config,
public void invite (Client client, Name invitee, GameConfig config,
InviteListener listener);
/**
@@ -1,5 +1,5 @@
//
// $Id: ParlorMarshaller.java,v 1.2 2002/08/20 19:38:14 mdb Exp $
// $Id: ParlorMarshaller.java,v 1.3 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.data;
@@ -11,6 +11,7 @@ import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationService.InvocationListener;
import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.dobj.InvocationResponseEvent;
import com.threerings.util.Name;
/**
* Provides the implementation of the {@link ParlorService} interface
@@ -18,10 +19,6 @@ import com.threerings.presents.dobj.InvocationResponseEvent;
* on the server. Also provides an implementation of the response listener
* interfaces that marshall the response arguments and deliver them back
* to the requesting client.
*
* <p> Generated from <code>
* $Id: ParlorMarshaller.java,v 1.2 2002/08/20 19:38:14 mdb Exp $
* </code>
*/
public class ParlorMarshaller extends InvocationMarshaller
implements ParlorService
@@ -92,7 +89,7 @@ public class ParlorMarshaller extends InvocationMarshaller
public static final int INVITE = 1;
// documentation inherited from interface
public void invite (Client arg1, String arg2, GameConfig arg3, InviteListener arg4)
public void invite (Client arg1, Name arg2, GameConfig arg3, InviteListener arg4)
{
InviteMarshaller listener4 = new InviteMarshaller();
listener4.listener = arg4;
@@ -166,5 +163,4 @@ public class ParlorMarshaller extends InvocationMarshaller
});
}
// Class file generated on 12:33:04 08/20/02.
}
+17 -18
View File
@@ -1,9 +1,10 @@
//
// $Id: Table.java,v 1.16 2003/03/27 23:45:04 mdb Exp $
// $Id: Table.java,v 1.17 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.data;
import com.samskivert.util.StringUtil;
import com.threerings.util.Name;
import com.threerings.presents.dobj.DSet;
@@ -30,7 +31,7 @@ public class Table
/** An array of the usernames of the occupants of this table (some
* slots may not be filled). */
public String[] occupants;
public Name[] occupants;
/** The body oids of the occupants of this table. (This is not
* propagated to remote instances.) */
@@ -64,7 +65,7 @@ public class Table
this.config = config;
// make room for the maximum number of players
occupants = new String[_tconfig.getMaximumPlayers()];
occupants = new Name[_tconfig.getMaximumPlayers()];
bodyOids = new int[occupants.length];
}
@@ -90,21 +91,21 @@ public class Table
* the players in the game, sized properly and with each player in the
* appropriate position.
*/
public String[] getPlayers ()
public Name[] getPlayers ()
{
// count up the players
int pcount = 0;
for (int i = 0; i < occupants.length; i++) {
if (!StringUtil.blank(occupants[i])) {
if (occupants[i] != null) {
pcount++;
}
}
// create and populate the players array
String[] players = new String[pcount];
Name[] players = new Name[pcount];
pcount = 0;
for (int i = 0; i < occupants.length; i++) {
if (!StringUtil.blank(occupants[i])) {
if (occupants[i] != null) {
players[pcount++] = occupants[i];
}
}
@@ -124,7 +125,7 @@ public class Table
* code explaining the failure if the user was not able to be seated
* at that position.
*/
public String setOccupant (int position, String username, int bodyOid)
public String setOccupant (int position, Name username, int bodyOid)
{
// find out how many positions we have for occupation
int maxpos = _tconfig.getDesiredPlayers();
@@ -139,7 +140,7 @@ public class Table
}
// make sure the requested position is not already occupied
if (!StringUtil.blank(occupants[position])) {
if (occupants[position] != null) {
return TABLE_POSITION_OCCUPIED;
}
@@ -157,11 +158,11 @@ public class Table
* removed, false if the user was never seated at the table in the
* first place.
*/
public boolean clearOccupant (String username)
public boolean clearOccupant (Name username)
{
for (int i = 0; i < occupants.length; i++) {
if (username.equals(occupants[i])) {
occupants[i] = "";
occupants[i] = null;
bodyOids[i] = 0;
return true;
}
@@ -181,7 +182,7 @@ public class Table
{
for (int i = 0; i < bodyOids.length; i++) {
if (bodyOid == bodyOids[i]) {
occupants[i] = "";
occupants[i] = null;
bodyOids[i] = 0;
return true;
}
@@ -198,7 +199,7 @@ public class Table
// make sure at least the minimum number of players are here
int want = _tconfig.getMinimumPlayers(), have = 0;
for (int i = 0; i < occupants.length; i++) {
if (!StringUtil.blank(occupants[i])) {
if (occupants[i] != null) {
if (++have == want) {
return true;
}
@@ -218,10 +219,8 @@ public class Table
need = _tconfig.getMaximumPlayers();
}
for (int i = 0; i < occupants.length; i++) {
if (StringUtil.blank(occupants[i])) {
if (--need == 0) {
return true;
}
if (occupants[i] != null && --need == 0) {
return true;
}
}
return false;
@@ -233,7 +232,7 @@ public class Table
public boolean isEmpty ()
{
for (int i = 0; i < occupants.length; i++) {
if (!StringUtil.blank(occupants[i])) {
if (occupants[i] != null) {
return false;
}
}
@@ -1,9 +1,10 @@
//
// $Id: GameConfig.java,v 1.16 2004/02/25 14:44:54 mdb Exp $
// $Id: GameConfig.java,v 1.17 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.game;
import com.threerings.crowd.data.PlaceConfig;
import com.threerings.util.Name;
/**
* The game config class encapsulates the configuration information for a
@@ -26,7 +27,7 @@ public abstract class GameConfig extends PlaceConfig
{
/** The usernames of the players involved in this game, or an empty
* array if such information is not needed by this particular game. */
public String[] players = new String[0];
public Name[] players = new Name[0];
/** Indicates whether or not this game is rated. */
public boolean rated = true;
@@ -1,5 +1,5 @@
//
// $Id: GameManager.java,v 1.70 2004/02/25 14:44:54 mdb Exp $
// $Id: GameManager.java,v 1.71 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.game;
@@ -9,6 +9,7 @@ import java.util.Iterator;
import com.samskivert.util.IntervalManager;
import com.samskivert.util.StringUtil;
import com.threerings.util.Name;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.dobj.AttributeChangeListener;
@@ -18,9 +19,8 @@ import com.threerings.presents.server.util.SafeInterval;
import com.threerings.crowd.chat.server.SpeakProvider;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.server.PlaceManager;
import com.threerings.crowd.server.CrowdServer;
import com.threerings.crowd.server.PlaceManager;
import com.threerings.crowd.server.PlaceManagerDelegate;
import com.threerings.parlor.Log;
@@ -79,7 +79,7 @@ public class GameManager extends PlaceManager
* @return the player index at which the player was added, or
* <code>-1</code> if the player could not be added to the game.
*/
public int addPlayer (String player)
public int addPlayer (Name player)
{
// determine the first available player index
int pidx = -1;
@@ -112,7 +112,7 @@ public class GameManager extends PlaceManager
* @param pidx the player index at which the player is to be added.
* @return true if the player was added successfully, false if not.
*/
public boolean addPlayerAt (String player, int pidx)
public boolean addPlayerAt (Name player, int pidx)
{
// make sure the specified player index is valid
if (pidx < 0 || pidx >= getPlayerSlots()) {
@@ -173,7 +173,7 @@ public class GameManager extends PlaceManager
* @param player the username of the player added to the game.
* @param pidx the player index of the player added to the game.
*/
protected void playerWasAdded (String player, int pidx)
protected void playerWasAdded (Name player, int pidx)
{
}
@@ -185,7 +185,7 @@ public class GameManager extends PlaceManager
* @param player the username of the player to remove from this game.
* @return true if the player was successfully removed, false if not.
*/
public boolean removePlayer (String player)
public boolean removePlayer (Name player)
{
// get the player's index in the player list
int pidx = _gameobj.getPlayerIndex(player);
@@ -230,7 +230,7 @@ public class GameManager extends PlaceManager
* @param pidx the player index of the player before they were removed
* from the game.
*/
protected void playerWasRemoved (String player, int pidx)
protected void playerWasRemoved (Name player, int pidx)
{
}
@@ -265,18 +265,19 @@ public class GameManager extends PlaceManager
}
/**
* Returns the name of the player with the specified index.
* Returns the name of the player with the specified index or null if
* no player exists at that index.
*/
public String getPlayerName (int index)
public Name getPlayerName (int index)
{
return (_gameobj == null) ? "" : _gameobj.players[index];
return (_gameobj == null) ? null : _gameobj.players[index];
}
/**
* Returns the player index of the given user in the game, or
* <code>-1</code> if the player is not involved in the game.
*/
public int getPlayerIndex (String username)
public int getPlayerIndex (Name username)
{
return (_gameobj == null) ? -1 : _gameobj.getPlayerIndex(username);
}
@@ -1,10 +1,11 @@
//
// $Id: GameObject.dobj,v 1.20 2003/05/26 23:46:46 mdb Exp $
// $Id: GameObject.dobj,v 1.21 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.game;
import com.samskivert.util.ListUtil;
import com.samskivert.util.StringUtil;
import com.threerings.util.Name;
import com.threerings.crowd.data.PlaceObject;
@@ -44,7 +45,7 @@ public class GameObject extends PlaceObject
public boolean isRated;
/** The usernames of the players involved in this game. */
public String[] players;
public Name[] players;
/** Whether each player in the game is a winner, or <code>null</code>
* if the game is not yet over. */
@@ -75,7 +76,7 @@ public class GameObject extends PlaceObject
* Returns the player index of the given user in the game, or
* <code>-1</code> if the player is not involved in the game.
*/
public int getPlayerIndex (String username)
public int getPlayerIndex (Name username)
{
int size = (players == null) ? 0 : players.length;
for (int ii = 0; ii < size; ii++) {
@@ -1,9 +1,11 @@
//
// $Id: GameObject.java,v 1.17 2004/02/25 14:44:54 mdb Exp $
// $Id: GameObject.java,v 1.18 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.game;
import com.samskivert.util.ListUtil;
import com.samskivert.util.StringUtil;
import com.threerings.util.Name;
import com.threerings.crowd.data.PlaceObject;
@@ -64,7 +66,7 @@ public class GameObject extends PlaceObject
public boolean isRated;
/** The usernames of the players involved in this game. */
public String[] players;
public Name[] players;
/** Whether each player in the game is a winner, or <code>null</code>
* if the game is not yet over. */
@@ -95,7 +97,7 @@ public class GameObject extends PlaceObject
* Returns the player index of the given user in the game, or
* <code>-1</code> if the player is not involved in the game.
*/
public int getPlayerIndex (String username)
public int getPlayerIndex (Name username)
{
int size = (players == null) ? 0 : players.length;
for (int ii = 0; ii < size; ii++) {
@@ -223,7 +225,7 @@ public class GameObject extends PlaceObject
* clients) will apply the value change when they received the
* attribute changed notification.
*/
public void setPlayers (String[] players)
public void setPlayers (Name[] players)
{
requestAttributeChange(PLAYERS, players);
this.players = players;
@@ -237,7 +239,7 @@ public class GameObject extends PlaceObject
* change. Proxied copies of this object (on clients) will apply the
* value change when they received the attribute changed notification.
*/
public void setPlayersAt (String value, int index)
public void setPlayersAt (Name value, int index)
{
requestElementUpdate(PLAYERS, value, index);
this.players[index] = value;
@@ -1,5 +1,5 @@
//
// $Id: ParlorDispatcher.java,v 1.2 2002/08/20 19:38:14 mdb Exp $
// $Id: ParlorDispatcher.java,v 1.3 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.server;
@@ -14,13 +14,10 @@ import com.threerings.presents.data.ClientObject;
import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.server.InvocationDispatcher;
import com.threerings.presents.server.InvocationException;
import com.threerings.util.Name;
/**
* Dispatches requests to the {@link ParlorProvider}.
*
* <p> Generated from <code>
* $Id: ParlorDispatcher.java,v 1.2 2002/08/20 19:38:14 mdb Exp $
* </code>
*/
public class ParlorDispatcher extends InvocationDispatcher
{
@@ -48,7 +45,7 @@ public class ParlorDispatcher extends InvocationDispatcher
case ParlorMarshaller.INVITE:
((ParlorProvider)provider).invite(
source,
(String)args[0], (GameConfig)args[1], (InviteListener)args[2]
(Name)args[0], (GameConfig)args[1], (InviteListener)args[2]
);
return;
@@ -1,9 +1,10 @@
//
// $Id: ParlorManager.java,v 1.20 2002/10/06 00:53:15 mdb Exp $
// $Id: ParlorManager.java,v 1.21 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.server;
import com.samskivert.util.HashIntMap;
import com.threerings.util.Name;
import com.threerings.presents.server.InvocationException;
import com.threerings.presents.server.InvocationManager;
@@ -183,7 +184,7 @@ public class ParlorManager
Log.info("Creating game manager [invite=" + invite + "].");
// configure the game config with the player info
invite.config.players = new String[] {
invite.config.players = new Name[] {
invite.invitee.username, invite.inviter.username };
// create the game manager and begin it's initialization
@@ -1,8 +1,10 @@
//
// $Id: ParlorProvider.java,v 1.13 2002/08/14 19:07:54 mdb Exp $
// $Id: ParlorProvider.java,v 1.14 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.server;
import com.threerings.util.Name;
import com.threerings.presents.client.InvocationService.InvocationListener;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.InvocationException;
@@ -44,7 +46,7 @@ public class ParlorProvider
* Processes a request from the client to invite another user to play
* a game.
*/
public void invite (ClientObject caller, String invitee,
public void invite (ClientObject caller, Name invitee,
GameConfig config, InviteListener listener)
throws InvocationException
{
@@ -1,5 +1,5 @@
//
// $Id: ParlorSender.java,v 1.2 2002/08/20 19:38:14 mdb Exp $
// $Id: ParlorSender.java,v 1.3 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.server;
@@ -8,14 +8,11 @@ import com.threerings.parlor.client.ParlorReceiver;
import com.threerings.parlor.game.GameConfig;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.InvocationSender;
import com.threerings.util.Name;
/**
* Used to issue notifications to a {@link ParlorReceiver} instance on a
* client.
*
* <p> Generated from <code>
* $Id: ParlorSender.java,v 1.2 2002/08/20 19:38:14 mdb Exp $
* </code>
*/
public class ParlorSender extends InvocationSender
{
@@ -36,7 +33,7 @@ public class ParlorSender extends InvocationSender
* ParlorReceiver#receivedInvite} on a client.
*/
public static void sendInvite (
ClientObject target, int arg1, String arg2, GameConfig arg3)
ClientObject target, int arg1, Name arg2, GameConfig arg3)
{
sendNotification(
target, ParlorDecoder.RECEIVER_CODE, ParlorDecoder.RECEIVED_INVITE,
@@ -67,5 +64,4 @@ public class ParlorSender extends InvocationSender
new Object[] { new Integer(arg1) });
}
// Generated on 12:37:00 08/20/02.
}
@@ -1,5 +1,5 @@
//
// $Id: TableManager.java,v 1.9 2003/03/27 23:45:04 mdb Exp $
// $Id: TableManager.java,v 1.10 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.server;
@@ -8,6 +8,7 @@ import java.util.Iterator;
import com.samskivert.util.HashIntMap;
import com.samskivert.util.StringUtil;
import com.threerings.util.Name;
import com.threerings.presents.dobj.ObjectAddedEvent;
import com.threerings.presents.dobj.ObjectDeathListener;
@@ -254,8 +255,7 @@ public class TableManager
* @return a reference to the newly created game manager or null if
* something choked during the creation or initialization process.
*/
protected GameManager createGameManager (
GameConfig config, String[] players)
protected GameManager createGameManager (GameConfig config, Name[] players)
{
GameManager gmgr = null;
@@ -1,8 +1,10 @@
//
// $Id: TurnGameManager.java,v 1.9 2004/02/25 14:44:54 mdb Exp $
// $Id: TurnGameManager.java,v 1.10 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.turn;
import com.threerings.util.Name;
/**
* A game manager that wishes to make use of the turn game services should
* implement this interface and create a {@link TurnGameManagerDelegate}
@@ -30,13 +32,13 @@ public interface TurnGameManager
* Extending {@link GameManager} should automatically handle
* implementing this method.
*/
public String getPlayerName (int index);
public Name getPlayerName (int index);
/**
* Extending {@link GameManager} should automatically handle
* implementing this method.
*/
public int getPlayerIndex (String username);
public int getPlayerIndex (Name username);
/**
* Extending {@link GameManager} should automatically handle
@@ -1,14 +1,16 @@
//
// $Id: TurnGameManagerDelegate.java,v 1.8 2002/10/15 23:07:23 shaper Exp $
// $Id: TurnGameManagerDelegate.java,v 1.9 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.turn;
import com.threerings.util.Name;
import com.threerings.util.RandomUtil;
import com.threerings.crowd.data.PlaceObject;
import com.threerings.parlor.Log;
import com.threerings.parlor.game.GameManager;
import com.threerings.parlor.game.GameManagerDelegate;
import com.threerings.util.RandomUtil;
/**
* Performs the server-side turn-based game processing for a turn based
@@ -40,7 +42,6 @@ public class TurnGameManagerDelegate extends GameManagerDelegate
*/
public int getTurnHolderIndex ()
{
String holder = _turnGame.getTurnHolder();
return _tgmgr.getPlayerIndex(_turnGame.getTurnHolder());
}
@@ -67,7 +68,7 @@ public class TurnGameManagerDelegate extends GameManagerDelegate
}
// get the player name and sanity-check again
String name = _tgmgr.getPlayerName(_turnIdx);
Name name = _tgmgr.getPlayerName(_turnIdx);
if (name == null) {
Log.warning("startTurn() called with invalid player " +
"[turnIdx=" + _turnIdx + "].");
@@ -1,8 +1,10 @@
//
// $Id: TurnGameObject.java,v 1.5 2004/02/25 14:44:54 mdb Exp $
// $Id: TurnGameObject.java,v 1.6 2004/03/06 11:29:19 mdb Exp $
package com.threerings.parlor.turn;
import com.threerings.util.Name;
/**
* Games that wish to support turn-based play must implement this
* interface with their {@link GameObject}.
@@ -21,16 +23,16 @@ public interface TurnGameObject
* turn in this turn-based game or <code>null</code> if no user
* currently holds the turn.
*/
public String getTurnHolder ();
public Name getTurnHolder ();
/**
* Requests that the <code>turnHolder</code> field be set to the specified
* value.
*/
public void setTurnHolder (String turnHolder);
public void setTurnHolder (Name turnHolder);
/**
* Returns the array of player names involved in the game.
*/
public String[] getPlayers ();
public Name[] getPlayers ();
}