Made getTurnHolderIndex() public.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@991 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-02-12 07:17:33 +00:00
parent 671d7ddce1
commit ebc3fe229d
@@ -1,5 +1,5 @@
//
// $Id: TurnGameManagerDelegate.java,v 1.2 2002/02/12 07:01:54 mdb Exp $
// $Id: TurnGameManagerDelegate.java,v 1.3 2002/02/12 07:17:33 mdb Exp $
package com.threerings.parlor.turn;
@@ -64,6 +64,24 @@ public class TurnGameManagerDelegate
}
}
/**
* Returns the index of the current turn holder as configured in the
* game object.
*
* @return the index into the players array of the current turn holder
* or -1 if there is no current turn holder.
*/
public int getTurnHolderIndex ()
{
String holder = _turnGame.getTurnHolder();
for (int i = 0; i < _players.length; i++) {
if (_players[i].equals(holder)) {
return i;
}
}
return -1;
}
/**
* This is called to determine whichi player will take the first
* turn. The default implementation chooses a player at random.
@@ -144,24 +162,6 @@ public class TurnGameManagerDelegate
_turnIdx = (_turnIdx + 1) % _players.length;
}
/**
* Returns the index of the current turn holder as configured in the
* game object.
*
* @return the index into the players array of the current turn holder
* or -1 if there is no current turn holder.
*/
protected int getTurnHolderIndex ()
{
String holder = _turnGame.getTurnHolder();
for (int i = 0; i < _players.length; i++) {
if (_players[i].equals(holder)) {
return i;
}
}
return -1;
}
/** The game manager for which we are delegating. */
protected TurnGameManager _tgmgr;