From: Erik V. <ev...@us...> - 2012-03-19 09:55:24
|
rails/game/MapHex.java | 1 + rails/ui/swing/hexmap/GUITile.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) New commits: commit e64779a1880d43bd4c810cf981b80654ddaab3bb Author: Martin Brumm <Dr....@t-...> Date: Mon Mar 19 10:54:15 2012 +0100 Fixed picture ID determination, which did not work for upgrades. diff --git a/rails/game/MapHex.java b/rails/game/MapHex.java index f6225cf..f02a37a 100644 --- a/rails/game/MapHex.java +++ b/rails/game/MapHex.java @@ -470,6 +470,7 @@ StationHolder, TokenHolder { /** Return the current picture ID (i.e. the tile ID to be displayed, rather than used for route determination). * <p> Usually, the picture ID is equal to the tile ID. Different values may be defined per hex or per tile. + * Restriction: definitions per hex can apply to preprinted tiles only. * @return The current picture ID */ public int getPictureId () { diff --git a/rails/ui/swing/hexmap/GUITile.java b/rails/ui/swing/hexmap/GUITile.java index f7162f9..9f34078 100644 --- a/rails/ui/swing/hexmap/GUITile.java +++ b/rails/ui/swing/hexmap/GUITile.java @@ -53,7 +53,14 @@ public class GUITile { this.hex = (MapHex)guiHex.getModel(); TileManager tileManager = guiHex.getHexMap().orUIManager.getTileManager(); tile = tileManager.getTile(tileId); - picId = hex.getPictureId(); + + if (tile.getId() > 0) { + // Layable tiles can have a different picture ID, defined per tile only. + picId = tile.getPictureId(); + } else { + // Preprinted tiles can have a different picture ID, defined per hex or per tile. + picId = hex.getPictureId(); + } if (hex.getTileOrientation() == TileOrientation.EW) { baseRotation = 0.5 * DEG60; |