From fcb0f2acd6f56bfc4fcecb0d045a0374413bab99 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 24 Sep 2016 12:55:17 +0100 Subject: [PATCH] Fix #4468: Boats at the Boat hire dock move on top of each other Confusingly gSpriteSpatialIndex is indexed by .yx not .xy, all the more reason to use the dedicated helper method. --- src/ride/vehicle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index 8c7510af86..a324319f16 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -5747,7 +5747,7 @@ bool vehicle_update_bumper_car_collision(rct_vehicle *vehicle, sint16 x, sint16 location.x += Unk9A37C4[i].x; location.y += Unk9A37C4[i].y; - uint16 spriteIdx = gSpriteSpatialIndex[location.xy]; + uint16 spriteIdx = sprite_get_first_in_quadrant(location.x * 32, location.y * 32); while (spriteIdx != 0xFFFF) { rct_vehicle* vehicle2 = GET_VEHICLE(spriteIdx); spriteIdx = vehicle2->next_in_quadrant; @@ -7056,7 +7056,7 @@ static bool vehicle_update_motion_collision_detection( location.x += Unk9A37C4[i].x; location.y += Unk9A37C4[i].y; - collideId = gSpriteSpatialIndex[location.xy]; + collideId = sprite_get_first_in_quadrant(location.x * 32, location.y * 32); for(; collideId != 0xFFFF; collideId = collideVehicle->next_in_quadrant){ collideVehicle = GET_VEHICLE(collideId); if (collideVehicle == vehicle) continue;