Added isOurTurn() for derived classes to call to determine correctly
whether or not it is their turn. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@498 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
//
|
//
|
||||||
// $Id: TurnGameController.java,v 1.1 2001/10/12 00:30:10 mdb Exp $
|
// $Id: TurnGameController.java,v 1.2 2001/10/18 20:53:23 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.parlor.turn;
|
package com.threerings.parlor.turn;
|
||||||
|
|
||||||
import com.threerings.presents.dobj.*;
|
import com.threerings.presents.dobj.*;
|
||||||
|
import com.threerings.crowd.data.BodyObject;
|
||||||
|
|
||||||
import com.threerings.parlor.Log;
|
import com.threerings.parlor.Log;
|
||||||
import com.threerings.parlor.game.GameController;
|
import com.threerings.parlor.game.GameController;
|
||||||
@@ -35,4 +36,16 @@ public abstract class TurnGameController extends GameController
|
|||||||
{
|
{
|
||||||
Log.info("Turn changed [holder=" + turnHolder + "].");
|
Log.info("Turn changed [holder=" + turnHolder + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the game is in progress and it is our turn; false
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
protected boolean isOurTurn ()
|
||||||
|
{
|
||||||
|
TurnGameObject turnGame = (TurnGameObject)_gobj;
|
||||||
|
BodyObject self = (BodyObject)_ctx.getClient().getClientObject();
|
||||||
|
return (turnGame.state == TurnGameObject.IN_PLAY &&
|
||||||
|
turnGame.turnHolder.equals(self.username));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user