Add slot support to road vehicles, ships and aircraft

This commit is contained in:
Jonathan G Rennison
2022-01-18 18:51:24 +00:00
parent 0513961b2a
commit 904ff6757d
29 changed files with 248 additions and 132 deletions

View File

@@ -851,6 +851,18 @@ static inline bool IsTraceRestrictTypeAuxSubtype(TraceRestrictItemType type)
}
}
/** May this TraceRestrictItemType take a slot of a different (non-train) vehicle type */
static inline bool IsTraceRestrictTypeNonMatchingVehicleTypeSlot(TraceRestrictItemType type)
{
switch (type) {
case TRIT_COND_SLOT_OCCUPANCY:
return true;
default:
return false;
}
}
/** Get mapping ref ID from tile and track */
static inline TraceRestrictRefId MakeTraceRestrictRefId(TileIndex t, Track track)
{
@@ -963,6 +975,7 @@ struct TraceRestrictSlot : TraceRestrictSlotPool::PoolItem<&_tracerestrictslot_p
uint32 max_occupancy = 1;
std::string name;
Owner owner;
VehicleType vehicle_type;
std::vector<SignalReference> progsig_dependants;
@@ -971,9 +984,10 @@ struct TraceRestrictSlot : TraceRestrictSlotPool::PoolItem<&_tracerestrictslot_p
static void ValidateSlotOccupants(std::function<void(const char *)> log);
static void PreCleanPool();
TraceRestrictSlot(CompanyID owner = INVALID_COMPANY)
TraceRestrictSlot(CompanyID owner = INVALID_COMPANY, VehicleType type = VEH_TRAIN)
{
this->owner = owner;
this->vehicle_type = type;
}
~TraceRestrictSlot()