Fix artic engines with no capacity on leading part in build window

Engines were being shown as not having any capacity overall
This commit is contained in:
Jonathan G Rennison
2023-01-07 00:26:04 +00:00
parent e816c2416a
commit 9cff3666ae
3 changed files with 34 additions and 3 deletions

View File

@@ -186,6 +186,35 @@ bool Engine::CanCarryCargo() const
return this->GetDefaultCargoType() != CT_INVALID;
}
bool Engine::CanPossiblyCarryCargo() const
{
if (this->IsGroundVehicle() && HasBit(this->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return true;
switch (this->type) {
case VEH_TRAIN:
if (HasBit(this->cb36_properties_used, PROP_TRAIN_CARGO_CAPACITY)) return true;
break;
case VEH_ROAD:
if (HasBit(this->cb36_properties_used, PROP_ROADVEH_CARGO_CAPACITY)) return true;
break;
case VEH_SHIP:
if (HasBit(this->cb36_properties_used, PROP_SHIP_CARGO_CAPACITY)) return true;
break;
case VEH_AIRCRAFT:
if (HasBit(this->cb36_properties_used, PROP_AIRCRAFT_PASSENGER_CAPACITY)) return true;
if (HasBit(this->cb36_properties_used, PROP_AIRCRAFT_MAIL_CAPACITY)) return true;
break;
default:
NOT_REACHED();
}
return this->CanCarryCargo();
}
/**
* Determines capacity of a given vehicle from scratch.