Wait for the call to wasResolved to call back about being abandoned as the scene panel is expecting that to be on the AWT thread

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@671 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Charlie Groves
2008-10-22 00:13:58 +00:00
parent 7fdedc30a3
commit b13728ac5f
@@ -105,11 +105,13 @@ public class SceneBlock
if (_panel != null) { if (_panel != null) {
if (_panel.getBlock(_bounds.x, _bounds.y) != this) { if (_panel.getBlock(_bounds.x, _bounds.y) != this) {
// Log.info("Not resolving abandoned block " + this + "."); // Log.info("Not resolving abandoned block " + this + ".");
_panel.blockAbandoned(this); _wasAbandoned = true;
return false; return false;
} }
_panel.blockResolving(this); _panel.blockResolving(this);
} }
// We're doing our work, we're needed!
_wasAbandoned = false;
// start with the bounds of the footprint polygon // start with the bounds of the footprint polygon
Rectangle sbounds = new Rectangle(_footprint.getBounds()); Rectangle sbounds = new Rectangle(_footprint.getBounds());
@@ -219,7 +221,11 @@ public class SceneBlock
protected void wasResolved () protected void wasResolved ()
{ {
if (_panel != null) { if (_panel != null) {
_panel.blockResolved(this); if (_wasAbandoned) {
_panel.blockAbandoned(this);
} else {
_panel.blockResolved(this);
}
} }
} }
@@ -358,8 +364,8 @@ public class SceneBlock
{ {
// make sure we don't already have this same object at these // make sure we don't already have this same object at these
// coordinates // coordinates
for (int ii = 0; ii < _objects.length; ii++) { for (SceneObject _object : _objects) {
if (_objects[ii].info.equals(info)) { if (_object.info.equals(info)) {
return false; return false;
} }
} }
@@ -524,8 +530,8 @@ public class SceneBlock
// if we need to regenerate the set of tiles covered by our // if we need to regenerate the set of tiles covered by our
// objects, do so // objects, do so
if (recover) { if (recover) {
for (int ii = 0; ii < _objects.length; ii++) { for (SceneObject _object : _objects) {
setCovered(blocks, _objects[ii]); setCovered(blocks, _object);
} }
} }
} }
@@ -616,6 +622,9 @@ public class SceneBlock
/** A debug flag indicating whether we were visible at creation. */ /** A debug flag indicating whether we were visible at creation. */
protected boolean _visi; protected boolean _visi;
/** If we discovered we were no longer needed in our last call to resolve. */
protected boolean _wasAbandoned;
// used to link up to our neighbors // used to link up to our neighbors
protected static final int[] DX = { -1, -1, 0, 1, 1, 1, 0, -1 }; protected static final int[] DX = { -1, -1, 0, 1, 1, 1, 0, -1 };
protected static final int[] DY = { 0, -1, -1, -1, 0, 1, 1, 1 }; protected static final int[] DY = { 0, -1, -1, -1, 0, 1, 1, 1 };