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: 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 ();
}