diff options
author | rubidium <rubidium@openttd.org> | 2009-02-19 09:45:44 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-02-19 09:45:44 +0000 |
commit | 02c52430c88db61e4004cf94a99449cd464cbd55 (patch) | |
tree | c9ee92ae7cbfe93892ebfded0c1f663c6a2f9e99 /src/engine.cpp | |
parent | 9a507acf377cc14ff7bf0ab50b34b23aed98d218 (diff) | |
download | openttd-02c52430c88db61e4004cf94a99449cd464cbd55.tar.xz |
(svn r15521) -Codechange: add helper function to get the display tractive effort of a vehicle.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r-- | src/engine.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 499ac399d..8373d9430 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -204,6 +204,22 @@ uint Engine::GetDisplayWeight() const } } +/** + * Returns the tractive effort for display purposes. + * For dual-headed train-engines this is the tractive effort of both heads + * @return tractive effort in display units kN + */ +uint Engine::GetDisplayMaxTractiveEffort() const +{ + /* Currently only trains have 'tractive effort' */ + switch (this->type) { + case VEH_TRAIN: + return (10 * this->GetDisplayWeight() * GetEngineProperty(this->index, 0x1F, this->u.rail.tractive_effort)) / 256; + + default: NOT_REACHED(); + } +} + /** Sets cached values in Company::num_vehicles and Group::num_vehicles */ void SetCachedEngineCounts() |