summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-09-08 21:37:13 +0000
committerrubidium <rubidium@openttd.org>2010-09-08 21:37:13 +0000
commitf5128695c54ad634e1ac45ae4271c1db5ed15fad (patch)
tree7fe3411110d924b4c2d879f3c32ceb5a0ddd4f00 /src/vehicle.cpp
parent881c6c679ff2606111cb890847147556142c3451 (diff)
downloadopenttd-f5128695c54ad634e1ac45ae4271c1db5ed15fad.tar.xz
(svn r20772) -Codechange: use packed VehicleListIdentifiers as window numbers
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index f54aefbf6..642a78023 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -49,6 +49,7 @@
#include "sound_func.h"
#include "effectvehicle_func.h"
#include "effectvehicle_base.h"
+#include "vehiclelist.h"
#include "table/strings.h"
@@ -1888,7 +1889,7 @@ void Vehicle::RemoveFromShared()
/* Remember if we were first and the old window number before RemoveVehicle()
* as this changes first if needed. */
bool were_first = (this->FirstShared() == this);
- uint32 old_window_number = (this->FirstShared()->index << 16) | (this->type << 11) | VLW_SHARED_ORDERS | this->owner;
+ VehicleListIdentifier vli(VL_SHARED_ORDERS, this->type, this->owner, this->FirstShared()->index);
this->orders.list->RemoveVehicle(this);
@@ -1902,12 +1903,12 @@ void Vehicle::RemoveFromShared()
if (this->orders.list->GetNumVehicles() == 1) {
/* When there is only one vehicle, remove the shared order list window. */
- DeleteWindowById(GetWindowClassForVehicleType(this->type), old_window_number);
+ DeleteWindowById(GetWindowClassForVehicleType(this->type), vli.Pack());
InvalidateVehicleOrder(this->FirstShared(), 0);
} 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), old_window_number, (this->FirstShared()->index << 16) | (1 << 15));
+ InvalidateWindowData(GetWindowClassForVehicleType(this->type), vli.Pack(), this->FirstShared()->index | (1U << 31));
}
this->next_shared = NULL;