diff options
author | PeterN <peter@fuzzle.org> | 2019-02-10 08:43:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-10 08:43:54 +0000 |
commit | d242875d270e29f198cc62508b338f8949bf3404 (patch) | |
tree | 331272647b78fb37fddcf50d437c419d7f7422a2 | |
parent | 6e211908588ab5272336d0d2db3bbb4020f7004f (diff) | |
download | openttd-d242875d270e29f198cc62508b338f8949bf3404.tar.xz |
Fix #7197: Invalidate depot buttons when necessary. (#7212)
-rw-r--r-- | src/vehicle.cpp | 2 | ||||
-rw-r--r-- | src/vehicle_cmd.cpp | 1 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 6 |
3 files changed, 8 insertions, 1 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index f655bbafc..f9a48a898 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1490,6 +1490,8 @@ void VehicleEnterDepot(Vehicle *v) TriggerVehicle(v, VEHICLE_TRIGGER_DEPOT); v->MarkDirty(); + InvalidateWindowData(WC_VEHICLE_VIEW, v->index); + if (v->current_order.IsType(OT_GOTO_DEPOT)) { SetWindowDirty(WC_VEHICLE_VIEW, v->index); diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index 9f8e03887..8284511dd 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -585,6 +585,7 @@ CommandCost CmdStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); SetWindowClassesDirty(GetWindowClassForVehicleType(v->type)); + InvalidateWindowData(WC_VEHICLE_VIEW, v->index); } return CommandCost(); } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index b4d6fdfab..777716c64 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2503,6 +2503,8 @@ public: this->GetWidget<NWidgetCore>(WID_VV_SHOW_ORDERS)->tool_tip = STR_VEHICLE_VIEW_TRAIN_ORDERS_TOOLTIP + v->type; this->GetWidget<NWidgetCore>(WID_VV_SHOW_DETAILS)->tool_tip = STR_VEHICLE_VIEW_TRAIN_SHOW_DETAILS_TOOLTIP + v->type; this->GetWidget<NWidgetCore>(WID_VV_CLONE)->tool_tip = STR_VEHICLE_VIEW_CLONE_TRAIN_INFO + v->type; + + this->UpdateButtonStatus(); } ~VehicleViewWindow() @@ -2732,7 +2734,7 @@ public: } } - virtual void OnGameTick() + void UpdateButtonStatus() { const Vehicle *v = Vehicle::Get(this->window_number); bool veh_stopped = v->IsStoppedInDepot(); @@ -2769,6 +2771,8 @@ public: * Nothing to do for this window. */ return; } + + this->UpdateButtonStatus(); } virtual bool IsNewGRFInspectable() const |