summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-03-06 12:59:28 +0000
committerterkhen <terkhen@openttd.org>2010-03-06 12:59:28 +0000
commitbe3b839ded1372ad6a3802118bb70fead2ccd4ce (patch)
treea3cd77841a20bf21b1dbcd7768b66467647a8046 /src/engine.cpp
parentb443a3ee0a39f28be1fde279e67c82ee51814f4d (diff)
downloadopenttd-be3b839ded1372ad6a3802118bb70fead2ccd4ce.tar.xz
(svn r19347) -Add: Vehicle GUI now shows power, weight and tractive effort for road vehicles.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 8e6c41ba0..0cccfcaac 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -297,10 +297,12 @@ uint Engine::GetDisplayMaxSpeed() const
uint Engine::GetPower() const
{
- /* Currently only trains have 'power' */
+ /* Only trains and road vehicles have 'power'. */
switch (this->type) {
case VEH_TRAIN:
return GetEngineProperty(this->index, PROP_TRAIN_POWER, this->u.rail.power);
+ case VEH_ROAD:
+ return this->u.road.power * 10;
default: NOT_REACHED();
}
@@ -313,10 +315,12 @@ uint Engine::GetPower() const
*/
uint Engine::GetDisplayWeight() const
{
- /* Currently only trains have 'weight' */
+ /* Only trains and road vehicles have 'weight'. */
switch (this->type) {
case VEH_TRAIN:
return GetEngineProperty(this->index, PROP_TRAIN_WEIGHT, this->u.rail.weight) << (this->u.rail.railveh_type == RAILVEH_MULTIHEAD ? 1 : 0);
+ case VEH_ROAD:
+ return this->u.road.weight / 4;
default: NOT_REACHED();
}
@@ -329,10 +333,12 @@ uint Engine::GetDisplayWeight() const
*/
uint Engine::GetDisplayMaxTractiveEffort() const
{
- /* Currently only trains have 'tractive effort' */
+ /* Only trains and road vehicles have 'tractive effort'. */
switch (this->type) {
case VEH_TRAIN:
return (10 * this->GetDisplayWeight() * GetEngineProperty(this->index, PROP_TRAIN_TRACTIVE_EFFORT, this->u.rail.tractive_effort)) / 256;
+ case VEH_ROAD:
+ return (10 * this->GetDisplayWeight() * this->u.road.tractive_effort) / 256;
default: NOT_REACHED();
}