Revision: 1396
http://rails.svn.sourceforge.net/rails/?rev=1396&view=rev
Author: evos
Date: 2010-08-21 12:23:09 +0000 (Sat, 21 Aug 2010)
Log Message:
-----------
Fix: if merging minor and major both bave a Pullmann, discard one.
Modified Paths:
--------------
trunk/18xx/rails/game/specific/_18EU/StockRound_18EU.java
Modified: trunk/18xx/rails/game/specific/_18EU/StockRound_18EU.java
===================================================================
--- trunk/18xx/rails/game/specific/_18EU/StockRound_18EU.java 2010-08-21 06:49:48 UTC (rev 1395)
+++ trunk/18xx/rails/game/specific/_18EU/StockRound_18EU.java 2010-08-21 12:23:09 UTC (rev 1396)
@@ -495,6 +495,7 @@
PublicCompanyI major = action.getSelectedTargetCompany();
PublicCertificateI cert = null;
CashHolder cashDestination = null; // Bank
+ TrainI pullmannToDiscard = null;
// TODO Validation to be added?
@@ -521,6 +522,18 @@
} else {
// Assets go to the major company
major.transferAssetsFrom(minor);
+
+ // Check for multiple Pullmanns
+ boolean hasPullmann = false;
+ for (TrainI train : major.getPortfolio().getTrainList()) {
+ if (train.getName().equalsIgnoreCase("P")) {
+ if (!hasPullmann) {
+ hasPullmann = true;
+ } else {
+ pullmannToDiscard = train; // Can only have two Pullmanns.
+ }
+ }
+ }
}
MapHex homeHex = minor.getHomeHex();
@@ -572,6 +585,13 @@
cert.moveTo(currentPlayer.getPortfolio());
ReportBuffer.add(LocalText.getText("MinorCloses", minor.getName()));
checkFlotation(major);
+
+ if (pullmannToDiscard != null) {
+ pullmannToDiscard.moveTo(pool);
+ ReportBuffer.add(LocalText.getText("CompanyDiscardsTrain",
+ major.getName(),
+ pullmannToDiscard.getName() ));
+ }
} else {
ReportBuffer.add("");
ReportBuffer.add(LocalText.getText("CLOSE_MINOR_LOG",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|