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
@@ -57,7 +57,7 @@ public:
|
||||
/* Note: these values represent part of the in-game CargoTypes enum */
|
||||
CT_AUTO_REFIT = ::CT_AUTO_REFIT, ///< Automatically choose cargo type when doing auto-refitting.
|
||||
CT_NO_REFIT = ::CT_NO_REFIT, ///< Do not refit cargo of a vehicle.
|
||||
CT_INVALID = ::CT_INVALID, ///< An invalid cargo type.
|
||||
CT_INVALID = ::INVALID_CARGO, ///< An invalid cargo type.
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -52,12 +52,12 @@
|
||||
|
||||
/* static */ CargoID ScriptEngine::GetCargoType(EngineID engine_id)
|
||||
{
|
||||
if (!IsValidEngine(engine_id)) return CT_INVALID;
|
||||
if (!IsValidEngine(engine_id)) return INVALID_CARGO;
|
||||
|
||||
CargoArray cap = ::GetCapacityOfArticulatedParts(engine_id);
|
||||
|
||||
auto it = std::max_element(std::cbegin(cap), std::cend(cap));
|
||||
if (*it == 0) return CT_INVALID;
|
||||
if (*it == 0) return INVALID_CARGO;
|
||||
|
||||
return CargoID(std::distance(std::cbegin(cap), it));
|
||||
}
|
||||
|
@@ -39,11 +39,11 @@ std::optional<std::string> ScriptEventEnginePreview::GetName()
|
||||
|
||||
CargoID ScriptEventEnginePreview::GetCargoType()
|
||||
{
|
||||
if (!this->IsEngineValid()) return CT_INVALID;
|
||||
if (!this->IsEngineValid()) return INVALID_CARGO;
|
||||
CargoArray cap = ::GetCapacityOfArticulatedParts(this->engine);
|
||||
|
||||
auto it = std::max_element(std::cbegin(cap), std::cend(cap));
|
||||
if (*it == 0) return CT_INVALID;
|
||||
if (*it == 0) return INVALID_CARGO;
|
||||
|
||||
return CargoID(std::distance(std::cbegin(cap), it));
|
||||
}
|
||||
|
@@ -257,9 +257,9 @@ public:
|
||||
/**
|
||||
* Get the last date this industry accepted any cargo delivery.
|
||||
* @param industry_id The index of the industry.
|
||||
* @param cargo_type The cargo to query, or CT_INVALID to query latest of all accepted cargoes.
|
||||
* @param cargo_type The cargo to query, or INVALID_CARGO to query latest of all accepted cargoes.
|
||||
* @pre IsValidIndustry(industry_id).
|
||||
* @pre IsValidCargo(cargo_type) || cargo_type == CT_INVALID.
|
||||
* @pre IsValidCargo(cargo_type) || cargo_type == INVALID_CARGO.
|
||||
* @return Date the industry last received cargo from a delivery, or ScriptDate::DATE_INVALID on error.
|
||||
* @api -ai
|
||||
*/
|
||||
|
@@ -67,7 +67,7 @@
|
||||
|
||||
/* static */ CargoID ScriptSubsidy::GetCargoType(SubsidyID subsidy_id)
|
||||
{
|
||||
if (!IsValidSubsidy(subsidy_id)) return CT_INVALID;
|
||||
if (!IsValidSubsidy(subsidy_id)) return INVALID_CARGO;
|
||||
|
||||
return ::Subsidy::Get(subsidy_id)->cargo_type;
|
||||
}
|
||||
|
@@ -89,7 +89,7 @@
|
||||
|
||||
/* static */ VehicleID ScriptVehicle::BuildVehicle(TileIndex depot, EngineID engine_id)
|
||||
{
|
||||
return _BuildVehicleInternal(depot, engine_id, CT_INVALID);
|
||||
return _BuildVehicleInternal(depot, engine_id, INVALID_CARGO);
|
||||
}
|
||||
|
||||
/* static */ VehicleID ScriptVehicle::BuildVehicleWithRefit(TileIndex depot, EngineID engine_id, CargoID cargo)
|
||||
|
Reference in New Issue
Block a user