Change: Add CargoTypes type for cargo masks. (#6790)

This commit is contained in:
PeterN
2018-05-21 22:08:39 +01:00
committed by GitHub
parent 42b43c9983
commit 4cebebcf68
34 changed files with 122 additions and 116 deletions

View File

@@ -37,8 +37,8 @@ extern void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index);
*/
static bool EnginesHaveCargoInCommon(EngineID engine_a, EngineID engine_b)
{
uint32 available_cargoes_a = GetUnionOfArticulatedRefitMasks(engine_a, true);
uint32 available_cargoes_b = GetUnionOfArticulatedRefitMasks(engine_b, true);
CargoTypes available_cargoes_a = GetUnionOfArticulatedRefitMasks(engine_a, true);
CargoTypes available_cargoes_b = GetUnionOfArticulatedRefitMasks(engine_b, true);
return (available_cargoes_a == 0 || available_cargoes_b == 0 || (available_cargoes_a & available_cargoes_b) != 0);
}
@@ -173,9 +173,8 @@ static void TransferCargo(Vehicle *old_veh, Vehicle *new_head, bool part_of_chai
*/
static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, EngineID engine_type)
{
uint32 union_refit_mask_a = GetUnionOfArticulatedRefitMasks(v->engine_type, false);
uint32 union_refit_mask_b = GetUnionOfArticulatedRefitMasks(engine_type, false);
CargoTypes union_refit_mask_a = GetUnionOfArticulatedRefitMasks(v->engine_type, false);
CargoTypes union_refit_mask_b = GetUnionOfArticulatedRefitMasks(engine_type, false);
const Order *o;
const Vehicle *u = (v->type == VEH_TRAIN) ? v->First() : v;
@@ -201,7 +200,7 @@ static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, EngineID engine_ty
*/
static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type, bool part_of_chain)
{
uint32 available_cargo_types, union_mask;
CargoTypes available_cargo_types, union_mask;
GetArticulatedRefitMasks(engine_type, true, &union_mask, &available_cargo_types);
if (union_mask == 0) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity