|
From: Stefan F. <ste...@us...> - 2012-09-19 09:38:45
|
dev/null |binary
src/data/18EU/Game.xml | 2
src/data/profiles/test.profile | 2
src/rails/algorithms/NetworkTrain.java | 2
src/rails/algorithms/RevenueAdapter.java | 1
src/rails/game/Bank.java | 15
src/rails/game/BankPortfolio.java | 4
src/rails/game/BaseToken.java | 2
src/rails/game/Certificate.java | 2
src/rails/game/GameManager.java | 21
src/rails/game/MapHex.java | 29
src/rails/game/OperatingRound.java | 32
src/rails/game/Player.java | 5
src/rails/game/PlayerManager.java | 6
src/rails/game/PrivateCompany.java | 10
src/rails/game/PublicCompany.java | 56
src/rails/game/RailsRoot.java | 8
src/rails/game/StartRound.java | 4
src/rails/game/StockMarket.java | 4
src/rails/game/StockRound.java | 8
src/rails/game/Stop.java | 6
src/rails/game/Train.java | 2
src/rails/game/TrainCertificateType.java | 4
src/rails/game/TrainManager.java | 4
src/rails/game/TreasuryShareRound.java | 2
src/rails/game/action/BuyBonusToken.java | 2
src/rails/game/action/BuyCertificate.java | 2
src/rails/game/action/BuyTrain.java | 3
src/rails/game/action/ExchangeTokens.java | 9
src/rails/game/action/ExchangeableToken.java | 7
src/rails/game/action/StartCompany.java | 3
src/rails/game/model/CertificatesModel.java | 23
src/rails/game/model/PortfolioModel.java | 378 +--
src/rails/game/special/LocatedBonus.java | 4
src/rails/game/special/SellBonusToken.java | 4
src/rails/game/specific/_1835/FoldIntoPrussian.java | 8
src/rails/game/specific/_1835/GameManager_1835.java | 10
src/rails/game/specific/_1835/PrussianFormationRound.java | 10
src/rails/game/specific/_1856/CGRFormationRound.java | 13
src/rails/game/specific/_1856/OperatingRound_1856.java | 5
src/rails/game/specific/_1856/PublicCompany_1856.java | 3
src/rails/game/specific/_1856/PublicCompany_CGR.java | 2
src/rails/game/specific/_1856/StockRound_1856.java | 5
src/rails/game/specific/_18AL/NameTrains.java | 28
src/rails/game/specific/_18AL/NameableTrain.java | 9
src/rails/game/specific/_18AL/NamedTrainToken.java | 10
src/rails/game/specific/_18AL/OperatingRound_18AL.java | 2
src/rails/game/specific/_18EU/OperatingRound_18EU.java | 12
src/rails/game/specific/_18EU/PullmanRevenueModifier.java | 3
src/rails/game/specific/_18EU/StartCompany_18EU.java | 10
src/rails/game/specific/_18EU/StockRound_18EU.java | 25
src/rails/game/state/Observable.java | 6
src/rails/game/state/PortfolioChange.java | 11
src/rails/game/state/StateManager.java | 14
src/rails/game/state/Trigger.java | 11
src/rails/game/state/Triggerable.java | 11
src/rails/ui/swing/GameSetupWindow.java | 7
src/rails/ui/swing/GameUIManager.java | 2
src/rails/ui/swing/ORUIManager.java | 4
src/rails/ui/swing/gamespecific/_18AL/NameTrainsDialog.java | 2
src/rails/ui/swing/gamespecific/_18EU/StatusWindow_18EU.java | 2
src/test/TestGameBuilder.java | 4
src/test/data/real/1830_A.report | 2
src/test/data/real/1856_A.report | 2
src/test/data/real/1889_B.report | 2
src/test/data/real/1889_C.report | 2
src/test/data/real/18AL_A.report | 2
src/test/data/real/18EU_A.report | 23
src/test/data/test/1835_PR_3rdTrain.rails |binary
src/test/data/test/1835_PR_3rdTrain.report | 43
src/test/data/test/18EU_After2nd8Train.report | 1194 -----------
71 files changed, 497 insertions(+), 1668 deletions(-)
New commits:
commit 61df3a9f1a6ae65aa4fa34a31a7caa21e820dd89
Author: Stefan Frey <ste...@we...>
Date: Wed Sep 19 11:38:07 2012 +0200
fixed issues with 1835 test game
diff --git a/src/rails/game/PublicCompany.java b/src/rails/game/PublicCompany.java
index 660d0a4..36aa8a0 100644
--- a/src/rails/game/PublicCompany.java
+++ b/src/rails/game/PublicCompany.java
@@ -221,8 +221,8 @@ public class PublicCompany extends RailsAbstractItem implements Company, MoneyOw
boolean certsAreInitiallyAvailable = true;
/** What percentage of ownership constitutes "one share" */
- protected IntegerState shareUnit = null; // configured see below
-
+ protected IntegerState shareUnit = IntegerState.create(this, "shareUnit", DEFAULT_SHARE_UNIT);
+
/** What number of share units relates to the share price
* (normally 1, but 2 for 1835 Prussian)
*/
@@ -364,7 +364,7 @@ public class PublicCompany extends RailsAbstractItem implements Company, MoneyOw
Tag shareUnitTag = tag.getChild("ShareUnit");
if (shareUnitTag != null) {
- shareUnit = IntegerState.create(this, "shareUnit", shareUnitTag.getAttributeAsInteger("percentage", DEFAULT_SHARE_UNIT));
+ shareUnit.set(shareUnitTag.getAttributeAsInteger("percentage", DEFAULT_SHARE_UNIT));
shareUnitsForSharePrice
= shareUnitTag.getAttributeAsInteger("sharePriceUnits", shareUnitsForSharePrice);
}
@@ -656,10 +656,6 @@ public class PublicCompany extends RailsAbstractItem implements Company, MoneyOw
}
- if (shareUnit == null) {
- shareUnit = IntegerState.create(this, "shareUnit", DEFAULT_SHARE_UNIT);
- }
-
int certIndex = 0;
if (certificateTags != null) {
int shareTotal = 0;
diff --git a/src/rails/game/action/StartCompany.java b/src/rails/game/action/StartCompany.java
index 8539e4c..0299976 100644
--- a/src/rails/game/action/StartCompany.java
+++ b/src/rails/game/action/StartCompany.java
@@ -51,7 +51,8 @@ public class StartCompany extends BuyCertificate {
public boolean equalsAsOption(PossibleAction action) {
if (!(action.getClass() == StartCompany.class)) return false;
StartCompany a = (StartCompany) action;
- return a.company == company && a.from == from && Ints.asList(startPrices).contains(a.price);
+ return a.company == company && a.from == from
+ && (startPrices == null && a.startPrices == null || Ints.asList(startPrices).contains(a.price));
}
@Override
diff --git a/src/rails/game/specific/_1835/FoldIntoPrussian.java b/src/rails/game/specific/_1835/FoldIntoPrussian.java
index c8322ab..b84b585 100644
--- a/src/rails/game/specific/_1835/FoldIntoPrussian.java
+++ b/src/rails/game/specific/_1835/FoldIntoPrussian.java
@@ -6,6 +6,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import com.google.common.collect.ImmutableSet;
+
import rails.game.*;
import rails.game.action.PossibleAction;
import rails.util.Util;
@@ -73,7 +75,7 @@ public class FoldIntoPrussian extends PossibleAction {
public boolean equalsAsOption(PossibleAction action) {
if (!(action instanceof FoldIntoPrussian)) return false;
FoldIntoPrussian a = (FoldIntoPrussian) action;
- return a.foldableCompanyNames.equals(foldableCompanyNames);
+ return ImmutableSet.copyOf(a.foldableCompanies).equals(ImmutableSet.copyOf(foldableCompanies));
}
@Override
@@ -95,7 +97,9 @@ public class FoldIntoPrussian extends PossibleAction {
if (foldableCompanyNames != null) {
foldableCompanies = new ArrayList<Company>();
for (String name : foldableCompanyNames.split(",")) {
- foldableCompanies.add(cmgr.getPublicCompany(name));
+ company = cmgr.getPublicCompany(name);
+ if (company == null) company = cmgr.getPrivateCompany(name);
+ if (company != null) foldableCompanies.add(company);
}
}
if (Util.hasValue(foldedCompanyNames)) {
diff --git a/src/rails/game/specific/_1835/GameManager_1835.java b/src/rails/game/specific/_1835/GameManager_1835.java
index 3852cb3..0b83cb4 100644
--- a/src/rails/game/specific/_1835/GameManager_1835.java
+++ b/src/rails/game/specific/_1835/GameManager_1835.java
@@ -54,9 +54,15 @@ public class GameManager_1835 extends GameManager {
}
public void startPrussianFormationRound(OperatingRound_1835 or) {
-
interruptedRound = or;
- createRound(PrussianFormationRound.class, "PrussianFormationRound").start ();
+ String roundName;
+ if (interruptedRound == null) {
+ // after a round
+ roundName = "PrussianFormationRound_after_" + previousRound.getId();
+ } else {
+ roundName = "PrussianFormationRound_in_" + or.getId();
+ }
+ createRound(PrussianFormationRound.class, roundName).start();
}
public void setPrussianFormationStartingPlayer(Player prFormStartingPlayer) {
diff --git a/src/rails/game/specific/_1835/PrussianFormationRound.java b/src/rails/game/specific/_1835/PrussianFormationRound.java
index 344b6fc..35804ae 100644
--- a/src/rails/game/specific/_1835/PrussianFormationRound.java
+++ b/src/rails/game/specific/_1835/PrussianFormationRound.java
@@ -250,7 +250,7 @@ public class PrussianFormationRound extends StockRound {
String message = LocalText.getText("START_MERGED_COMPANY",
PR_ID,
Currency.format(this, prussian.getIPOPrice()),
- prussian.getStartSpace());
+ prussian.getStartSpace().toText());
ReportBuffer.add(message);
if (display) DisplayBuffer.add(message);
@@ -342,7 +342,7 @@ public class PrussianFormationRound extends StockRound {
player.getId(),
cert.getShare(),
PR_ID,
- ipo.getId(),
+ ipo.getParent().getId(),
company.getId());
ReportBuffer.add(message);
if (display) DisplayBuffer.add (message);
diff --git a/src/test/data/test/1835_PR_3rdTrain.rails b/src/test/data/test/1835_PR_3rdTrain.rails
index e2e9503..e9709aa 100644
Binary files a/src/test/data/test/1835_PR_3rdTrain.rails and b/src/test/data/test/1835_PR_3rdTrain.rails differ
diff --git a/src/test/data/test/1835_PR_3rdTrain.report b/src/test/data/test/1835_PR_3rdTrain.report
index 6ddf818..2e256e6 100644
--- a/src/test/data/test/1835_PR_3rdTrain.report
+++ b/src/test/data/test/1835_PR_3rdTrain.report
@@ -1058,46 +1058,3 @@ FirstTrainBought,5
StartOfPhase,5
PrivateCloses,OBB
PrivateCloses,PfB
-CompanyDiscardsTrain,SX,3
-
-EndOfOperatingRound,7.1
-ORWorthIncrease,Alice,7.1,549
-ORWorthIncrease,Bob,7.1,824
-ORWorthIncrease,Charlie,7.1,946
-Has,BY,250
-Has,SX,175
-Has,BA,24
-Has,WT,752
-Has,HE,649
-Has,PR,663
-Has,Alice,317
-Has,Bob,770
-Has,Charlie,615
-START_OR,7.2
-
-CompanyOperates,BY,Alice
-LaysTileAt,BY,220,E19,SW
-CompanyRevenue,BY,140
-CompanyPaysOutFull,BY,140
-Payout,Alice,98,7,10
-Payout,Bob,28,2,10
-Payout,Charlie,14,1,10
-PRICE_MOVES_LOG,BY,232,J1,258,K1
-BuysTrain,BY,5,WT,1
-
-CompanyOperates,SX,Charlie
-LaysTileAt,SX,216,H20,E
-CompanyRevenue,SX,300
-CompanyWithholds,SX,300
-PRICE_MOVES_LOG,SX,166,G1,148,F1
-
-CompanyOperates,PR,Bob
-LaysTileAtFor,PR,221,C11,SW,50
-CompanyRevenue,PR,350
-CompanyPaysOutFull,PR,350
-Payout,Alice,105,6,5
-Payout,Bob,123,7,5
-Payout,Charlie,123,7,5
-PRICE_MOVES_LOG,PR,154,I4,172,J4
-BuysTrain,PR,5,IPO,500
-All 5-trains are sold out, 5+5-trains now available
commit 75076388bb90838d87bd4d3da4aa3bf379ac89d0
Author: Stefan Frey <ste...@we...>
Date: Wed Sep 19 09:53:40 2012 +0200
renamed cert# into cert_
diff --git a/src/rails/game/PublicCompany.java b/src/rails/game/PublicCompany.java
index fd812e3..660d0a4 100644
--- a/src/rails/game/PublicCompany.java
+++ b/src/rails/game/PublicCompany.java
@@ -693,7 +693,7 @@ public class PublicCompany extends RailsAbstractItem implements Company, MoneyOw
}
for (int k = 0; k < number; k++) {
- certificate = new PublicCertificate(this, "cert#" + certIndex, shares, president,
+ certificate = new PublicCertificate(this, "cert_" + certIndex, shares, president,
certIsInitiallyAvailable, certificateCount, certIndex++);
certificates.add(certificate);
shareTotal += shares * shareUnit.value();
commit 45cda25271bcf5a37bdba7aecaea9d2e466977cb
Author: Stefan Frey <ste...@we...>
Date: Wed Sep 19 09:51:56 2012 +0200
fixed issues with 1856 testgames
diff --git a/src/rails/game/Bank.java b/src/rails/game/Bank.java
index ffe7616..6a03798 100644
--- a/src/rails/game/Bank.java
+++ b/src/rails/game/Bank.java
@@ -14,7 +14,7 @@ import rails.game.model.WalletMoneyModel;
import rails.game.state.BooleanState;
import rails.game.state.Change;
import rails.game.state.Observable;
-import rails.game.state.Trigger;
+import rails.game.state.Triggerable;
import rails.game.state.UnknownOwner;
import rails.util.Util;
@@ -52,7 +52,7 @@ public class Bank extends RailsManager implements MoneyOwner, Configurable {
// Instance initializer to create a BankBroken model
{
- new Trigger() {
+ new Triggerable() {
{// instance initializer
cash.addTrigger(this);
}
diff --git a/src/rails/game/OperatingRound.java b/src/rails/game/OperatingRound.java
index 3f1d159..a9fb0dc 100644
--- a/src/rails/game/OperatingRound.java
+++ b/src/rails/game/OperatingRound.java
@@ -2095,7 +2095,7 @@ public class OperatingRound extends Round implements Observer {
ReportBuffer.add(LocalText.getText("BuysBonusTokenFrom",
operatingCompany.value().getId(),
- sbt.getId(),
+ sbt.getName(),
bank.getCurrency().format(sbt.getValue()), // TODO: Do this nicer
seller.getId(),
bank.getCurrency().format(sbt.getPrice()))); // TODO: Do this nicer
diff --git a/src/rails/game/PrivateCompany.java b/src/rails/game/PrivateCompany.java
index 7e1abd2..b968d14 100644
--- a/src/rails/game/PrivateCompany.java
+++ b/src/rails/game/PrivateCompany.java
@@ -519,7 +519,7 @@ public class PrivateCompany extends OwnableItem<PrivateCompany> implements Compa
* @return Boolean
*/
public boolean hasSpecialProperties() {
- return specialProperties != null && !specialProperties.isEmpty();
+ return !specialProperties.isEmpty();
}
// Company methods
@@ -550,7 +550,7 @@ public class PrivateCompany extends OwnableItem<PrivateCompany> implements Compa
public ImmutableSet<SpecialProperty> getSpecialProperties() {
return specialProperties.items();
}
-
+
// RailsItem methods
@Override
public RailsItem getParent() {
diff --git a/src/rails/game/PublicCompany.java b/src/rails/game/PublicCompany.java
index 4c29ee0..fd812e3 100644
--- a/src/rails/game/PublicCompany.java
+++ b/src/rails/game/PublicCompany.java
@@ -758,8 +758,8 @@ public class PublicCompany extends RailsAbstractItem implements Company, MoneyOw
// Can companies acquire special rights (such as in 1830 Coalfields)?
// TODO: Can this be simplified?
- if (portfolio.getSpecialProperties() != null) {
- for (SpecialProperty sp : portfolio.getSpecialProperties()) {
+ if (portfolio.hasSpecialProperties()) {
+ for (SpecialProperty sp : portfolio.getPersistentSpecialProperties()) {
if (sp instanceof SpecialRight) {
gameManager.setGuiParameter (GuiDef.Parm.HAS_ANY_RIGHTS, true);
// Initialize rights here to prevent overhead if not used,
@@ -2030,7 +2030,7 @@ public class PublicCompany extends RailsAbstractItem implements Company, MoneyOw
}
public ImmutableSet<SpecialProperty> getSpecialProperties() {
- return portfolio.getSpecialProperties().items();
+ return portfolio.getPersistentSpecialProperties();
}
diff --git a/src/rails/game/action/ExchangeTokens.java b/src/rails/game/action/ExchangeTokens.java
index e8cda22..aad52c7 100644
--- a/src/rails/game/action/ExchangeTokens.java
+++ b/src/rails/game/action/ExchangeTokens.java
@@ -74,7 +74,14 @@ public class ExchangeTokens extends PossibleORAction {
public boolean equalsAsOption(PossibleAction action) {
if (!(action instanceof ExchangeTokens)) return false;
ExchangeTokens a = (ExchangeTokens) action;
- return a.tokensToExchange == tokensToExchange && a.company == company;
+ if (a.company != this.company) return false;
+ // check if all tokensToExchange are equal as option (without selected)
+ for (int i=0; i< tokensToExchange.size(); i++) {
+ if (!(a.tokensToExchange.get(i).equalsAsOption(tokensToExchange.get(i)))) {
+ return false;
+ }
+ }
+ return true;
}
@Override
diff --git a/src/rails/game/action/ExchangeableToken.java b/src/rails/game/action/ExchangeableToken.java
index 5add07a..34ac130 100644
--- a/src/rails/game/action/ExchangeableToken.java
+++ b/src/rails/game/action/ExchangeableToken.java
@@ -8,6 +8,8 @@ package rails.game.action;
import java.io.Serializable;
+import com.google.common.base.Objects;
+
/**
* A simple, serializable class that holds the <i>original</i> location
* of a Base token, to facilitate its replacement even after its company
@@ -44,6 +46,11 @@ public class ExchangeableToken implements Serializable {
this.selected = selected;
}
+ public boolean equalsAsOption(ExchangeableToken other) {
+ return Objects.equal(this.cityName, other.cityName)
+ && Objects.equal(this.oldCompanyName, other.oldCompanyName);
+ }
+
public String toString() {
return cityName+"["+oldCompanyName+"]"
+ (selected ? "*" : "");
diff --git a/src/rails/game/model/PortfolioModel.java b/src/rails/game/model/PortfolioModel.java
index df3d495..db3bc30 100644
--- a/src/rails/game/model/PortfolioModel.java
+++ b/src/rails/game/model/PortfolioModel.java
@@ -19,10 +19,8 @@ import com.google.common.collect.ImmutableSortedSet;
import rails.common.LocalText;
import rails.game.Bank;
import rails.game.BankPortfolio;
-import rails.game.Bonus;
import rails.game.BonusToken;
import rails.game.Company;
-import rails.game.Currency;
import rails.game.GameManager;
import rails.game.MoneyOwner;
import rails.game.Player;
@@ -33,7 +31,6 @@ import rails.game.ReportBuffer;
import rails.game.Train;
import rails.game.TrainCertificateType;
import rails.game.TrainType;
-import rails.game.special.LocatedBonus;
import rails.game.special.SpecialProperty;
import rails.game.state.Model;
import rails.game.state.Owner;
@@ -47,13 +44,12 @@ import rails.game.state.PortfolioSet;
*/
public class PortfolioModel extends Model {
public static final String ID = "PortfolioModel";
-
- protected static Logger log =
- LoggerFactory.getLogger(PortfolioModel.class);
-
+
+ protected static Logger log = LoggerFactory.getLogger(PortfolioModel.class);
+
/** Owned certificates */
private final CertificatesModel certificates;
-
+
/** Owned private companies */
private final PrivatesModel privates;
@@ -63,13 +59,13 @@ public class PortfolioModel extends Model {
/** Owned tokens */
// TODO Currently only used to discard expired Bonus tokens.
private final Portfolio<BonusToken> bonusTokens;
-
+
/**
* Private-independent special properties. When moved here, a special
* property no longer depends on the private company being alive. Example:
* 18AL named train tokens.
*/
- private final Portfolio<SpecialProperty> specialProperties;
+ private final SpecialPropertiesModel specialProperties;
private final GameManager gameManager;
@@ -83,9 +79,10 @@ public class PortfolioModel extends Model {
certificates = CertificatesModel.create(parent);
privates = PrivatesModel.create(parent);
trains = TrainsModel.create(parent);
- bonusTokens = PortfolioSet.create(parent, "BonusTokens", BonusToken.class);
- specialProperties = PortfolioSet.create(parent, "SpecialProperties", SpecialProperty.class);
-
+ bonusTokens =
+ PortfolioSet.create(parent, "BonusTokens", BonusToken.class);
+ specialProperties = SpecialPropertiesModel.create(parent);
+
// change display style dependent on owner
if (parent instanceof PublicCompany) {
trains.setAbbrList(false);
@@ -98,7 +95,7 @@ public class PortfolioModel extends Model {
gameManager.addPortfolio(this);
}
-
+
public static PortfolioModel create(PortfolioOwner parent) {
return new PortfolioModel(parent, ID);
}
@@ -106,20 +103,20 @@ public class PortfolioModel extends Model {
public void finishConfiguration() {
certificates.initShareModels(gameManager.getAllPublicCompanies());
}
-
+
@Override
public PortfolioOwner getParent() {
- return (PortfolioOwner)super.getParent();
+ return (PortfolioOwner) super.getParent();
}
-
- // returns the associated MoneyOwner
+
+ // returns the associated MoneyOwner
public MoneyOwner getMoneyOwner() {
if (getParent() instanceof BankPortfolio) {
- return ((BankPortfolio)getParent()).getParent();
+ return ((BankPortfolio) getParent()).getParent();
}
- return (MoneyOwner)getParent();
+ return (MoneyOwner) getParent();
}
-
+
public void transferAssetsFrom(PortfolioModel otherPortfolio) {
// Move trains
@@ -129,39 +126,44 @@ public class PortfolioModel extends Model {
otherPortfolio.moveAllCertificates(this.getParent());
}
- /** Low-level method, only to be called by the local addObject() method and by initialisation code. */
+ /**
+ * Low-level method, only to be called by the local addObject() method and
+ * by initialisation code.
+ */
// TODO: Ignores position now, is this necessary?
public void addPrivateCompany(PrivateCompany company) {
// add to private Model
privates.moveInto(company);
-
- if (company.getSpecialProperties() != null) {
+
+ if (company.hasSpecialProperties()) {
log.debug(company.getId() + " has special properties!");
} else {
log.debug(company.getId() + " has no special properties");
}
- // TODO: This should not be necessary as soon as a PlayerModel works correctly
- updatePlayerWorth ();
+ // TODO: This should not be necessary as soon as a PlayerModel works
+ // correctly
+ updatePlayerWorth();
}
- // FIXME: Solve the presidentShare problem, should not be identified at position zero
-
- protected void updatePlayerWorth () {
+ // FIXME: Solve the presidentShare problem, should not be identified at
+ // position zero
+
+ protected void updatePlayerWorth() {
if (getParent() instanceof Player) {
- ((Player)getParent()).updateWorth();
+ ((Player) getParent()).updateWorth();
}
}
-
- public CertificatesModel getCertificatesModel() {
- return certificates;
- }
-
- public ShareModel getShareModel(PublicCompany company) {
- return certificates.getShareModel(company);
- }
-
+
+ public CertificatesModel getCertificatesModel() {
+ return certificates;
+ }
+
+ public ShareModel getShareModel(PublicCompany company) {
+ return certificates.getShareModel(company);
+ }
+
public ImmutableSet<PrivateCompany> getPrivateCompanies() {
return privates.getPortfolio().items();
}
@@ -173,7 +175,9 @@ public class PortfolioModel extends Model {
/** Get the number of certificates that count against the certificate limit */
public float getCertificateCount() {
- float number = privates.getPortfolio().size(); // TODO: May not hold for all games, for example 1880
+ float number = privates.getPortfolio().size(); // TODO: May not hold for
+ // all games, for example
+ // 1880
return number + certificates.getCertificateCount();
}
@@ -182,13 +186,14 @@ public class PortfolioModel extends Model {
return certificates.getPortfolio().view();
}
- public ImmutableSortedSet<PublicCertificate> getCertificates(PublicCompany company) {
+ public ImmutableSortedSet<PublicCertificate> getCertificates(
+ PublicCompany company) {
return certificates.getPortfolio().items(company);
}
/**
* Find a certificate for a given company.
- *
+ *
* @param company The public company for which a certificate is found.
* @param president Whether we look for a president or non-president
* certificate. If there is only one certificate, this parameter has no
@@ -200,14 +205,17 @@ public class PortfolioModel extends Model {
return findCertificate(company, 1, president);
}
- /** Find a specified certificate
- * @return (first) certificate found, null if not found */
- public PublicCertificate findCertificate(PublicCompany company,
- int shares, boolean president) {
+ /**
+ * Find a specified certificate
+ *
+ * @return (first) certificate found, null if not found
+ */
+ public PublicCertificate findCertificate(PublicCompany company, int shares,
+ boolean president) {
for (PublicCertificate cert : certificates.getPortfolio().items(company)) {
if (company.getShareUnit() == 100 || president
- && cert.isPresidentShare() || !president
- && !cert.isPresidentShare() && cert.getShares() == shares) {
+ && cert.isPresidentShare() || !president
+ && !cert.isPresidentShare() && cert.getShares() == shares) {
return cert;
}
}
@@ -223,16 +231,16 @@ public class PortfolioModel extends Model {
}
return list.build();
}
-
- public PublicCertificate getAnyCertOfType(String certTypeId) {
- for (PublicCertificate cert : certificates) {
- if (cert.getTypeId().equals(certTypeId)) {
- return cert;
- }
- }
- return null;
+
+ public PublicCertificate getAnyCertOfType(String certTypeId) {
+ for (PublicCertificate cert : certificates) {
+ if (cert.getTypeId().equals(certTypeId)) {
+ return cert;
+ }
+ }
+ return null;
}
-
+
/**
* Returns percentage that a portfolio contains of one company.
*/
@@ -244,7 +252,8 @@ public class PortfolioModel extends Model {
boolean president) {
int certs = 0;
if (certificates.contains(company)) {
- for (PublicCertificate cert : certificates.getPortfolio().items(company)) {
+ for (PublicCertificate cert : certificates.getPortfolio().items(
+ company)) {
if (president) {
if (cert.isPresidentShare()) return 1;
} else if (cert.getShares() == unit) {
@@ -254,7 +263,7 @@ public class PortfolioModel extends Model {
}
return certs;
}
-
+
public void moveAllCertificates(Owner owner) {
certificates.getPortfolio().moveAll(owner);
}
@@ -262,7 +271,7 @@ public class PortfolioModel extends Model {
/**
* Swap this Portfolio's President certificate for common shares in another
* Portfolio.
- *
+ *
* @param company The company whose Presidency is handed over.
* @param other The new President's portfolio.
* @return The common certificates returned.
@@ -302,11 +311,11 @@ public class PortfolioModel extends Model {
public void discardTrain(Train train) {
// FIXME: This is a horrible list of method calls
- GameManager.getInstance().getBank().getPool().getPortfolioModel().getTrainsModel().getPortfolio().moveInto(train);
-
-
+ GameManager.getInstance().getBank().getPool().getPortfolioModel().getTrainsModel().getPortfolio().moveInto(
+ train);
+
ReportBuffer.add(LocalText.getText("CompanyDiscardsTrain",
- getParent().getId(), train.toText() ));
+ getParent().getId(), train.toText()));
}
// FIXME: Is this still needed?
@@ -341,7 +350,7 @@ public class PortfolioModel extends Model {
Set<Train> trainsFound = new HashSet<Train>();
Map<TrainType, Object> trainTypesFound =
- new HashMap<TrainType, Object>();
+ new HashMap<TrainType, Object>();
for (Train train : trains.getPortfolio()) {
if (!trainTypesFound.containsKey(train.getType())) {
trainsFound.add(train);
@@ -355,7 +364,7 @@ public class PortfolioModel extends Model {
public Train getTrainOfType(TrainCertificateType type) {
return trains.getTrainOfType(type);
}
-
+
/**
* Add a train to the train portfolio
*/
@@ -363,140 +372,78 @@ public class PortfolioModel extends Model {
return trains.getPortfolio().moveInto(train);
}
-
/**
- * Add a special property. Used to make special properties independent of
- * the private company that originally held it.
- * Low-level method, only to be called by Move objects.
- *
- * @param property The special property object to add.
- * @return True if successful.
- */
- @Deprecated
- public boolean addSpecialProperty(SpecialProperty property, int position) {
-
- /*
- boolean result = specialProperties.addObject(property, position);
- if (!result) return false;
-
- property.setOwner(specialProperties);
- */
- // Special case for bonuses with predefined locations
- // TODO Does this belong here?
- // FIXME: This does not belong here as this method is not called anymore from anywhere
- if (getParent() instanceof PublicCompany && property instanceof LocatedBonus) {
- PublicCompany company = (PublicCompany)getParent();
- LocatedBonus locBonus = (LocatedBonus)property;
- Bonus bonus = new Bonus(company, locBonus.getId(), locBonus.getValue(),
- locBonus.getLocations());
- company.addBonus(bonus);
- ReportBuffer.add(LocalText.getText("AcquiresBonus",
- getParent().getId(),
- locBonus.getId(),
- Currency.format(getParent(), locBonus.getValue()),
- locBonus.getLocationNameString()));
- }
-
- return false;
- }
-
- /**
- * Add an object.
- * Low-level method, only to be called by Move objects.
+ * Add an object. Low-level method, only to be called by Move objects.
+ *
* @param object The object to add.
* @return True if successful.
*/
// TODO: Is this still required?
- /* public boolean addObject(Holdable object, int position) {
- if (object instanceof PublicCertificate) {
- if (position == null) position = new int[] {-1, -1, -1};
- addCertificate((PublicCertificate) object, position);
- return true;
- } else if (object instanceof PrivateCompany) {
- addPrivate((PrivateCompany) object, position == null ? -1 : position[0]);
- return true;
- } else if (object instanceof Train) {
- if (position == null) position = new int[] {-1, -1, -1};
- addTrain((Train) object, position);
- return true;
- } else if (object instanceof SpecialProperty) {
- return addSpecialProperty((SpecialProperty) object, position == null ? -1 : position[0]);
- } else if (object instanceof Token) {
- return addToken((Token) object, position == null ? -1 : position[0]);
- } else {
- return false;
- }
- }
-*/
-
+ /*
+ * public boolean addObject(Holdable object, int position) { if (object
+ * instanceof PublicCertificate) { if (position == null) position = new
+ * int[] {-1, -1, -1}; addCertificate((PublicCertificate) object, position);
+ * return true; } else if (object instanceof PrivateCompany) {
+ * addPrivate((PrivateCompany) object, position == null ? -1 : position[0]);
+ * return true; } else if (object instanceof Train) { if (position == null)
+ * position = new int[] {-1, -1, -1}; addTrain((Train) object, position);
+ * return true; } else if (object instanceof SpecialProperty) { return
+ * addSpecialProperty((SpecialProperty) object, position == null ? -1 :
+ * position[0]); } else if (object instanceof Token) { return
+ * addToken((Token) object, position == null ? -1 : position[0]); } else {
+ * return false; } }
+ */
+
/**
- * Remove an object.
- * Low-level method, only to be called by Move objects.
- *
+ * Remove an object. Low-level method, only to be called by Move objects.
+ *
* @param object The object to remove.
* @return True if successful.
*/
// TODO: Is this still required?
-/*
- public boolean removeObject(Holdable object) {
- if (object instanceof PublicCertificate) {
- removeCertificate((PublicCertificate) object);
- return true;
- } else if (object instanceof PrivateCompany) {
- removePrivate((PrivateCompany) object);
- return true;
- } else if (object instanceof Train) {
- removeTrain((Train) object);
- return true;
- } else if (object instanceof SpecialProperty) {
- return removeSpecialProperty((SpecialProperty) object);
- } else if (object instanceof Token) {
- return removeToken((Token) object);
- } else {
- return false;
- }
- }
-*/
-
+ /*
+ * public boolean removeObject(Holdable object) { if (object instanceof
+ * PublicCertificate) { removeCertificate((PublicCertificate) object);
+ * return true; } else if (object instanceof PrivateCompany) {
+ * removePrivate((PrivateCompany) object); return true; } else if (object
+ * instanceof Train) { removeTrain((Train) object); return true; } else if
+ * (object instanceof SpecialProperty) { return
+ * removeSpecialProperty((SpecialProperty) object); } else if (object
+ * instanceof Token) { return removeToken((Token) object); } else { return
+ * false; } }
+ */
+
// TODO: Check if this is still required
-/* public int[] getListIndex (Holdable object) {
- if (object instanceof PublicCertificate) {
- PublicCertificate cert = (PublicCertificate) object;
- return new int[] {
- certificates.indexOf(object),
- certPerCompany.get(cert.getCompany().getId()).indexOf(cert),
- certsPerType.get(cert.getTypeId()).indexOf(cert)
- };
- } else if (object instanceof PrivateCompany) {
- return new int[] {privateCompanies.indexOf(object)};
- } else if (object instanceof Train) {
- Train train = (Train) object;
- return new int[] {
- trains.indexOf(train),
- train.getPreviousType() != null ? trainsPerType.get(train.getPreviousType()).indexOf(train) : -1,
- trainsPerCertType.get(train.getCertType()).indexOf(train)
- };
- } else if (object instanceof SpecialProperty) {
- return new int[] {specialProperties.indexOf(object)};
- } else if (object instanceof Token) {
- return new int[] {tokens.indexOf(object)};
- } else {
- return Holdable.AT_END;
- }
- }
-*/
-
+ /*
+ * public int[] getListIndex (Holdable object) { if (object instanceof
+ * PublicCertificate) { PublicCertificate cert = (PublicCertificate) object;
+ * return new int[] { certificates.indexOf(object),
+ * certPerCompany.get(cert.getCompany().getId()).indexOf(cert),
+ * certsPerType.get(cert.getTypeId()).indexOf(cert) }; } else if (object
+ * instanceof PrivateCompany) { return new int[]
+ * {privateCompanies.indexOf(object)}; } else if (object instanceof Train) {
+ * Train train = (Train) object; return new int[] { trains.indexOf(train),
+ * train.getPreviousType() != null ?
+ * trainsPerType.get(train.getPreviousType()).indexOf(train) : -1,
+ * trainsPerCertType.get(train.getCertType()).indexOf(train) }; } else if
+ * (object instanceof SpecialProperty) { return new int[]
+ * {specialProperties.indexOf(object)}; } else if (object instanceof Token)
+ * { return new int[] {tokens.indexOf(object)}; } else { return
+ * Holdable.AT_END; } }
+ */
+
/**
* @return Set of all special properties we have.
*/
public ImmutableSet<SpecialProperty> getPersistentSpecialProperties() {
- return specialProperties.items();
+ return specialProperties.getPortfolio().items();
}
public ImmutableList<SpecialProperty> getAllSpecialProperties() {
- ImmutableList.Builder<SpecialProperty> sps = new ImmutableList.Builder<SpecialProperty>();
- if (specialProperties != null) sps.addAll(specialProperties);
+ ImmutableList.Builder<SpecialProperty> sps =
+ new ImmutableList.Builder<SpecialProperty>();
+ sps.addAll(specialProperties.getPortfolio().items());
for (PrivateCompany priv : privates.getPortfolio()) {
if (priv.getSpecialProperties() != null) {
sps.addAll(priv.getSpecialProperties());
@@ -507,18 +454,13 @@ public class PortfolioModel extends Model {
/**
* Do we have any special properties?
- *
+ *
* @return Boolean
*/
public boolean hasSpecialProperties() {
- return specialProperties != null && !specialProperties.isEmpty();
+ return !specialProperties.getPortfolio().isEmpty();
}
- public Portfolio<SpecialProperty> getSpecialProperties() {
- return specialProperties;
- }
-
-
// TODO: Check if this code can be simplified
@SuppressWarnings("unchecked")
public <T extends SpecialProperty> List<T> getSpecialProperties(
@@ -526,7 +468,8 @@ public class PortfolioModel extends Model {
List<T> result = new ArrayList<T>();
Set<SpecialProperty> sps;
- if (getParent() instanceof Player || getParent() instanceof PublicCompany) {
+ if (getParent() instanceof Player
+ || getParent() instanceof PublicCompany) {
for (PrivateCompany priv : privates.getPortfolio()) {
@@ -535,27 +478,29 @@ public class PortfolioModel extends Model {
for (SpecialProperty sp : sps) {
if ((clazz == null || clazz.isAssignableFrom(sp.getClass()))
- && sp.isExecutionable()
- && (!sp.isExercised() || includeExercised)
- && (getParent() instanceof Company && sp.isUsableIfOwnedByCompany()
- || getParent()instanceof Player && sp.isUsableIfOwnedByPlayer())) {
- log.debug("Portfolio "+getParent().getId()+" has SP " + sp);
+ && sp.isExecutionable()
+ && (!sp.isExercised() || includeExercised)
+ && (getParent() instanceof Company
+ && sp.isUsableIfOwnedByCompany() || getParent() instanceof Player
+ && sp.isUsableIfOwnedByPlayer())) {
+ log.debug("Portfolio " + getParent().getId()
+ + " has SP " + sp);
result.add((T) sp);
}
}
}
// Private-independent special properties
- if (specialProperties != null) {
- for (SpecialProperty sp : specialProperties) {
- if ((clazz == null || clazz.isAssignableFrom(sp.getClass()))
- && sp.isExecutionable()
- && (!sp.isExercised() || includeExercised)
- && (getParent() instanceof Company && sp.isUsableIfOwnedByCompany()
- || getParent() instanceof Player && sp.isUsableIfOwnedByPlayer())) {
- log.debug("Portfolio "+getParent().getId()+" has persistent SP " + sp);
- result.add((T) sp);
- }
+ for (SpecialProperty sp : specialProperties.getPortfolio()) {
+ if ((clazz == null || clazz.isAssignableFrom(sp.getClass()))
+ && sp.isExecutionable()
+ && (!sp.isExercised() || includeExercised)
+ && (getParent() instanceof Company
+ && sp.isUsableIfOwnedByCompany() || getParent() instanceof Player
+ && sp.isUsableIfOwnedByPlayer())) {
+ log.debug("Portfolio " + getParent().getId()
+ + " has persistent SP " + sp);
+ result.add((T) sp);
}
}
@@ -568,14 +513,14 @@ public class PortfolioModel extends Model {
return privates;
}
- public boolean addBonusToken(BonusToken token){
+ public boolean addBonusToken(BonusToken token) {
return bonusTokens.moveInto(token);
}
-
+
public Portfolio<BonusToken> getTokenHolder() {
return bonusTokens;
}
-
+
public void rustObsoleteTrains() {
List<Train> trainsToRust = new ArrayList<Train>();
@@ -590,7 +535,7 @@ public class PortfolioModel extends Model {
ReportBuffer.add(LocalText.getText("TrainsObsoleteRusted",
train.toText(), getParent().getId()));
log.debug("Obsolete train " + train.getId() + " (owned by "
- + getParent().getId() + ") rusted");
+ + getParent().getId() + ") rusted");
train.setRusted();
}
// FIXME:: Still required?
@@ -604,18 +549,18 @@ public class PortfolioModel extends Model {
public String getName() {
return getParent().getId();
}
-
+
/**
- * Used to identify portfolios on reload
- * TODO: Remove that in the future
+ * Used to identify portfolios on reload TODO: Remove that in the future
*/
@Deprecated
- public String getUniqueName () {
+ public String getUniqueName() {
// For BankPortfolios use Bank
if (getParent() instanceof BankPortfolio) {
return Bank.class.getSimpleName() + "_" + getParent().getId();
}
- return getParent().getClass().getSimpleName() + "_" + getParent().getId();
+ return getParent().getClass().getSimpleName() + "_"
+ + getParent().getId();
}
}
diff --git a/src/rails/game/special/LocatedBonus.java b/src/rails/game/special/LocatedBonus.java
index c20d58c..a603480 100644
--- a/src/rails/game/special/LocatedBonus.java
+++ b/src/rails/game/special/LocatedBonus.java
@@ -70,6 +70,10 @@ public final class LocatedBonus extends SpecialProperty {
public int getValue() {
return value;
}
+
+ public String getName() {
+ return name;
+ }
@Override
public String toText() {
diff --git a/src/rails/game/specific/_1856/CGRFormationRound.java b/src/rails/game/specific/_1856/CGRFormationRound.java
index 7252db9..cc0cb02 100644
--- a/src/rails/game/specific/_1856/CGRFormationRound.java
+++ b/src/rails/game/specific/_1856/CGRFormationRound.java
@@ -436,8 +436,7 @@ public class CGRFormationRound extends SwitchableUIRound {
ReportBuffer.add(message);
// Move the remaining CGR shares to the ipo.
- // Clone the shares list first
- cgr.getPortfolioModel().moveAllCertificates(ipo.getParent());
+ Portfolio.moveAll(unavailable.getCertificates(cgr), ipo.getParent());
// Assign the new president
if (newPresident.getPortfolioModel().getShare(cgr) == cgr.getShareUnit()) {
@@ -630,7 +629,7 @@ bonuses: for (Bonus bonus : bonuses) {
String cityName;
for (BaseToken token : nonHomeTokens) {
if (token.getOwner() instanceof Stop) {
- cityName = token.getOwner().getId();
+ cityName = ((Stop)token.getOwner()).getSpecificId();
if (oldTokens.containsKey(cityName)) {
oldTokens.put(cityName,
oldTokens.get(cityName)+","+token.getParent().getId());
diff --git a/src/rails/game/state/Observable.java b/src/rails/game/state/Observable.java
index 08ae14d..95d72af 100644
--- a/src/rails/game/state/Observable.java
+++ b/src/rails/game/state/Observable.java
@@ -69,15 +69,15 @@ public abstract class Observable implements Item {
return getStateManager().getModels(this);
}
- public void addTrigger(Trigger m) {
+ public void addTrigger(Triggerable m) {
getStateManager().addTrigger(m, this);
}
- public boolean removeTrigger(Trigger m) {
+ public boolean removeTrigger(Triggerable m) {
return getStateManager().removeTrigger(m, this);
}
- public ImmutableSet<Trigger> getTriggers() {
+ public ImmutableSet<Triggerable> getTriggers() {
return getStateManager().getTriggers(this);
}
diff --git a/src/rails/game/state/PortfolioChange.java b/src/rails/game/state/PortfolioChange.java
index d1cc3d5..f82b67e 100644
--- a/src/rails/game/state/PortfolioChange.java
+++ b/src/rails/game/state/PortfolioChange.java
@@ -1,6 +1,6 @@
package rails.game.state;
-final class PortfolioChange<T extends Ownable> extends Change {
+public final class PortfolioChange<T extends Ownable> extends Change {
private final Portfolio<T> portfolio;
private final T item;
@@ -36,5 +36,14 @@ final class PortfolioChange<T extends Ownable> extends Change {
return "Change for " + portfolio + ": Remove " + item;
}
}
+
+ // external information
+ public T getItem() {
+ return item;
+ }
+
+ public boolean isIntoPortfolio() {
+ return intoPortfolio;
+ }
}
diff --git a/src/rails/game/state/StateManager.java b/src/rails/game/state/StateManager.java
index 26648a1..f987953 100644
--- a/src/rails/game/state/StateManager.java
+++ b/src/rails/game/state/StateManager.java
@@ -27,7 +27,7 @@ public final class StateManager extends Manager{
HashSetState.create(this, "allStates");
private final HashMultimapState<Observable, Model> models =
HashMultimapState.create(this, "models");
- private final HashMultimapState<Observable, Trigger> triggers =
+ private final HashMultimapState<Observable, Triggerable> triggers =
HashMultimapState.create(this, "triggers");
@@ -122,25 +122,25 @@ public final class StateManager extends Manager{
/**
* Adds the combination of trigger to observable
- * @param Trigger the trigger that tracks the observable
+ * @param Triggerable the trigger that tracks the observable
* @param Observable the observable to monitor
*/
- void addTrigger(Trigger trigger, Observable observable) {
+ void addTrigger(Triggerable trigger, Observable observable) {
triggers.put(observable, trigger);
}
- boolean removeTrigger(Trigger trigger, Observable observable) {
+ boolean removeTrigger(Triggerable trigger, Observable observable) {
return triggers.remove(observable, trigger);
}
- ImmutableSet<Trigger> getTriggers(Observable observable) {
+ ImmutableSet<Triggerable> getTriggers(Observable observable) {
return triggers.get(observable);
}
void informTriggers(State state, Change change) {
// Inform direct triggers
- for (Trigger t:getTriggers(state)) {
+ for (Triggerable t:getTriggers(state)) {
t.triggered(state, change);
log.debug("State " + state + " sends change to Trigger " + t);
}
@@ -152,7 +152,7 @@ public final class StateManager extends Manager{
// Inform indirect triggers
for (Model m:allModels) {
- for (Trigger t:getTriggers(m)) {
+ for (Triggerable t:getTriggers(m)) {
t.triggered(m, change);
log.debug("Model " + m + " sends change to Trigger " + t);
}
diff --git a/src/rails/game/state/Trigger.java b/src/rails/game/state/Trigger.java
deleted file mode 100644
index 6d98021..0000000
--- a/src/rails/game/state/Trigger.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package rails.game.state;
-
-public interface Trigger {
-
- /**
- * Method that is called if something has changed
- */
- public void triggered(Observable observable, Change change);
-
-
-}
diff --git a/src/rails/game/state/Triggerable.java b/src/rails/game/state/Triggerable.java
new file mode 100644
index 0000000..7f984f4
--- /dev/null
+++ b/src/rails/game/state/Triggerable.java
@@ -0,0 +1,11 @@
+package rails.game.state;
+
+public interface Triggerable {
+
+ /**
+ * Method that is called if something has changed
+ */
+ public void triggered(Observable observable, Change change);
+
+
+}
diff --git a/src/test/data/real/1856_A.report b/src/test/data/real/1856_A.report
index e063728..e3ea294 100644
--- a/src/test/data/real/1856_A.report
+++ b/src/test/data/real/1856_A.report
@@ -1807,8 +1807,8 @@ CompanyOperates,CV,Joakim
LaysTileAt,CV,24,L11,NE
CompanyRevenue,CV,630
CompanyPaysOutFull,CV,630
-Payout,Joakim,378,6,10
BankIsBrokenReportText
+Payout,Joakim,378,6,10
Payout,Aliza,126,2,10
Payout,Ed,63,1,10
Payout,Adam,63,1,10
commit a7726f3b4592029e679c8c72388afee840d38b1c
Author: Stefan Frey <ste...@we...>
Date: Tue Sep 18 12:26:28 2012 +0200
Fixed issue with ClosesOnFirstTrain for 1830_5forDtrainExchange test game
diff --git a/src/rails/game/PublicCompany.java b/src/rails/game/PublicCompany.java
index 4199638..4c29ee0 100644
--- a/src/rails/game/PublicCompany.java
+++ b/src/rails/game/PublicCompany.java
@@ -462,7 +462,7 @@ public class PublicCompany extends RailsAbstractItem implements Company, MoneyOw
firstTrainTag.getAttributeAsString("type", "Private");
if (typeName.equalsIgnoreCase("Private")) {
privateToCloseOnFirstTrainName =
- firstTrainTag.getAttributeAsString("getId()");
+ firstTrainTag.getAttributeAsString("name");
} else {
throw new ConfigurationException(
"Only Privates can be closed on first train buy");
commit e66c163215df2b40f79e97538428b246120eef43
Author: Stefan Frey <ste...@we...>
Date: Tue Sep 18 11:46:21 2012 +0200
Fixed issues with test 18EU games
18EU_A is wrong in the processing the Pullman purchases from the Pool
18EU_After2nd8Train is removed due to invalid action 247
diff --git a/src/rails/game/StartRound.java b/src/rails/game/StartRound.java
index c0b63a8..5b1d8a1 100644
--- a/src/rails/game/StartRound.java
+++ b/src/rails/game/StartRound.java
@@ -261,7 +261,7 @@ public abstract class StartRound extends Round {
String priceText = Currency.toBank(player, price);
ReportBuffer.add(LocalText.getText("BuysItemFor",
player.getId(),
- primary.getId(),
+ primary.getName(),
priceText ));
transferCertificate (primary, player.getPortfolioModel());
checksOnBuying(primary, sharePrice);
diff --git a/src/rails/game/specific/_18EU/StockRound_18EU.java b/src/rails/game/specific/_18EU/StockRound_18EU.java
index 1fbf341..59b1947 100644
--- a/src/rails/game/specific/_18EU/StockRound_18EU.java
+++ b/src/rails/game/specific/_18EU/StockRound_18EU.java
@@ -429,7 +429,7 @@ public class StockRound_18EU extends StockRound {
currentPlayer.getId(),
cert2.getShare(),
company.getId(),
- ipo.getId(),
+ ipo.getParent().getId(),
minor.getId() ));
} else {
ReportBuffer.add(LocalText.getText("SelectedHomeBase",
diff --git a/src/test/data/real/18EU_A.report b/src/test/data/real/18EU_A.report
index b43ad0b..316b937 100644
--- a/src/test/data/real/18EU_A.report
+++ b/src/test/data/real/18EU_A.report
@@ -1740,7 +1740,7 @@ Payout,Arne,23,1,10
Payout,Joakim,115,5,10
Payout,Ed,46,2,10
PRICE_MOVES_LOG,KKÃB,165,I2,180,J2
-BuysTrain,KKÃB,P,SNCF,100
+BuysTrain,KKÃB,P,Pool,100
CompanyOperates,SNCF,Arne
LaysTileAt,SNCF,513,I6,S
@@ -1790,7 +1790,7 @@ SNCB receives 110
Payout,Arne,11,1,10
Payout,Joakim,55,5,10
PRICE_MOVES_LOG,SNCB,70,D6,75,E6
-BuysTrain,SNCB,P,KKÃB,100
+BuysTrain,SNCB,P,Pool,100
CompanyOperates,FS,Chris
LaysTileAt,FS,582,S8,NE
@@ -1812,9 +1812,9 @@ Has,SNCB,48
Has,NS,47
Has,KBS,8
Has,KPEV,670
-Has,KKÃB,221
+Has,KKÃB,121
Has,FS,2
-Has,SNCF,174
+Has,SNCF,74
Has,DR,18
Has,Chris,476
Has,Joakim,556
@@ -1870,9 +1870,9 @@ Has,SNCB,48
Has,NS,47
Has,KBS,8
Has,KPEV,670
-Has,KKÃB,221
+Has,KKÃB,121
Has,FS,2
-Has,SNCF,174
+Has,SNCF,74
Has,DR,18
Has,Chris,431
Has,Joakim,556
@@ -1931,6 +1931,7 @@ Payout,Arne,24,1,10
Payout,Joshua,144,6,10
PRICE_MOVES_LOG,KPEV,122,G3,135,H3
BuysTrain,KPEV,8,IPO,800
+CompanyDiscardsTrain,KPEV,P
CompanyOperates,DR,Chris
LaysTileAt,DR,513,G4,S
@@ -1973,9 +1974,9 @@ Has,SNCB,48
Has,NS,47
Has,KBS,8
Has,KPEV,50
-Has,KKÃB,221
+Has,KKÃB,121
Has,FS,2
-Has,SNCF,174
+Has,SNCF,74
Has,DR,18
Has,Chris,1053
Has,Joakim,1179
@@ -2061,8 +2062,8 @@ LAYS_FREE_TOKEN_ON,FS,S8
CompanyRevenue,FS,350
CompanyPaysOutFull,FS,350
Payout,Arne,35,1,10
-BankIsBrokenReportText
Payout,Ed,70,2,10
+BankIsBrokenReportText
Payout,Chris,140,4,10
PRICE_MOVES_LOG,FS,70,D6,75,E6
@@ -2077,9 +2078,9 @@ Has,SNCB,48
Has,NS,47
Has,KBS,8
Has,KPEV,50
-Has,KKÃB,221
+Has,KKÃB,121
Has,FS,2
-Has,SNCF,174
+Has,SNCF,74
Has,DR,18
Has,Chris,1713
Has,Joakim,1911
diff --git a/src/test/data/test/18EU_After2nd8Train.rails b/src/test/data/test/18EU_After2nd8Train.rails
deleted file mode 100644
index 6c8dcb7..0000000
Binary files a/src/test/data/test/18EU_After2nd8Train.rails and /dev/null differ
diff --git a/src/test/data/test/18EU_After2nd8Train.report b/src/test/data/test/18EU_After2nd8Train.report
deleted file mode 100644
index 6ec498c..0000000
--- a/src/test/data/test/18EU_After2nd8Train.report
+++ /dev/null
@@ -1,1194 +0,0 @@
-GameIs,18EU
-PlayerIs,1,Alice
-PlayerIs,2,Bob
-PlayerIs,3,Charlie
-PlayerCash,450
-BankHas,10650
-StartOfPhase,2
-BankSizeIs,10650
-StartOfInitialRound
-HasPriority,Alice
-
-SelectForAuctioning,Alice,1
-BID_ITEM,Alice,100,1
-PASSES,Bob
-PASSES,Charlie
-BuysItemFor,Alice,1,100
-Floats,1
-
-SelectForAuctioning,Bob,2
-BID_ITEM,Bob,100,2
-PASSES,Charlie
-PASSES,Alice
-BuysItemFor,Bob,2,100
-Floats,2
-
-SelectForAuctioning,Charlie,3
-BID_ITEM,Charlie,100,3
-PASSES,Alice
-PASSES,Bob
-BuysItemFor,Charlie,3,100
-Floats,3
-
-SelectForAuctioning,Alice,4
-BID_ITEM,Alice,100,4
-PASSES,Bob
-PASSES,Charlie
-BuysItemFor,Alice,4,100
-Floats,4
-
-SelectForAuctioning,Bob,5
-BID_ITEM,Bob,100,5
-PASSES,Charlie
-PASSES,Alice
-BuysItemFor,Bob,5,100
-Floats,5
-
-SelectForAuctioning,Charlie,6
-BID_ITEM,Charlie,100,6
-PASSES,Alice
-PASSES,Bob
-BuysItemFor,Charlie,6,100
-Floats,6
-
-SelectForAuctioning,Alice,7
-BID_ITEM,Alice,100,7
-PASSES,Bob
-PASSES,Charlie
-BuysItemFor,Alice,7,100
-Floats,7
-
-SelectForAuctioning,Bob,8
-BID_ITEM,Bob,100,8
-PASSES,Charlie
-PASSES,Alice
-BuysItemFor,Bob,8,100
-Floats,8
-
-SelectForAuctioning,Charlie,9
-BID_ITEM,Charlie,100,9
-PASSES,Alice
-PASSES,Bob
-BuysItemFor,Charlie,9,100
-Floats,9
-
-SelectForAuctioning,Alice,10
-BID_ITEM,Alice,100,10
-PASSES,Bob
-PASSES,Charlie
-BuysItemFor,Alice,10,100
-Floats,10
-
-SelectForAuctioning,Bob,11
-BID_ITEM,Bob,100,11
-PASSES,Charlie
-PASSES,Alice
-BuysItemFor,Bob,11,100
-Floats,11
-
-SelectForAuctioning,Charlie,12
-BID_ITEM,Charlie,100,12
-PASSES,Alice
-PASSES,Bob
-BuysItemFor,Charlie,12,100
-Floats,12
-
-SelectForAuctioning,Alice,13
-PASSES,Bob
-PASSES,Charlie
-ITEM_PRICE_REDUCED,13,90
-PASSES,Alice
-PASSES,Bob
-PASSES,Charlie
-ITEM_PRICE_REDUCED,13,80
-PASSES,Alice
-PASSES,Bob
-PASSES,Charlie
-ITEM_PRICE_REDUCED,13,70
-PASSES,Alice
-PASSES,Bob
-PASSES,Charlie
-ITEM_PRICE_REDUCED,13,60
-PASSES,Alice
-PASSES,Bob
-PASSES,Charlie
-ITEM_PRICE_REDUCED,13,50
-BuysItemFor,Alice,13,50
-Floats,13
-
-SelectForAuctioning,Bob,14
-PASSES,Charlie
-PASSES,Alice
-ITEM_PRICE_REDUCED,14,90
-PASSES,Bob
-PASSES,Charlie
-PASSES,Alice
-ITEM_PRICE_REDUCED,14,80
-PASSES,Bob
-PASSES,Charlie
-PASSES,Alice
-ITEM_PRICE_REDUCED,14,70
-PASSES,Bob
-PASSES,Charlie
-PASSES,Alice
-ITEM_PRICE_REDUCED,14,60
-PASSES,Bob
-PASSES,Charlie
-PASSES,Alice
-ITEM_PRICE_REDUCED,14,50
-BuysItemFor,Bob,14,50
-Floats,14
-
-SelectForAuctioning,Charlie,15
-PASSES,Alice
-PASSES,Bob
-ITEM_PRICE_REDUCED,15,90
-PASSES,Charlie
-PASSES,Alice
-PASSES,Bob
-ITEM_PRICE_REDUCED,15,80
-PASSES,Charlie
-PASSES,Alice
-PASSES,Bob
-ITEM_PRICE_REDUCED,15,70
-PASSES,Charlie
-PASSES,Alice
-PASSES,Bob
-ITEM_PRICE_REDUCED,15,60
-PASSES,Charlie
-PASSES,Alice
-PASSES,Bob
-ITEM_PRICE_REDUCED,15,50
-BuysItemFor,Charlie,15,50
-All 2-trains are sold out, 3-trains now available
-Floats,15
-Has,1,0
-Has,2,0
-Has,3,0
-Has,4,0
-Has,5,0
-Has,6,0
-Has,7,0
-Has,8,0
-Has,9,0
-Has,10,0
-Has,11,0
-Has,12,0
-Has,13,0
-Has,14,0
-Has,15,0
-Has,Alice,0
-Has,Bob,0
-Has,Charlie,0
-START_OR,0.1
-
-CompanyOperates,1,Alice
-LaysTileAt,1,8,I2,SW
-LaysTileAt,1,58,G2,S
-CompanyRevenue,1,90
-CompanySplits,1,90
-1 receives 45
-Payout,Alice,45,1,100
-
-CompanyOperates,2,Bob
-LaysTileAt,2,201,H3,NE
-LaysTileAt,2,4,F3,SW
-CompanyRevenue,2,40
-CompanySplits,2,40
-2 receives 20
-Payout,Bob,20,1,100
-
-CompanyOperates,3,Charlie
-LaysTileAt,3,8,K2,S
-LaysTileAt,3,3,M2,N
-CompanyRevenue,3,50
-CompanySplits,3,50
-3 receives 25
-Payout,Charlie,25,1,100
-
-CompanyOperates,4,Alice
-LaysTileAt,4,202,G10,NE
-LaysTileAt,4,4,H9,NW
-CompanyRevenue,4,40
-CompanySplits,4,40
-4 receives 20
-Payout,Alice,20,1,100
-
-CompanyOperates,5,Bob
-LaysTileAt,5,201,S8,SW
-LaysTileAt,5,8,U8,SW
-CompanyRevenue,5,60
-CompanySplits,5,60
-5 receives 30
-Payout,Bob,30,1,100
-
-CompanyOperates,6,Charlie
-LaysTileAt,6,58,L11,S
-LaysTileAt,6,57,K10,NW
-CompanyRevenue,6,60
-CompanySplits,6,60
-6 receives 30
-Payout,Charlie,30,1,100
-
-CompanyOperates,7,Alice
-LaysTileAt,7,9,F9,SW
-LaysTileAt,7,58,G8,NW
-CompanyRevenue,7,40
-CompanyS...
[truncated message content] |