From: Erik V. <ev...@us...> - 2011-10-12 13:43:46
|
data/1835/Tiles.xml | 2 +- rails/game/Game.java | 2 +- rails/ui/swing/GameStatus.java | 14 ++++++++------ rails/ui/swing/elements/Caption.java | 11 ++++------- rails/ui/swing/elements/Field.java | 33 ++++++++++++++++++++++----------- tiles/TileDictionary.18t | 2 +- tiles/TileDictionary.xml | 2 +- tiles/Tiles.xml | 2 +- 8 files changed, 39 insertions(+), 29 deletions(-) New commits: commit c7277d4d9659931ddd2996d48fc20e6bf32b80fc Author: Erik Vos <eri...@xs...> Date: Wed Oct 12 15:28:57 2011 +0200 Fixed wrong revenue value (20) of NW city on tile -803 (1835 Hamburg) diff --git a/data/1835/Tiles.xml b/data/1835/Tiles.xml index fb95273..f2e99d8 100644 --- a/data/1835/Tiles.xml +++ b/data/1835/Tiles.xml @@ -68,7 +68,7 @@ <Track from="side3" gauge="normal" to="side4"/> </Tile> <Tile colour="green" id="-803" name="Hamburg"> - <Station id="city1" position="502" slots="1" type="City" value="20"/> + <Station id="city1" position="502" slots="1" type="City" value="40"/> <Station id="city2" position="052" slots="1" type="City" value="40"/> <Station id="city3" position="302" slots="1" type="City" value="40"/> <Track from="city1" gauge="normal" to="side5"/> diff --git a/tiles/TileDictionary.18t b/tiles/TileDictionary.18t index 2c295a6..d14e28d 100644 --- a/tiles/TileDictionary.18t +++ b/tiles/TileDictionary.18t @@ -12835,7 +12835,7 @@ object TTilesWrapper item JunType = jtCity Position = tp2SideF - Revenue = 20 + Revenue = 40 RevenuePosition = tpCenter end item diff --git a/tiles/TileDictionary.xml b/tiles/TileDictionary.xml index 8ecd5ae..5843696 100644 --- a/tiles/TileDictionary.xml +++ b/tiles/TileDictionary.xml @@ -17555,7 +17555,7 @@ <junType>jtCity</junType> <position>tp2SideF</position> <revenue> - <value>20</value> + <value>40</value> <position>tpCenter</position> </revenue> </junction> diff --git a/tiles/Tiles.xml b/tiles/Tiles.xml index fc210d3..d7741b5 100644 --- a/tiles/Tiles.xml +++ b/tiles/Tiles.xml @@ -3087,7 +3087,7 @@ <Track from="side3" gauge="normal" to="side4"/> </Tile> <Tile colour="green" id="-803" name="Hamburg"> - <Station id="city1" position="502" slots="1" type="City" value="20"/> + <Station id="city1" position="502" slots="1" type="City" value="40"/> <Station id="city2" position="052" slots="1" type="City" value="40"/> <Station id="city3" position="302" slots="1" type="City" value="40"/> <Track from="city1" gauge="normal" to="side5"/> commit 919a2ba43dec0595a445e163d2f008104dc27852 Author: Erik Vos <eri...@xs...> Date: Wed Oct 12 13:24:16 2011 +0200 In GameStatus window, make train list fields auto-wrapping. By embedding the text in <html>...</html> and setting the JLabel preferred size to (1,1). diff --git a/rails/ui/swing/GameStatus.java b/rails/ui/swing/GameStatus.java index 71a1ce4..da0f965 100644 --- a/rails/ui/swing/GameStatus.java +++ b/rails/ui/swing/GameStatus.java @@ -1,10 +1,10 @@ package rails.ui.swing; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.*; +import java.util.List; import javax.swing.*; @@ -494,7 +494,7 @@ public class GameStatus extends GridPanel implements ActionListener { for (int i = 0; i < np; i++) { f = playerCertCount[i] = - new Field(players[i].getCertCountModel(), true); + new Field(players[i].getCertCountModel(), false, true); addField(f, playerCertCountXOffset + i, playerCertCountYOffset, 1, 1, WIDE_TOP, true); } @@ -546,14 +546,16 @@ public class GameStatus extends GridPanel implements ActionListener { // Future trains addField(new Caption(LocalText.getText("Future")), futureTrainsXOffset, futureTrainsYOffset - 1, futureTrainsWidth, 1, WIDE_TOP, true); - futureTrains = new Field(bank.getUnavailable().getTrainsModel()); + futureTrains = new Field(bank.getUnavailable().getTrainsModel(), true, false); + futureTrains.setPreferredSize(new Dimension (1,1)); // To enable auto word wrap addField(futureTrains, futureTrainsXOffset, futureTrainsYOffset, futureTrainsWidth, 1, 0, true); // Train cost overview String text = gameUIManager.getGameManager().getTrainManager().getTrainCostOverview(); - addField (new Caption(text), poolTrainsXOffset, newTrainsYOffset + 1, - futureTrainsWidth + 2, 1, 0, true); + addField (f = new Caption("<html>" + text + "</html>"), poolTrainsXOffset, newTrainsYOffset + 1, + futureTrainsWidth + 2, 2, 0, true); + f.setPreferredSize(new Dimension (1,1));// To enable auto word wrap dummyButton = new ClickField("", "", "", this, buySellGroup); } diff --git a/rails/ui/swing/elements/Caption.java b/rails/ui/swing/elements/Caption.java index 6af9fc4..aacaa96 100644 --- a/rails/ui/swing/elements/Caption.java +++ b/rails/ui/swing/elements/Caption.java @@ -2,11 +2,8 @@ package rails.ui.swing.elements; import java.awt.Color; -import java.awt.Font; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.border.Border; public class Caption extends JLabel { @@ -17,9 +14,9 @@ public class Caption extends JLabel { private static final Color NORMAL_BG_COLOUR = new Color(240, 240, 240); private static final Color HIGHLIGHT_BG_COLOUR = new Color(255, 255, 80); - + private static final Color NORMAL_FG_COLOUR = new Color (0, 0, 0); - + private static final Color LOCAL_PLAYER_COLOUR = new Color (255, 0, 0); public Caption(String text) { @@ -34,7 +31,7 @@ public class Caption extends JLabel { public void setHighlight(boolean highlight) { this.setBackground(highlight ? HIGHLIGHT_BG_COLOUR : NORMAL_BG_COLOUR); } - + public void setLocalPlayer (boolean highlight) { this.setForeground(highlight ? LOCAL_PLAYER_COLOUR : NORMAL_FG_COLOUR); } diff --git a/rails/ui/swing/elements/Field.java b/rails/ui/swing/elements/Field.java index 5eaac15..76b674f 100644 --- a/rails/ui/swing/elements/Field.java +++ b/rails/ui/swing/elements/Field.java @@ -29,6 +29,8 @@ public class Field extends JLabel implements ViewObject { private boolean pull = false; + private boolean html = false; + public Field(String text) { super(text.equals("0%") ? "" : text); this.setBackground(NORMAL_BG_COLOUR); @@ -46,18 +48,16 @@ public class Field extends JLabel implements ViewObject { } public Field(ModelObject modelObject) { - this(""); - //this(modelObject.getText()); + this(modelObject, false, false); this.modelObject = modelObject; - //Object mu = modelObject.getUpdate(); - //if (mu instanceof ViewUpdate) { - // updateDetails ((ViewUpdate) mu); - //} modelObject.addObserver(this); } - public Field(ModelObject modelObject, boolean pull) { - this(modelObject); + public Field(ModelObject modelObject, boolean html, boolean pull) { + this(""); + this.modelObject = modelObject; + this.html = html; + this.modelObject.addObserver(this); this.pull = pull; } @@ -103,14 +103,23 @@ public class Field extends JLabel implements ViewObject { } } + @Override + public void setText (String text) { + if (html) { + super.setText("<html>" + text + "</html>"); + } else { + super.setText(text); + } + } + protected void updateDetails (ViewUpdate vu) { for (String key : vu.getKeys()) { if (ViewUpdate.TEXT.equalsIgnoreCase(key)) { setText (vu.getText()); } else if (ViewUpdate.BGCOLOUR.equalsIgnoreCase(key)) { setBackground((Color)vu.getValue(key)); - normalBgColour = getBackground(); - setForeground (Util.isDark(normalBgColour) ? Color.WHITE : Color.BLACK); + normalBgColour = getBackground(); + setForeground (Util.isDark(normalBgColour) ? Color.WHITE : Color.BLACK); } } } @@ -130,5 +139,7 @@ public class Field extends JLabel implements ViewObject { return dependents; } - + public void setHtml() { + html = true; + } } commit 15fa441bd80ceb32615bd8706d620d811166be77 Author: Erik Vos <eri...@xs...> Date: Mon Oct 10 16:12:11 2011 +0200 Set version # to 1.5.1+ diff --git a/rails/game/Game.java b/rails/game/Game.java index 9a6b6bb..c670a7b 100644 --- a/rails/game/Game.java +++ b/rails/game/Game.java @@ -14,7 +14,7 @@ import rails.game.action.PossibleAction; import rails.util.GameFileIO; public class Game { - public static final String version = "1.5"; + public static final String version = "1.5.1+"; /** The component Manager */ protected GameManager gameManager; |