|
From: <ev...@us...> - 2010-09-07 19:42:07
|
Revision: 1415
http://rails.svn.sourceforge.net/rails/?rev=1415&view=rev
Author: evos
Date: 2010-09-07 19:42:01 +0000 (Tue, 07 Sep 2010)
Log Message:
-----------
Some share selling code reorganisation to allow (later) centralizing of follow-up actions.
Modified Paths:
--------------
trunk/18xx/rails/game/StockRound.java
trunk/18xx/rails/game/specific/_1856/StockRound_1856.java
Modified: trunk/18xx/rails/game/StockRound.java
===================================================================
--- trunk/18xx/rails/game/StockRound.java 2010-09-07 19:14:48 UTC (rev 1414)
+++ trunk/18xx/rails/game/StockRound.java 2010-09-07 19:42:01 UTC (rev 1415)
@@ -1070,7 +1070,6 @@
Bank.format(numberSold * price * shareUnits) ));
}
- // PROVISIONALLY MOVED UPWARDS
adjustSharePrice (company, numberSold, soldBefore);
if (!company.isClosed()) {
@@ -1097,8 +1096,6 @@
executeTradeCertificate(cert, pool, cert.getShares() * price);
}
}
- // PROVISIONALLY MOVED UPWARDS
- //adjustSharePrice (company, numberSold, soldBefore);
// Check if we still have the presidency
if (currentPlayer == company.getPresident()) {
Modified: trunk/18xx/rails/game/specific/_1856/StockRound_1856.java
===================================================================
--- trunk/18xx/rails/game/specific/_1856/StockRound_1856.java 2010-09-07 19:14:48 UTC (rev 1414)
+++ trunk/18xx/rails/game/specific/_1856/StockRound_1856.java 2010-09-07 19:42:01 UTC (rev 1415)
@@ -64,24 +64,21 @@
@Override
protected void adjustSharePrice (PublicCompanyI company, int numberSold, boolean soldBefore) {
+ if (!company.canSharePriceVary()) return;
+
+ int numberOfSpaces = numberSold;
if (company instanceof PublicCompany_CGR) {
- if (company.canSharePriceVary()) {
- int numberOfSpaces;
- if (company.getShareUnit() == 5) {
- // Take care for selling 5% shares in multiple blocks per turn
- numberOfSpaces
- = (sharesSoldSoFar.intValue() + numberSold)/2
- - squaresDownSoFar.intValue();
- sharesSoldSoFar.add(numberSold);
- squaresDownSoFar.add(numberOfSpaces);
- } else {
- numberOfSpaces = numberSold;
- }
- stockMarket.sell(company, numberOfSpaces);
+ if (company.getShareUnit() == 5) {
+ // Take care for selling 5% shares in multiple blocks per turn
+ numberOfSpaces
+ = (sharesSoldSoFar.intValue() + numberSold)/2
+ - squaresDownSoFar.intValue();
+ sharesSoldSoFar.add(numberSold);
+ squaresDownSoFar.add(numberOfSpaces);
}
- } else {
- super.adjustSharePrice (company, numberSold, soldBefore);
}
+
+ super.adjustSharePrice (company, numberOfSpaces, soldBefore);
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|