Added getPlayerIndex().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1636 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -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
|
||||
* <code>-1</code> 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 <code>state</code> field be set to the specified
|
||||
* value. The local value will be updated immediately and an event
|
||||
|
||||
Reference in New Issue
Block a user