diff options
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r-- | src/vehicle_gui.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 6efbecf53..d8a69c04e 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -686,6 +686,12 @@ struct RefitWindow : public Window { virtual void OnInvalidateData(int data) { switch (data) { + case -666: + /* Autoreplace replaced the vehicle. + * Nothing to do though for this window. + * This case is _not_ called asynchronously. Get out directly, rest can be done later */ + break; + case 0: { // The consist has changed; rebuild the entire list. /* Clear the selection. */ Vehicle *v = Vehicle::Get(this->window_number); @@ -1121,7 +1127,7 @@ static inline void ChangeVehicleWindow(WindowClass window_class, VehicleID from_ } /* Notify the window immediately, without scheduling. */ - w->InvalidateData(); + w->InvalidateData(-666); } } @@ -1780,6 +1786,12 @@ struct VehicleDetailsWindow : Window { virtual void OnInvalidateData(int data) { + if (data == -666) { + /* Autoreplace replaced the vehicle. + * Nothing to do for this window though. + * This case is _not_ called asynchronously. Get out directly, rest can be done later */ + return; + } const Vehicle *v = Vehicle::Get(this->window_number); if (v->type == VEH_ROAD) { const NWidgetBase *nwid_info = this->GetWidget<NWidgetBase>(VLD_WIDGET_MIDDLE_DETAILS); @@ -2581,6 +2593,16 @@ public: } } + virtual void OnInvalidateData(int data) + { + if (data == -666) { + /* Autoreplace replaced the vehicle. + * Nothing to do for this window though. + * This case is _not_ called asynchronously. Get out directly, rest can be done later */ + return; + } + } + virtual bool IsNewGRFInspectable() const { return ::IsNewGRFInspectable(GetGrfSpecFeature(Vehicle::Get(this->window_number)->type), this->window_number); |