Added setWinners().

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@415 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2007-08-23 23:10:02 +00:00
parent b9ba20c19b
commit 71f2a1442c
@@ -76,6 +76,15 @@ public class EZGameManager extends GameManager
addDelegate(_turnDelegate = new EZGameTurnDelegate(this)); addDelegate(_turnDelegate = new EZGameTurnDelegate(this));
} }
/**
* Configures the oids of the winners of this game. If a game manager delegate wishes to handle
* winner assignment, it should call this method and then call {@link #enddGame}.
*/
public void setWinners (int[] winnerOids)
{
_winnerOids = winnerOids;
}
// from TurnGameManager // from TurnGameManager
public void turnWillStart () public void turnWillStart ()
{ {
@@ -146,7 +155,7 @@ public class EZGameManager extends GameManager
} }
validateStateModification(caller, false); validateStateModification(caller, false);
_winnerIds = winnerOids; setWinners(winnerOids);
endGame(); endGame();
} }
@@ -575,14 +584,14 @@ public class EZGameManager extends GameManager
@Override @Override
protected void assignWinners (boolean[] winners) protected void assignWinners (boolean[] winners)
{ {
if (_winnerIds != null) { if (_winnerOids != null) {
for (int oid : _winnerIds) { for (int oid : _winnerOids) {
int index = IntListUtil.indexOf(_playerOids, oid); int index = IntListUtil.indexOf(_playerOids, oid);
if (index >= 0 && index < winners.length) { if (index >= 0 && index < winners.length) {
winners[index] = true; winners[index] = true;
} }
} }
_winnerIds = null; _winnerOids = null;
} }
} }
@@ -696,7 +705,7 @@ public class EZGameManager extends GameManager
protected ArrayIntSet _cookieLookups = new ArrayIntSet(); protected ArrayIntSet _cookieLookups = new ArrayIntSet();
/** The array of winner oids, after the user has filled it in. */ /** The array of winner oids, after the user has filled it in. */
protected int[] _winnerIds; protected int[] _winnerOids;
/** Handles the storage of our user cookies; lazily initialized. */ /** Handles the storage of our user cookies; lazily initialized. */
protected GameCookieManager _cookMgr; protected GameCookieManager _cookMgr;