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".
This commit is contained in:
frosch 2022-08-26 20:50:33 +02:00 committed by GitHub
parent bba6ad1f4e
commit acf9d786f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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 */