Various updates to allow a system where a user's visible name is not the same
as their authentication name (which we leave in BodyObject.username). This turns out to be simpler than the system we adopted for Yohoho wherein we replace the player's user object after they select a character, but converting to this sort of system is way more work than would be worth it. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3758 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -223,7 +223,7 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate
|
||||
int fromidx = _cgmgr.getPlayerIndex(client);
|
||||
if (fromidx == -1) {
|
||||
Log.warning("Send request from non-player [username=" +
|
||||
((BodyObject)client).username + ", cards=" +
|
||||
((BodyObject)client).who() + ", cards=" +
|
||||
StringUtil.toString(cards) + "].");
|
||||
return;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate
|
||||
// make sure they have the cards
|
||||
if (!_hands[fromidx].containsAll(cards)) {
|
||||
Log.warning("Tried to send cards not held [username=" +
|
||||
((BodyObject)client).username + ", cards=" +
|
||||
((BodyObject)client).who() + ", cards=" +
|
||||
StringUtil.toString(cards) + "].");
|
||||
return;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate
|
||||
}
|
||||
|
||||
// make sure it's their turn
|
||||
Name username = ((BodyObject)client).username;
|
||||
Name username = ((BodyObject)client).getVisibleName();
|
||||
if (!username.equals(_trickCardGame.getTurnHolder())) {
|
||||
return;
|
||||
}
|
||||
@@ -334,7 +334,7 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate
|
||||
// make sure the game is over
|
||||
if (_cardGame.state != CardGameObject.GAME_OVER) {
|
||||
Log.warning("Tried to request rematch when game wasn't over " +
|
||||
"[username=" + ((BodyObject)client).username + "].");
|
||||
"[username=" + ((BodyObject)client).who() + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate
|
||||
int pidx = _cgmgr.getPlayerIndex(client);
|
||||
if (pidx == -1) {
|
||||
Log.warning("Rematch request from non-player [username=" +
|
||||
((BodyObject)client).username + "].");
|
||||
((BodyObject)client).who() + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate
|
||||
if (_trickCardGame.getRematchRequests()[pidx] !=
|
||||
TrickCardGameObject.NO_REQUEST) {
|
||||
Log.warning("Repeated rematch request [username=" +
|
||||
((BodyObject)client).username + "].");
|
||||
((BodyObject)client).who() + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ public class TableDirector extends BasicDirector
|
||||
// look for our username in the occupants array
|
||||
BodyObject self = (BodyObject)_ctx.getClient().getClientObject();
|
||||
for (int i = 0; i < table.occupants.length; i++) {
|
||||
if (self.username.equals(table.occupants[i])) {
|
||||
if (self.getVisibleName().equals(table.occupants[i])) {
|
||||
_ourTable = table;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public abstract class GameController extends PlaceController
|
||||
// runnable here that will let the game manager know that we're
|
||||
// ready on the next pass through the distributed event loop
|
||||
Log.info("Entering game " + _gobj.which() + ".");
|
||||
if (_gobj.getPlayerIndex(bobj.username) != -1) {
|
||||
if (_gobj.getPlayerIndex(bobj.getVisibleName()) != -1) {
|
||||
_ctx.getClient().getRunQueue().postRunnable(new Runnable() {
|
||||
public void run () {
|
||||
// finally let the game manager know that we're ready
|
||||
|
||||
@@ -1062,7 +1062,7 @@ public class GameManager extends PlaceManager
|
||||
BodyObject plobj = (BodyObject)caller;
|
||||
|
||||
// get the user's player index
|
||||
int pidx = _gameobj.getPlayerIndex(plobj.username);
|
||||
int pidx = _gameobj.getPlayerIndex(plobj.getVisibleName());
|
||||
if (pidx == -1) {
|
||||
// only complain if this is not a party game, since it's
|
||||
// perfectly normal to receive a player ready notification
|
||||
|
||||
@@ -103,8 +103,8 @@ public class ParlorManager
|
||||
_invites.put(invite.inviteId, invite);
|
||||
|
||||
// deliver an invite notification to the invitee
|
||||
ParlorSender.sendInvite(invitee, invite.inviteId,
|
||||
inviter.username, config);
|
||||
ParlorSender.sendInvite(
|
||||
invitee, invite.inviteId, inviter.getVisibleName(), config);
|
||||
|
||||
// and let the caller know the invite id we assigned
|
||||
return invite.inviteId;
|
||||
|
||||
@@ -177,7 +177,9 @@ public class ParlorProvider
|
||||
|
||||
try {
|
||||
// just this fellow will be playing
|
||||
config.players = new Name[] { user.username };
|
||||
if (config.players == null || config.players.length == 0) {
|
||||
config.players = new Name[] { user.getVisibleName() };
|
||||
}
|
||||
|
||||
// create the game manager and begin its initialization
|
||||
// process
|
||||
|
||||
@@ -114,7 +114,7 @@ public class TableManager
|
||||
// stick the creator into the first non-AI position
|
||||
int cpos = (config.ais == null) ? 0 : config.ais.length;
|
||||
String error =
|
||||
table.setOccupant(cpos, creator.username, creator.getOid());
|
||||
table.setOccupant(cpos, creator.getVisibleName(), creator.getOid());
|
||||
if (error != null) {
|
||||
Log.warning("Unable to add creator to position zero of " +
|
||||
"table!? [table=" + table + ", creator=" + creator +
|
||||
@@ -170,8 +170,8 @@ public class TableManager
|
||||
}
|
||||
|
||||
// request that the user be added to the table at that position
|
||||
String error =
|
||||
table.setOccupant(position, joiner.username, joiner.getOid());
|
||||
String error = table.setOccupant(
|
||||
position, joiner.getVisibleName(), joiner.getOid());
|
||||
// if that failed, report the error
|
||||
if (error != null) {
|
||||
throw new InvocationException(error);
|
||||
@@ -215,7 +215,7 @@ public class TableManager
|
||||
}
|
||||
|
||||
// request that the user be removed from the table
|
||||
if (!table.clearOccupant(leaver.username)) {
|
||||
if (!table.clearOccupant(leaver.getVisibleName())) {
|
||||
throw new InvocationException(NOT_AT_TABLE);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class TurnGameControllerDelegate extends GameControllerDelegate
|
||||
{
|
||||
BodyObject self = (BodyObject)_ctx.getClient().getClientObject();
|
||||
return (_gameObj.state == GameObject.IN_PLAY &&
|
||||
self.username.equals(_turnGame.getTurnHolder()));
|
||||
self.getVisibleName().equals(_turnGame.getTurnHolder()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user