(svn r17728) -Cleanup: Remove some more unneeded/unused parameters.
This commit is contained in:
@@ -81,23 +81,24 @@ static inline uint32 GetAvailableVehicleCargoTypes(EngineID engine, bool include
|
||||
return cargos;
|
||||
}
|
||||
|
||||
CargoArray GetCapacityOfArticulatedParts(EngineID engine, VehicleType type)
|
||||
CargoArray GetCapacityOfArticulatedParts(EngineID engine)
|
||||
{
|
||||
CargoArray capacity;
|
||||
const Engine *e = Engine::Get(engine);
|
||||
|
||||
CargoID cargo_type;
|
||||
uint16 cargo_capacity = GetVehicleDefaultCapacity(engine, &cargo_type);
|
||||
if (cargo_type < NUM_CARGO) capacity[cargo_type] = cargo_capacity;
|
||||
|
||||
if (type != VEH_TRAIN && type != VEH_ROAD) return capacity;
|
||||
if (e->type != VEH_TRAIN && e->type != VEH_ROAD) return capacity;
|
||||
|
||||
if (!HasBit(EngInfo(engine)->callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return capacity;
|
||||
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return capacity;
|
||||
|
||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine, NULL);
|
||||
if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) break;
|
||||
|
||||
EngineID artic_engine = GetNewEngineID(GetEngineGRF(engine), type, GB(callback, 0, 7));
|
||||
EngineID artic_engine = GetNewEngineID(GetEngineGRF(engine), e->type, GB(callback, 0, 7));
|
||||
|
||||
cargo_capacity = GetVehicleDefaultCapacity(artic_engine, &cargo_type);
|
||||
if (cargo_type < NUM_CARGO) capacity[cargo_type] += cargo_capacity;
|
||||
@@ -134,23 +135,23 @@ bool IsArticulatedVehicleRefittable(EngineID engine)
|
||||
/**
|
||||
* Ors the refit_masks of all articulated parts.
|
||||
* @param engine the first part
|
||||
* @param type the vehicle type
|
||||
* @param include_initial_cargo_type if true the default cargo type of the vehicle is included; if false only the refit_mask
|
||||
* @return bit mask of CargoIDs which are a refit option for at least one articulated part
|
||||
*/
|
||||
uint32 GetUnionOfArticulatedRefitMasks(EngineID engine, VehicleType type, bool include_initial_cargo_type)
|
||||
uint32 GetUnionOfArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type)
|
||||
{
|
||||
const Engine *e = Engine::Get(engine);
|
||||
uint32 cargos = GetAvailableVehicleCargoTypes(engine, include_initial_cargo_type);
|
||||
|
||||
if (type != VEH_TRAIN && type != VEH_ROAD) return cargos;
|
||||
if (e->type != VEH_TRAIN && e->type != VEH_ROAD) return cargos;
|
||||
|
||||
if (!HasBit(EngInfo(engine)->callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return cargos;
|
||||
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return cargos;
|
||||
|
||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine, NULL);
|
||||
if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) break;
|
||||
|
||||
EngineID artic_engine = GetNewEngineID(GetEngineGRF(engine), type, GB(callback, 0, 7));
|
||||
EngineID artic_engine = GetNewEngineID(GetEngineGRF(engine), e->type, GB(callback, 0, 7));
|
||||
cargos |= GetAvailableVehicleCargoTypes(artic_engine, include_initial_cargo_type);
|
||||
}
|
||||
|
||||
@@ -160,26 +161,26 @@ uint32 GetUnionOfArticulatedRefitMasks(EngineID engine, VehicleType type, bool i
|
||||
/**
|
||||
* Ands the refit_masks of all articulated parts.
|
||||
* @param engine the first part
|
||||
* @param type the vehicle type
|
||||
* @param include_initial_cargo_type if true the default cargo type of the vehicle is included; if false only the refit_mask
|
||||
* @return bit mask of CargoIDs which are a refit option for every articulated part (with default capacity > 0)
|
||||
*/
|
||||
uint32 GetIntersectionOfArticulatedRefitMasks(EngineID engine, VehicleType type, bool include_initial_cargo_type)
|
||||
uint32 GetIntersectionOfArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type)
|
||||
{
|
||||
const Engine *e = Engine::Get(engine);
|
||||
uint32 cargos = UINT32_MAX;
|
||||
|
||||
uint32 veh_cargos = GetAvailableVehicleCargoTypes(engine, include_initial_cargo_type);
|
||||
if (veh_cargos != 0) cargos &= veh_cargos;
|
||||
|
||||
if (type != VEH_TRAIN && type != VEH_ROAD) return cargos;
|
||||
if (e->type != VEH_TRAIN && e->type != VEH_ROAD) return cargos;
|
||||
|
||||
if (!HasBit(EngInfo(engine)->callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return cargos;
|
||||
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return cargos;
|
||||
|
||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine, NULL);
|
||||
if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) break;
|
||||
|
||||
EngineID artic_engine = GetNewEngineID(GetEngineGRF(engine), type, GB(callback, 0, 7));
|
||||
EngineID artic_engine = GetNewEngineID(GetEngineGRF(engine), e->type, GB(callback, 0, 7));
|
||||
veh_cargos = GetAvailableVehicleCargoTypes(artic_engine, include_initial_cargo_type);
|
||||
if (veh_cargos != 0) cargos &= veh_cargos;
|
||||
}
|
||||
@@ -239,9 +240,9 @@ void CheckConsistencyOfArticulatedVehicle(const Vehicle *v)
|
||||
{
|
||||
const Engine *engine = Engine::Get(v->engine_type);
|
||||
|
||||
uint32 purchase_refit_union = GetUnionOfArticulatedRefitMasks(v->engine_type, v->type, true);
|
||||
uint32 purchase_refit_intersection = GetIntersectionOfArticulatedRefitMasks(v->engine_type, v->type, true);
|
||||
CargoArray purchase_default_capacity = GetCapacityOfArticulatedParts(v->engine_type, v->type);
|
||||
uint32 purchase_refit_union = GetUnionOfArticulatedRefitMasks(v->engine_type, true);
|
||||
uint32 purchase_refit_intersection = GetIntersectionOfArticulatedRefitMasks(v->engine_type, true);
|
||||
CargoArray purchase_default_capacity = GetCapacityOfArticulatedParts(v->engine_type);
|
||||
|
||||
uint32 real_refit_union = 0;
|
||||
uint32 real_refit_intersection = UINT_MAX;
|
||||
|
Reference in New Issue
Block a user