From 55a0ab91f72597ae97ec8ef162369a0444f9f679 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 28 Dec 2004 03:51:29 +0000 Subject: [PATCH] Regenerated our DObject derivations in the new world order. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3288 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/admin/data/ConfigObject.dobj | 45 ----- .../com/threerings/crowd/data/BodyObject.dobj | 80 -------- .../com/threerings/crowd/data/BodyObject.java | 68 ++++--- .../threerings/crowd/data/PlaceObject.dobj | 106 ---------- .../threerings/crowd/data/PlaceObject.java | 36 ++-- .../threerings/micasa/lobby/LobbyObject.dobj | 33 ---- .../micasa/lobby/table/TableLobbyObject.dobj | 58 ------ .../micasa/lobby/table/TableLobbyObject.java | 12 +- .../threerings/parlor/game/GameObject.dobj | 182 ------------------ .../threerings/parlor/game/GameObject.java | 146 ++++++++------ .../presents/data/ClientObject.dobj | 78 -------- .../presents/data/ClientObject.java | 12 +- .../presents/data/InvocationObject.java | 2 +- .../presents/data/TimeBaseObject.dobj | 122 ------------ .../presents/data/TimeBaseObject.java | 36 ++-- .../threerings/puzzle/data/PuzzleObject.dobj | 84 -------- .../threerings/puzzle/data/PuzzleObject.java | 114 ++++++----- .../threerings/whirled/data/SceneObject.java | 2 +- .../whirled/spot/data/ClusterObject.dobj | 47 ----- .../whirled/spot/data/ClusterObject.java | 12 +- .../whirled/spot/data/SpotSceneObject.dobj | 38 ---- .../whirled/spot/data/SpotSceneObject.java | 20 +- .../presents/server/TestObject.dobj | 36 ---- 23 files changed, 273 insertions(+), 1096 deletions(-) delete mode 100644 src/java/com/threerings/admin/data/ConfigObject.dobj delete mode 100644 src/java/com/threerings/crowd/data/BodyObject.dobj delete mode 100644 src/java/com/threerings/crowd/data/PlaceObject.dobj delete mode 100644 src/java/com/threerings/micasa/lobby/LobbyObject.dobj delete mode 100644 src/java/com/threerings/micasa/lobby/table/TableLobbyObject.dobj delete mode 100644 src/java/com/threerings/parlor/game/GameObject.dobj delete mode 100644 src/java/com/threerings/presents/data/ClientObject.dobj delete mode 100644 src/java/com/threerings/presents/data/TimeBaseObject.dobj delete mode 100644 src/java/com/threerings/puzzle/data/PuzzleObject.dobj delete mode 100644 src/java/com/threerings/whirled/spot/data/ClusterObject.dobj delete mode 100644 src/java/com/threerings/whirled/spot/data/SpotSceneObject.dobj delete mode 100644 tests/src/java/com/threerings/presents/server/TestObject.dobj diff --git a/src/java/com/threerings/admin/data/ConfigObject.dobj b/src/java/com/threerings/admin/data/ConfigObject.dobj deleted file mode 100644 index 7445e460e..000000000 --- a/src/java/com/threerings/admin/data/ConfigObject.dobj +++ /dev/null @@ -1,45 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.admin.data; - -import java.lang.reflect.Field; -import javax.swing.JPanel; - -import com.threerings.presents.dobj.DObject; -import com.threerings.presents.util.PresentsContext; - -import com.threerings.admin.client.FieldEditor; - -/** - * Base class for runtime config distributed objects. Used to allow - * config objects to supply custom object editing UI. - */ -public class ConfigObject extends DObject -{ - /** - * Returns the editor panel for the specified field. - */ - public JPanel getEditor (PresentsContext ctx, Field field) - { - return new FieldEditor(ctx, field, this); - } -} diff --git a/src/java/com/threerings/crowd/data/BodyObject.dobj b/src/java/com/threerings/crowd/data/BodyObject.dobj deleted file mode 100644 index b49ae0a21..000000000 --- a/src/java/com/threerings/crowd/data/BodyObject.dobj +++ /dev/null @@ -1,80 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.crowd.data; - -import com.threerings.util.Name; - -import com.threerings.presents.data.ClientObject; -import com.threerings.crowd.chat.data.SpeakObject; - -/** - * The basic user object class for Crowd users. Bodies have a username, a - * location and a status. - */ -public class BodyObject extends ClientObject - implements SpeakObject -{ - /** - * The username associated with this body object. - */ - public Name username; - - /** - * The oid of the place currently occupied by this body or -1 if they - * currently occupy no place. - */ - public int location = -1; - - /** - * The user's current status ({@link OccupantInfo#ACTIVE}, etc.). - */ - public byte status; - - /** - * The time at which the {@link #status} field was last updated. This - * is only available on the server. - */ - public transient long statusTime; - - /** - * If non-null, this contains a message to be auto-replied whenever - * another user delivers a tell message to this user. - */ - public String awayMessage; - - // documentation inherited - public void applyToListeners (ListenerOp op) - { - op.apply(getOid()); - } - - // documentation inherited - public String who () - { - StringBuffer buf = new StringBuffer(username.toString()); - buf.append(" (").append(getOid()); - if (status != OccupantInfo.ACTIVE) { - buf.append(" ").append(OccupantInfo.X_STATUS[status]); - } - return buf.append(")").toString(); - } -} diff --git a/src/java/com/threerings/crowd/data/BodyObject.java b/src/java/com/threerings/crowd/data/BodyObject.java index 774814653..d509e8b48 100644 --- a/src/java/com/threerings/crowd/data/BodyObject.java +++ b/src/java/com/threerings/crowd/data/BodyObject.java @@ -33,6 +33,7 @@ import com.threerings.crowd.chat.data.SpeakObject; public class BodyObject extends ClientObject implements SpeakObject { + // AUTO-GENERATED: FIELDS START /** The field name of the username field. */ public static final String USERNAME = "username"; @@ -44,6 +45,7 @@ public class BodyObject extends ClientObject /** The field name of the awayMessage field. */ public static final String AWAY_MESSAGE = "awayMessage"; + // AUTO-GENERATED: FIELDS END /** * The username associated with this body object. @@ -90,59 +92,69 @@ public class BodyObject extends ClientObject return buf.append(")").toString(); } + // AUTO-GENERATED: METHODS START /** - * Requests that the username field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the username field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setUsername (Name username) + public void setUsername (Name value) { - requestAttributeChange(USERNAME, username); - this.username = username; + Name ovalue = this.username; + requestAttributeChange( + USERNAME, value, ovalue); + this.username = value; } /** - * Requests that the location field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the location field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setLocation (int location) + public void setLocation (int value) { - requestAttributeChange(LOCATION, new Integer(location)); - this.location = location; + int ovalue = this.location; + requestAttributeChange( + LOCATION, new Integer(value), new Integer(ovalue)); + this.location = value; } /** - * Requests that the status field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the status field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setStatus (byte status) + public void setStatus (byte value) { - requestAttributeChange(STATUS, new Byte(status)); - this.status = status; + byte ovalue = this.status; + requestAttributeChange( + STATUS, new Byte(value), new Byte(ovalue)); + this.status = value; } /** - * Requests that the awayMessage field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the awayMessage field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setAwayMessage (String awayMessage) + public void setAwayMessage (String value) { - requestAttributeChange(AWAY_MESSAGE, awayMessage); - this.awayMessage = awayMessage; + String ovalue = this.awayMessage; + requestAttributeChange( + AWAY_MESSAGE, value, ovalue); + this.awayMessage = value; } + // AUTO-GENERATED: METHODS END } diff --git a/src/java/com/threerings/crowd/data/PlaceObject.dobj b/src/java/com/threerings/crowd/data/PlaceObject.dobj deleted file mode 100644 index 35440d36e..000000000 --- a/src/java/com/threerings/crowd/data/PlaceObject.dobj +++ /dev/null @@ -1,106 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.crowd.data; - -import java.util.Iterator; - -import com.threerings.util.Name; - -import com.threerings.presents.dobj.DObject; -import com.threerings.presents.dobj.DSet; -import com.threerings.presents.dobj.OidList; - -import com.threerings.crowd.Log; -import com.threerings.crowd.chat.data.SpeakMarshaller; -import com.threerings.crowd.chat.data.SpeakObject; - -/** - * A distributed object that contains information on a place that is - * occupied by bodies. This place might be a chat room, a game room, an - * island in a massively multiplayer piratical universe, anything that has - * occupants that might want to chat with one another. - */ -public class PlaceObject extends DObject - implements SpeakObject -{ - /** - * Tracks the oid of the body objects of all of the occupants of this - * place. - */ - public OidList occupants = new OidList(); - - /** - * Contains an info record (of type {@link OccupantInfo}) for each - * occupant that contains information about that occupant that needs - * to be known by everyone in the place. Note: Don't obtain - * occupant info records directly from this set when on the server, - * use PlaceManager.getOccupantInfo() instead (along with - * PlaceManager.updateOccupantInfo()) because it does - * some special processing to ensure that readers and updaters don't - * step on one another even if they make rapid fire changes to a - * user's occupant info. - */ - public DSet occupantInfo = new DSet(); - - /** Used to generate speak requests on this place object. */ - public SpeakMarshaller speakService; - - /** - * Used to indicate whether broadcast chat messages should be dispatched - * on this place object. - */ - public boolean shouldBroadcast () - { - return true; - } - - /** - * Looks up a user's occupant info by name. - * - * @return the occupant info record for the named user or null if no - * user in the room has that username. - */ - public OccupantInfo getOccupantInfo (Name username) - { - try { - Iterator iter = occupantInfo.entries(); - while (iter.hasNext()) { - OccupantInfo info = (OccupantInfo)iter.next(); - if (info.username.equals(username)) { - return info; - } - } - } catch (Throwable t) { - Log.warning("PlaceObject.getOccupantInfo choked."); - Log.logStackTrace(t); - } - return null; - } - - // documentation inherited - public void applyToListeners (ListenerOp op) - { - for (int ii = 0, ll = occupants.size(); ii < ll; ii++) { - op.apply(occupants.get(ii)); - } - } -} diff --git a/src/java/com/threerings/crowd/data/PlaceObject.java b/src/java/com/threerings/crowd/data/PlaceObject.java index 370c6d216..f18a0ff07 100644 --- a/src/java/com/threerings/crowd/data/PlaceObject.java +++ b/src/java/com/threerings/crowd/data/PlaceObject.java @@ -42,6 +42,7 @@ import com.threerings.crowd.chat.data.SpeakObject; public class PlaceObject extends DObject implements SpeakObject { + // AUTO-GENERATED: FIELDS START /** The field name of the occupants field. */ public static final String OCCUPANTS = "occupants"; @@ -50,6 +51,7 @@ public class PlaceObject extends DObject /** The field name of the speakService field. */ public static final String SPEAK_SERVICE = "speakService"; + // AUTO-GENERATED: FIELDS END /** * Tracks the oid of the body objects of all of the occupants of this @@ -113,10 +115,11 @@ public class PlaceObject extends DObject } } + // AUTO-GENERATED: METHODS START /** - * Requests that the specified oid be added to the - * occupants oid list. The list will not change until the - * event is actually propagated through the system. + * Requests that oid be added to the occupants + * oid list. The list will not change until the event is actually + * propagated through the system. */ public void addToOccupants (int oid) { @@ -124,7 +127,7 @@ public class PlaceObject extends DObject } /** - * Requests that the specified oid be removed from the + * Requests that oid be removed from the * occupants oid list. The list will not change until the * event is actually propagated through the system. */ @@ -140,7 +143,7 @@ public class PlaceObject extends DObject */ public void addToOccupantInfo (DSet.Entry elem) { - requestEntryAdd(OCCUPANT_INFO, elem); + requestEntryAdd(OCCUPANT_INFO, occupantInfo, elem); } /** @@ -150,7 +153,7 @@ public class PlaceObject extends DObject */ public void removeFromOccupantInfo (Comparable key) { - requestEntryRemove(OCCUPANT_INFO, key); + requestEntryRemove(OCCUPANT_INFO, occupantInfo, key); } /** @@ -160,7 +163,7 @@ public class PlaceObject extends DObject */ public void updateOccupantInfo (DSet.Entry elem) { - requestEntryUpdate(OCCUPANT_INFO, elem); + requestEntryUpdate(OCCUPANT_INFO, occupantInfo, elem); } /** @@ -175,21 +178,24 @@ public class PlaceObject extends DObject */ public void setOccupantInfo (DSet occupantInfo) { - requestAttributeChange(OCCUPANT_INFO, occupantInfo); + requestAttributeChange(OCCUPANT_INFO, occupantInfo, this.occupantInfo); this.occupantInfo = occupantInfo; } /** - * Requests that the speakService field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the speakService field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setSpeakService (SpeakMarshaller speakService) + public void setSpeakService (SpeakMarshaller value) { - requestAttributeChange(SPEAK_SERVICE, speakService); - this.speakService = speakService; + SpeakMarshaller ovalue = this.speakService; + requestAttributeChange( + SPEAK_SERVICE, value, ovalue); + this.speakService = value; } + // AUTO-GENERATED: METHODS END } diff --git a/src/java/com/threerings/micasa/lobby/LobbyObject.dobj b/src/java/com/threerings/micasa/lobby/LobbyObject.dobj deleted file mode 100644 index 3c3abb935..000000000 --- a/src/java/com/threerings/micasa/lobby/LobbyObject.dobj +++ /dev/null @@ -1,33 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.micasa.lobby; - -import com.threerings.crowd.data.PlaceObject; - -/** - * Presently the lobby object contains nothing specific, but the class - * acts as a placeholder in case lobby-wide fields are needed in the - * future. - */ -public class LobbyObject extends PlaceObject -{ -} diff --git a/src/java/com/threerings/micasa/lobby/table/TableLobbyObject.dobj b/src/java/com/threerings/micasa/lobby/table/TableLobbyObject.dobj deleted file mode 100644 index 9f9efa6b0..000000000 --- a/src/java/com/threerings/micasa/lobby/table/TableLobbyObject.dobj +++ /dev/null @@ -1,58 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.micasa.lobby.table; - -import com.threerings.presents.dobj.DSet; -import com.threerings.parlor.data.Table; -import com.threerings.micasa.lobby.LobbyObject; - -public class TableLobbyObject - extends LobbyObject - implements com.threerings.parlor.data.TableLobbyObject -{ - /** A set containing all of the tables being managed by this lobby. */ - public DSet tableSet = new DSet(); - - // documentation inherited - public DSet getTables () - { - return tableSet; - } - - // documentation inherited from interface - public void addToTables (Table table) - { - addToTableSet(table); - } - - // documentation inherited from interface - public void updateTables (Table table) - { - updateTableSet(table); - } - - // documentation inherited from interface - public void removeFromTables (Comparable key) - { - removeFromTableSet(key); - } -} diff --git a/src/java/com/threerings/micasa/lobby/table/TableLobbyObject.java b/src/java/com/threerings/micasa/lobby/table/TableLobbyObject.java index c834f2db8..004acfaaa 100644 --- a/src/java/com/threerings/micasa/lobby/table/TableLobbyObject.java +++ b/src/java/com/threerings/micasa/lobby/table/TableLobbyObject.java @@ -29,8 +29,10 @@ public class TableLobbyObject extends LobbyObject implements com.threerings.parlor.data.TableLobbyObject { + // AUTO-GENERATED: FIELDS START /** The field name of the tableSet field. */ public static final String TABLE_SET = "tableSet"; + // AUTO-GENERATED: FIELDS END /** A set containing all of the tables being managed by this lobby. */ public DSet tableSet = new DSet(); @@ -59,6 +61,7 @@ public class TableLobbyObject removeFromTableSet(key); } + // AUTO-GENERATED: METHODS START /** * Requests that the specified entry be added to the * tableSet set. The set will not change until the event is @@ -66,7 +69,7 @@ public class TableLobbyObject */ public void addToTableSet (DSet.Entry elem) { - requestEntryAdd(TABLE_SET, elem); + requestEntryAdd(TABLE_SET, tableSet, elem); } /** @@ -76,7 +79,7 @@ public class TableLobbyObject */ public void removeFromTableSet (Comparable key) { - requestEntryRemove(TABLE_SET, key); + requestEntryRemove(TABLE_SET, tableSet, key); } /** @@ -86,7 +89,7 @@ public class TableLobbyObject */ public void updateTableSet (DSet.Entry elem) { - requestEntryUpdate(TABLE_SET, elem); + requestEntryUpdate(TABLE_SET, tableSet, elem); } /** @@ -101,7 +104,8 @@ public class TableLobbyObject */ public void setTableSet (DSet tableSet) { - requestAttributeChange(TABLE_SET, tableSet); + requestAttributeChange(TABLE_SET, tableSet, this.tableSet); this.tableSet = tableSet; } + // AUTO-GENERATED: METHODS END } diff --git a/src/java/com/threerings/parlor/game/GameObject.dobj b/src/java/com/threerings/parlor/game/GameObject.dobj deleted file mode 100644 index 234f72f0d..000000000 --- a/src/java/com/threerings/parlor/game/GameObject.dobj +++ /dev/null @@ -1,182 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.parlor.game; - -import com.samskivert.util.ListUtil; -import com.samskivert.util.StringUtil; -import com.threerings.util.Name; - -import com.threerings.crowd.data.PlaceObject; - -/** - * A game object hosts the shared data associated with a game played by - * one or more players. The game object extends the place object so that - * the game can act as a place where players actually go when playing the - * game. Only very basic information is maintained in the base game - * object. It serves as the base for a hierarchy of game object - * derivatives that handle basic gameplay for a suite of different game - * types (ie. turn based games, party games, board games, card games, - * etc.). - */ -public class GameObject extends PlaceObject -{ - /** A game state constant indicating that the game has not yet started - * and is still awaiting the arrival of all of the players. */ - public static final int AWAITING_PLAYERS = 0; - - /** A game state constant indicating that the game is in play. */ - public static final int IN_PLAY = 1; - - /** A game state constant indicating that the game ended normally. */ - public static final int GAME_OVER = 2; - - /** A game state constant indicating that the game was cancelled. */ - public static final int CANCELLED = 3; - - /** Provides general game invocation services. */ - public GameMarshaller gameService; - - /** The game state, one of {@link #AWAITING_PLAYERS}, {@link #IN_PLAY}, - * {@link #GAME_OVER}, or {@link #CANCELLED}. */ - public int state; - - /** Indicates whether or not this game is rated. */ - public boolean isRated; - - /** The usernames of the players involved in this game. */ - public Name[] players; - - /** Whether each player in the game is a winner, or null - * if the game is not yet over. */ - public boolean[] winners; - - /** The unique round identifier for the current round. */ - public int roundId; - - /** The player index of the creating player if this is a party game. */ - public int creator; - - /** - * Returns the number of players in the game. - */ - public int getPlayerCount () - { - int count = 0; - int size = players.length; - for (int ii = 0; ii < size; ii++) { - if (players[ii] != null) { - count++; - } - } - return count; - } - - /** - * Returns the player index of the given user in the game, or - * -1 if the player is not involved in the game. - */ - public int getPlayerIndex (Name username) - { - int size = (players == null) ? 0 : players.length; - for (int ii = 0; ii < size; ii++) { - if (players[ii] != null && players[ii].equals(username)) { - return ii; - } - } - return -1; - } - - /** - * Returns whether the game is in play. A game that is not in play - * could either be awaiting players, ended, or cancelled. - */ - public boolean isInPlay () - { - return (state == IN_PLAY); - } - - /** - * Returns whether the given player index in the game is occupied. - */ - public boolean isOccupiedPlayer (int pidx) - { - return (players[pidx] != null); - } - - /** - * Returns whether the given player index is a winner, or false if the - * winners are not yet assigned. - */ - public boolean isWinner (int pidx) - { - return (winners == null) ? false : winners[pidx]; - } - - /** - * Returns the number of winners for this game, or 0 if - * the winners array is not populated, e.g., the game is not yet over. - */ - public int getWinnerCount () - { - int count = 0; - int size = (winners == null) ? 0 : winners.length; - for (int ii = 0; ii < size; ii++) { - if (winners[ii]) { - count++; - } - } - return count; - } - - /** - * Returns true if the game is ended in a draw. - */ - public boolean isDraw () - { - return getWinnerCount() == getPlayerCount(); - } - - /** - * Returns the winner index of the first winning player for this game, - * or -1 if there are no winners or the winners array is - * not yet assigned. This is only likely to be useful for games that - * are known to have a single winner. - */ - public int getWinnerIndex () - { - int size = (winners == null) ? 0 : winners.length; - for (int ii = 0; ii < size; ii++) { - if (winners[ii]) { - return ii; - } - } - return -1; - } - - // documentation inherited - protected void which (StringBuffer buf) - { - super.which(buf); - StringUtil.toString(buf, players); - buf.append(":").append(state); - } -} diff --git a/src/java/com/threerings/parlor/game/GameObject.java b/src/java/com/threerings/parlor/game/GameObject.java index c0930c30d..d2d27d556 100644 --- a/src/java/com/threerings/parlor/game/GameObject.java +++ b/src/java/com/threerings/parlor/game/GameObject.java @@ -39,6 +39,7 @@ import com.threerings.crowd.data.PlaceObject; */ public class GameObject extends PlaceObject { + // AUTO-GENERATED: FIELDS START /** The field name of the gameService field. */ public static final String GAME_SERVICE = "gameService"; @@ -59,6 +60,7 @@ public class GameObject extends PlaceObject /** The field name of the creator field. */ public static final String CREATOR = "creator"; + // AUTO-GENERATED: FIELDS END /** A game state constant indicating that the game has not yet started * and is still awaiting the arrival of all of the players. */ @@ -201,129 +203,151 @@ public class GameObject extends PlaceObject buf.append(":").append(state); } + // AUTO-GENERATED: METHODS START /** - * Requests that the gameService field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the gameService field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setGameService (GameMarshaller gameService) + public void setGameService (GameMarshaller value) { - requestAttributeChange(GAME_SERVICE, gameService); - this.gameService = gameService; + GameMarshaller ovalue = this.gameService; + requestAttributeChange( + GAME_SERVICE, value, ovalue); + this.gameService = value; } /** - * Requests that the state field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the state field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setState (int state) + public void setState (int value) { - requestAttributeChange(STATE, new Integer(state)); - this.state = state; + int ovalue = this.state; + requestAttributeChange( + STATE, new Integer(value), new Integer(ovalue)); + this.state = value; } /** - * Requests that the isRated field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the isRated field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setIsRated (boolean isRated) + public void setIsRated (boolean value) { - requestAttributeChange(IS_RATED, new Boolean(isRated)); - this.isRated = isRated; + boolean ovalue = this.isRated; + requestAttributeChange( + IS_RATED, new Boolean(value), new Boolean(ovalue)); + this.isRated = value; } /** - * Requests that the players field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the players field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setPlayers (Name[] players) + public void setPlayers (Name[] value) { - requestAttributeChange(PLAYERS, players); - this.players = players; + Name[] ovalue = this.players; + requestAttributeChange( + PLAYERS, value, ovalue); + this.players = value; } /** * Requests that the indexth element of - * players field be set to the specified value. The local - * value will be updated immediately and an event will be propagated - * through the system to notify all listeners that the attribute did - * change. Proxied copies of this object (on clients) will apply the - * value change when they received the attribute changed notification. + * players field be set to the specified value. + * The local value will be updated immediately and an event will be + * propagated through the system to notify all listeners that the + * attribute did change. Proxied copies of this object (on clients) + * will apply the value change when they received the attribute + * changed notification. */ public void setPlayersAt (Name value, int index) { - requestElementUpdate(PLAYERS, value, index); + Name ovalue = this.players[index]; + requestElementUpdate( + PLAYERS, index, value, ovalue); this.players[index] = value; } /** - * Requests that the winners field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the winners field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setWinners (boolean[] winners) + public void setWinners (boolean[] value) { - requestAttributeChange(WINNERS, winners); - this.winners = winners; + boolean[] ovalue = this.winners; + requestAttributeChange( + WINNERS, value, ovalue); + this.winners = value; } /** * Requests that the indexth element of - * winners field be set to the specified value. The local - * value will be updated immediately and an event will be propagated - * through the system to notify all listeners that the attribute did - * change. Proxied copies of this object (on clients) will apply the - * value change when they received the attribute changed notification. + * winners field be set to the specified value. + * The local value will be updated immediately and an event will be + * propagated through the system to notify all listeners that the + * attribute did change. Proxied copies of this object (on clients) + * will apply the value change when they received the attribute + * changed notification. */ public void setWinnersAt (boolean value, int index) { - requestElementUpdate(WINNERS, new Boolean(value), index); + boolean ovalue = this.winners[index]; + requestElementUpdate( + WINNERS, index, new Boolean(value), new Boolean(ovalue)); this.winners[index] = value; } /** - * Requests that the roundId field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the roundId field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setRoundId (int roundId) + public void setRoundId (int value) { - requestAttributeChange(ROUND_ID, new Integer(roundId)); - this.roundId = roundId; + int ovalue = this.roundId; + requestAttributeChange( + ROUND_ID, new Integer(value), new Integer(ovalue)); + this.roundId = value; } /** - * Requests that the creator field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the creator field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setCreator (int creator) + public void setCreator (int value) { - requestAttributeChange(CREATOR, new Integer(creator)); - this.creator = creator; + int ovalue = this.creator; + requestAttributeChange( + CREATOR, new Integer(value), new Integer(ovalue)); + this.creator = value; } + // AUTO-GENERATED: METHODS END } diff --git a/src/java/com/threerings/presents/data/ClientObject.dobj b/src/java/com/threerings/presents/data/ClientObject.dobj deleted file mode 100644 index f5fcd68bb..000000000 --- a/src/java/com/threerings/presents/data/ClientObject.dobj +++ /dev/null @@ -1,78 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.presents.data; - -import com.threerings.presents.dobj.DObject; -import com.threerings.presents.dobj.DSet; - -/** - * Every client in the system has an associated client object to which - * only they subscribe. The client object can be used to deliver messages - * solely to a particular client as well as to publish client-specific - * data. - */ -public class ClientObject extends DObject -{ - /** The name of a message event delivered to the client when they - * switch usernames (and therefore user objects). */ - public static final String CLOBJ_CHANGED = "!clobj_changed!"; - - /** Used to publish all invocation service receivers registered on - * this client. */ - public DSet receivers = new DSet(); - - /** - * Returns a short string identifying this client. - */ - public String who () - { - return "(" + getOid() + ")"; - } - - /** - * Used for reference counting client objects, adds a reference to - * this object. - */ - public synchronized void reference () - { - _references++; -// Log.info("Incremented references [who=" + who() + -// ", refs=" + _references + "]."); - } - - /** - * Used for reference counting client objects, releases a reference to - * this object. - * - * @return true if the object has remaining references, false - * otherwise. - */ - public synchronized boolean release () - { -// Log.info("Decremented references [who=" + who() + -// ", refs=" + (_references-1) + "]."); - return (--_references > 0); - } - - /** Used to reference count resolved client objects. */ - protected transient int _references; -} diff --git a/src/java/com/threerings/presents/data/ClientObject.java b/src/java/com/threerings/presents/data/ClientObject.java index d9b12d6aa..930f817b8 100644 --- a/src/java/com/threerings/presents/data/ClientObject.java +++ b/src/java/com/threerings/presents/data/ClientObject.java @@ -32,8 +32,10 @@ import com.threerings.presents.dobj.DSet; */ public class ClientObject extends DObject { + // AUTO-GENERATED: FIELDS START /** The field name of the receivers field. */ public static final String RECEIVERS = "receivers"; + // AUTO-GENERATED: FIELDS END /** The name of a message event delivered to the client when they * switch usernames (and therefore user objects). */ @@ -79,6 +81,7 @@ public class ClientObject extends DObject /** Used to reference count resolved client objects. */ protected transient int _references; + // AUTO-GENERATED: METHODS START /** * Requests that the specified entry be added to the * receivers set. The set will not change until the event is @@ -86,7 +89,7 @@ public class ClientObject extends DObject */ public void addToReceivers (DSet.Entry elem) { - requestEntryAdd(RECEIVERS, elem); + requestEntryAdd(RECEIVERS, receivers, elem); } /** @@ -96,7 +99,7 @@ public class ClientObject extends DObject */ public void removeFromReceivers (Comparable key) { - requestEntryRemove(RECEIVERS, key); + requestEntryRemove(RECEIVERS, receivers, key); } /** @@ -106,7 +109,7 @@ public class ClientObject extends DObject */ public void updateReceivers (DSet.Entry elem) { - requestEntryUpdate(RECEIVERS, elem); + requestEntryUpdate(RECEIVERS, receivers, elem); } /** @@ -121,7 +124,8 @@ public class ClientObject extends DObject */ public void setReceivers (DSet receivers) { - requestAttributeChange(RECEIVERS, receivers); + requestAttributeChange(RECEIVERS, receivers, this.receivers); this.receivers = receivers; } + // AUTO-GENERATED: METHODS END } diff --git a/src/java/com/threerings/presents/data/InvocationObject.java b/src/java/com/threerings/presents/data/InvocationObject.java index 18ae38bcf..8c77ed030 100644 --- a/src/java/com/threerings/presents/data/InvocationObject.java +++ b/src/java/com/threerings/presents/data/InvocationObject.java @@ -1,5 +1,5 @@ // -// $Id: InvocationObject.java,v 1.5 2004/08/27 02:20:19 mdb Exp $ +// $Id$ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved diff --git a/src/java/com/threerings/presents/data/TimeBaseObject.dobj b/src/java/com/threerings/presents/data/TimeBaseObject.dobj deleted file mode 100644 index f7f0ebb37..000000000 --- a/src/java/com/threerings/presents/data/TimeBaseObject.dobj +++ /dev/null @@ -1,122 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.presents.data; - -import com.threerings.presents.dobj.DObject; - -/** - * Used to communicate time bases to clients so that more efficient delta - * times can be transmitted over the network. Two time stamps are - * maintained: even and odd. When the even time base is sufficiently old - * that our delta time container (usually a short or an int) will exceed - * its maximum value, we switch to the odd time base. The bouncing between - * two separate values prevents problems from arising when the base time - * is changed, yet values using the old base time might still be - * propagating through the system. - * - *

Note that for sufficiently small delta time containers, stale - * values could still linger longer than the time required for two swaps - * (two byte delta stamps for example, must swap every 30 seconds). - */ -public class TimeBaseObject extends DObject -{ - /** The even time base, used to decode even delta times. */ - public long evenBase; - - /** The odd time base, used to decode odd delta times. */ - public long oddBase; - - /** - * Converts the supplied time stamp into a time delta (measured - * relative to the appropriate time base, even or odd) with maximum - * value of 2^15. (One bit must be used to indicate that it is an even - * or odd time stamp). - */ - public short toShortDelta (long timeStamp) - { - return (short)getDelta(timeStamp, Short.MAX_VALUE); - } - - /** - * Converts the supplied time stamp into a time delta (measured - * relative to the appropriate time base, even or odd) with maximum - * value of 2^31. (One bit must be used to indicate that it is an even - * or odd time stamp). - */ - public int toIntDelta (long timeStamp) - { - return (int)getDelta(timeStamp, Integer.MAX_VALUE); - } - - /** - * Converts the supplied delta time back to a wall time based on the - * base time in this time base object. Either an int or short delta - * can be passed to this method (the short will have been promoted to - * an int in the process but that will not mess up its encoded value). - */ - public long fromDelta (int delta) - { - boolean even = (delta > 0); - long time = even ? evenBase : oddBase; - if (even) { - time += delta; - } else { - time += (-1 - delta); - } - return time; - } - - /** - * Obtains a delta with the specified maximum value, swapping from - * even to odd, if necessary. - */ - protected long getDelta (long timeStamp, long maxValue) - { - boolean even = (evenBase > oddBase); - long base = even ? evenBase : oddBase; - long delta = timeStamp - base; - - // make sure this timestamp is not sufficiently old that we can't - // generate a delta time with it - if (delta < 0) { - String errmsg = "Time stamp too old for conversion to delta time"; - throw new IllegalArgumentException(errmsg); - } - - // see if it's time to swap - if (delta > maxValue) { - if (even) { - setOddBase(timeStamp); - } else { - setEvenBase(timeStamp); - } - delta = 0; - } - - // if we're odd, we need to mark the value as such - if (!even) { - delta = (-1 - delta); - } - - return delta; - } -} diff --git a/src/java/com/threerings/presents/data/TimeBaseObject.java b/src/java/com/threerings/presents/data/TimeBaseObject.java index 8d8500efa..5f4483893 100644 --- a/src/java/com/threerings/presents/data/TimeBaseObject.java +++ b/src/java/com/threerings/presents/data/TimeBaseObject.java @@ -39,11 +39,13 @@ import com.threerings.presents.dobj.DObject; */ public class TimeBaseObject extends DObject { + // AUTO-GENERATED: FIELDS START /** The field name of the evenBase field. */ public static final String EVEN_BASE = "evenBase"; /** The field name of the oddBase field. */ public static final String ODD_BASE = "oddBase"; + // AUTO-GENERATED: FIELDS END /** The even time base, used to decode even delta times. */ public long evenBase; @@ -126,31 +128,37 @@ public class TimeBaseObject extends DObject return delta; } + // AUTO-GENERATED: METHODS START /** - * Requests that the evenBase field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the evenBase field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setEvenBase (long evenBase) + public void setEvenBase (long value) { - requestAttributeChange(EVEN_BASE, new Long(evenBase)); - this.evenBase = evenBase; + long ovalue = this.evenBase; + requestAttributeChange( + EVEN_BASE, new Long(value), new Long(ovalue)); + this.evenBase = value; } /** - * Requests that the oddBase field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the oddBase field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setOddBase (long oddBase) + public void setOddBase (long value) { - requestAttributeChange(ODD_BASE, new Long(oddBase)); - this.oddBase = oddBase; + long ovalue = this.oddBase; + requestAttributeChange( + ODD_BASE, new Long(value), new Long(ovalue)); + this.oddBase = value; } + // AUTO-GENERATED: METHODS END } diff --git a/src/java/com/threerings/puzzle/data/PuzzleObject.dobj b/src/java/com/threerings/puzzle/data/PuzzleObject.dobj deleted file mode 100644 index b269c4f2c..000000000 --- a/src/java/com/threerings/puzzle/data/PuzzleObject.dobj +++ /dev/null @@ -1,84 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.puzzle.data; - -import com.threerings.parlor.game.GameObject; - -/** - * Extends the basic {@link GameObject} to add individual player - * status. Puzzle games typically contain numerous players that may be - * knocked out of the game while the overall game continues on, thereby - * necessitating this second level of game status. - */ -public class PuzzleObject extends GameObject - implements PuzzleCodes -{ - /** The player status constant for a player whose game is in play. */ - public static final int PLAYER_IN_PLAY = 0; - - /** The player status constant for a player whose has been knocked out - * of the game. */ - public static final int PLAYER_KNOCKED_OUT = 1; - - /** Provides general puzzle game invocation services. */ - public PuzzleGameMarshaller puzzleGameService; - - /** The puzzle difficulty level. */ - public int difficulty; - - /** The status of each of the players in the game. The status value - * is one of {@link #PLAYER_KNOCKED_OUT} or {@link - * #PLAYER_IN_PLAY}. */ - public int[] playerStatus; - - /** Summaries of the boards of all players in this puzzle (may be null - * if the puzzle doesn't support individual player boards). */ - public BoardSummary[] summaries; - - /** The seed used to germinate the boards. */ - public long seed; - - /** - * Returns the number of active players in the game. - */ - public int getActivePlayerCount () - { - int count = 0; - int size = players.length; - for (int ii = 0; ii < size; ii++) { - if (isActivePlayer(ii)) { - count++; - } - } - return count; - } - - /** - * Returns whether the given player is still an active player, e.g., - * their game has not ended. - */ - public boolean isActivePlayer (int pidx) - { - return (isOccupiedPlayer(pidx) && - playerStatus != null && playerStatus[pidx] == PLAYER_IN_PLAY); - } -} diff --git a/src/java/com/threerings/puzzle/data/PuzzleObject.java b/src/java/com/threerings/puzzle/data/PuzzleObject.java index ff05e03ce..38f4555c5 100644 --- a/src/java/com/threerings/puzzle/data/PuzzleObject.java +++ b/src/java/com/threerings/puzzle/data/PuzzleObject.java @@ -32,6 +32,7 @@ import com.threerings.parlor.game.GameObject; public class PuzzleObject extends GameObject implements PuzzleCodes { + // AUTO-GENERATED: FIELDS START /** The field name of the puzzleGameService field. */ public static final String PUZZLE_GAME_SERVICE = "puzzleGameService"; @@ -46,6 +47,7 @@ public class PuzzleObject extends GameObject /** The field name of the seed field. */ public static final String SEED = "seed"; + // AUTO-GENERATED: FIELDS END /** The player status constant for a player whose game is in play. */ public static final int PLAYER_IN_PLAY = 0; @@ -97,101 +99,119 @@ public class PuzzleObject extends GameObject playerStatus != null && playerStatus[pidx] == PLAYER_IN_PLAY); } + // AUTO-GENERATED: METHODS START /** - * Requests that the puzzleGameService field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the puzzleGameService field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setPuzzleGameService (PuzzleGameMarshaller puzzleGameService) + public void setPuzzleGameService (PuzzleGameMarshaller value) { - requestAttributeChange(PUZZLE_GAME_SERVICE, puzzleGameService); - this.puzzleGameService = puzzleGameService; + PuzzleGameMarshaller ovalue = this.puzzleGameService; + requestAttributeChange( + PUZZLE_GAME_SERVICE, value, ovalue); + this.puzzleGameService = value; } /** - * Requests that the difficulty field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the difficulty field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setDifficulty (int difficulty) + public void setDifficulty (int value) { - requestAttributeChange(DIFFICULTY, new Integer(difficulty)); - this.difficulty = difficulty; + int ovalue = this.difficulty; + requestAttributeChange( + DIFFICULTY, new Integer(value), new Integer(ovalue)); + this.difficulty = value; } /** - * Requests that the playerStatus field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the playerStatus field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setPlayerStatus (int[] playerStatus) + public void setPlayerStatus (int[] value) { - requestAttributeChange(PLAYER_STATUS, playerStatus); - this.playerStatus = playerStatus; + int[] ovalue = this.playerStatus; + requestAttributeChange( + PLAYER_STATUS, value, ovalue); + this.playerStatus = value; } /** * Requests that the indexth element of - * playerStatus field be set to the specified value. The local - * value will be updated immediately and an event will be propagated - * through the system to notify all listeners that the attribute did - * change. Proxied copies of this object (on clients) will apply the - * value change when they received the attribute changed notification. + * playerStatus field be set to the specified value. + * The local value will be updated immediately and an event will be + * propagated through the system to notify all listeners that the + * attribute did change. Proxied copies of this object (on clients) + * will apply the value change when they received the attribute + * changed notification. */ public void setPlayerStatusAt (int value, int index) { - requestElementUpdate(PLAYER_STATUS, new Integer(value), index); + int ovalue = this.playerStatus[index]; + requestElementUpdate( + PLAYER_STATUS, index, new Integer(value), new Integer(ovalue)); this.playerStatus[index] = value; } /** - * Requests that the summaries field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the summaries field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setSummaries (BoardSummary[] summaries) + public void setSummaries (BoardSummary[] value) { - requestAttributeChange(SUMMARIES, summaries); - this.summaries = summaries; + BoardSummary[] ovalue = this.summaries; + requestAttributeChange( + SUMMARIES, value, ovalue); + this.summaries = value; } /** * Requests that the indexth element of - * summaries field be set to the specified value. The local - * value will be updated immediately and an event will be propagated - * through the system to notify all listeners that the attribute did - * change. Proxied copies of this object (on clients) will apply the - * value change when they received the attribute changed notification. + * summaries field be set to the specified value. + * The local value will be updated immediately and an event will be + * propagated through the system to notify all listeners that the + * attribute did change. Proxied copies of this object (on clients) + * will apply the value change when they received the attribute + * changed notification. */ public void setSummariesAt (BoardSummary value, int index) { - requestElementUpdate(SUMMARIES, value, index); + BoardSummary ovalue = this.summaries[index]; + requestElementUpdate( + SUMMARIES, index, value, ovalue); this.summaries[index] = value; } /** - * Requests that the seed field be set to the specified - * value. The local value will be updated immediately and an event - * will be propagated through the system to notify all listeners that - * the attribute did change. Proxied copies of this object (on + * Requests that the seed field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on * clients) will apply the value change when they received the * attribute changed notification. */ - public void setSeed (long seed) + public void setSeed (long value) { - requestAttributeChange(SEED, new Long(seed)); - this.seed = seed; + long ovalue = this.seed; + requestAttributeChange( + SEED, new Long(value), new Long(ovalue)); + this.seed = value; } + // AUTO-GENERATED: METHODS END } diff --git a/src/java/com/threerings/whirled/data/SceneObject.java b/src/java/com/threerings/whirled/data/SceneObject.java index 8484a701c..ccfc0164e 100644 --- a/src/java/com/threerings/whirled/data/SceneObject.java +++ b/src/java/com/threerings/whirled/data/SceneObject.java @@ -1,5 +1,5 @@ // -// $Id: SceneObject.java,v 1.3 2004/08/27 02:20:42 mdb Exp $ +// $Id$ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved diff --git a/src/java/com/threerings/whirled/spot/data/ClusterObject.dobj b/src/java/com/threerings/whirled/spot/data/ClusterObject.dobj deleted file mode 100644 index ee33724b0..000000000 --- a/src/java/com/threerings/whirled/spot/data/ClusterObject.dobj +++ /dev/null @@ -1,47 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.whirled.spot.data; - -import com.threerings.presents.dobj.DObject; -import com.threerings.presents.dobj.OidList; - -import com.threerings.crowd.chat.data.SpeakObject; - -/** - * Used to dispatch chat in clusters. - */ -public class ClusterObject extends DObject - implements SpeakObject -{ - /** - * Tracks the oid of the body objects that occupy this cluster. - */ - public OidList occupants = new OidList(); - - // documentation inherited - public void applyToListeners (ListenerOp op) - { - for (int ii = 0, ll = occupants.size(); ii < ll; ii++) { - op.apply(occupants.get(ii)); - } - } -} diff --git a/src/java/com/threerings/whirled/spot/data/ClusterObject.java b/src/java/com/threerings/whirled/spot/data/ClusterObject.java index 22181b189..314b5e1cd 100644 --- a/src/java/com/threerings/whirled/spot/data/ClusterObject.java +++ b/src/java/com/threerings/whirled/spot/data/ClusterObject.java @@ -32,8 +32,10 @@ import com.threerings.crowd.chat.data.SpeakObject; public class ClusterObject extends DObject implements SpeakObject { + // AUTO-GENERATED: FIELDS START /** The field name of the occupants field. */ public static final String OCCUPANTS = "occupants"; + // AUTO-GENERATED: FIELDS END /** * Tracks the oid of the body objects that occupy this cluster. @@ -48,10 +50,11 @@ public class ClusterObject extends DObject } } + // AUTO-GENERATED: METHODS START /** - * Requests that the specified oid be added to the - * occupants oid list. The list will not change until the - * event is actually propagated through the system. + * Requests that oid be added to the occupants + * oid list. The list will not change until the event is actually + * propagated through the system. */ public void addToOccupants (int oid) { @@ -59,7 +62,7 @@ public class ClusterObject extends DObject } /** - * Requests that the specified oid be removed from the + * Requests that oid be removed from the * occupants oid list. The list will not change until the * event is actually propagated through the system. */ @@ -67,4 +70,5 @@ public class ClusterObject extends DObject { requestOidRemove(OCCUPANTS, oid); } + // AUTO-GENERATED: METHODS END } diff --git a/src/java/com/threerings/whirled/spot/data/SpotSceneObject.dobj b/src/java/com/threerings/whirled/spot/data/SpotSceneObject.dobj deleted file mode 100644 index 1bda5a35e..000000000 --- a/src/java/com/threerings/whirled/spot/data/SpotSceneObject.dobj +++ /dev/null @@ -1,38 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.whirled.spot.data; - -import com.threerings.presents.dobj.DSet; -import com.threerings.whirled.data.SceneObject; - -/** - * Extends the {@link SceneObject} with information specific to spots. - */ -public class SpotSceneObject extends SceneObject -{ - /** A distributed set containing {@link SceneLocation} records for all - * occupants of this scene. */ - public DSet occupantLocs = new DSet(); - - /** Contains information on all {@link Cluster}s in this scene. */ - public DSet clusters = new DSet(); -} diff --git a/src/java/com/threerings/whirled/spot/data/SpotSceneObject.java b/src/java/com/threerings/whirled/spot/data/SpotSceneObject.java index 4785f4e23..76bd85e93 100644 --- a/src/java/com/threerings/whirled/spot/data/SpotSceneObject.java +++ b/src/java/com/threerings/whirled/spot/data/SpotSceneObject.java @@ -29,11 +29,13 @@ import com.threerings.whirled.data.SceneObject; */ public class SpotSceneObject extends SceneObject { + // AUTO-GENERATED: FIELDS START /** The field name of the occupantLocs field. */ public static final String OCCUPANT_LOCS = "occupantLocs"; /** The field name of the clusters field. */ public static final String CLUSTERS = "clusters"; + // AUTO-GENERATED: FIELDS END /** A distributed set containing {@link SceneLocation} records for all * occupants of this scene. */ @@ -42,6 +44,7 @@ public class SpotSceneObject extends SceneObject /** Contains information on all {@link Cluster}s in this scene. */ public DSet clusters = new DSet(); + // AUTO-GENERATED: METHODS START /** * Requests that the specified entry be added to the * occupantLocs set. The set will not change until the event is @@ -49,7 +52,7 @@ public class SpotSceneObject extends SceneObject */ public void addToOccupantLocs (DSet.Entry elem) { - requestEntryAdd(OCCUPANT_LOCS, elem); + requestEntryAdd(OCCUPANT_LOCS, occupantLocs, elem); } /** @@ -59,7 +62,7 @@ public class SpotSceneObject extends SceneObject */ public void removeFromOccupantLocs (Comparable key) { - requestEntryRemove(OCCUPANT_LOCS, key); + requestEntryRemove(OCCUPANT_LOCS, occupantLocs, key); } /** @@ -69,7 +72,7 @@ public class SpotSceneObject extends SceneObject */ public void updateOccupantLocs (DSet.Entry elem) { - requestEntryUpdate(OCCUPANT_LOCS, elem); + requestEntryUpdate(OCCUPANT_LOCS, occupantLocs, elem); } /** @@ -84,7 +87,7 @@ public class SpotSceneObject extends SceneObject */ public void setOccupantLocs (DSet occupantLocs) { - requestAttributeChange(OCCUPANT_LOCS, occupantLocs); + requestAttributeChange(OCCUPANT_LOCS, occupantLocs, this.occupantLocs); this.occupantLocs = occupantLocs; } @@ -95,7 +98,7 @@ public class SpotSceneObject extends SceneObject */ public void addToClusters (DSet.Entry elem) { - requestEntryAdd(CLUSTERS, elem); + requestEntryAdd(CLUSTERS, clusters, elem); } /** @@ -105,7 +108,7 @@ public class SpotSceneObject extends SceneObject */ public void removeFromClusters (Comparable key) { - requestEntryRemove(CLUSTERS, key); + requestEntryRemove(CLUSTERS, clusters, key); } /** @@ -115,7 +118,7 @@ public class SpotSceneObject extends SceneObject */ public void updateClusters (DSet.Entry elem) { - requestEntryUpdate(CLUSTERS, elem); + requestEntryUpdate(CLUSTERS, clusters, elem); } /** @@ -130,7 +133,8 @@ public class SpotSceneObject extends SceneObject */ public void setClusters (DSet clusters) { - requestAttributeChange(CLUSTERS, clusters); + requestAttributeChange(CLUSTERS, clusters, this.clusters); this.clusters = clusters; } + // AUTO-GENERATED: METHODS END } diff --git a/tests/src/java/com/threerings/presents/server/TestObject.dobj b/tests/src/java/com/threerings/presents/server/TestObject.dobj deleted file mode 100644 index def000aa3..000000000 --- a/tests/src/java/com/threerings/presents/server/TestObject.dobj +++ /dev/null @@ -1,36 +0,0 @@ -// -// $Id$ -// -// Narya library - tools for developing networked games -// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/narya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.presents.server; - -import com.threerings.presents.dobj.*; - -/** - * A test distributed object. - */ -public class TestObject extends DObject -{ - public int foo; - public String bar; - public int[] ints = new int[5]; - public String[] strings = new String[5]; - public OidList list = new OidList(); -}