Tracerestrict: Add enum type for TRIT_LONG_RESERVE values
This commit is contained in:
@@ -678,10 +678,18 @@ void TraceRestrictProgram::Execute(const Train* v, const TraceRestrictProgramInp
|
||||
break;
|
||||
|
||||
case TRIT_LONG_RESERVE:
|
||||
if (GetTraceRestrictValue(item)) {
|
||||
out.flags &= ~TRPRF_LONG_RESERVE;
|
||||
} else {
|
||||
switch (static_cast<TraceRestrictLongReserveValueField>(GetTraceRestrictValue(item))) {
|
||||
case TRLRVF_LONG_RESERVE:
|
||||
out.flags |= TRPRF_LONG_RESERVE;
|
||||
break;
|
||||
|
||||
case TRLRVF_CANCEL_LONG_RESERVE:
|
||||
out.flags &= ~TRPRF_LONG_RESERVE;
|
||||
break;
|
||||
|
||||
default:
|
||||
NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -269,6 +269,14 @@ enum TraceRestrictTargetDirectionCondAuxField {
|
||||
/* space up to 3 */
|
||||
};
|
||||
|
||||
/**
|
||||
* TraceRestrictItem value field, for TRIT_LONG_RESERVE
|
||||
*/
|
||||
enum TraceRestrictLongReserveValueField {
|
||||
TRLRVF_LONG_RESERVE = 0, ///< Long reserve
|
||||
TRLRVF_CANCEL_LONG_RESERVE = 1, ///< Cancel long reserve
|
||||
};
|
||||
|
||||
/**
|
||||
* TraceRestrictItem value field, for TRIT_WAIT_AT_PBS
|
||||
*/
|
||||
@@ -697,7 +705,7 @@ enum TraceRestrictValueType {
|
||||
TRVT_TILE_INDEX = 8, ///< takes a TileIndex in the next item slot
|
||||
TRVT_PF_PENALTY = 9, ///< takes a pathfinder penalty value or preset index, as per the auxiliary field as type: TraceRestrictPathfinderPenaltyAuxField
|
||||
TRVT_RESERVE_THROUGH = 10,///< takes a value 0 = reserve through, 1 = cancel previous reserve through
|
||||
TRVT_LONG_RESERVE = 11,///< takes a value 0 = long reserve, 1 = cancel previous long reserve
|
||||
TRVT_LONG_RESERVE = 11,///< takes a TraceRestrictLongReserveValueField
|
||||
TRVT_GROUP_INDEX = 12,///< takes a GroupID
|
||||
TRVT_WEIGHT = 13,///< takes a weight
|
||||
TRVT_POWER = 14,///< takes a power
|
||||
|
@@ -1545,7 +1545,19 @@ static void DrawInstructionString(const TraceRestrictProgram *prog, TraceRestric
|
||||
break;
|
||||
|
||||
case TRIT_LONG_RESERVE:
|
||||
instruction_string = GetTraceRestrictValue(item) ? STR_TRACE_RESTRICT_LONG_RESERVE_CANCEL : STR_TRACE_RESTRICT_LONG_RESERVE;
|
||||
switch (static_cast<TraceRestrictLongReserveValueField>(GetTraceRestrictValue(item))) {
|
||||
case TRLRVF_LONG_RESERVE:
|
||||
instruction_string = STR_TRACE_RESTRICT_LONG_RESERVE;
|
||||
break;
|
||||
|
||||
case TRLRVF_CANCEL_LONG_RESERVE:
|
||||
instruction_string = STR_TRACE_RESTRICT_LONG_RESERVE_CANCEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case TRIT_WAIT_AT_PBS:
|
||||
@@ -3180,7 +3192,7 @@ private:
|
||||
right_sel->SetDisplayedPlane(DPR_VALUE_DROPDOWN);
|
||||
this->EnableWidget(TR_WIDGET_VALUE_DROPDOWN);
|
||||
this->GetWidget<NWidgetCore>(TR_WIDGET_VALUE_DROPDOWN)->widget_data =
|
||||
GetTraceRestrictValue(item) ? STR_TRACE_RESTRICT_LONG_RESERVE_CANCEL : STR_TRACE_RESTRICT_LONG_RESERVE;
|
||||
GetDropDownStringByValue(&_long_reserve_value, GetTraceRestrictValue(item));
|
||||
break;
|
||||
|
||||
case TRVT_WAIT_AT_PBS:
|
||||
|
Reference in New Issue
Block a user