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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user