Obtain our persistent id from our name, not the whole object.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@816 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2009-04-21 20:48:48 +00:00
parent d873854578
commit 74fb88002b
3 changed files with 8 additions and 8 deletions
@@ -3,12 +3,12 @@
package com.threerings.parlor.game.data;
import com.threerings.crowd.data.BodyObject;
import com.threerings.util.Name;
public interface UserIdentifier
{
/**
* Returns the id of the specified user, or 0 if they're not valid.
*/
int getUserId (BodyObject bodyObj);
int getUserId (Name name);
}
@@ -330,11 +330,11 @@ public class GameManager extends PlaceManager
}
/**
* Returns the persistent user id for the supplied body.
* Returns the persistent user id for the supplied player name.
*/
public int getPlayerPersistentId (BodyObject bobj)
public int getPlayerPersistentId (Name name)
{
return (bobj == null) ? 0 : _userIder.getUserId(bobj);
return _userIder.getUserId(name);
}
/**
@@ -1385,7 +1385,7 @@ public class GameManager extends PlaceManager
/** Used to map users to persistent integer identifiers. */
protected static UserIdentifier _userIder = new UserIdentifier() {
public int getUserId (BodyObject bodyObj) {
public int getUserId (Name name) {
return 0; // by default no one has persistent info
}
};
@@ -126,7 +126,7 @@ public abstract class RatingDelegate extends GameManagerDelegate
BodyObject bobj = (BodyObject)_omgr.getObject(_gobj.occupants.get(ii));
int pidx = _gmgr.getPlayerIndex(bobj.getVisibleName());
if (pidx != -1) {
_playerIds[pidx] = _gmgr.getPlayerPersistentId(bobj);
_playerIds[pidx] = _gmgr.getPlayerPersistentId(bobj.getVisibleName());
}
Rating rating = maybeCreateRating(bobj);
if (rating != null) {
@@ -168,7 +168,7 @@ public abstract class RatingDelegate extends GameManagerDelegate
protected Rating maybeCreateRating (BodyObject bobj)
{
// if this occupant is not a player (or not ratable), skip 'em
int playerId = _gmgr.getPlayerPersistentId(bobj);
int playerId = _gmgr.getPlayerPersistentId(bobj.getVisibleName());
if (playerId == 0) {
return null;
}