summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-08-27 10:34:31 +0000
committerfrosch <frosch@openttd.org>2011-08-27 10:34:31 +0000
commit8a9b68d96433aee162b5f7cee5d3cd11bb4f02f1 (patch)
tree7520522d0c008f434e2e2b302b179d01d711e71d /src
parente157a23056b3991a30ad21f581e7e74b6bec41d7 (diff)
downloadopenttd-8a9b68d96433aee162b5f7cee5d3cd11bb4f02f1.tar.xz
(svn r22850) -Feature: Display separate ocean and canal speeds in the ship purchase list, if they differ.
Diffstat (limited to 'src')
-rw-r--r--src/build_vehicle_gui.cpp23
-rw-r--r--src/lang/english.txt2
2 files changed, 22 insertions, 3 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 29486744d..e696b8a5b 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -666,10 +666,27 @@ static int DrawShipPurchaseInfo(int left, int right, int y, EngineID engine_numb
const Engine *e = Engine::Get(engine_number);
/* Purchase cost - Max speed */
+ uint raw_speed = e->GetDisplayMaxSpeed();
+ uint ocean_speed = e->u.ship.ApplyWaterClassSpeedFrac(raw_speed, true);
+ uint canal_speed = e->u.ship.ApplyWaterClassSpeedFrac(raw_speed, false);
+
SetDParam(0, e->GetCost());
- SetDParam(1, e->GetDisplayMaxSpeed());
- DrawString(left, right, y, STR_PURCHASE_INFO_COST_SPEED);
- y += FONT_HEIGHT_NORMAL;
+ if (ocean_speed == canal_speed) {
+ SetDParam(1, ocean_speed);
+ DrawString(left, right, y, STR_PURCHASE_INFO_COST_SPEED);
+ y += FONT_HEIGHT_NORMAL;
+ } else {
+ DrawString(left, right, y, STR_PURCHASE_INFO_COST);
+ y += FONT_HEIGHT_NORMAL;
+
+ SetDParam(0, ocean_speed);
+ DrawString(left, right, y, STR_PURCHASE_INFO_SPEED_OCEAN);
+ y += FONT_HEIGHT_NORMAL;
+
+ SetDParam(0, canal_speed);
+ DrawString(left, right, y, STR_PURCHASE_INFO_SPEED_CANAL);
+ y += FONT_HEIGHT_NORMAL;
+ }
/* Cargo type + capacity */
SetDParam(0, e->GetDefaultCargoType());
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 80601c1aa..090540f78 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -2836,6 +2836,8 @@ STR_BUY_VEHICLE_AIRCRAFT_CAPTION :New Aircraft
STR_PURCHASE_INFO_COST_WEIGHT :{BLACK}Cost: {GOLD}{CURRENCY}{BLACK} Weight: {GOLD}{WEIGHT_S}
STR_PURCHASE_INFO_SPEED_POWER :{BLACK}Speed: {GOLD}{VELOCITY}{BLACK} Power: {GOLD}{POWER}
STR_PURCHASE_INFO_SPEED :{BLACK}Speed: {GOLD}{VELOCITY}
+STR_PURCHASE_INFO_SPEED_OCEAN :{BLACK}Speed on ocean: {GOLD}{VELOCITY}
+STR_PURCHASE_INFO_SPEED_CANAL :{BLACK}Speed on canal/river: {GOLD}{VELOCITY}
STR_PURCHASE_INFO_RUNNINGCOST :{BLACK}Running Cost: {GOLD}{CURRENCY}/yr
STR_PURCHASE_INFO_CAPACITY :{BLACK}Capacity: {GOLD}{CARGO} {STRING}
STR_PURCHASE_INFO_REFITTABLE :(refittable)