Revision: 1353
http://rails.svn.sourceforge.net/rails/?rev=1353&view=rev
Author: stefanfrey
Date: 2010-07-21 18:45:07 +0000 (Wed, 21 Jul 2010)
Log Message:
-----------
Fixed bug that station for token might not exist yet, thus delayed interpretation of station to lay token in startcompany
Modified Paths:
--------------
trunk/18xx/rails/game/specific/_18EU/StartCompany_18EU.java
Modified: trunk/18xx/rails/game/specific/_18EU/StartCompany_18EU.java
===================================================================
--- trunk/18xx/rails/game/specific/_18EU/StartCompany_18EU.java 2010-07-21 18:43:52 UTC (rev 1352)
+++ trunk/18xx/rails/game/specific/_18EU/StartCompany_18EU.java 2010-07-21 18:45:07 UTC (rev 1353)
@@ -78,6 +78,15 @@
}
public City getSelectedHomeStation() {
+ // use delayed selectedHomeStation initialization
+ // as not all cities are defined immediately
+ if (selectedHomeStation == null && selectedHomeStationName != null) {
+ MapManager mapManager = GameManager.getInstance().getMapManager();
+ String[] parts = parseStationName (selectedHomeStationName);
+ MapHex hex = mapManager.getHex(parts[0]);
+ selectedHomeStation = hex.getCity(Integer.parseInt(parts[1]));
+ }
+
return selectedHomeStation;
}
@@ -130,11 +139,7 @@
availableHomeStations.add (hex.getCity(Integer.parseInt(parts[1])));
}
}
- if (selectedHomeStationName != null) {
- String[] parts = parseStationName (selectedHomeStationName);
- MapHex hex = mapManager.getHex(parts[0]);
- selectedHomeStation = hex.getCity(Integer.parseInt(parts[1]));
- }
+ // selectedHomeStation is delayed
}
private String[] parseStationName (String name) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|