Codechange: Split CT_INVALID into CT_INVALID and INVALID_CARGO.
INVALID_CARGO is a CargoID and should be used for most purposes in game. CT_INVALID is a CargoType used for defining default properties.
This commit is contained in:
committed by
Peter Nelson
parent
4fd986bd07
commit
952d111b94
@@ -107,7 +107,7 @@ uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
|
||||
static inline uint16_t GetVehicleDefaultCapacity(EngineID engine, CargoID *cargo_type)
|
||||
{
|
||||
const Engine *e = Engine::Get(engine);
|
||||
CargoID cargo = (e->CanCarryCargo() ? e->GetDefaultCargoType() : (CargoID)CT_INVALID);
|
||||
CargoID cargo = (e->CanCarryCargo() ? e->GetDefaultCargoType() : INVALID_CARGO);
|
||||
if (cargo_type != nullptr) *cargo_type = cargo;
|
||||
if (!IsValidCargoID(cargo)) return 0;
|
||||
return e->GetDisplayDefaultCapacity();
|
||||
@@ -259,13 +259,13 @@ CargoTypes GetUnionOfArticulatedRefitMasks(EngineID engine, bool include_initial
|
||||
* Get cargo mask of all cargoes carried by an articulated vehicle.
|
||||
* Note: Vehicles not carrying anything are ignored
|
||||
* @param v the first vehicle in the chain
|
||||
* @param cargo_type returns the common CargoID if needed. (CT_INVALID if no part is carrying something or they are carrying different things)
|
||||
* @param cargo_type returns the common CargoID if needed. (INVALID_CARGO if no part is carrying something or they are carrying different things)
|
||||
* @return cargo mask, may be 0 if the no vehicle parts have cargo capacity
|
||||
*/
|
||||
CargoTypes GetCargoTypesOfArticulatedVehicle(const Vehicle *v, CargoID *cargo_type)
|
||||
{
|
||||
CargoTypes cargoes = 0;
|
||||
CargoID first_cargo = CT_INVALID;
|
||||
CargoID first_cargo = INVALID_CARGO;
|
||||
|
||||
do {
|
||||
if (IsValidCargoID(v->cargo_type) && v->GetEngine()->CanCarryCargo()) {
|
||||
@@ -273,7 +273,7 @@ CargoTypes GetCargoTypesOfArticulatedVehicle(const Vehicle *v, CargoID *cargo_ty
|
||||
if (!IsValidCargoID(first_cargo)) first_cargo = v->cargo_type;
|
||||
if (first_cargo != v->cargo_type) {
|
||||
if (cargo_type != nullptr) {
|
||||
*cargo_type = CT_INVALID;
|
||||
*cargo_type = INVALID_CARGO;
|
||||
cargo_type = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user