From: Stefan F. <ste...@us...> - 2011-11-25 14:12:58
|
rails/game/MapManager.java | 2 +- rails/ui/swing/hexmap/HexMapImage.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) New commits: commit 572d4fa812f40923634d460a94236d4d94b5a453 Author: Stefan Frey <ste...@we...> Date: Fri Nov 25 15:15:47 2011 +0100 Fixed bug that prevented loading MapImage from jar diff --git a/rails/game/MapManager.java b/rails/game/MapManager.java index dd85c46..f45dd10 100644 --- a/rails/game/MapManager.java +++ b/rails/game/MapManager.java @@ -245,7 +245,7 @@ public class MapManager implements ConfigurableComponentI { if (!rails.util.Util.hasValue(rootDirectory)) { rootDirectory = "data"; } - mapImageFilepath = rootDirectory + "/" + mapImageFilename; + mapImageFilepath = "/" + rootDirectory + "/" + mapImageFilename; } for (String hexName : mHexes.keySet()) { diff --git a/rails/ui/swing/hexmap/HexMapImage.java b/rails/ui/swing/hexmap/HexMapImage.java index e360245..a1435e6 100644 --- a/rails/ui/swing/hexmap/HexMapImage.java +++ b/rails/ui/swing/hexmap/HexMapImage.java @@ -67,9 +67,10 @@ public final class HexMapImage extends JSVGCanvas { private void loadMap() { try { - File imageFile = new File (mapManager.getMapImageFilepath()); - setURI(imageFile.toURI().toString()); - log.debug("ImageFile="+ imageFile.getName()); +// File imageFile = new File (mapManager.getMapImageFilepath()); +// setURI(imageFile.toURI().toString()); +// log.debug("ImageFile="+ imageFile.getName()); + setURI(getClass().getResource(mapManager.getMapImageFilepath()).toString()); } catch (Exception e) { log.error ("Cannot load map image file " + mapManager.getMapImageFilepath(), e); } |