summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-06-13 07:14:42 +0000
committerpeter1138 <peter1138@openttd.org>2007-06-13 07:14:42 +0000
commitcb54a561ef254eb599c6ef638b896690a77c944a (patch)
treed06a65fb982a1fd315fe3f540b8154e38bb9bbce /src
parent19db4ee85c3f50631ee834c7763fba2e1cc96285 (diff)
downloadopenttd-cb54a561ef254eb599c6ef638b896690a77c944a.tar.xz
(svn r10129) -Fix (r10111): Test for x == INVALID_COORD instead of v->tile == INVALID_TILE to determine if a vehicle should be removed from the has.
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 540ef8c0b..a7180809e 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -456,12 +456,12 @@ void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
return NULL;
}
-static void UpdateNewVehiclePosHash(Vehicle *v)
+static void UpdateNewVehiclePosHash(Vehicle *v, bool remove)
{
Vehicle **old_hash = v->old_new_hash;
Vehicle **new_hash;
- if (v->tile == INVALID_TILE || v->tile == 0) {
+ if (remove) {
new_hash = NULL;
} else {
int x = GB(TileX(v->tile), HASH_RES, HASH_BITS);
@@ -503,7 +503,7 @@ static Vehicle *_vehicle_position_hash[0x1000];
static void UpdateVehiclePosHash(Vehicle* v, int x, int y)
{
- UpdateNewVehiclePosHash(v);
+ UpdateNewVehiclePosHash(v, x == INVALID_COORD);
Vehicle **old_hash, **new_hash;
int old_x = v->left_coord;
@@ -687,7 +687,6 @@ void DestroyVehicle(Vehicle *v)
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
}
- v->tile = INVALID_TILE;
UpdateVehiclePosHash(v, INVALID_COORD, 0);
v->next_hash = NULL;
v->next_new_hash = NULL;