Fix: [NewGRF] New engines did not have a default cargo type set. (#13146)

Engines defined outside the original range did not have their cargo type/cargo label fields initialised properly.
If these engines are also not assigned a cargo type, they would therefore use the cargo in slot 0 instead of falling back to first refittable.
This commit is contained in:
Peter Nelson 2024-12-03 21:59:22 +00:00 committed by GitHub
parent 9e182871c7
commit efcafe49f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -85,8 +85,9 @@ Engine::Engine(VehicleType type, EngineID base)
this->info.base_life = 0xFF;
/* Set road vehicle tractive effort to the default value */
if (type == VEH_ROAD) this->u.road.tractive_effort = 0x4C;
/* Aircraft must have INVALID_CARGO as default, as there is no property */
if (type == VEH_AIRCRAFT) this->info.cargo_type = INVALID_CARGO;
/* Aircraft must have CT_INVALID as default, as there is no property */
this->info.cargo_type = INVALID_CARGO;
this->info.cargo_label = (type == VEH_AIRCRAFT) ? CT_INVALID : CT_PASSENGERS;
/* Ships must have a non-zero acceleration. */
if (type == VEH_SHIP) this->u.ship.acceleration = 1;
/* Set visual effect to the default value */