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.getBlock(_bounds.x, _bounds.y) != this) {
// Log.info("Not resolving abandoned block " + this + ".");
_panel.blockAbandoned(this);
_wasAbandoned = true;
return false;
}
_panel.blockResolving(this);
}
// We're doing our work, we're needed!
_wasAbandoned = false;
// start with the bounds of the footprint polygon
Rectangle sbounds = new Rectangle(_footprint.getBounds());
@@ -219,7 +221,11 @@ public class SceneBlock
protected void wasResolved ()
{
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
// coordinates
for (int ii = 0; ii < _objects.length; ii++) {
if (_objects[ii].info.equals(info)) {
for (SceneObject _object : _objects) {
if (_object.info.equals(info)) {
return false;
}
}
@@ -524,8 +530,8 @@ public class SceneBlock
// if we need to regenerate the set of tiles covered by our
// objects, do so
if (recover) {
for (int ii = 0; ii < _objects.length; ii++) {
setCovered(blocks, _objects[ii]);
for (SceneObject _object : _objects) {
setCovered(blocks, _object);
}
}
}
@@ -616,6 +622,9 @@ public class SceneBlock
/** A debug flag indicating whether we were visible at creation. */
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
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 };