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)
|
InvocationService.InvocationListener listener)
|
||||||
throws InvocationException
|
throws InvocationException
|
||||||
{
|
{
|
||||||
validateStateModification(caller);
|
validateStateModification(caller, true);
|
||||||
|
|
||||||
Name nextTurnHolder = null;
|
Name nextTurnHolder = null;
|
||||||
if (nextPlayerId != 0) {
|
if (nextPlayerId != 0) {
|
||||||
@@ -118,7 +118,7 @@ public class EZGameManager extends GameManager
|
|||||||
if (!_gameObj.isInPlay()) {
|
if (!_gameObj.isInPlay()) {
|
||||||
throw new InvocationException("e.already_ended");
|
throw new InvocationException("e.already_ended");
|
||||||
}
|
}
|
||||||
validateStateModification(caller);
|
validateStateModification(caller, false);
|
||||||
|
|
||||||
_winnerIds = winnerOids;
|
_winnerIds = winnerOids;
|
||||||
endGame();
|
endGame();
|
||||||
@@ -449,16 +449,18 @@ public class EZGameManager extends GameManager
|
|||||||
/**
|
/**
|
||||||
* Validate that the specified listener has access to make a change.
|
* 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
|
throws InvocationException
|
||||||
{
|
{
|
||||||
validateUser(caller);
|
validateUser(caller);
|
||||||
|
|
||||||
|
if (requireHoldsTurn) {
|
||||||
Name holder = _gameObj.turnHolder;
|
Name holder = _gameObj.turnHolder;
|
||||||
if (holder != null && !holder.equals(((BodyObject) caller).getVisibleName())) {
|
if (holder != null && !holder.equals(((BodyObject) caller).getVisibleName())) {
|
||||||
throw new InvocationException(InvocationCodes.ACCESS_DENIED);
|
throw new InvocationException(InvocationCodes.ACCESS_DENIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the specified player body by Oid.
|
* Get the specified player body by Oid.
|
||||||
|
|||||||
Reference in New Issue
Block a user