diff --git a/src/java/com/threerings/micasa/lobby/table/TableItem.java b/src/java/com/threerings/micasa/lobby/table/TableItem.java
index 02580a53..c7a7e90b 100644
--- a/src/java/com/threerings/micasa/lobby/table/TableItem.java
+++ b/src/java/com/threerings/micasa/lobby/table/TableItem.java
@@ -199,12 +199,12 @@ public class TableItem
"click came from [event=" + event + "].");
} else {
// otherwise, request to join the table at this position
- _tdtr.joinTable(table.getTableId(), position);
+ _tdtr.joinTable(table.tableId, position);
}
} else if (cmd.equals("leave")) {
// if we're not joining, we're leaving
- _tdtr.leaveTable(table.getTableId());
+ _tdtr.leaveTable(table.tableId);
} else if (cmd.equals("go")) {
// they want to see the game... so go there
diff --git a/src/java/com/threerings/micasa/lobby/table/TableListView.java b/src/java/com/threerings/micasa/lobby/table/TableListView.java
index fbd2961a..43896482 100644
--- a/src/java/com/threerings/micasa/lobby/table/TableListView.java
+++ b/src/java/com/threerings/micasa/lobby/table/TableListView.java
@@ -189,7 +189,7 @@ public class TableListView extends JPanel
Log.info("Table updated [table=" + table + "].");
// locate the table item associated with this table
- TableItem item = getTableItem(table.getTableId());
+ TableItem item = getTableItem(table.tableId);
if (item == null) {
Log.warning("Received table updated notification for " +
"unknown table [table=" + table + "].");
@@ -257,7 +257,7 @@ public class TableListView extends JPanel
int ccount = _matchList.getComponentCount();
for (int i = 0; i < ccount; i++) {
TableItem child = (TableItem)_matchList.getComponent(i);
- if (child.table.getTableId() == tableId) {
+ if (child.table.tableId == tableId) {
return child;
}
}
@@ -266,7 +266,7 @@ public class TableListView extends JPanel
ccount = _playList.getComponentCount();
for (int i = 0; i < ccount; i++) {
TableItem child = (TableItem)_playList.getComponent(i);
- if (child.table.getTableId() == tableId) {
+ if (child.table.tableId == tableId) {
return child;
}
}
diff --git a/src/java/com/threerings/parlor/client/TableConfigurator.java b/src/java/com/threerings/parlor/client/TableConfigurator.java
index c1259d87..e764184f 100644
--- a/src/java/com/threerings/parlor/client/TableConfigurator.java
+++ b/src/java/com/threerings/parlor/client/TableConfigurator.java
@@ -113,7 +113,7 @@ public abstract class TableConfigurator
protected ParlorContext _ctx;
/** The config we're configurating. */
- protected TableConfig _config;
+ protected TableConfig _config;
/** The game configurator, which we may wish to reference. */
protected GameConfigurator _gameConfigurator;
diff --git a/src/java/com/threerings/parlor/client/TableDirector.java b/src/java/com/threerings/parlor/client/TableDirector.java
index 8f55203e..c10dcdd1 100644
--- a/src/java/com/threerings/parlor/client/TableDirector.java
+++ b/src/java/com/threerings/parlor/client/TableDirector.java
@@ -260,16 +260,16 @@ public class TableDirector extends BasicDirector
public void entryRemoved (EntryRemovedEvent event)
{
if (event.getName().equals(_tableField)) {
- Integer tableId = (Integer)event.getKey();
+ int tableId = ((Integer) event.getKey()).intValue();
// check to see if our table just disappeared
- if (_ourTable != null && tableId.equals(_ourTable.tableId)) {
+ if (_ourTable != null && tableId == _ourTable.tableId) {
_ourTable = null;
notifySeatedness(false);
}
// now let the observer know what's up
- _observer.tableRemoved(tableId.intValue());
+ _observer.tableRemoved(tableId);
}
}
diff --git a/src/java/com/threerings/parlor/data/Table.java b/src/java/com/threerings/parlor/data/Table.java
index 85a3c471..2098cba4 100644
--- a/src/java/com/threerings/parlor/data/Table.java
+++ b/src/java/com/threerings/parlor/data/Table.java
@@ -43,7 +43,7 @@ public class Table
implements DSet.Entry, ParlorCodes
{
/** The unique identifier for this table. */
- public Integer tableId;
+ public int tableId;
/** The object id of the lobby object with which this table is
* associated. */
@@ -80,7 +80,7 @@ public class Table
public Table (int lobbyOid, TableConfig tconfig, GameConfig config)
{
// assign a unique table id
- tableId = Integer.valueOf(++_tableIdCounter);
+ tableId = ++_tableIdCounter;
// keep track of our lobby oid
this.lobbyOid = lobbyOid;
@@ -109,14 +109,6 @@ public class Table
public Table ()
{
}
-
- /**
- * A convenience function for accessing the table id as an int.
- */
- public int getTableId ()
- {
- return tableId.intValue();
- }
/**
* Returns true if there is no one sitting at this table.
@@ -363,13 +355,13 @@ public class Table
public boolean equals (Object other)
{
return (other instanceof Table) &&
- tableId.equals(((Table) other).tableId);
+ (tableId == ((Table) other).tableId);
}
// documentation inherited
public int hashCode ()
{
- return tableId.intValue();
+ return tableId;
}
/**
diff --git a/src/java/com/threerings/parlor/game/client/GameController.java b/src/java/com/threerings/parlor/game/client/GameController.java
index 901b249e..7cdc9005 100644
--- a/src/java/com/threerings/parlor/game/client/GameController.java
+++ b/src/java/com/threerings/parlor/game/client/GameController.java
@@ -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 + "].");
}
}
}
diff --git a/src/java/com/threerings/parlor/game/data/GameObject.java b/src/java/com/threerings/parlor/game/data/GameObject.java
index 81c9b8ce..5db78ffd 100644
--- a/src/java/com/threerings/parlor/game/data/GameObject.java
+++ b/src/java/com/threerings/parlor/game/data/GameObject.java
@@ -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
* -1 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];
}
/**
diff --git a/src/java/com/threerings/parlor/server/TableManager.java b/src/java/com/threerings/parlor/server/TableManager.java
index c8339262..6db39c67 100644
--- a/src/java/com/threerings/parlor/server/TableManager.java
+++ b/src/java/com/threerings/parlor/server/TableManager.java
@@ -129,7 +129,7 @@ public class TableManager
_boidMap.put(creator.getOid(), table);
// also stick it into our tables tables
- _tables.put(table.getTableId(), table);
+ _tables.put(table.tableId, table);
// if the table has only one seat, start the game immediately
if (table.shouldBeStarted()) {
@@ -137,7 +137,7 @@ public class TableManager
}
// finally let the caller know what the new table id is
- return table.getTableId();
+ return table.tableId;
}
/**
@@ -163,7 +163,7 @@ public class TableManager
throws InvocationException
{
// look the table up
- Table table = (Table)_tables.get(tableId);
+ Table table = _tables.get(tableId);
if (table == null) {
throw new InvocationException(NO_SUCH_TABLE);
}
@@ -207,7 +207,7 @@ public class TableManager
throws InvocationException
{
// look the table up
- Table table = (Table)_tables.get(tableId);
+ Table table = _tables.get(tableId);
if (table == null) {
throw new InvocationException(NO_SUCH_TABLE);
}
@@ -239,7 +239,7 @@ public class TableManager
protected void purgeTable (Table table)
{
// remove the table from our tables table
- _tables.remove(table.getTableId());
+ _tables.remove(table.tableId);
// clear out all matching entries in the boid map
for (int i = 0; i < table.bodyOids.length; i++) {
@@ -308,9 +308,7 @@ public class TableManager
protected void unmapTable (int gameOid)
{
// look through our tables table for a table with a matching game
- Iterator iter = _tables.values().iterator();
- while (iter.hasNext()) {
- Table table = (Table)iter.next();
+ for (Table table : _tables.values()) {
if (table.gameOid == gameOid) {
purgeTable(table);
return; // all done
@@ -337,7 +335,7 @@ public class TableManager
// look up the table to which this occupant is mapped
int bodyOid = event.getOid();
- Table pender = (Table)_boidMap.remove(bodyOid);
+ Table pender = _boidMap.remove(bodyOid);
if (pender == null) {
return;
}
@@ -365,10 +363,10 @@ public class TableManager
protected TableLobbyObject _tlobj;
/** The table of pending tables. */
- protected HashIntMap _tables = new HashIntMap();
+ protected HashIntMap