summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-07-11 21:31:34 +0000
committerpeter1138 <peter1138@openttd.org>2007-07-11 21:31:34 +0000
commitdcf4881b074129ee1d6a8a0a9c119222a2f0f303 (patch)
treea015e916c6d1de267ed1d35a3069fb75a06f06f2 /src
parent2121112cc8abe004a2ccbec4f7c3d7e5f7cf680e (diff)
downloadopenttd-dcf4881b074129ee1d6a8a0a9c119222a2f0f303.tar.xz
(svn r10513) -Fix [FS#1022]: use vehicle subtile position to update cache, not tile, so that collision detection works on bridges and tunnels.
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index d331f6325..b2d1ccdac 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -471,8 +471,8 @@ static void UpdateNewVehiclePosHash(Vehicle *v, bool remove)
if (remove) {
new_hash = NULL;
} else {
- int x = GB(TileX(v->tile), HASH_RES, HASH_BITS);
- int y = GB(TileY(v->tile), HASH_RES, HASH_BITS) << HASH_BITS;
+ int x = GB(v->x_pos / TILE_SIZE, HASH_RES, HASH_BITS);
+ int y = GB(v->y_pos / TILE_SIZE, HASH_RES, HASH_BITS) << HASH_BITS;
new_hash = &_new_vehicle_position_hash[(x + y) & TOTAL_HASH_MASK];
}