summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vehicle.cpp2
-rw-r--r--src/vehicle_gui.cpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index f1dd8a7cd..e3ffbbc91 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2270,7 +2270,7 @@ void Vehicle::RemoveFromShared()
} else if (were_first) {
/* If we were the first one, update to the new first one.
* Note: FirstShared() is already the new first */
- InvalidateWindowData(GetWindowClassForVehicleType(this->type), vli.Pack(), this->FirstShared()->index | (1U << 31), true);
+ InvalidateWindowData(GetWindowClassForVehicleType(this->type), vli.Pack(), this->FirstShared()->index | (1U << 31));
}
this->next_shared = NULL;
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index a20e44a67..2974c351f 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1609,13 +1609,14 @@ public:
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
- if (!gui_scope) return;
- if (HasBit(data, 31) && this->vli.type == VL_SHARED_ORDERS) {
+ if (!gui_scope && HasBit(data, 31) && this->vli.type == VL_SHARED_ORDERS) {
+ /* Needs to be done in command-scope, so everything stays valid */
this->vli.index = GB(data, 0, 20);
this->window_number = this->vli.Pack();
this->vehicles.ForceRebuild();
return;
}
+ if (!gui_scope) return;
/* We can only set the trigger for resorting/rebuilding.
* We cannot safely resort at this point, as there might be multiple scheduled invalidations,