From 9cfc27333631f10869f39eb29a1045da3d82d68c Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 13 Nov 2007 21:52:16 +0000 Subject: [PATCH] We don't need to be able to end the game here, just be a player. Simplified some of the access checking while I was in there since the only thing that required the turn-holder was endTurn(). git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@494 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../ezgame/server/EZGameManager.java | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/java/com/threerings/ezgame/server/EZGameManager.java b/src/java/com/threerings/ezgame/server/EZGameManager.java index d1200599..a212a257 100644 --- a/src/java/com/threerings/ezgame/server/EZGameManager.java +++ b/src/java/com/threerings/ezgame/server/EZGameManager.java @@ -95,7 +95,7 @@ public class EZGameManager extends GameManager if (!_ezObj.isInPlay()) { throw new InvocationException("e.already_ended"); } - validateStateModification(caller, false); + validateUser(caller); } // from TurnGameManager @@ -118,7 +118,13 @@ public class EZGameManager extends GameManager InvocationService.InvocationListener listener) throws InvocationException { - validateStateModification(caller, true); + validateUser(caller); + + // make sure this player is the turn holder + Name holder = _ezObj.turnHolder; + if (holder != null && !holder.equals(((BodyObject) caller).getVisibleName())) { + throw new InvocationException(InvocationCodes.ACCESS_DENIED); + } Name nextTurnHolder = null; if (nextPlayerId != 0) { @@ -136,7 +142,7 @@ public class EZGameManager extends GameManager InvocationService.InvocationListener listener) throws InvocationException { - validateStateModification(caller, false); + validateUser(caller); // let the game know that it is doing something stupid if (_ezObj.roundId < 0) { @@ -173,7 +179,7 @@ public class EZGameManager extends GameManager InvocationService.InvocationListener listener) throws InvocationException { - validateCanEndGame(caller); + validateUser(caller); // queue up the start of the next game if (seconds > 0) { @@ -492,22 +498,6 @@ public class EZGameManager extends GameManager } } - /** - * Validate that the specified listener has access to make a change. - */ - protected void validateStateModification (ClientObject caller, boolean requireHoldsTurn) - throws InvocationException - { - validateUser(caller); - - if (requireHoldsTurn) { - Name holder = _ezObj.turnHolder; - if (holder != null && !holder.equals(((BodyObject) caller).getVisibleName())) { - throw new InvocationException(InvocationCodes.ACCESS_DENIED); - } - } - } - /** * Get the specified player body by Oid. */