From a581d9b4136bb633771e5e881bbee5a36247b0e0 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sat, 24 Jan 2009 14:37:02 -0500 Subject: Extended GameCharacters from ArrayList --- src/com/fourisland/fourpuzzle/Audio.java | 3 +- src/com/fourisland/fourpuzzle/GameCharacters.java | 48 +++++++++------------- src/com/fourisland/fourpuzzle/SaveFile.java | 2 +- .../fourpuzzle/gamestate/mapview/Map.java | 31 +++++++------- 4 files changed, 37 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/com/fourisland/fourpuzzle/Audio.java b/src/com/fourisland/fourpuzzle/Audio.java index 99d4207..39ce3d8 100644 --- a/src/com/fourisland/fourpuzzle/Audio.java +++ b/src/com/fourisland/fourpuzzle/Audio.java @@ -8,7 +8,6 @@ package com.fourisland.fourpuzzle; import com.fourisland.fourpuzzle.util.ObjectLoader; import javax.sound.midi.MidiSystem; import javax.sound.midi.Sequencer; -import javax.sound.midi.Track; /** * @@ -46,7 +45,7 @@ public class Audio { } public static void playMusic(String file, boolean loop, float speed) throws Exception - { + { seq.setSequence(ObjectLoader.getMusic(file)); if (loop) diff --git a/src/com/fourisland/fourpuzzle/GameCharacters.java b/src/com/fourisland/fourpuzzle/GameCharacters.java index ef945c5..2a3b050 100644 --- a/src/com/fourisland/fourpuzzle/GameCharacters.java +++ b/src/com/fourisland/fourpuzzle/GameCharacters.java @@ -12,45 +12,42 @@ import java.util.ArrayList; * * @author hatkirby */ -public class GameCharacters implements Cloneable { +public class GameCharacters extends ArrayList +{ + private GameCharacters() {} - private GameCharacters() + private static GameCharacters INSTANCE = new GameCharacters(); + public static GameCharacters getDefaultParty() { + return INSTANCE; } - - public static GameCharacters INSTANCE = new GameCharacters(); - public void add(GameCharacter e) + public static GameCharacters createParty() { - characters.add(e); + GameCharacters temp = new GameCharacters(); + temp.addAll(INSTANCE); + + return temp; } public GameCharacter getLeader() throws Exception { - int i = 0; - for (i=0;i characters = new ArrayList(); public boolean exists(String heroName) { - int i=0; - for (i=0;i(); - party = GameCharacters.INSTANCE.newInstance(); + party = GameCharacters.createParty(); variables = new HashMap(); currentMap = new String(); hero = new HeroEvent(); diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java index b17d7b3..3df55dd 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java @@ -75,27 +75,26 @@ public abstract class Map { return true; } - int i=0; - for (i=0;i cSID = cSI.getChipSetData(); - for (i=0;i mapArea : getMapData()) { - if ((toMove == Direction.North) && (!cSID.get(mapData.get(i).get(x+((y-1)*getSize().width))).isEnableSouth())) + if ((toMove == Direction.North) && (!cSID.get(mapArea.get(x+((y-1)*getSize().width))).isEnableSouth())) { return true; - } else if ((toMove == Direction.West) && (!cSID.get(mapData.get(i).get(x-1+(y*getSize().width))).isEnableEast())) + } else if ((toMove == Direction.West) && (!cSID.get(mapArea.get(x-1+(y*getSize().width))).isEnableEast())) { return true; - } else if ((toMove == Direction.South) && (!cSID.get(mapData.get(i).get(x+((y+1)*getSize().width))).isEnableNorth())) + } else if ((toMove == Direction.South) && (!cSID.get(mapArea.get(x+((y+1)*getSize().width))).isEnableNorth())) { return true; - } else if ((toMove == Direction.East) && (!cSID.get(mapData.get(i).get(x+1+(y*getSize().width))).isEnableWest())) + } else if ((toMove == Direction.East) && (!cSID.get(mapArea.get(x+1+(y*getSize().width))).isEnableWest())) { return true; } - if ((toMove == Direction.North) && (!cSID.get(mapData.get(i).get(x+(y*getSize().width))).isEnableNorth())) + if ((toMove == Direction.North) && (!cSID.get(mapArea.get(x+(y*getSize().width))).isEnableNorth())) { return true; - } else if ((toMove == Direction.West) && (!cSID.get(mapData.get(i).get(x+(y*getSize().width))).isEnableWest())) + } else if ((toMove == Direction.West) && (!cSID.get(mapArea.get(x+(y*getSize().width))).isEnableWest())) { return true; - } else if ((toMove == Direction.South) && (!cSID.get(mapData.get(i).get(x+(y*getSize().width))).isEnableSouth())) + } else if ((toMove == Direction.South) && (!cSID.get(mapArea.get(x+(y*getSize().width))).isEnableSouth())) { return true; - } else if ((toMove == Direction.East) && (!cSID.get(mapData.get(i).get(x+(y*getSize().width))).isEnableEast())) + } else if ((toMove == Direction.East) && (!cSID.get(mapArea.get(x+(y*getSize().width))).isEnableEast())) { return true; } -- cgit 1.4.1