From 13b8913d5fa8e8b93953b471e26850c67d126d1b Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sun, 11 Mar 2007 02:31:35 +0000 Subject: [PATCH] Not all games are turn games. Let's not require that an unasked-for and arbitrarily assigned turn holder be the one to end the game. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@234 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../threerings/ezgame/server/EZGameManager.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/java/com/threerings/ezgame/server/EZGameManager.java b/src/java/com/threerings/ezgame/server/EZGameManager.java index 985438f2..990e0025 100644 --- a/src/java/com/threerings/ezgame/server/EZGameManager.java +++ b/src/java/com/threerings/ezgame/server/EZGameManager.java @@ -97,7 +97,7 @@ public class EZGameManager extends GameManager InvocationService.InvocationListener listener) throws InvocationException { - validateStateModification(caller); + validateStateModification(caller, true); Name nextTurnHolder = null; if (nextPlayerId != 0) { @@ -118,7 +118,7 @@ public class EZGameManager extends GameManager if (!_gameObj.isInPlay()) { throw new InvocationException("e.already_ended"); } - validateStateModification(caller); + validateStateModification(caller, false); _winnerIds = winnerOids; endGame(); @@ -449,14 +449,16 @@ public class EZGameManager extends GameManager /** * Validate that the specified listener has access to make a change. */ - protected void validateStateModification (ClientObject caller) + protected void validateStateModification (ClientObject caller, boolean requireHoldsTurn) throws InvocationException { validateUser(caller); - Name holder = _gameObj.turnHolder; - if (holder != null && !holder.equals(((BodyObject) caller).getVisibleName())) { - throw new InvocationException(InvocationCodes.ACCESS_DENIED); + if (requireHoldsTurn) { + Name holder = _gameObj.turnHolder; + if (holder != null && !holder.equals(((BodyObject) caller).getVisibleName())) { + throw new InvocationException(InvocationCodes.ACCESS_DENIED); + } } }