diff options
author | peter1138 <peter1138@openttd.org> | 2007-07-11 21:31:34 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2007-07-11 21:31:34 +0000 |
commit | 1aaab031b203b25746bead8fc5cf01f62b01a10a (patch) | |
tree | a015e916c6d1de267ed1d35a3069fb75a06f06f2 | |
parent | 2c517a302646c6d3d4220b02198eefc59f0200bb (diff) | |
download | openttd-1aaab031b203b25746bead8fc5cf01f62b01a10a.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.
-rw-r--r-- | src/vehicle.cpp | 4 |
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]; } |