diff --git a/src/java/com/threerings/parlor/game/GameObject.dobj b/src/java/com/threerings/parlor/game/GameObject.dobj
index d3b75d396..4e35b7bf1 100644
--- a/src/java/com/threerings/parlor/game/GameObject.dobj
+++ b/src/java/com/threerings/parlor/game/GameObject.dobj
@@ -1,9 +1,11 @@
//
-// $Id: GameObject.dobj,v 1.9 2002/06/12 07:59:19 shaper Exp $
+// $Id: GameObject.dobj,v 1.10 2002/08/09 23:34:10 shaper Exp $
package com.threerings.parlor.game;
+import com.samskivert.util.ListUtil;
import com.samskivert.util.StringUtil;
+
import com.threerings.crowd.data.PlaceObject;
/**
@@ -43,4 +45,14 @@ public class GameObject extends PlaceObject
/** The unique round identifier for the current round. */
public int roundId;
+
+ /**
+ * Returns the player index of the given user in the game, or
+ * -1 if the player is not involved in the game.
+ */
+ public int getPlayerIndex (String username)
+ {
+ return (players == null) ? -1 :
+ ListUtil.indexOfEqual(players, username);
+ }
}
diff --git a/src/java/com/threerings/parlor/game/GameObject.java b/src/java/com/threerings/parlor/game/GameObject.java
index d4bbd7eac..75d35a74e 100644
--- a/src/java/com/threerings/parlor/game/GameObject.java
+++ b/src/java/com/threerings/parlor/game/GameObject.java
@@ -1,9 +1,11 @@
//
-// $Id: GameObject.java,v 1.4 2002/06/12 07:59:19 shaper Exp $
+// $Id: GameObject.java,v 1.5 2002/08/09 23:34:10 shaper Exp $
package com.threerings.parlor.game;
+import com.samskivert.util.ListUtil;
import com.samskivert.util.StringUtil;
+
import com.threerings.crowd.data.PlaceObject;
/**
@@ -56,6 +58,16 @@ public class GameObject extends PlaceObject
/** The unique round identifier for the current round. */
public int roundId;
+ /**
+ * Returns the player index of the given user in the game, or
+ * -1 if the player is not involved in the game.
+ */
+ public int getPlayerIndex (String username)
+ {
+ return (players == null) ? -1 :
+ ListUtil.indexOfEqual(players, username);
+ }
+
/**
* Requests that the state field be set to the specified
* value. The local value will be updated immediately and an event