Codechange: Pass the max-distance as parameter to VehiclesNearTileXY.

This commit is contained in:
frosch
2025-04-26 15:23:14 +02:00
committed by frosch
parent 2df1233f1f
commit 3a70d1e2f7
4 changed files with 25 additions and 18 deletions
+2 -2
View File
@@ -553,7 +553,7 @@ static bool RoadVehCheckTrainCrash(RoadVehicle *v)
if (!IsLevelCrossingTile(tile)) continue;
if (HasVehicleNearTileXY(v->x_pos, v->y_pos, [&u](const Vehicle *t) {
if (HasVehicleNearTileXY(v->x_pos, v->y_pos, 6, [&u](const Vehicle *t) {
return t->type == VEH_TRAIN && abs(t->z_pos - u->z_pos) <= 6 &&
abs(t->x_pos - u->x_pos) <= 4 && abs(t->y_pos - u->y_pos) <= 4;
})) {
@@ -649,7 +649,7 @@ static RoadVehicle *RoadVehFindCloseTo(RoadVehicle *v, int x, int y, Direction d
FindClosestBlockingRoadVeh(u, &rvf);
}
} else {
for (Vehicle *u : VehiclesNearTileXY(x, y)) {
for (Vehicle *u : VehiclesNearTileXY(x, y, 6)) {
FindClosestBlockingRoadVeh(u, &rvf);
}
}