|
From: <ste...@us...> - 2010-07-25 19:15:40
|
Revision: 1358
http://rails.svn.sourceforge.net/rails/?rev=1358&view=rev
Author: stefanfrey
Date: 2010-07-25 19:15:33 +0000 (Sun, 25 Jul 2010)
Log Message:
-----------
Fixed reported bug (feature request):
1889 offboards- rollover scores incorrect ('D' missing) - ID: 3033639
Shows bonus information in tooltip now
Modified Paths:
--------------
trunk/18xx/rails/algorithms/RevenueBonusTemplate.java
trunk/18xx/rails/ui/swing/hexmap/GUIHex.java
Modified: trunk/18xx/rails/algorithms/RevenueBonusTemplate.java
===================================================================
--- trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2010-07-25 17:08:37 UTC (rev 1357)
+++ trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2010-07-25 19:15:33 UTC (rev 1358)
@@ -13,6 +13,7 @@
import rails.game.PhaseManager;
import rails.game.TrainManager;
import rails.game.TrainTypeI;
+import rails.util.LocalText;
import rails.util.Tag;
/**
@@ -132,6 +133,32 @@
}
}
}
+
+ /**
+ * @return bonus name for display
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return bonus toolTip text
+ */
+ public String getToolTip() {
+ StringBuffer s = new StringBuffer();
+ s.append(value);
+ if (identPhases.size() != 0) {
+ s.append(identPhases);
+ if (identTrainTypes.size() != 0) {
+ s.append("");
+ }
+ }
+ if (identTrainTypes.size() != 0) {
+ s.append(identTrainTypes);
+ }
+ return s.toString();
+ }
+
public String toString() {
StringBuffer s = new StringBuffer();
s.append("RevenueBonusTemplate");
Modified: trunk/18xx/rails/ui/swing/hexmap/GUIHex.java
===================================================================
--- trunk/18xx/rails/ui/swing/hexmap/GUIHex.java 2010-07-25 17:08:37 UTC (rev 1357)
+++ trunk/18xx/rails/ui/swing/hexmap/GUIHex.java 2010-07-25 19:15:33 UTC (rev 1358)
@@ -8,6 +8,8 @@
import org.apache.log4j.Logger;
+import rails.algorithms.RevenueBonus;
+import rails.algorithms.RevenueBonusTemplate;
import rails.game.*;
import rails.game.model.ModelObject;
import rails.ui.swing.GUIToken;
@@ -662,6 +664,29 @@
return toolTip;
}
+
+ private String bonusToolTipText(List<RevenueBonusTemplate> bonuses) {
+ StringBuffer tt = new StringBuffer();
+ if (bonuses != null) {
+ if (bonuses.size() == 1) {
+ tt.append("<br>Bonus:");
+ tt.append(bonuses.get(0).getToolTip());
+ } else {
+ Set<String> bonusNames = new HashSet<String>();
+ for (RevenueBonusTemplate bonus:bonuses) {
+ bonusNames.add(bonus.getName());
+ }
+ tt.append("<br>Bonus:");
+ int i=0;
+ for (String bonusName:bonusNames) {
+ if (i++ != 0) tt.append(",");
+ tt.append(bonusName);
+ }
+ }
+ }
+ return tt.toString();
+ }
+
protected void setToolTip() {
StringBuffer tt = new StringBuffer("<html>");
tt.append("<b>Hex</b>: ").append(hexName);
@@ -708,7 +733,12 @@
// TEMPORARY
tt.append(" <small>pos=" + st.getPosition() + "</small>");
}
+ tt.append(bonusToolTipText(currentTile.getRevenueBonuses()));
}
+
+ // revenueBonuses
+ tt.append(bonusToolTipText(model.getRevenueBonuses()));
+
String upgrades = currentTile.getUpgradesString(model);
if (upgrades.equals("")) {
tt.append("<br>No upgrades");
@@ -726,6 +756,8 @@
tt.append(dest.getName());
}
}
+
+
tt.append("</html>");
toolTip = tt.toString();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|