|
From: <ev...@us...> - 2010-12-15 21:49:18
|
Revision: 1459
http://rails.svn.sourceforge.net/rails/?rev=1459&view=rev
Author: evos
Date: 2010-12-15 21:49:12 +0000 (Wed, 15 Dec 2010)
Log Message:
-----------
Fix UI bug when only one start price is possible because of lack of cash
Modified Paths:
--------------
trunk/18xx/rails/game/action/StartCompany.java
trunk/18xx/rails/ui/swing/GameStatus.java
Modified: trunk/18xx/rails/game/action/StartCompany.java
===================================================================
--- trunk/18xx/rails/game/action/StartCompany.java 2010-11-09 15:45:47 UTC (rev 1458)
+++ trunk/18xx/rails/game/action/StartCompany.java 2010-12-15 21:49:12 UTC (rev 1459)
@@ -38,7 +38,7 @@
}
public boolean mustSelectAPrice() {
- return startPrices != null && startPrices.length > 1;
+ return startPrices != null/* && startPrices.length > 1*/;
}
public void setStartPrice(int startPrice) {
Modified: trunk/18xx/rails/ui/swing/GameStatus.java
===================================================================
--- trunk/18xx/rails/ui/swing/GameStatus.java 2010-11-09 15:45:47 UTC (rev 1458)
+++ trunk/18xx/rails/ui/swing/GameStatus.java 2010-12-15 21:49:12 UTC (rev 1459)
@@ -623,13 +623,22 @@
startPrices =
((StartCompany) buy).getStartPrices();
Arrays.sort(startPrices);
- for (int i = 0; i < startPrices.length; i++) {
- options.add(LocalText.getText("StartCompany",
- Bank.format(startPrices[i]),
- sharePerCert,
- Bank.format(sharesPerCert * startPrices[i]) ));
+ if (startPrices.length > 1) {
+ for (int i = 0; i < startPrices.length; i++) {
+ options.add(LocalText.getText("StartCompany",
+ Bank.format(startPrices[i]),
+ sharePerCert,
+ Bank.format(sharesPerCert * startPrices[i]) ));
+ buyActions.add(buy);
+ buyAmounts.add(startPrices[i]);
+ }
+ } else {
+ options.add (LocalText.getText("StartACompany",
+ companyName,
+ company.getPresidentsShare().getShare(),
+ Bank.format(company.getPresidentsShare().getShares() * startPrices[0])));
buyActions.add(buy);
- buyAmounts.add(startPrices[i]);
+ buyAmounts.add(startPrices[0]);
}
} else {
startPrices = new int[] {((StartCompany) buy).getPrice()};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|