From: Erik V. <ev...@us...> - 2010-05-15 22:44:54
|
Update of /cvsroot/rails/18xx/rails/ui/swing/hexmap In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv26563/rails/ui/swing/hexmap Modified Files: HexMap.java Log Message: Enable custom route colours Index: HexMap.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/HexMap.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** HexMap.java 29 Apr 2010 19:47:32 -0000 1.25 --- HexMap.java 15 May 2010 22:44:46 -0000 1.26 *************** *** 16,19 **** --- 16,20 ---- import rails.ui.swing.GameUIManager; import rails.ui.swing.ORUIManager; + import rails.util.*; /** *************** *** 69,77 **** /** list of generalpath elements to indicate train runs */ protected List<GeneralPath> trainPaths; ! protected Color[] trainColors = new Color[]{Color.CYAN, Color.PINK, Color.ORANGE, Color.GRAY}; protected int strokeWidth = 5; protected int strokeCap = BasicStroke.CAP_ROUND; protected int strokeJoin = BasicStroke.JOIN_BEVEL; public void init(ORUIManager orUIManager, MapManager mapManager) { this.orUIManager = orUIManager; --- 70,95 ---- /** list of generalpath elements to indicate train runs */ protected List<GeneralPath> trainPaths; ! ! private static Color colour1, colour2, colour3, colour4; ! protected Color[] trainColors = new Color[4]; protected int strokeWidth = 5; protected int strokeCap = BasicStroke.CAP_ROUND; protected int strokeJoin = BasicStroke.JOIN_BEVEL; + static { + try { + colour1 = Util.parseColour(Config.get("route.colour.1", null)); + colour2 = Util.parseColour(Config.get("route.colour.2", null)); + colour3 = Util.parseColour(Config.get("route.colour.3", null)); + colour4 = Util.parseColour(Config.get("route.colour.4", null)); + } catch (ConfigurationException e) { + } finally { + if (colour1 == null) colour1 = Color.CYAN; + if (colour2 == null) colour2 = Color.PINK; + if (colour3 == null) colour3 = Color.ORANGE; + if (colour4 == null) colour4 = Color.GRAY; + } + } + public void init(ORUIManager orUIManager, MapManager mapManager) { this.orUIManager = orUIManager; *************** *** 86,89 **** --- 104,109 ---- maxCol = mapManager.getMaxCol(); setupHexes(); + + trainColors = new Color[]{colour1, colour2, colour3, colour4}; } |