summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-17 21:07:09 +0000
committerrubidium <rubidium@openttd.org>2008-08-17 21:07:09 +0000
commit99efe9aaae2f7d6d39ab694e0be9981b738661ec (patch)
tree0187f4162e6e574d8191d24993c7ca782e70d6f5 /src/vehicle.cpp
parentabd9f748715c3f1278d54637c725e18d5cbe5bd5 (diff)
downloadopenttd-99efe9aaae2f7d6d39ab694e0be9981b738661ec.tar.xz
(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.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index ae77872a9..80ddeb032 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -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;