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
This commit is contained in:
@@ -95,7 +95,7 @@ public class EZGameManager extends GameManager
|
|||||||
if (!_ezObj.isInPlay()) {
|
if (!_ezObj.isInPlay()) {
|
||||||
throw new InvocationException("e.already_ended");
|
throw new InvocationException("e.already_ended");
|
||||||
}
|
}
|
||||||
validateStateModification(caller, false);
|
validateUser(caller);
|
||||||
}
|
}
|
||||||
|
|
||||||
// from TurnGameManager
|
// from TurnGameManager
|
||||||
@@ -118,7 +118,13 @@ public class EZGameManager extends GameManager
|
|||||||
InvocationService.InvocationListener listener)
|
InvocationService.InvocationListener listener)
|
||||||
throws InvocationException
|
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;
|
Name nextTurnHolder = null;
|
||||||
if (nextPlayerId != 0) {
|
if (nextPlayerId != 0) {
|
||||||
@@ -136,7 +142,7 @@ public class EZGameManager extends GameManager
|
|||||||
InvocationService.InvocationListener listener)
|
InvocationService.InvocationListener listener)
|
||||||
throws InvocationException
|
throws InvocationException
|
||||||
{
|
{
|
||||||
validateStateModification(caller, false);
|
validateUser(caller);
|
||||||
|
|
||||||
// let the game know that it is doing something stupid
|
// let the game know that it is doing something stupid
|
||||||
if (_ezObj.roundId < 0) {
|
if (_ezObj.roundId < 0) {
|
||||||
@@ -173,7 +179,7 @@ public class EZGameManager extends GameManager
|
|||||||
InvocationService.InvocationListener listener)
|
InvocationService.InvocationListener listener)
|
||||||
throws InvocationException
|
throws InvocationException
|
||||||
{
|
{
|
||||||
validateCanEndGame(caller);
|
validateUser(caller);
|
||||||
|
|
||||||
// queue up the start of the next game
|
// queue up the start of the next game
|
||||||
if (seconds > 0) {
|
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.
|
* Get the specified player body by Oid.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user