|
From: Erik V. <ev...@us...> - 2012-01-25 14:01:30
|
LocalisedText.properties | 6
data/1880/CompanyManager.xml | 59 +
data/1880/Game.xml | 29
data/1880/StockMarket.xml | 8
data/1880/Tiles.xml | 2
rails/game/Company.java | 2
rails/game/GameManager.java | 16
rails/game/PublicCompany.java | 5
rails/game/PublicCompanyI.java | 2
rails/game/Round.java | 3
rails/game/StockMarket.java | 13
rails/game/StockMarketI.java | 1
rails/game/StockRound.java | 4
rails/game/StockSpace.java | 2
rails/game/StockSpaceI.java | 5
rails/game/StockSpaceType.java | 17
rails/game/StockSpaceTypeI.java | 16
rails/game/action/BuyStartItem.java | 12
rails/game/specific/_1880/BuyStartItem_1880.java | 164 +++++
rails/game/specific/_1880/GameManager_1880.java | 102 +++
rails/game/specific/_1880/OperatingRound_1880.java | 334 ++++++++++-
rails/game/specific/_1880/PublicCompany_1880.java | 169 +++++
rails/game/specific/_1880/StartRound_1880.java | 70 +-
rails/game/specific/_1880/StockMarket_1880.java | 169 +++++
rails/game/specific/_1880/StockRound_1880.java | 121 +++
rails/ui/swing/StartRoundWindow.java | 46 -
rails/ui/swing/gamespecific/_1880/StartRoundWindow_1880.java | 121 +++
rails/ui/swing/gamespecific/_1880/StatusWindow_1880.java | 34 +
tiles/TileDictionary.18t | 25
tiles/TileDictionary.xml | 4
tiles/svg/tile235.svg | 145 ++++
31 files changed, 1577 insertions(+), 129 deletions(-)
New commits:
commit b1d3ff5d36d8bfd9c0a226e6c5f433c917ecd8fd
Author: Erik Vos <eri...@xs...>
Date: Wed Jan 25 14:55:51 2012 +0100
1880 tile 235 added to TileDesigner
diff --git a/tiles/TileDictionary.18t b/tiles/TileDictionary.18t
index d14e28d..9038379 100644
--- a/tiles/TileDictionary.18t
+++ b/tiles/TileDictionary.18t
@@ -17417,5 +17417,30 @@ object TTilesWrapper
JunType = jtCity
Revenue = 40
end>
+ end
+ item
+ Code = 235
+ LongName = 'OO'
+ Category = 'OO'
+ CategoryPosition = tp2CornerC
+ Level = tlMapUpgradableToGreen
+ Connections = <
+ item
+ Position1 = tp2SideF
+ Position2 = tp4SideF
+ end>
+ Junctions = <
+ item
+ JunType = jtCity
+ Position = tp2SideD
+ Revenue = 30
+ RevenuePosition = tp3CornerB
+ end
+ item
+ JunType = jtCity
+ Position = tp2SideF
+ Revenue = 30
+ RevenuePosition = tp3CornerB
+ end>
end>
end
commit 90483652116407d14af524316c5482d9db3687bc
Author: Martin Brumm <dr....@t-...>
Date: Wed Jan 25 14:30:11 2012 +0100
1880 patches
diff --git a/LocalisedText.properties b/LocalisedText.properties
index ee9b8a4..27d1085 100644
--- a/LocalisedText.properties
+++ b/LocalisedText.properties
@@ -688,9 +688,11 @@ Version=Version
VersionOf=version of {0}
WantToReplaceToken=Do you want to replace the {0} home token with one of {1}?
WarningNeedCash=Warning: {0} will be deducted from the company revenue or from your personal cash
+WHICH_BUILDING_RIGHT={0} please choose the Building Rights for {1}
WHICH_PRICE=Which price?
WHICH_PRIVATE=Which Private?
-WHICH_PRIVATE_PRICE=Buy {0} for which price (valid range {1} to {2})?
+WHICH_PRIVATE_PRICE=Buy {0} for which price (valid range {1} to {2})?
+WHICH_RIGHT=Which Building Right ?
WHICH_START_PRICE={0} please set the start price for {1}
WhichStation=Which Station?
WHICH_TRAIN=Which train
@@ -729,4 +731,4 @@ YouMustRaiseCash=You must raise {0} cash by selling shares
YouMustRaiseCashButCannot=You must still raise {0}, but you can''t sell any more shares.
YouMustSelect1=You must select {0} item(s)
YouMustSelect2=You must select between {0} and {1} items
-YourTurn={0}, it''s your turn again
\ No newline at end of file
+YourTurn={0}, it''s your turn again
diff --git a/data/1880/CompanyManager.xml b/data/1880/CompanyManager.xml
index ecaea80..c4b55f7 100644
--- a/data/1880/CompanyManager.xml
+++ b/data/1880/CompanyManager.xml
@@ -12,7 +12,7 @@
<Payout split="no"/>
</CompanyType>
- <CompanyType name="Minor" class="rails.game.PublicCompany">
+ <CompanyType name="Minor" class="rails.game.specific._1880.PublicCompany_1880">
<ShareUnit percentage="100"/>
<Certificate type="President" shares="1"/>
<StockPrice market="no"/>
@@ -21,18 +21,18 @@
</BaseTokens>
<Payout split="no"/>
<Trains limit="1" mandatory="no"/>
+ <CanUseSpecialProperties/>
+ <!-- Specialproperties -->
+ <!-- Specialproperty condition="ifNotConnected" when="orTurn"
+ class="rails.game.special.TrainLoan" -->
+ <!-- /Specialproperty-->
+ <!-- /Specialproperties-->
</CompanyType>
<CompanyType name="Private" class="rails.game.PrivateCompany"/>
- <CompanyType name="Major" class="rails.game.PublicCompany"
- capitalisation="incremental">
- <Capitalisation Type="incremental"/>
- <!--TileLays>
- <Number colour="yellow" phase="2+2,3,3+3,4,4+4,6,6e,8,8e,10"
- number="2"/>
- </TileLays-->
- <Float percentage="60"/>
+ <CompanyType name="Major" class="rails.game.specific._1880.PublicCompany_1880">
+ <Float percentage="20"/>
<StockPrice par="yes"/>
<ShareUnit percentage="10"/>
<Certificate type="President" shares="2"/>
@@ -40,9 +40,9 @@
<BaseTokens>
<LayCost method="sequence" cost="0,40,100"/>
</BaseTokens>
- <Capitalisation type="incremental"/>
<Trains limit="4,3,2"/>
<CanUseSpecialProperties/>
+
</CompanyType>
<Company name="WR" longname="Woosong Railway" type="Private" basePrice="5"
@@ -60,28 +60,40 @@
<Phase>4</Phase>
</ClosingConditions>
</Company>
- <Company name="YC" longname="Yanda Ferry
- Company" type="Private"
+ <Company name="YC" longname="Yanda Ferry Company" type="Private"
basePrice="25" revenue="10">
- <!-- SpecialProperty condition="ifOwnedByPlayer" when="revenuecalcStep" revenue="10" -->
+ <SpecialProperties>
+ <SpecialProperty condition="ifOwnedByPlayer" when="revenueStep"
+ class="rails.game.special.LocatedBonus" transfer="toCompany">
+ <LocatedBonus name="Ferry" location="F12,F14,I15" value="10"/>
+ </SpecialProperty>
+ </SpecialProperties>
</Company>
<Company name="TL" longname="Taiwan Western Line" type="Private" basePrice="45"
revenue="15">
- <!-- SpecialProperty condition="ifOwnedByPlayer" when="revenuecalcStep" revenue="20" -->
- </Company>
- <Company name="CC" longname="Chinese Rivers Ferry
- Company" type="Private"
+ <SpecialProperties>
+ <SpecialProperty condition="ifOwnedByPlayer" when="revenueStep"
+ class="rails.game.special.LocatedBonus" transfer="toCompany">
+ <LocatedBonus name="Taiwan" location="N16" value="20"/>
+ </SpecialProperty>
+ </SpecialProperties>
+ </Company>
+ <Company name="CC" longname="Chinese Rivers Ferry Company" type="Private"
basePrice="70" revenue="20">
+ <SpecialProperties>
<SpecialProperty condition="ifOwnedByPlayer" when="tileLayingStep"
class="rails.game.special.SpecialTileLay">
<SpecialTileLay location="M15" extra="no" free="yes"/>
</SpecialProperty>
+ </SpecialProperties>
</Company>
<Company name="JO" longname="Jeme Tien Yow Engineer Office" type="Private"
basePrice="70" revenue="20">
- <SpecialProperty condition="ifOwnedByPlayer" when="tileLayingStep"
- class="rails.game.specific._1880.BuildingPermit">
- </SpecialProperty>
+ <!-- SpecialProperties-->
+ <!-- SpecialProperty condition="ifOwnedByPlayer" when="tileLayingStep"
+ class="rails.game.specific._1880.BuildingPermit"-->
+ <!-- /SpecialProperty-->
+ <!-- -->/SpecialProperties-->
</Company>
<Company name="IG" longname="Imperial Qing Government" type="Private"
basePrice="160" revenue="20">
@@ -89,17 +101,18 @@
</Company>
<Company name="RC" longname="Rocket Company" type="Private" basePrice="70"
revenue="0">
- <SpecialProperty condition="ifOwnedByPlayer" when="trainBuyingStep"
- class="rails.game.special.SpecialTrainBuy"/>
+ <!-- SpecialProperties-->
+ <!-- SpecialProperty condition="ifOwnedByPlayer" when="trainBuyingStep"
+ class="rails.game.special.SpecialTrainBuy"/-->
<!-- Kostenfreie Lok bei Phasenwechsel durch Lokkauf -->
<!-- Can exchange Certificate for actual train in one phase 2,2+3,3,3+3,4
as soon as train has been bought -->
<!-- The train can be moved upon purchase into one company owned by the
owner of the certificate --> <!-- Company must have space for the new train, but can hand back an older
train to bank (2+2,3,3+3) -->
+ <!-- /SpecialProperties-->
<ClosingConditions>
<Phase>5</Phase>
- <SpecialProperties condition="ifExercised"/>
</ClosingConditions>
</Company>
<Company name="BCR" longname="Baocheng Railway" type="Major" tokens="3"
diff --git a/data/1880/Game.xml b/data/1880/Game.xml
index 1a0ff10..814f622 100644
--- a/data/1880/Game.xml
+++ b/data/1880/Game.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ComponentManager>
- <Component name="GameManager" class="rails.game.GameManager">
+ <Component name="GameManager" class="rails.game.specific._1880.GameManager_1880">
<Game name="1880"/>
<GameOption name="RouteAwareness" values="Highlight,Deactivate"
default="Deactivate"/>
@@ -23,7 +23,7 @@
<StatusWindow class="rails.ui.swing.StatusWindow"/>
<StartRoundWindow
class="rails.ui.swing.gamespecific._1880.StartRoundWindow_1880"/>
- </GuiClasses>
+ </GuiClasses>
<EndOfGame/>
<!-- need to implement the 3 OR set limit after purchase of first 8 TrainType -->
@@ -92,7 +92,8 @@
<Component name="PhaseManager" class="rails.game.PhaseManager">
<Phase name="2" realName="A1">
<Tiles colour="yellow">
- <Lays companyType="Major" colour="yellow" number="2"/>
+ <Lays companyType="Major" colour="yellow" number="1"/>
+ <Lays companyType="Minor" colour="yellow" number="1"/>
</Tiles>
<OperatingRounds number="-1"/>
<Float percentage="20"/>
@@ -103,28 +104,37 @@
</Phase>
<Phase name="3" realName="B1">
<Tiles colour="yellow,green"/>
+ <Lays companyType="Major" colour="yellow" number="2"/>
+ <Lays companyType="Minor" colour="yellow" number="1"/>
+ <Lays companyType="Major" colour="green" number="1"/>
+ <Lays companyType="Minor" colour="green" number="1"/>
+
<Float percentage="30"/>
<Stocks avail="10"/>
<OffBoardRevenue step="2"/>
+ <Action name="RaisingCertAvailability"/>
</Phase>
<Phase name="3+3" realName="B2">
<OffBoardRevenue step="2"/>
</Phase>
<Phase name="4" realName="B3">
+ <Action name="CommunistTakeOver"/>
<OffBoardRevenue step="2"/>
<Privates close="yes"/>
<Investors active="no"/>
- <Communists active="yes"/>
<Float percentage="40"/>
<Trains limitStep="2" rusted="2"/>
</Phase>
<Phase name="4+4" realName="C1">
<Tiles colour="yellow,green,brown"/>
+ <Lays companyType="Major" colour="yellow" number="2"/>
+ <Lays companyType="Major" colour="green" number="1"/>
+ <Lays companyType="Major" colour="brown" number="1"/>
<OffBoardRevenue step="3"/>
<Trains rusted="2+2"/>
</Phase>
<Phase name="6" realName="C2">
- <Communists active="no"/>
+ <Action name="ShanghaiExchangeOpen"/>
<Float percentage="60"/>
<OffBoardRevenue step="3"/>
<Trains limitStep="3" rusted="3"/>
@@ -135,6 +145,10 @@
</Phase>
<Phase name="8" realName="D1">
<Tiles colour="yellow,green,brown,grey"/>
+ <Lays companyType="Major" colour="yellow" number="2"/>
+ <Lays companyType="Major" colour="green" number="1"/>
+ <Lays companyType="Major" colour="brown" number="1"/>
+ <Lays companyType="Major" colour="grey" number="1"/>
<OffBoardRevenue step="4"/>
<Trains limitStep="3" rusted="4"/>
</Phase>
@@ -150,8 +164,5 @@
class="rails.game.specific._1880.ExpressTrainRevenueModifier"/>
</Component>
</Component>
- <Component name="RevenueManager" class="rails.algorithms.RevenueManager">
- <Modifier class="rails.game.specific._1826.TGVModifier"/>
- </Component>
-
+
</ComponentManager>
\ No newline at end of file
diff --git a/data/1880/StockMarket.xml b/data/1880/StockMarket.xml
index 5960108..c3dfccf 100644
--- a/data/1880/StockMarket.xml
+++ b/data/1880/StockMarket.xml
@@ -42,19 +42,19 @@
<StockSpace name="C9" price="60" />
<StockSpace name="D1" price="105" />
<StockSpace name="D2" price="100" >
- <StartSpace parslots="4"/>
+ <StartSpace/>
</StockSpace>
<StockSpace name="D3" price="95" />
<StockSpace name="D4" price="90" >
- <StartSpace parslots="4"/>
+ <StartSpace/>
</StockSpace>
<StockSpace name="D5" price="85" />
<StockSpace name="D6" price="80" >
- <StartSpace parslots="4"/>
+ <StartSpace/>
</StockSpace>
<StockSpace name="D7" price="75" />
<StockSpace name="D8" price="70" >
- <StartSpace parslots="4"/>
+ <StartSpace/>
</StockSpace>
<StockSpace name="D9" price="65" />
<StockSpace name="E1" price="110" />
diff --git a/data/1880/Tiles.xml b/data/1880/Tiles.xml
index 34f548a..6ed5fd7 100644
--- a/data/1880/Tiles.xml
+++ b/data/1880/Tiles.xml
@@ -62,7 +62,7 @@
<Track from="city1" gauge="normal" to="side0"/>
</Tile><Tile colour="yellow" id="235" name="235">
<Station id="city1" position="502" slots="1" type="City" value="20"/>
- <Station id="city2" position="352" slots="1" type="City" value="20"/>
+ <Station id="city2" position="352" slots="1" type="City"/>
<Track from="city1" gauge="normal" to="side5"/>
</Tile><Tile colour="yellow" id="8850" name="8850">
<Station id="city1" position="352" type="Town" value="20"/>
diff --git a/rails/game/Company.java b/rails/game/Company.java
index f96b3a8..0b2aa2f 100644
--- a/rails/game/Company.java
+++ b/rails/game/Company.java
@@ -46,7 +46,7 @@ Cloneable, Comparable<Company> {
/** Closed state */
protected BooleanState closedObject;
- // Moved here from PrivayeCOmpany on behalf of 1835
+ // Moved here from PrivateCompany on behalf of 1835
protected List<SpecialPropertyI> specialProperties = null;
protected static Logger log =
diff --git a/rails/game/GameManager.java b/rails/game/GameManager.java
index 8046968..8058d91 100644
--- a/rails/game/GameManager.java
+++ b/rails/game/GameManager.java
@@ -226,6 +226,10 @@ public class GameManager implements ConfigurableComponentI, GameManagerI {
protected static Logger log =
Logger.getLogger(GameManager.class.getPackage().getName());
+ //State variable to be able to determine a changed playerorder after a Startround Sub Phase
+ //Currently use in 1880 (1853, 1844, 1837, or any other game that reorders players after result of startinground)
+ public BooleanState playerOrderHasChanged = new BooleanState("PlayerOrderHasChange", false);
+
public GameManager() {
gmName = GM_NAME;
gmKey = GM_KEY;
@@ -1341,7 +1345,7 @@ public class GameManager implements ConfigurableComponentI, GameManagerI {
addToNextPlayerMessages(msg, true);
}
- private void finishGame() {
+ protected void finishGame() {
gameOver.set(true);
String message = LocalText.getText("GameOver");
@@ -1885,21 +1889,21 @@ public class GameManager implements ConfigurableComponentI, GameManagerI {
public Player reorderPlayersByCash (boolean ascending) {
final boolean _ascending = ascending;
- Collections.sort (players, new Comparator<Player>() {
+ Collections.sort (this.players, new Comparator<Player>() {
public int compare (Player p1, Player p2) {
return _ascending ? p1.getCash() - p2.getCash() : p2.getCash() - p1.getCash();
}
});
Player player;
- for (int i=0; i<players.size(); i++) {
- player = players.get(i);
+ for (int i=0; i<this.players.size(); i++) {
+ player = this.players.get(i);
player.setIndex (i);
- playerNames.set (i, player.getName());
+ this.playerNames.set (i, player.getName());
log.debug("New player "+i+" is "+player.getName() +" (cash="+Bank.format(player.getCash())+")");
}
- return players.get(0);
+ return this.players.get(0);
}
public void resetStorage() {
diff --git a/rails/game/PublicCompany.java b/rails/game/PublicCompany.java
index 16c25ee..3ad1c2c 100644
--- a/rails/game/PublicCompany.java
+++ b/rails/game/PublicCompany.java
@@ -792,6 +792,7 @@ public class PublicCompany extends Company implements PublicCompanyI {
name + "_" + colour + "_ExtraTileTurns", turns));
}
+
/** Reset turn objects */
public void initTurn() {
@@ -1963,6 +1964,7 @@ public class PublicCompany extends Company implements PublicCompanyI {
// New style
int tileLays = phase.getTileLaysPerColour(getTypeName(), tileColour);
+
if (tileLays <= 1) {
extraTileLays = null;
return tileLays;
@@ -1973,6 +1975,8 @@ public class PublicCompany extends Company implements PublicCompanyI {
if (turnsWithExtraTileLays != null) {
extraTiles = turnsWithExtraTileLays.get(tileColour);
}
+
+
if (extraTiles != null) {
if (extraTiles.intValue() == 0) {
extraTiles = null;
@@ -2091,4 +2095,5 @@ public class PublicCompany extends Company implements PublicCompanyI {
public boolean hasRoute() {
return true;
}
+
}
diff --git a/rails/game/PublicCompanyI.java b/rails/game/PublicCompanyI.java
index f39b619..ab08a06 100644
--- a/rails/game/PublicCompanyI.java
+++ b/rails/game/PublicCompanyI.java
@@ -16,7 +16,7 @@ public interface PublicCompanyI extends CompanyI, CashHolder, TokenHolder {
public static final int CAPITALISE_INCREMENTAL = 1;
public static final int CAPITALISE_WHEN_BOUGHT = 2;
-
+
public void setIndex (int index);
diff --git a/rails/game/Round.java b/rails/game/Round.java
index b162080..0dcfd98 100644
--- a/rails/game/Round.java
+++ b/rails/game/Round.java
@@ -13,6 +13,7 @@ import rails.common.*;
import rails.game.action.*;
import rails.game.move.*;
import rails.game.special.SpecialPropertyI;
+import rails.game.specific._1880.PublicCompany_1880;
import rails.game.state.BooleanState;
/**
@@ -373,7 +374,7 @@ public abstract class Round implements RoundI {
} else if (capitalisationMode == PublicCompanyI.CAPITALISE_WHEN_BOUGHT) {
// Cash goes directly to treasury at each buy (as in 1856 before phase 6)
capFactor = 0;
- }
+ }
int price = company.getIPOPrice();
cash = capFactor * price;
} else {
diff --git a/rails/game/StockMarket.java b/rails/game/StockMarket.java
index c117ead..d64e167 100644
--- a/rails/game/StockMarket.java
+++ b/rails/game/StockMarket.java
@@ -130,6 +130,7 @@ public class StockMarket implements StockMarketI, ConfigurableComponentI {
if (spaceTag.getChild(StockSpaceI.START_SPACE_TAG) != null) {
space.setStart(true);
startSpaces.add(space);
+
}
space.setClosesCompany(spaceTag.getChild(StockSpaceI.CLOSES_COMPANY_TAG) != null);
space.setEndsGame(spaceTag.getChild(StockSpaceI.GAME_OVER_TAG) != null);
@@ -344,14 +345,14 @@ public class StockMarket implements StockMarketI, ConfigurableComponentI {
public int[] getStartPrices() {
return startPrices;
}
-
+
public StockSpaceI getStartSpace(int price) {
for (StockSpaceI square : startSpaces) {
if (square.getPrice() == price) return square;
}
return null;
}
-
+
public PublicCertificate removeShareFromPile(PublicCertificate stock) {
if (ipoPile.contains(stock)) {
int index = ipoPile.lastIndexOf(stock);
@@ -378,4 +379,12 @@ public class StockMarket implements StockMarketI, ConfigurableComponentI {
return numRows;
}
+ public int getNumberOfStartPrices() {
+ int result = 0;
+ for(int i=0; i< startPrices.length; i++) {
+ if (startPrices[i]!= 0) result++;
+ }
+ return result;
+ }
+
}
diff --git a/rails/game/StockMarketI.java b/rails/game/StockMarketI.java
index a878360..96ed186 100644
--- a/rails/game/StockMarketI.java
+++ b/rails/game/StockMarketI.java
@@ -48,4 +48,5 @@ public interface StockMarketI extends ConfigurableComponentI {
public void processMoveToStackPosition(PublicCompanyI company, StockSpaceI from,
StockSpaceI to, int toStackPosition);
+
}
diff --git a/rails/game/StockRound.java b/rails/game/StockRound.java
index ca25bf3..0d3fcf8 100644
--- a/rails/game/StockRound.java
+++ b/rails/game/StockRound.java
@@ -1657,4 +1657,8 @@ public class StockRound extends Round {
sellObligationLifted.add(company);
}
+ /* (non-Javadoc)
+ * @see rails.game.Round#floatCompany(rails.game.PublicCompanyI)
+ */
+
}
diff --git a/rails/game/StockSpace.java b/rails/game/StockSpace.java
index 1945cbf..5853946 100644
--- a/rails/game/StockSpace.java
+++ b/rails/game/StockSpace.java
@@ -247,7 +247,7 @@ public class StockSpace extends ModelObject implements StockSpaceI {
public void setStart(boolean b) {
start = b;
}
-
+
/**
* @param set if token is left of ledge
*/
diff --git a/rails/game/StockSpaceI.java b/rails/game/StockSpaceI.java
index 83cc3e7..578a6d5 100644
--- a/rails/game/StockSpaceI.java
+++ b/rails/game/StockSpaceI.java
@@ -29,6 +29,9 @@ public interface StockSpaceI // extends TokenHolderI
*/
public static final String START_SPACE_TAG = "StartSpace";
+ /** The name of the XML tag for the number of Parslots per Startprice */
+ public static final String START_SPACE_SLOTS_TAG ="ParSlots";
+
/** The name of the XML tag for the "below ledge" property. */
public static final String BELOW_LEDGE_TAG = "BelowLedge";
@@ -38,7 +41,7 @@ public interface StockSpaceI // extends TokenHolderI
/** The name of the XML tag for the "closes company" property. */
public static final String CLOSES_COMPANY_TAG = "ClosesCompany";
- /** The name of the XML tag for the "gamn over" property. */
+ /** The name of the XML tag for the "game over" property. */
public static final String GAME_OVER_TAG = "GameOver";
// No constructors (yet) for the booleans, which are rarely needed. Use the
diff --git a/rails/game/StockSpaceType.java b/rails/game/StockSpaceType.java
index 6e5295f..c1e965d 100644
--- a/rails/game/StockSpaceType.java
+++ b/rails/game/StockSpaceType.java
@@ -22,6 +22,7 @@ public class StockSpaceType implements StockSpaceTypeI {
protected boolean noCertLimit = false; // In yellow zone
protected boolean noHoldLimit = false; // In orange zone (1830)
protected boolean noBuyLimit = false; // In brown zone (1830)
+ protected int addRevenue = 0; // additional revenue for company listed at that space (1880)
public static final String WHITE = "FFFFFF";
@@ -72,6 +73,14 @@ public class StockSpaceType implements StockSpaceTypeI {
public boolean isNoHoldLimit() {
return noHoldLimit;
}
+
+ /**
+ * @return returns the additional revenue per 10% share
+ */
+ public int hasAddRevenue() {
+ return addRevenue;
+ }
+
/*--- Setters ---*/
/**
@@ -94,5 +103,11 @@ public class StockSpaceType implements StockSpaceTypeI {
public void setNoHoldLimit(boolean b) {
noHoldLimit = b;
}
-
+ /**
+ * @param revenue additional Revenue for a company listed at this space
+ */
+ public void setAddRevenue(int revenue) {
+ addRevenue = revenue;
+ }
+
}
diff --git a/rails/game/StockSpaceTypeI.java b/rails/game/StockSpaceTypeI.java
index ca896f7..a84aa63 100644
--- a/rails/game/StockSpaceTypeI.java
+++ b/rails/game/StockSpaceTypeI.java
@@ -41,8 +41,8 @@ public interface StockSpaceTypeI {
* The name of the XML tag for the "NoBuyLimit" property. (1830: brown area)
*/
public static final String NO_BUY_LIMIT_TAG = "NoBuyLimit";
-
- /**
+
+ /**
* @return Color
*/
public abstract Color getColour();
@@ -67,6 +67,11 @@ public interface StockSpaceTypeI {
* @return if space triggers Stock not counting toward certificate limit
*/
public boolean isNoHoldLimit();
+
+ /**
+ * @return returns the additional revenue per 10% share
+ */
+ public int hasAddRevenue();
/**
* @param b
@@ -82,5 +87,10 @@ public interface StockSpaceTypeI {
* @param b
*/
public void setNoHoldLimit(boolean b);
-
+
+ /**
+ * @param revenue additional Revenue for a company listed at this space
+ */
+ public void setAddRevenue(int revenue);
+
}
diff --git a/rails/game/action/BuyStartItem.java b/rails/game/action/BuyStartItem.java
index 2b203a7..a66ac7e 100644
--- a/rails/game/action/BuyStartItem.java
+++ b/rails/game/action/BuyStartItem.java
@@ -5,6 +5,8 @@
*/
package rails.game.action;
+import java.util.BitSet;
+
import rails.game.PublicCompanyI;
import rails.game.StartItem;
@@ -16,12 +18,13 @@ public class BuyStartItem extends StartItemAction {
/* Server-provided fields */
private int price;
private boolean selected;
- private boolean sharePriceToSet = false;
- private String companyNeedingSharePrice = null;
- private boolean setSharePriceOnly = false;
+ protected boolean sharePriceToSet = false;
+ protected String companyNeedingSharePrice = null;
+ protected boolean setSharePriceOnly = false;
// Client-provided fields
private int associatedSharePrice;
+ private BitSet associatedBuildingRight;
public static final long serialVersionUID = 1L;
@@ -38,7 +41,7 @@ public class BuyStartItem extends StartItemAction {
PublicCompanyI company;
if ((company = startItem.needsPriceSetting()) != null) {
- sharePriceToSet = true;
+ sharePriceToSet=true;
companyNeedingSharePrice = company.getName();
}
}
@@ -102,4 +105,5 @@ public class BuyStartItem extends StartItemAction {
return b.toString();
}
+
}
diff --git a/rails/game/specific/_1880/BuyStartItem_1880.java b/rails/game/specific/_1880/BuyStartItem_1880.java
new file mode 100644
index 0000000..3efa52c
--- /dev/null
+++ b/rails/game/specific/_1880/BuyStartItem_1880.java
@@ -0,0 +1,164 @@
+/**
+ *
+ */
+package rails.game.specific._1880;
+
+import rails.game.StartItem;
+import rails.game.action.BuyStartItem;
+
+import java.util.BitSet;
+
+import rails.game.PublicCompanyI;
+import rails.game.action.PossibleAction;
+/**
+ * @author Martin Brumm
+ *
+ */
+public class BuyStartItem_1880 extends BuyStartItem {
+
+ public static final long serialVersionUID = 1L;
+
+ private BitSet buildingRights;
+
+ private BitSet associatedBuildingRight;
+ /**
+ * @param startItem
+ * @param price
+ * @param selected
+ * @param setSharePriceOnly
+ */
+ public BuyStartItem_1880(StartItem startItem, int price, boolean selected,
+ boolean setSharePriceOnly) {
+
+
+ super(startItem, price, selected, setSharePriceOnly);
+ // TODO Auto-generated constructor stub
+ this.buildingRights = new BitSet(4);
+ }
+
+
+ public BuyStartItem_1880(StartItem startItem, int price, boolean selected,
+ boolean setSharePriceOnly, BitSet buildingRight) {
+
+ super(startItem,price,selected,setSharePriceOnly);
+ this.buildingRights = buildingRight;
+
+ PublicCompanyI company;
+ if ((company = startItem.needsPriceSetting()) != null) {
+ sharePriceToSet = true;
+ companyNeedingSharePrice = company.getName();
+ }
+ }
+
+ /**
+ * @param startItem
+ * @param price
+ * @param selected
+ */
+ public BuyStartItem_1880(StartItem startItem, int price, boolean selected) {
+ super(startItem, price, selected);
+ // TODO Auto-generated constructor stub
+ this.buildingRights = new BitSet(4);
+ }
+
+ public boolean equalsAsOption(PossibleAction action) {
+ if (!(action instanceof BuyStartItem_1880)) return false;
+ BuyStartItem_1880 a = (BuyStartItem_1880) action;
+ return a.startItem == startItem && a.itemIndex == itemIndex
+ && a.getPrice() == getPrice() && a.buildingRights == buildingRights;
+ }
+ public boolean equalsAsAction(PossibleAction action) {
+ if (!(action instanceof BuyStartItem_1880)) return false;
+ BuyStartItem_1880 a = (BuyStartItem_1880) action;
+ return a.equalsAsOption(this)
+ && a.getAssociatedSharePrice() == getAssociatedSharePrice()
+ && a.associatedBuildingRight == associatedBuildingRight;
+ }
+ public String toString() {
+ StringBuffer b = new StringBuffer();
+ b.append("BuyStartItem_1880 ").append(startItemName).append(" price=").append(
+ getPrice()).append(" selected=").append(isSelected());
+
+ if (sharePriceToSet) {
+ b.append(" shareprice=").append(getAssociatedSharePrice()).append(" BuildingRight=").append(buildingRightToString(buildingRights)).append(
+ " for company " + ...
[truncated message content] |