Tracerestrict: Add status test for if train is stopping at order destination

Station/waypoint of current order
pull/510/head
Jonathan G Rennison 1 year ago
parent cfc6b1b302
commit 55f11129c8

@ -917,6 +917,7 @@ STR_TRACE_RESTRICT_TRAIN_STATUS_LOADING :loading
STR_TRACE_RESTRICT_TRAIN_STATUS_WAITING :waiting
STR_TRACE_RESTRICT_TRAIN_STATUS_LOST :lost
STR_TRACE_RESTRICT_TRAIN_STATUS_REQUIRES_SERVICE :requires service
STR_TRACE_RESTRICT_TRAIN_STATUS_STOPPING_AT_STATION_WAYPOINT :stopping at station/waypoint
STR_TRACE_RESTRICT_REVERSE_SIG :Reverse behind signal
STR_TRACE_RESTRICT_REVERSE_SIG_CANCEL :Cancel reverse behind signal
STR_TRACE_RESTRICT_SET_SPEED_RESTRICTION :Restrict train speed to: {VELOCITY}

@ -77,7 +77,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
{ XSLFI_TRACE_RESTRICT, XSCF_NULL, 15, 15, "tracerestrict", nullptr, nullptr, "TRRM,TRRP,TRRS" },
{ XSLFI_TRACE_RESTRICT_OWNER, XSCF_NULL, 1, 1, "tracerestrict_owner", nullptr, nullptr, nullptr },
{ XSLFI_TRACE_RESTRICT_ORDRCND, XSCF_NULL, 4, 4, "tracerestrict_order_cond", nullptr, nullptr, nullptr },
{ XSLFI_TRACE_RESTRICT_STATUSCND, XSCF_NULL, 1, 1, "tracerestrict_status_cond", nullptr, nullptr, nullptr },
{ XSLFI_TRACE_RESTRICT_STATUSCND, XSCF_NULL, 2, 2, "tracerestrict_status_cond", nullptr, nullptr, nullptr },
{ XSLFI_TRACE_RESTRICT_REVERSE, XSCF_NULL, 1, 1, "tracerestrict_reverse", nullptr, nullptr, nullptr },
{ XSLFI_TRACE_RESTRICT_NEWSCTRL, XSCF_NULL, 1, 1, "tracerestrict_newsctrl", nullptr, nullptr, nullptr },
{ XSLFI_TRACE_RESTRICT_COUNTER, XSCF_NULL, 1, 1, "tracerestrict_counter", nullptr, nullptr, "TRRC" },

@ -511,6 +511,20 @@ void TraceRestrictProgram::Execute(const Train* v, const TraceRestrictProgramInp
case TRTSVF_REQUIRES_SERVICE:
has_status = v->NeedsServicing();
break;
case TRTSVF_STOPPING_AT_STATION_WAYPOINT:
switch (v->current_order.GetType()) {
case OT_GOTO_STATION:
case OT_GOTO_WAYPOINT:
case OT_LOADING_ADVANCE:
has_status = v->current_order.ShouldStopAtStation(v, v->current_order.GetDestination(), v->current_order.IsType(OT_GOTO_WAYPOINT));
break;
default:
has_status = false;
break;
}
break;
}
result = TestBinaryConditionCommon(item, has_status);
break;
@ -1185,6 +1199,7 @@ CommandCost TraceRestrictProgram::Validate(const std::vector<TraceRestrictItem>
case TRTSVF_WAITING:
case TRTSVF_LOST:
case TRTSVF_REQUIRES_SERVICE:
case TRTSVF_STOPPING_AT_STATION_WAYPOINT:
break;
default:
@ -1242,6 +1257,7 @@ CommandCost TraceRestrictProgram::Validate(const std::vector<TraceRestrictItem>
case TRTSVF_HEADING_TO_DEPOT:
case TRTSVF_LOADING:
case TRTSVF_WAITING:
case TRTSVF_STOPPING_AT_STATION_WAYPOINT:
actions_used_flags |= TRPAUF_ORDER_CONDITIONALS;
break;

@ -334,6 +334,7 @@ enum TraceRestrictTrainStatusValueField {
TRTSVF_WAITING = 8, ///< Train is waiting
TRTSVF_LOST = 9, ///< Train is lost
TRTSVF_REQUIRES_SERVICE = 10, ///< Train requires service
TRTSVF_STOPPING_AT_STATION_WAYPOINT= 11, ///< Train stops at destination station/waypoint
};
/**

@ -306,6 +306,7 @@ static const StringID _train_status_value_str[] = {
STR_TRACE_RESTRICT_TRAIN_STATUS_WAITING,
STR_TRACE_RESTRICT_TRAIN_STATUS_LOST,
STR_TRACE_RESTRICT_TRAIN_STATUS_REQUIRES_SERVICE,
STR_TRACE_RESTRICT_TRAIN_STATUS_STOPPING_AT_STATION_WAYPOINT,
INVALID_STRING_ID
};
static const uint _train_status_value_val[] = {
@ -320,6 +321,7 @@ static const uint _train_status_value_val[] = {
TRTSVF_WAITING,
TRTSVF_LOST,
TRTSVF_REQUIRES_SERVICE,
TRTSVF_STOPPING_AT_STATION_WAYPOINT,
};
/** value drop down list for train status type strings and values */

Loading…
Cancel
Save