(svn r14097) -Fix [FS#2085]: one couldn't get a list of vehicles sharing an order when the number of orders was 0; you could see that the vehicles had a shared order though.

This commit is contained in:
rubidium
2008-08-17 21:07:09 +00:00
parent abd9f74871
commit 99efe9aaae
5 changed files with 17 additions and 37 deletions

View File

@@ -2614,11 +2614,15 @@ void Vehicle::RemoveFromShared()
if (this->next_shared != NULL) this->next_shared->previous_shared = this->previous_shared;
uint32 old_window_number = (this->FirstShared()->index << 16) | (this->type << 11) | VLW_SHARED_ORDERS | this->owner;
if (new_first->NextShared() == NULL) {
/* When there is only one vehicle, remove the shared order list window. */
extern void RemoveSharedOrderVehicleList(Vehicle *v);
if (new_first->orders != NULL) RemoveSharedOrderVehicleList(new_first);
DeleteWindowById(GetWindowClassForVehicleType(this->type), old_window_number);
InvalidateVehicleOrder(new_first);
} else if (this->FirstShared() == this) {
/* If we were the first one, update to the new first one. */
InvalidateWindowData(GetWindowClassForVehicleType(this->type), old_window_number, (new_first->index << 16) | (1 << 15));
}
this->first_shared = this;