From 71f2a1442ce841de3b0eb03605e042cb465ec137 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 23 Aug 2007 23:10:02 +0000 Subject: [PATCH] Added setWinners(). git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@415 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../ezgame/server/EZGameManager.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/java/com/threerings/ezgame/server/EZGameManager.java b/src/java/com/threerings/ezgame/server/EZGameManager.java index 6d87def1..0c4a68ad 100644 --- a/src/java/com/threerings/ezgame/server/EZGameManager.java +++ b/src/java/com/threerings/ezgame/server/EZGameManager.java @@ -76,6 +76,15 @@ public class EZGameManager extends GameManager 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 public void turnWillStart () { @@ -146,7 +155,7 @@ public class EZGameManager extends GameManager } validateStateModification(caller, false); - _winnerIds = winnerOids; + setWinners(winnerOids); endGame(); } @@ -575,14 +584,14 @@ public class EZGameManager extends GameManager @Override protected void assignWinners (boolean[] winners) { - if (_winnerIds != null) { - for (int oid : _winnerIds) { + if (_winnerOids != null) { + for (int oid : _winnerOids) { int index = IntListUtil.indexOf(_playerOids, oid); if (index >= 0 && index < winners.length) { winners[index] = true; } } - _winnerIds = null; + _winnerOids = null; } } @@ -696,7 +705,7 @@ public class EZGameManager extends GameManager protected ArrayIntSet _cookieLookups = new ArrayIntSet(); /** 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. */ protected GameCookieManager _cookMgr;