summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-01-08 16:04:44 +0100
committerGitHub <noreply@github.com>2021-01-08 16:04:44 +0100
commit9aa39d0af9f6a4423e37e82a46a6558e51beeece (patch)
treeb0aae0e946ea755cc4a234472e1bf81167ef1d0f /src
parentfda1fbf61cbce0b857a14122fe8d6341c6411a98 (diff)
downloadopenttd-9aa39d0af9f6a4423e37e82a46a6558e51beeece.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/order_gui.cpp4
2 files changed, 4 insertions, 1 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index c92d03cb6..52b10d8d1 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -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)
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index d26d00278..d3b4aa952 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -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());