From acf9d786f13790ca0d32af086b0b72d2f47c1119 Mon Sep 17 00:00:00 2001 From: frosch Date: Fri, 26 Aug 2022 20:50:33 +0200 Subject: [PATCH] Fix: [NewGRF] Default value of RailVehicleInfo::railveh_type was inconsistent with other default properties. (#9967) If a NewGRF assigned neither "power" nor "dual-headed" properties, then "railveh_type" defaulted to "singlehead-engine", while "power=0" said "it's a wagon". --- src/engine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine.cpp b/src/engine.cpp index 6d0b25fcc7..d1e9cc472f 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -76,6 +76,8 @@ Engine::Engine(VehicleType type, EngineID base) /* Check if this base engine is within the original engine data range */ if (base >= _engine_counts[type]) { + /* 'power' defaults to zero, so we also have to default to 'wagon' */ + if (type == VEH_TRAIN) this->u.rail.railveh_type = RAILVEH_WAGON; /* Set model life to maximum to make wagons available */ this->info.base_life = 0xFF; /* Set road vehicle tractive effort to the default value */