From f5884d91e90e858b2672ef416071941fea786923 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Wed, 28 Jan 2009 16:47:47 -0500 Subject: Fixed HeroEvent rendering condition bug Replaced said condition with an instanceof check to see if toDraw.getGraphic() is an instance of BlankEventGraphic. The previous way did not, in fact, work because an EventGraphic never be equal to a String. This previous way only existed because HeroEvent's graphic used to be stored as a filename/offset combo instead of as an EventGraphic. --- .../fourpuzzle/gamestate/mapview/event/HeroEvent.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/com/fourisland') diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java index 8b9e3fb..f39c451 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java @@ -13,6 +13,7 @@ import com.fourisland.fourpuzzle.Game; import com.fourisland.fourpuzzle.GameCharacter; import com.fourisland.fourpuzzle.gamestate.mapview.Map; import com.fourisland.fourpuzzle.gamestate.mapview.MapViewGameState; +import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; /** * @@ -33,16 +34,7 @@ public class HeroEvent extends AbstractEvent implements Event { public void render(Graphics g) { GameCharacter toDraw = Game.getSaveFile().getParty().getLeader(); - - /* TODO Replace below condition with an instanceof check to - * see if toDraw.getGraphic() is an instance of BlankEventGraphic. - * The current way does not, in fact, work because an EventGraphic - * never be equal to a String. This current way only exists because - * HeroEvent's graphic used to be stored as a filename/offset combo - * instead of as an EventGraphic. - */ - - if (!toDraw.getGraphic().equals("blank")) + if (!(toDraw.getGraphic() instanceof BlankEventGraphic)) { toDraw.getGraphic().setDirection(direction); toDraw.getGraphic().setAnimationStep(animationStep); -- cgit 1.4.1