From dc5d23e3e44cc532f7a3bdf6fa86f58ca0abd028 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sun, 28 Apr 2002 03:14:15 +0000 Subject: [PATCH] Don't foolishly blow away a perfectly good set of object tile ids and actions unless we're actually loaded into the editor and turned into a real editable scene. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1315 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../miso/tools/EditableMisoSceneImpl.java | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/java/com/threerings/miso/tools/EditableMisoSceneImpl.java b/src/java/com/threerings/miso/tools/EditableMisoSceneImpl.java index 35dbfc21e..8632472fb 100644 --- a/src/java/com/threerings/miso/tools/EditableMisoSceneImpl.java +++ b/src/java/com/threerings/miso/tools/EditableMisoSceneImpl.java @@ -1,5 +1,5 @@ // -// $Id: EditableMisoSceneImpl.java,v 1.17 2002/04/27 18:41:14 mdb Exp $ +// $Id: EditableMisoSceneImpl.java,v 1.18 2002/04/28 03:14:15 mdb Exp $ package com.threerings.miso.scene.tools; @@ -187,22 +187,26 @@ public class EditableMisoSceneImpl // we need to flush the object layer to the model prior to // returning it int ocount = _objects.size(); - int[] otids = new int[ocount*3]; - String[] actions = new String[ocount]; - for (int ii = 0; ii < ocount; ii++) { - ObjectTile tile = (ObjectTile)_objects.get(ii); - Point coords = (Point)_coords.get(tile); - otids[3*ii] = coords.x; - otids[3*ii+1] = coords.y; - otids[3*ii+2] = ((Integer)_objectTileIds.get(tile)).intValue(); - actions[ii] = (String)_actions.get(tile); + // but only do it if we've actually got some objects + if (ocount > 0) { + int[] otids = new int[ocount*3]; + String[] actions = new String[ocount]; + + for (int ii = 0; ii < ocount; ii++) { + ObjectTile tile = (ObjectTile)_objects.get(ii); + Point coords = (Point)_coords.get(tile); + otids[3*ii] = coords.x; + otids[3*ii+1] = coords.y; + otids[3*ii+2] = ((Integer)_objectTileIds.get(tile)).intValue(); + actions[ii] = (String)_actions.get(tile); + } + + // stuff the new arrays into the model + _model.objectTileIds = otids; + _model.objectActions = actions; } - // stuff the new arrays into the model - _model.objectTileIds = otids; - _model.objectActions = actions; - // and we're ready to roll return _model; }