From 939a350864a6a63e9cdb4c28998f8595de2b23da Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 28 Feb 2017 19:32:29 +0000 Subject: [PATCH] TBTR: Assume that virtual vehicles are on a suitably powered railtype. --- src/train.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/train.h b/src/train.h index 7aa39034a5..c53da91a4c 100644 --- a/src/train.h +++ b/src/train.h @@ -197,7 +197,7 @@ protected: // These functions should not be called outside acceleration code. inline uint16 GetPower() const { /* Power is not added for articulated parts */ - if (!this->IsArticulatedPart() && HasPowerOnRail(this->railtype, GetRailType(this->tile))) { + if (!this->IsArticulatedPart() && (this->IsVirtual() || HasPowerOnRail(this->railtype, GetRailType(this->tile)))) { uint16 power = GetVehicleProperty(this, PROP_TRAIN_POWER, RailVehInfo(this->engine_type)->power); /* Halve power for multiheaded parts */ if (this->IsMultiheaded()) power /= 2; @@ -214,7 +214,7 @@ protected: // These functions should not be called outside acceleration code. inline uint16 GetPoweredPartPower(const Train *head) const { /* For powered wagons the engine defines the type of engine (i.e. railtype) */ - if (HasBit(this->flags, VRF_POWEREDWAGON) && HasPowerOnRail(head->railtype, GetRailType(this->tile))) { + if (HasBit(this->flags, VRF_POWEREDWAGON) && (head->IsVirtual() || HasPowerOnRail(head->railtype, GetRailType(this->tile)))) { return RailVehInfo(this->gcache.first_engine)->pow_wag_power; }