From 58c3529f14de0e5142e0ba0927d3c7aa9288c799 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Wed, 28 Jan 2009 16:49:17 -0500 Subject: Fixed LayerEvent rendering condition bug Replaced said condition with an instanceof check to see if toDraw.getGraphic() is an instance of BlankEventGraphic. The previous way requires BlankEventGraphic() to be instantated many times for no reason, thus wasting resources and causing other problems. --- .../fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src') diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java index c88c42b..b31705d 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java @@ -78,13 +78,7 @@ public class LayerEvent extends AbstractEvent implements Event { public void render(Graphics g) { PossibleEvent toDraw = getPossibleEvent(); - - /* TODO Replace below condition with an instanceof check to - * see if toDraw.getGraphic() is an instance of BlankEventGraphic. - * The current way requires BlankEventGraphic() to be instantated - * many times for no reason. */ - - if (!toDraw.getGraphic().equals(new BlankEventGraphic())) + if (!(toDraw.getGraphic() instanceof BlankEventGraphic)) { g.drawImage(toDraw.getImage(), getRenderX(), getRenderY(), null); } -- cgit 1.4.1