Merge branch 'tracerestrict-sx' into jgrpp

# Conflicts:
#	src/pbs.cpp
#	src/saveload/extended_ver_sl.cpp
This commit is contained in:
Jonathan G Rennison
2018-06-17 23:24:22 +01:00
9 changed files with 221 additions and 19 deletions

View File

@@ -223,6 +223,16 @@ enum TraceRestrictPathfinderPenaltyAuxField {
/* space up to 3 */
};
/**
* TraceRestrictItem value field, for TRIT_WAIT_AT_PBS
*/
enum TraceRestrictWaitAtPbsValueField {
TRWAPVF_WAIT_AT_PBS = 0, ///< Wait at PBS
TRWAPVF_CANCEL_WAIT_AT_PBS = 1, ///< Cancel wait at PBS
TRWAPVF_PBS_RES_END_WAIT = 2, ///< PBS reservations ending at this signal wait
TRWAPVF_CANCEL_PBS_RES_END_WAIT = 3, ///< Cancel PBS reservations ending at this signal wait
};
/**
* TraceRestrictItem repurposed condition operator field, for slot operation type actions
*/
@@ -231,6 +241,9 @@ enum TraceRestrictSlotCondOpField {
TRSCOF_ACQUIRE_TRY = 1, ///< try to acquire a slot, or carry on otherwise
TRSCOF_RELEASE_BACK = 2, ///< release a slot (back of train)
TRSCOF_RELEASE_FRONT = 3, ///< release a slot (front of train)
TRSCOF_PBS_RES_END_ACQ_WAIT = 4, ///< PBS reservations ending at this signal: acquire a slot, or wait
TRSCOF_PBS_RES_END_ACQ_TRY = 5, ///< PBS reservations ending at this signal: acquire a slot, or carry on otherwise
TRSCOF_PBS_RES_END_RELEASE = 6, ///< PBS reservations ending at this signal: release a slot
/* space up to 8 */
};
@@ -262,6 +275,7 @@ enum TraceRestrictProgramResultFlags {
TRPRF_RESERVE_THROUGH = 1 << 1, ///< Reserve through is set
TRPRF_LONG_RESERVE = 1 << 2, ///< Long reserve is set
TRPRF_WAIT_AT_PBS = 1 << 3, ///< Wait at PBS signal is set
TRPRF_PBS_RES_END_WAIT = 1 << 4, ///< PBS reservations ending at this signal wait is set
};
DECLARE_ENUM_AS_BIT_SET(TraceRestrictProgramResultFlags)
@@ -276,6 +290,8 @@ enum TraceRestrictProgramActionsUsedFlags {
TRPAUF_SLOT_ACQUIRE = 1 << 4, ///< Slot acquire action is present
TRPAUF_SLOT_RELEASE_BACK = 1 << 5, ///< Slot release (back) action is present
TRPAUF_SLOT_RELEASE_FRONT = 1 << 6, ///< Slot release (front) action is present
TRPAUF_PBS_RES_END_WAIT = 1 << 7, ///< PBS reservations ending at this signal wait action is present
TRPAUF_PBS_RES_END_SLOT = 1 << 8, ///< PBS reservations ending at this signal slot action is present
};
DECLARE_ENUM_AS_BIT_SET(TraceRestrictProgramActionsUsedFlags)
@@ -286,6 +302,9 @@ enum TraceRestrictProgramInputSlotPermissions {
TRPISP_ACQUIRE = 1 << 0, ///< Slot acquire is permitted
TRPISP_RELEASE_BACK = 1 << 1, ///< Slot release (back) is permitted
TRPISP_RELEASE_FRONT = 1 << 2, ///< Slot release (front) is permitted
TRPISP_PBS_RES_END_ACQUIRE = 1 << 3, ///< Slot acquire (PBS reservations ending at this signal) is permitted
TRPISP_PBS_RES_END_ACQ_DRY = 1 << 4, ///< Dry-run slot acquire (PBS reservations ending at this signal) is permitted
TRPISP_PBS_RES_END_RELEASE = 1 << 5, ///< Slot release (PBS reservations ending at this signal) is permitted
};
DECLARE_ENUM_AS_BIT_SET(TraceRestrictProgramInputSlotPermissions)
@@ -499,7 +518,7 @@ enum TraceRestrictValueType {
TRVT_FORCE = 15,///< takes a force
TRVT_POWER_WEIGHT_RATIO = 16,///< takes a power / weight ratio, * 100
TRVT_FORCE_WEIGHT_RATIO = 17,///< takes a force / weight ratio, * 100
TRVT_WAIT_AT_PBS = 18,///< takes a value 0 = wait at PBS signal, 1 = cancel wait at PBS signal
TRVT_WAIT_AT_PBS = 18,///< takes a TraceRestrictWaitAtPbsValueField value
TRVT_SLOT_INDEX = 19,///< takes a TraceRestrictSlotID
TRVT_SLOT_INDEX_INT = 20,///< takes a TraceRestrictSlotID, and an integer in the next item slot
TRVT_OWNER = 40,///< takes a CompanyID
@@ -778,6 +797,7 @@ struct TraceRestrictSlot : TraceRestrictSlotPool::PoolItem<&_tracerestrictslot_p
}
bool Occupy(VehicleID id, bool force = false);
bool OccupyDryRun(VehicleID ids);
void Vacate(VehicleID id);
void Clear();