diff --git a/src/java/com/threerings/miso/data/MisoSceneModel.java b/src/java/com/threerings/miso/data/MisoSceneModel.java
index 026395c8c..61bb1fd6e 100644
--- a/src/java/com/threerings/miso/data/MisoSceneModel.java
+++ b/src/java/com/threerings/miso/data/MisoSceneModel.java
@@ -1,5 +1,5 @@
//
-// $Id: MisoSceneModel.java,v 1.3 2001/11/30 21:54:34 mdb Exp $
+// $Id: MisoSceneModel.java,v 1.4 2001/12/12 02:47:17 mdb Exp $
package com.threerings.miso.scene;
@@ -15,6 +15,7 @@ import com.samskivert.util.StringUtil;
* instance of {@link DisplayMisoScene}.
*/
public class MisoSceneModel
+ implements Cloneable
{
/** The width of the scene in tile units. */
public int width;
@@ -91,6 +92,19 @@ public class MisoSceneModel
", objectTileIds=" + StringUtil.toString(objectTileIds) + "]";
}
+ /**
+ * Creates a copy of this Miso scene model.
+ */
+ public Object clone ()
+ throws CloneNotSupportedException
+ {
+ MisoSceneModel model = (MisoSceneModel)super.clone();
+ model.baseTileIds = (int[])baseTileIds.clone();
+ model.fringeTileIds = (int[])fringeTileIds.clone();
+ model.objectTileIds = (int[])objectTileIds.clone();
+ return model;
+ }
+
/**
* Creates and returns a blank scene model (with zero width and
* height).
diff --git a/src/java/com/threerings/whirled/data/SceneModel.java b/src/java/com/threerings/whirled/data/SceneModel.java
index fd2ff00f8..df7af4ea3 100644
--- a/src/java/com/threerings/whirled/data/SceneModel.java
+++ b/src/java/com/threerings/whirled/data/SceneModel.java
@@ -1,5 +1,5 @@
//
-// $Id: SceneModel.java,v 1.4 2001/11/30 21:54:34 mdb Exp $
+// $Id: SceneModel.java,v 1.5 2001/12/12 02:47:17 mdb Exp $
package com.threerings.whirled.data;
@@ -21,7 +21,8 @@ import com.threerings.presents.io.Streamable;
* what is transmitted over the wire when communicating scenes from the
* server to the client.
*/
-public class SceneModel implements Streamable
+public class SceneModel
+ implements Streamable, Cloneable
{
/** This scene's unique identifier. */
public int sceneId;
@@ -72,6 +73,15 @@ public class SceneModel implements Streamable
return buf.append("]").toString();
}
+ // documentation inherited
+ public Object clone ()
+ throws CloneNotSupportedException
+ {
+ SceneModel model = (SceneModel)super.clone();
+ model.neighborIds = (int[])neighborIds.clone();
+ return model;
+ }
+
/**
* Derived classes override this to tack their toString
* data on to the string buffer.
diff --git a/src/java/com/threerings/whirled/spot/data/SpotSceneModel.java b/src/java/com/threerings/whirled/spot/data/SpotSceneModel.java
index 421e369f2..55e6114ef 100644
--- a/src/java/com/threerings/whirled/spot/data/SpotSceneModel.java
+++ b/src/java/com/threerings/whirled/spot/data/SpotSceneModel.java
@@ -1,5 +1,5 @@
//
-// $Id: SpotSceneModel.java,v 1.5 2001/12/04 22:34:04 mdb Exp $
+// $Id: SpotSceneModel.java,v 1.6 2001/12/12 02:47:17 mdb Exp $
package com.threerings.whirled.spot.data;
@@ -127,6 +127,21 @@ public class SpotSceneModel extends SceneModel
}
}
+ // documentation inherited
+ public Object clone ()
+ throws CloneNotSupportedException
+ {
+ SpotSceneModel model = (SpotSceneModel)super.clone();
+ model.locationIds = (int[])locationIds.clone();
+ model.locationX = (int[])locationX.clone();
+ model.locationY = (int[])locationY.clone();
+ model.locationOrients = (int[])locationOrients.clone();
+ model.locationClusters = (int[])locationClusters.clone();
+ model.portalIds = (int[])portalIds.clone();
+ model.targetLocIds = (int[])targetLocIds.clone();
+ return model;
+ }
+
/**
* Creates and returns a blank scene model.
*/
diff --git a/src/java/com/threerings/whirled/spot/tools/EditableSpotSceneModel.java b/src/java/com/threerings/whirled/spot/tools/EditableSpotSceneModel.java
index cb0dacf78..d520e219a 100644
--- a/src/java/com/threerings/whirled/spot/tools/EditableSpotSceneModel.java
+++ b/src/java/com/threerings/whirled/spot/tools/EditableSpotSceneModel.java
@@ -1,5 +1,5 @@
//
-// $Id: EditableSpotSceneModel.java,v 1.2 2001/12/05 03:38:09 mdb Exp $
+// $Id: EditableSpotSceneModel.java,v 1.3 2001/12/12 02:47:17 mdb Exp $
package com.threerings.whirled.tools.spot;
@@ -20,6 +20,23 @@ public class EditableSpotSceneModel extends EditableSceneModel
* portals link. */
public String[] targetPortalNames;
+ // documentation inherited
+ public Object clone ()
+ throws CloneNotSupportedException
+ {
+ return cloneWithDelegate((SpotSceneModel)spotSceneModel.clone());
+ }
+
+ // documentation inherited
+ protected Object cloneWithDelegate (SpotSceneModel spotSceneModel)
+ throws CloneNotSupportedException
+ {
+ EditableSpotSceneModel essm = (EditableSpotSceneModel)
+ super.cloneWithDelegate(spotSceneModel);
+ essm.spotSceneModel = spotSceneModel;
+ return essm;
+ }
+
/**
* Derived classes override this to tack their toString
* data on to the string buffer.
diff --git a/src/java/com/threerings/whirled/tools/EditableSceneModel.java b/src/java/com/threerings/whirled/tools/EditableSceneModel.java
index 9ab5729cb..0e9278bf9 100644
--- a/src/java/com/threerings/whirled/tools/EditableSceneModel.java
+++ b/src/java/com/threerings/whirled/tools/EditableSceneModel.java
@@ -1,5 +1,5 @@
//
-// $Id: EditableSceneModel.java,v 1.2 2001/12/05 03:38:09 mdb Exp $
+// $Id: EditableSceneModel.java,v 1.3 2001/12/12 02:47:17 mdb Exp $
package com.threerings.whirled.tools;
@@ -34,6 +34,22 @@ public class EditableSceneModel
return buf.append("]").toString();
}
+ // documentation inherited
+ public Object clone ()
+ throws CloneNotSupportedException
+ {
+ return cloneWithDelegate((SceneModel)sceneModel.clone());
+ }
+
+ // documentation inherited
+ protected Object cloneWithDelegate (SceneModel sceneModel)
+ throws CloneNotSupportedException
+ {
+ EditableSceneModel esm = (EditableSceneModel)super.clone();
+ esm.sceneModel = sceneModel;
+ return esm;
+ }
+
/**
* Derived classes override this to tack their toString
* data on to the string buffer.