- Changed Table to just have an int as its key and use autoboxing to make
that a Comparable. It's a slight performance hit, as when a DSet is binary searched, it will be boxing up an int for every entry examined. Oh well. - Use some generics. - Some other cleanups I spotted while writing actionscript versions. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@29 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -134,8 +134,8 @@ public abstract class GameController extends PlaceController
|
||||
*/
|
||||
public boolean isGameOver ()
|
||||
{
|
||||
boolean gameOver =
|
||||
((_gobj != null) ? (_gobj.state != GameObject.IN_PLAY) : true);
|
||||
boolean gameOver = (_gobj == null) ||
|
||||
(_gobj.state != GameObject.IN_PLAY);
|
||||
return (_gameOver || gameOver);
|
||||
}
|
||||
|
||||
@@ -199,10 +199,10 @@ public abstract class GameController extends PlaceController
|
||||
{
|
||||
// deal with game state changes
|
||||
if (event.getName().equals(GameObject.STATE)) {
|
||||
if (!stateDidChange(event.getIntValue())) {
|
||||
int newState = event.getIntValue();
|
||||
if (!stateDidChange(newState)) {
|
||||
Log.warning("Game transitioned to unknown state " +
|
||||
"[gobj=" + _gobj +
|
||||
", state=" + event.getIntValue() + "].");
|
||||
"[gobj=" + _gobj + ", state=" + newState + "].");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,6 @@ public class GameObject extends PlaceObject
|
||||
(playerStatus == null || isActivePlayerStatus(playerStatus[pidx]));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the player index of the given user in the game, or
|
||||
* <code>-1</code> if the player is not involved in the game.
|
||||
@@ -194,7 +193,7 @@ public class GameObject extends PlaceObject
|
||||
*/
|
||||
public boolean isWinner (int pidx)
|
||||
{
|
||||
return (winners == null) ? false : winners[pidx];
|
||||
return (winners != null) && winners[pidx];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user