summaryrefslogtreecommitdiff
path: root/src/engine_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-02-01 16:10:06 +0000
committerfrosch <frosch@openttd.org>2009-02-01 16:10:06 +0000
commitc28c4c1986a9a25cbf67ed84c6ba3d51447bbb6f (patch)
treedb4e289e273064a04dbb517c6f5ff509c4fa81f7 /src/engine_gui.cpp
parent6d5cd47c74be39ce6ffd92addcab417f178cbaad (diff)
downloadopenttd-c28c4c1986a9a25cbf67ed84c6ba3d51447bbb6f.tar.xz
(svn r15306) -Codechange: Deduplicate code by adding Engine::GetDisplayMaxSpeed(), GetPower() and GetDisplayWeight(). (and using them)
Diffstat (limited to 'src/engine_gui.cpp')
-rw-r--r--src/engine_gui.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index 0cf3d99d3..be6af32ce 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -124,13 +124,12 @@ static uint GetTotalCapacityOfArticulatedParts(EngineID engine, VehicleType type
static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
{
const RailVehicleInfo *rvi = RailVehInfo(engine);
- int multihead = (rvi->railveh_type == RAILVEH_MULTIHEAD) ? 1 : 0;
const Engine *e = GetEngine(engine);
SetDParam(0, e->GetCost());
- SetDParam(2, GetEngineProperty(engine, 0x09, rvi->max_speed) * 10 / 16);
- SetDParam(3, GetEngineProperty(engine, 0x0B, rvi->power));
- SetDParam(1, GetEngineProperty(engine, 0x16, rvi->weight) << multihead);
+ SetDParam(2, e->GetDisplayMaxSpeed());
+ SetDParam(3, e->GetPower());
+ SetDParam(1, e->GetDisplayWeight());
SetDParam(4, e->GetRunningCost());
@@ -150,7 +149,7 @@ static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw)
const Engine *e = GetEngine(engine);
SetDParam(0, e->GetCost());
- SetDParam(1, avi->max_speed * 10 / 16);
+ SetDParam(1, e->GetDisplayMaxSpeed());
SetDParam(2, avi->passenger_capacity);
SetDParam(3, avi->mail_capacity);
SetDParam(4, e->GetRunningCost());
@@ -164,7 +163,7 @@ static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
const Engine *e = GetEngine(engine);
SetDParam(0, e->GetCost());
- SetDParam(1, rvi->max_speed * 10 / 32);
+ SetDParam(1, e->GetDisplayMaxSpeed());
SetDParam(2, e->GetRunningCost());
SetDParam(3, rvi->cargo_type);
SetDParam(4, GetTotalCapacityOfArticulatedParts(engine, VEH_ROAD));
@@ -178,7 +177,7 @@ static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw)
const Engine *e = GetEngine(engine);
SetDParam(0, e->GetCost());
- SetDParam(1, GetEngineProperty(engine, 0x0B, svi->max_speed) * 10 / 32);
+ SetDParam(1, e->GetDisplayMaxSpeed());
SetDParam(2, svi->cargo_type);
SetDParam(3, GetEngineProperty(engine, 0x0D, svi->capacity));
SetDParam(4, e->GetRunningCost());