Add reverse at waypoint orders.
The train will reverse when its tail is within the waypoint tile. This is useful for reversing on train en-route, without creating dedicated reversing sidings or platforms.
This commit is contained in:
@@ -314,10 +314,13 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
|
||||
}
|
||||
break;
|
||||
|
||||
case OT_GOTO_WAYPOINT:
|
||||
SetDParam(0, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_GO_NON_STOP_TO_WAYPOINT : STR_ORDER_GO_TO_WAYPOINT);
|
||||
case OT_GOTO_WAYPOINT: {
|
||||
StringID str = (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_GO_NON_STOP_TO_WAYPOINT : STR_ORDER_GO_TO_WAYPOINT;
|
||||
if (order->GetWaypointFlags() & OWF_REVERSE) str += STR_ORDER_GO_TO_WAYPOINT_REVERSE - STR_ORDER_GO_TO_WAYPOINT;
|
||||
SetDParam(0, str);
|
||||
SetDParam(1, order->GetDestination());
|
||||
break;
|
||||
}
|
||||
|
||||
case OT_CONDITIONAL:
|
||||
SetDParam(1, order->GetConditionSkipToOrder() + 1);
|
||||
@@ -489,6 +492,7 @@ private:
|
||||
/* WID_O_SEL_TOP_LEFT */
|
||||
DP_LEFT_LOAD = 0, ///< Display 'load' in the left button of the top row of the train/rv order window.
|
||||
DP_LEFT_REFIT = 1, ///< Display 'refit' in the left button of the top row of the train/rv order window.
|
||||
DP_LEFT_REVERSE = 2, ///< Display 'reverse' in the left button of the top row of the train/rv order window.
|
||||
|
||||
/* WID_O_SEL_TOP_MIDDLE */
|
||||
DP_MIDDLE_UNLOAD = 0, ///< Display 'unload' in the middle button of the top row of the train/rv order window.
|
||||
@@ -999,13 +1003,14 @@ public:
|
||||
row_sel->SetDisplayedPlane(DP_ROW_LOAD);
|
||||
} else {
|
||||
train_row_sel->SetDisplayedPlane(DP_GROUNDVEHICLE_ROW_NORMAL);
|
||||
left_sel->SetDisplayedPlane(DP_LEFT_LOAD);
|
||||
left_sel->SetDisplayedPlane(DP_LEFT_REVERSE);
|
||||
middle_sel->SetDisplayedPlane(DP_MIDDLE_UNLOAD);
|
||||
right_sel->SetDisplayedPlane(DP_RIGHT_EMPTY);
|
||||
this->EnableWidget(WID_O_NON_STOP);
|
||||
this->SetWidgetLoweredState(WID_O_NON_STOP, order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
|
||||
this->EnableWidget(WID_O_REVERSE);
|
||||
this->SetWidgetLoweredState(WID_O_REVERSE, order->GetWaypointFlags() & OWF_REVERSE);
|
||||
}
|
||||
this->DisableWidget(WID_O_FULL_LOAD);
|
||||
this->DisableWidget(WID_O_UNLOAD);
|
||||
this->DisableWidget(WID_O_REFIT_DROPDOWN);
|
||||
break;
|
||||
@@ -1287,6 +1292,17 @@ public:
|
||||
}
|
||||
break;
|
||||
|
||||
case WID_O_REVERSE: {
|
||||
VehicleOrderID sel_ord = this->OrderGetSel();
|
||||
const Order *order = this->vehicle->GetOrder(sel_ord);
|
||||
|
||||
if (order == NULL) break;
|
||||
|
||||
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_WAYPOINT_FLAGS | (order->GetWaypointFlags() ^ OWF_REVERSE) << 4,
|
||||
CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_O_TIMETABLE_VIEW:
|
||||
ShowTimetableWindow(this->vehicle);
|
||||
break;
|
||||
@@ -1555,6 +1571,8 @@ static const NWidgetPart _nested_orders_train_widgets[] = {
|
||||
SetDataTip(STR_ORDER_TOGGLE_FULL_LOAD, STR_ORDER_TOOLTIP_FULL_LOAD), SetResize(1, 0),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_REFIT), SetMinimalSize(93, 12), SetFill(1, 0),
|
||||
SetDataTip(STR_ORDER_REFIT, STR_ORDER_REFIT_TOOLTIP), SetResize(1, 0),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_O_REVERSE), SetMinimalSize(93, 12), SetFill(1, 0),
|
||||
SetDataTip(STR_ORDER_REVERSE, STR_ORDER_REVERSE_TOOLTIP), SetResize(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_O_SEL_TOP_MIDDLE),
|
||||
NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_UNLOAD), SetMinimalSize(93, 12), SetFill(1, 0),
|
||||
|
Reference in New Issue
Block a user