From 44be1bda188c054c376da3e03c4302484db1b601 Mon Sep 17 00:00:00 2001 From: Ted V Date: Fri, 28 Jan 2005 03:28:38 +0000 Subject: [PATCH] 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 --- .../puzzle/client/PuzzleBoardView.java | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/puzzle/client/PuzzleBoardView.java b/src/java/com/threerings/puzzle/client/PuzzleBoardView.java index 5145d72d5..aa1c659be 100644 --- a/src/java/com/threerings/puzzle/client/PuzzleBoardView.java +++ b/src/java/com/threerings/puzzle/client/PuzzleBoardView.java @@ -68,9 +68,9 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel */ public void init (PuzzleConfig config) { - // save off our bounds + // save off our bounds 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) { - super.addAnimation(anim); + super.addAnimation(anim); // remember the animation's existence _actionAnims.add(anim); @@ -172,7 +172,7 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel */ public void addActionSprite (Sprite sprite) { - // add the piece to the sprite manager + // add the piece to the sprite manager addSprite(sprite); // 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 - if (_actionSprites.remove(sprite)) { + if (_actionSprites.remove(sprite)) { 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. */ @@ -359,14 +373,14 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel protected void renderBackground (Graphics2D gfx, Rectangle dirty) { gfx.setColor(getBackground()); - gfx.fill(dirty); + gfx.fill(dirty); } // documentation inherited public void paintBetween (Graphics2D gfx, Rectangle dirty) { super.paintBetween(gfx, dirty); -// PerformanceMonitor.tick(this, "paint"); +// PerformanceMonitor.tick(this, "paint"); renderBoard(gfx, dirty); }