Fixed bug where action animations and sprites weren't being removed

when all animations and sprites were cleared out.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3320 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ted V
2005-01-28 03:28:38 +00:00
parent 81487748dc
commit 44be1bda18
@@ -68,9 +68,9 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel
*/ */
public void init (PuzzleConfig config) public void init (PuzzleConfig config)
{ {
// save off our bounds // save off our bounds
Dimension bounds = getPreferredSize(); Dimension bounds = getPreferredSize();
_bounds = new Rectangle(0, 0, bounds.width, bounds.height); _bounds = new Rectangle(0, 0, bounds.width, bounds.height);
} }
/** /**
@@ -129,7 +129,7 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel
*/ */
public void addActionAnimation (Animation anim) public void addActionAnimation (Animation anim)
{ {
super.addAnimation(anim); super.addAnimation(anim);
// remember the animation's existence // remember the animation's existence
_actionAnims.add(anim); _actionAnims.add(anim);
@@ -172,7 +172,7 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel
*/ */
public void addActionSprite (Sprite sprite) public void addActionSprite (Sprite sprite)
{ {
// add the piece to the sprite manager // add the piece to the sprite manager
addSprite(sprite); addSprite(sprite);
// note that this piece is interesting // note that this piece is interesting
@@ -192,11 +192,25 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel
} }
// we just always check to see if it was action-y // we just always check to see if it was action-y
if (_actionSprites.remove(sprite)) { if (_actionSprites.remove(sprite)) {
maybeFireCleared(); maybeFireCleared();
} }
} }
// documentation inherited
public void clearSprites ()
{
super.clearSprites();
_actionSprites.clear();
}
// documentation inherited
public void clearAnimations ()
{
super.clearAnimations();
_actionAnims.clear();
}
/** /**
* Returns the number of action animations on the board. * Returns the number of action animations on the board.
*/ */
@@ -359,14 +373,14 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel
protected void renderBackground (Graphics2D gfx, Rectangle dirty) protected void renderBackground (Graphics2D gfx, Rectangle dirty)
{ {
gfx.setColor(getBackground()); gfx.setColor(getBackground());
gfx.fill(dirty); gfx.fill(dirty);
} }
// documentation inherited // documentation inherited
public void paintBetween (Graphics2D gfx, Rectangle dirty) public void paintBetween (Graphics2D gfx, Rectangle dirty)
{ {
super.paintBetween(gfx, dirty); super.paintBetween(gfx, dirty);
// PerformanceMonitor.tick(this, "paint"); // PerformanceMonitor.tick(this, "paint");
renderBoard(gfx, dirty); renderBoard(gfx, dirty);
} }