Fix #7972: show invalid orders to stations that don't accept your vehicle (#8516)

Before it was shown as a normal order, but the vehicle was skipping
it. This was rather unclear to the user. Now it is red and contains
text with some hints what is going on.

The text is prefixed rather than post-fixed, as we have many
post-fixes already.
pull/217/head
Patric Stout 3 years ago committed by GitHub
parent fda1fbf61c
commit 9aa39d0af9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4021,6 +4021,7 @@ STR_ORDER_REFIT_STOP_ORDER :(Refit to {STRI
STR_ORDER_STOP_ORDER :(Stop)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING1}
STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION :{PUSH_COLOUR}{RED}(Can't use station){POP_COLOUR} {STRING} {STATION} {STRING1}
STR_ORDER_IMPLICIT :(Implicit)

@ -28,6 +28,7 @@
#include "hotkeys.h"
#include "aircraft.h"
#include "engine_func.h"
#include "vehicle_func.h"
#include "widgets/order_widget.h"
@ -258,8 +259,9 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
case OT_GOTO_STATION: {
OrderLoadFlags load = order->GetLoadType();
OrderUnloadFlags unload = order->GetUnloadType();
bool valid_station = CanVehicleUseStation(v, Station::Get(order->GetDestination()));
SetDParam(0, STR_ORDER_GO_TO_STATION);
SetDParam(0, valid_station ? STR_ORDER_GO_TO_STATION : STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION);
SetDParam(1, STR_ORDER_GO_TO + (v->IsGroundVehicle() ? order->GetNonStopType() : 0));
SetDParam(2, order->GetDestination());

Loading…
Cancel
Save