summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-01-09 23:43:06 +0100
committerGitHub <noreply@github.com>2021-01-09 23:43:06 +0100
commit5f1154e0765251dd0a88dc28dbe487080fdcd6e0 (patch)
treed943a27c0db42219a003411e085b2f6008d9996c
parent928276a66e739d8b82aa87064cc736f1c5cfaa47 (diff)
downloadopenttd-5f1154e0765251dd0a88dc28dbe487080fdcd6e0.tar.xz
Fix #8272: vehicle destination text colour when mousing over (#8543)
Co-authored-by: Jonathan G Rennison <j.g.rennison@gmail.com>
-rw-r--r--src/vehicle_gui.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 877767aa5..1e558373b 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -2800,6 +2800,7 @@ public:
const Vehicle *v = Vehicle::Get(this->window_number);
StringID str;
+ TextColour text_colour = TC_FROMSTRING;
if (v->vehstatus & VS_CRASHED) {
str = STR_VEHICLE_STATUS_CRASHED;
} else if (v->type != VEH_AIRCRAFT && v->breakdown_ctr == 1) { // check for aircraft necessary?
@@ -2824,6 +2825,13 @@ public:
} else if (v->type == VEH_AIRCRAFT && HasBit(Aircraft::From(v)->flags, VAF_DEST_TOO_FAR) && !v->current_order.IsType(OT_LOADING)) {
str = STR_VEHICLE_STATUS_AIRCRAFT_TOO_FAR;
} else { // vehicle is in a "normal" state, show current order
+ if (mouse_over_start_stop) {
+ if (v->vehstatus & VS_STOPPED) {
+ text_colour = TC_RED | TC_FORCED;
+ } else if (v->type == VEH_TRAIN && HasBit(Train::From(v)->flags, VRF_TRAIN_STUCK) && !v->current_order.IsType(OT_LOADING)) {
+ text_colour = TC_ORANGE | TC_FORCED;
+ }
+ }
switch (v->current_order.GetType()) {
case OT_GOTO_STATION: {
SetDParam(0, v->current_order.GetDestination());
@@ -2890,7 +2898,7 @@ public:
int image = ((v->vehstatus & VS_STOPPED) != 0) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING;
int lowered = this->IsWidgetLowered(WID_VV_START_STOP) ? 1 : 0;
DrawSprite(image, PAL_NONE, image_left + lowered, r.top + WD_IMGBTN_TOP + lowered);
- DrawString(text_left + lowered, text_right + lowered, r.top + WD_FRAMERECT_TOP + lowered, str, TC_FROMSTRING, SA_HOR_CENTER);
+ DrawString(text_left + lowered, text_right + lowered, r.top + WD_FRAMERECT_TOP + lowered, str, text_colour, SA_HOR_CENTER);
}
void OnClick(Point pt, int widget, int click_count) override