mirror of https://github.com/OpenRCT2/OpenRCT2.git
Introduce constant for max adjacency distance
This commit is contained in:
parent
202bea59c8
commit
a6993bdb9f
|
@ -41,6 +41,7 @@
|
||||||
#define MAX_RIDES 255
|
#define MAX_RIDES 255
|
||||||
#define RIDE_ID_NULL 255
|
#define RIDE_ID_NULL 255
|
||||||
|
|
||||||
|
static const uint8 ride_adjacent_station_max_distance = 5;
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
|
|
|
@ -2425,19 +2425,17 @@ static bool vehicle_can_depart_synchronised(rct_vehicle *vehicle)
|
||||||
_lastSynchronisedVehicle = _synchronisedVehicles;
|
_lastSynchronisedVehicle = _synchronisedVehicles;
|
||||||
|
|
||||||
// Search for stations to sync in both directions from the current tile.
|
// Search for stations to sync in both directions from the current tile.
|
||||||
|
|
||||||
static const sint32 maxSearchDistance = 5; // How many tiles we are allowed to search
|
|
||||||
|
|
||||||
// First search direction.
|
// First search direction.
|
||||||
sint32 direction = (mapElement->type + 1) & 3;
|
sint32 direction = (mapElement->type + 1) & 3;
|
||||||
sint32 spaceBetween;
|
sint32 spaceBetween;
|
||||||
|
|
||||||
spaceBetween = maxSearchDistance;
|
spaceBetween = ride_adjacent_station_max_distance;
|
||||||
while (_lastSynchronisedVehicle < &_synchronisedVehicles[SYNCHRONISED_VEHICLE_COUNT - 1]) {
|
while (_lastSynchronisedVehicle < &_synchronisedVehicles[SYNCHRONISED_VEHICLE_COUNT - 1]) {
|
||||||
x += TileDirectionDelta[direction].x;
|
x += TileDirectionDelta[direction].x;
|
||||||
y += TileDirectionDelta[direction].y;
|
y += TileDirectionDelta[direction].y;
|
||||||
if (try_add_synchronised_station(x, y, z)) {
|
if (try_add_synchronised_station(x, y, z)) {
|
||||||
spaceBetween = maxSearchDistance;
|
spaceBetween = ride_adjacent_station_max_distance;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (spaceBetween-- == 0)
|
if (spaceBetween-- == 0)
|
||||||
|
@ -2450,12 +2448,12 @@ static bool vehicle_can_depart_synchronised(rct_vehicle *vehicle)
|
||||||
|
|
||||||
// Other search direction.
|
// Other search direction.
|
||||||
direction = (direction ^ 2) & 3;
|
direction = (direction ^ 2) & 3;
|
||||||
spaceBetween = maxSearchDistance;
|
spaceBetween = ride_adjacent_station_max_distance;
|
||||||
while (_lastSynchronisedVehicle < &_synchronisedVehicles[SYNCHRONISED_VEHICLE_COUNT - 1]) {
|
while (_lastSynchronisedVehicle < &_synchronisedVehicles[SYNCHRONISED_VEHICLE_COUNT - 1]) {
|
||||||
x += TileDirectionDelta[direction].x;
|
x += TileDirectionDelta[direction].x;
|
||||||
y += TileDirectionDelta[direction].y;
|
y += TileDirectionDelta[direction].y;
|
||||||
if (try_add_synchronised_station(x, y, z)) {
|
if (try_add_synchronised_station(x, y, z)) {
|
||||||
spaceBetween = maxSearchDistance;
|
spaceBetween = ride_adjacent_station_max_distance;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (spaceBetween-- == 0)
|
if (spaceBetween-- == 0)
|
||||||
|
|
Loading…
Reference in New Issue