summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-02-12 09:20:07 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-02-12 09:20:07 -0500
commit25cac8db589a689df121b2a9f4142fdc1cef2fee (patch)
treeb1474363944831860cb00f20b32da9e2cfd3aaa1 /src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java
parent804beeb6a3b8d374e7a95600c700f109f6f40280 (diff)
downloadfourpuzzle-25cac8db589a689df121b2a9f4142fdc1cef2fee.tar.gz
fourpuzzle-25cac8db589a689df121b2a9f4142fdc1cef2fee.tar.bz2
fourpuzzle-25cac8db589a689df121b2a9f4142fdc1cef2fee.zip
Engine: Rewrote Map abstraction
Instead of requiring users to extend Map, all that is required now is the creation of a Map object, which should then be configured and added to the Database via Database.addMap()
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java')
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java index 8f411af..3ed23c3 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java
@@ -13,6 +13,7 @@ import com.fourisland.fourpuzzle.gamestate.mapview.event.HeroEvent;
13import com.fourisland.fourpuzzle.Game; 13import com.fourisland.fourpuzzle.Game;
14import com.fourisland.fourpuzzle.Layer; 14import com.fourisland.fourpuzzle.Layer;
15import com.fourisland.fourpuzzle.PuzzleApplication; 15import com.fourisland.fourpuzzle.PuzzleApplication;
16import com.fourisland.fourpuzzle.database.Database;
16import com.fourisland.fourpuzzle.gamestate.mapview.event.EventCallTime; 17import com.fourisland.fourpuzzle.gamestate.mapview.event.EventCallTime;
17import com.fourisland.fourpuzzle.gamestate.mapview.event.EventHandler; 18import com.fourisland.fourpuzzle.gamestate.mapview.event.EventHandler;
18import com.fourisland.fourpuzzle.gamestate.mapview.event.EventList; 19import com.fourisland.fourpuzzle.gamestate.mapview.event.EventList;
@@ -22,13 +23,10 @@ import com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove.MoveEventTh
22import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.AutomaticViewpoint; 23import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.AutomaticViewpoint;
23import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.Viewpoint; 24import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.Viewpoint;
24import com.fourisland.fourpuzzle.util.Functions; 25import com.fourisland.fourpuzzle.util.Functions;
25import com.fourisland.fourpuzzle.util.ResourceNotFoundException;
26import com.fourisland.fourpuzzle.window.MessageWindow; 26import com.fourisland.fourpuzzle.window.MessageWindow;
27import java.awt.Graphics2D; 27import java.awt.Graphics2D;
28import java.awt.event.KeyEvent; 28import java.awt.event.KeyEvent;
29import java.awt.image.BufferedImage; 29import java.awt.image.BufferedImage;
30import java.util.logging.Level;
31import java.util.logging.Logger;
32 30
33/** 31/**
34 * 32 *
@@ -238,26 +236,10 @@ public class MapViewGameState implements GameState {
238 } 236 }
239 } 237 }
240 238
241 public void initCurrentMap(String mapName)
242 {
243 try {
244 Class mapClass = Class.forName(PuzzleApplication.INSTANCE.getGamePackage() + ".gamedata.map." + mapName);
245 Object mapObject = mapClass.newInstance();
246 Map map = (Map) mapObject;
247 map.initalize();
248 currentMap = map;
249 } catch (InstantiationException ex) {
250 Logger.getLogger(MapViewGameState.class.getName()).log(Level.SEVERE, null, ex);
251 } catch (IllegalAccessException ex) {
252 Logger.getLogger(MapViewGameState.class.getName()).log(Level.SEVERE, null, ex);
253 } catch (ClassNotFoundException ex) {
254 throw new ResourceNotFoundException("Map", mapName);
255 }
256 }
257 public void setCurrentMap(String mapName) 239 public void setCurrentMap(String mapName)
258 { 240 {
259 Game.getSaveFile().setCurrentMap(mapName); 241 Game.getSaveFile().setCurrentMap(mapName);
260 initCurrentMap(mapName); 242 currentMap = Database.getMap(mapName);
261 } 243 }
262 244
263 public Map getCurrentMap() 245 public Map getCurrentMap()