summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdurrahmaan Iqbal <abdurrahmaaniqbal@hotmail.com>2020-06-23 20:50:41 +0100
committerCharles Pigott <charlespigott@googlemail.com>2020-07-10 14:48:22 +0100
commit7d2db99bfdf915b81bbd02ecbdcbf20a6d0973c9 (patch)
tree56962cbe4e6b0dbc357052329e8265bf90102b52
parentc39d62c245f51a67b6c212453777378d18bb9059 (diff)
downloadopenttd-7d2db99bfdf915b81bbd02ecbdcbf20a6d0973c9.tar.xz
Fix #7772: Show destination on mouseover when vehicle stopped (and not in depot)
-rw-r--r--src/vehicle_gui.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 79ffffcf0..84ff890d1 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -2430,6 +2430,7 @@ private:
SEL_DC_BASEPLANE = SEL_DC_GOTO_DEPOT, ///< First plane of the #WID_VV_SELECT_DEPOT_CLONE stacked widget.
SEL_RT_BASEPLANE = SEL_RT_REFIT, ///< First plane of the #WID_VV_SELECT_REFIT_TURN stacked widget.
};
+ bool mouse_over_start_stop = false;
/**
* Display a plane in the window.
@@ -2575,7 +2576,7 @@ public:
str = STR_VEHICLE_STATUS_CRASHED;
} else if (v->type != VEH_AIRCRAFT && v->breakdown_ctr == 1) { // check for aircraft necessary?
str = STR_VEHICLE_STATUS_BROKEN_DOWN;
- } else if (v->vehstatus & VS_STOPPED) {
+ } else if (v->vehstatus & VS_STOPPED && (!mouse_over_start_stop || v->IsStoppedInDepot())) {
if (v->type == VEH_TRAIN) {
if (v->cur_speed == 0) {
if (Train::From(v)->gcache.cached_power == 0) {
@@ -2731,6 +2732,15 @@ public:
}
}
+ void OnMouseOver(Point pt, int widget) override
+ {
+ bool start_stop = widget == WID_VV_START_STOP;
+ if (start_stop != mouse_over_start_stop) {
+ mouse_over_start_stop = start_stop;
+ this->SetWidgetDirty(WID_VV_START_STOP);
+ }
+ }
+
void OnResize() override
{
if (this->viewport != nullptr) {