mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-16 00:42:45 +01:00
Codechange: rename CargoID to CargoType and amend related variables/comments
This commit is contained in:
@@ -187,7 +187,7 @@ bool Engine::CanCarryCargo() const
|
||||
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
return IsValidCargoID(this->GetDefaultCargoType());
|
||||
return IsValidCargoType(this->GetDefaultCargoType());
|
||||
}
|
||||
|
||||
|
||||
@@ -206,8 +206,8 @@ uint Engine::DetermineCapacity(const Vehicle *v, uint16_t *mail_capacity) const
|
||||
if (!this->CanCarryCargo()) return 0;
|
||||
|
||||
bool new_multipliers = HasBit(this->info.misc_flags, EF_NO_DEFAULT_CARGO_MULTIPLIER);
|
||||
CargoID default_cargo = this->GetDefaultCargoType();
|
||||
CargoID cargo_type = (v != nullptr) ? v->cargo_type : default_cargo;
|
||||
CargoType default_cargo = this->GetDefaultCargoType();
|
||||
CargoType cargo_type = (v != nullptr) ? v->cargo_type : default_cargo;
|
||||
|
||||
if (mail_capacity != nullptr && this->type == VEH_AIRCRAFT && IsCargoInClass(cargo_type, CC_PASSENGERS)) {
|
||||
*mail_capacity = GetEngineProperty(this->index, PROP_AIRCRAFT_MAIL_CAPACITY, this->u.air.mail_capacity, v);
|
||||
@@ -244,10 +244,10 @@ uint Engine::DetermineCapacity(const Vehicle *v, uint16_t *mail_capacity) const
|
||||
if (!IsCargoInClass(cargo_type, CC_PASSENGERS)) {
|
||||
extra_mail_cap = GetEngineProperty(this->index, PROP_AIRCRAFT_MAIL_CAPACITY, this->u.air.mail_capacity, v);
|
||||
}
|
||||
if (IsValidCargoID(GetCargoIDByLabel(CT_MAIL))) {
|
||||
if (!new_multipliers && cargo_type == GetCargoIDByLabel(CT_MAIL)) return capacity + extra_mail_cap;
|
||||
if (IsValidCargoType(GetCargoTypeByLabel(CT_MAIL))) {
|
||||
if (!new_multipliers && cargo_type == GetCargoTypeByLabel(CT_MAIL)) return capacity + extra_mail_cap;
|
||||
}
|
||||
default_cargo = GetCargoIDByLabel(CT_PASSENGERS); // Always use 'passengers' wrt. cargo multipliers
|
||||
default_cargo = GetCargoTypeByLabel(CT_PASSENGERS); // Always use 'passengers' wrt. cargo multipliers
|
||||
break;
|
||||
|
||||
default: NOT_REACHED();
|
||||
@@ -264,8 +264,8 @@ uint Engine::DetermineCapacity(const Vehicle *v, uint16_t *mail_capacity) const
|
||||
uint16_t default_multiplier = new_multipliers ? 0x100 : CargoSpec::Get(default_cargo)->multiplier;
|
||||
uint16_t cargo_multiplier = CargoSpec::Get(cargo_type)->multiplier;
|
||||
capacity *= cargo_multiplier;
|
||||
if (extra_mail_cap > 0 && IsValidCargoID(GetCargoIDByLabel(CT_MAIL))) {
|
||||
uint mail_multiplier = CargoSpec::Get(GetCargoIDByLabel(CT_MAIL))->multiplier;
|
||||
if (extra_mail_cap > 0 && IsValidCargoType(GetCargoTypeByLabel(CT_MAIL))) {
|
||||
uint mail_multiplier = CargoSpec::Get(GetCargoTypeByLabel(CT_MAIL))->multiplier;
|
||||
capacity += (default_multiplier * extra_mail_cap * cargo_multiplier + mail_multiplier / 2) / mail_multiplier;
|
||||
}
|
||||
capacity = (capacity + default_multiplier / 2) / default_multiplier;
|
||||
@@ -1309,10 +1309,10 @@ bool IsEngineRefittable(EngineID engine)
|
||||
if (HasBit(ei->callback_mask, CBM_VEHICLE_CARGO_SUFFIX)) return true;
|
||||
|
||||
/* Is there any cargo except the default cargo? */
|
||||
CargoID default_cargo = e->GetDefaultCargoType();
|
||||
CargoType default_cargo = e->GetDefaultCargoType();
|
||||
CargoTypes default_cargo_mask = 0;
|
||||
SetBit(default_cargo_mask, default_cargo);
|
||||
return IsValidCargoID(default_cargo) && ei->refit_mask != default_cargo_mask;
|
||||
return IsValidCargoType(default_cargo) && ei->refit_mask != default_cargo_mask;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user