|
From: <ev...@us...> - 2010-07-30 20:59:14
|
Revision: 1363
http://rails.svn.sourceforge.net/rails/?rev=1363&view=rev
Author: evos
Date: 2010-07-30 20:59:08 +0000 (Fri, 30 Jul 2010)
Log Message:
-----------
New option to enable selling stock of one company in one turn in separate actions at decreasing prices.
Only for 1830 at this stage.
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/data/1830/Game.xml
trunk/18xx/data/GamesList.xml
trunk/18xx/rails/game/ShareSellingRound.java
trunk/18xx/rails/game/StockRound.java
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2010-07-30 10:20:42 UTC (rev 1362)
+++ trunk/18xx/LocalisedText.properties 2010-07-30 20:59:08 UTC (rev 1363)
@@ -472,6 +472,7 @@
SELL_SHARES_LOG={0} sells {1} {2}% shares ({3}%) of {4} to Pool for {5}.
SellHowManyShares=Sell how many shares?
SellShares=Sell {0} {1}% share(s) ({2}%) of {3} for {4}
+SeparateSalesAtSamePrice=Allow separate sales at same price
SET_REVENUE=Set Revenue
SET_SCALE=Set Scale
SharesPutInTreasury=The remaining {0}% shares of {1} are put in its treasury
Modified: trunk/18xx/data/1830/Game.xml
===================================================================
--- trunk/18xx/data/1830/Game.xml 2010-07-30 10:20:42 UTC (rev 1362)
+++ trunk/18xx/data/1830/Game.xml 2010-07-30 20:59:08 UTC (rev 1363)
@@ -25,6 +25,7 @@
<GameOption name="UnlimitedTiles" type="toggle" default="no"/>
<GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/>
<GameOption name="TwoPlayersCertLimit70Percent" type="toggle" default="yes"/>
+ <GameOption name="SeparateSalesAtSamePrice" type="toggle" default="yes"/>
<GameParameters>
<PlayerShareLimit percentage="60">
<!-- Option "NumberOfPlayers" is automatically set
Modified: trunk/18xx/data/GamesList.xml
===================================================================
--- trunk/18xx/data/GamesList.xml 2010-07-30 10:20:42 UTC (rev 1362)
+++ trunk/18xx/data/GamesList.xml 2010-07-30 20:59:08 UTC (rev 1363)
@@ -30,6 +30,7 @@
<Option name="UnlimitedTiles" type="toggle" default="no"/>
<Option name="LeaveAuctionOnPass" type="toggle" default="no"/>
<Option name="TwoPlayersCertLimit70Percent" type="toggle" default="no"/>
+ <Option name="SeparateSalesAtSamePrice" type="toggle" default="yes"/>
<Players minimum="2" maximum="6"/>
</Game>
Modified: trunk/18xx/rails/game/ShareSellingRound.java
===================================================================
--- trunk/18xx/rails/game/ShareSellingRound.java 2010-07-30 10:20:42 UTC (rev 1362)
+++ trunk/18xx/rails/game/ShareSellingRound.java 2010-07-30 20:59:08 UTC (rev 1363)
@@ -22,7 +22,7 @@
Player sellingPlayer;
IntegerState cashToRaise;
PublicCompanyI unsellableCompany = null;
-
+
private List<SellShares> sellableShares;
/**
@@ -86,15 +86,15 @@
public void setSellableShares() {
possibleActions.addAll(sellableShares);
}
-
+
/**
- * Create a list of certificates that a player may sell in an emergency
+ * Create a list of certificates that a player may sell in an emergency
* share selling round, taking all rules taken into account.
*/
private List<SellShares> getSellableShares () {
-
+
sellableShares = new ArrayList<SellShares> ();
-
+
String compName;
int price;
int number;
@@ -318,7 +318,8 @@
int price;
// Get the sell price (does not change within a turn)
- if (sellPrices.containsKey(companyName)) {
+ if (sellPrices.containsKey(companyName)
+ && GameOption.convertValueToBoolean(getGameOption("SeparateSalesAtSamePrice"))) {
price = (sellPrices.get(companyName)).getPrice();
} else {
sellPrice = company.getCurrentSpace();
Modified: trunk/18xx/rails/game/StockRound.java
===================================================================
--- trunk/18xx/rails/game/StockRound.java 2010-07-30 10:20:42 UTC (rev 1362)
+++ trunk/18xx/rails/game/StockRound.java 2010-07-30 20:59:08 UTC (rev 1363)
@@ -412,7 +412,8 @@
* Check the price. If a cert was sold before this turn, the
* original price is still valid
*/
- if (sellPrices.containsKey(compName)) {
+ if (sellPrices.containsKey(compName)
+ && GameOption.convertValueToBoolean(getGameOption("SeparateSalesAtSamePrice"))) {
price = (sellPrices.get(compName)).getPrice();
} else {
price = company.getMarketPrice();
@@ -1039,7 +1040,8 @@
boolean soldBefore = sellPrices.containsKey(companyName);
// Get the sell price (does not change within a turn)
- if (soldBefore) {
+ if (soldBefore
+ && GameOption.convertValueToBoolean(getGameOption("SeparateSalesAtSamePrice"))) {
price = (sellPrices.get(companyName)).getPrice();
} else {
sellPrice = company.getCurrentSpace();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|