1
0
Fork 0

(svn r22245) -Codechange: Make vehicle lists handle command-/GUI-scope invalidations themself.

release/1.2
frosch 2011-03-13 21:33:30 +00:00
parent f051a81b4e
commit dd20823277
2 changed files with 4 additions and 3 deletions

View File

@ -2270,7 +2270,7 @@ void Vehicle::RemoveFromShared()
} else if (were_first) { } else if (were_first) {
/* If we were the first one, update to the new first one. /* If we were the first one, update to the new first one.
* Note: FirstShared() is already the new first */ * 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; this->next_shared = NULL;

View File

@ -1609,13 +1609,14 @@ public:
*/ */
virtual void OnInvalidateData(int data = 0, bool gui_scope = true) virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{ {
if (!gui_scope) return; if (!gui_scope && HasBit(data, 31) && this->vli.type == VL_SHARED_ORDERS) {
if (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->vli.index = GB(data, 0, 20);
this->window_number = this->vli.Pack(); this->window_number = this->vli.Pack();
this->vehicles.ForceRebuild(); this->vehicles.ForceRebuild();
return; return;
} }
if (!gui_scope) return;
/* We can only set the trigger for resorting/rebuilding. /* We can only set the trigger for resorting/rebuilding.
* We cannot safely resort at this point, as there might be multiple scheduled invalidations, * We cannot safely resort at this point, as there might be multiple scheduled invalidations,