(svn r10513) -Fix [FS#1022]: use vehicle subtile position to update cache, not tile, so that collision detection works on bridges and tunnels.
authorpeter1138
Wed, 11 Jul 2007 21:31:34 +0000
changeset 7232 21170a714fea
parent 7231 a4a53a70f796
child 7233 aadfbb505671
(svn r10513) -Fix [FS#1022]: use vehicle subtile position to update cache, not tile, so that collision detection works on bridges and tunnels.
src/vehicle.cpp
--- a/src/vehicle.cpp	Wed Jul 11 17:02:15 2007 +0000
+++ b/src/vehicle.cpp	Wed Jul 11 21:31:34 2007 +0000
@@ -471,8 +471,8 @@
 	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];
 	}