summaryrefslogtreecommitdiff
path: root/src/build_vehicle_gui.cpp
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/build_vehicle_gui.cpp
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/build_vehicle_gui.cpp')
-rw-r--r--src/build_vehicle_gui.cpp23
1 files changed, 20 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());