forked from mirror/OpenTTD
(svn r21924) -Codechange: Unify some parts of the articulated vehicle code.
-Cleanup: Avoid conversions to Train and RoadVehicle that are no longer required.
This commit is contained in:
@@ -626,7 +626,7 @@ bool Vehicle::IsEngineCountable() const
|
||||
switch (this->type) {
|
||||
case VEH_AIRCRAFT: return Aircraft::From(this)->IsNormalAircraft(); // don't count plane shadows and helicopter rotors
|
||||
case VEH_TRAIN:
|
||||
return !Train::From(this)->IsArticulatedPart() && // tenders and other articulated parts
|
||||
return !this->IsArticulatedPart() && // tenders and other articulated parts
|
||||
!Train::From(this)->IsRearDualheaded(); // rear parts of multiheaded engines
|
||||
case VEH_ROAD: return RoadVehicle::From(this)->IsFrontEngine();
|
||||
case VEH_SHIP: return true;
|
||||
@@ -1538,7 +1538,7 @@ LiveryScheme GetEngineLiveryScheme(EngineID engine_type, EngineID parent_engine_
|
||||
switch (e->type) {
|
||||
default: NOT_REACHED();
|
||||
case VEH_TRAIN:
|
||||
if (v != NULL && parent_engine_type != INVALID_ENGINE && (UsesWagonOverride(v) || (Train::From(v)->IsArticulatedPart() && e->u.rail.railveh_type != RAILVEH_WAGON))) {
|
||||
if (v != NULL && parent_engine_type != INVALID_ENGINE && (UsesWagonOverride(v) || (v->IsArticulatedPart() && e->u.rail.railveh_type != RAILVEH_WAGON))) {
|
||||
/* Wagonoverrides use the colour scheme of the front engine.
|
||||
* Articulated parts use the colour scheme of the first part. (Not supported for articulated wagons) */
|
||||
engine_type = parent_engine_type;
|
||||
|
Reference in New Issue
Block a user