Limit tunnel length at the proper place
This commit is contained in:

committed by
Jonathan G Rennison

parent
3e771dc18d
commit
a3d1b916d1
@@ -382,12 +382,13 @@ static TileIndex BuildTunnel(PathNode *current, TileIndex end_tile = INVALID_TIL
|
|||||||
const TileIndexDiff delta = TileOffsByDiagDir(direction);
|
const TileIndexDiff delta = TileOffsByDiagDir(direction);
|
||||||
end_tile = start_tile;
|
end_tile = start_tile;
|
||||||
int end_z;
|
int end_z;
|
||||||
|
const uint tunnel_length_limit = std::min<uint>(_settings_game.construction.max_tunnel_length, 30);
|
||||||
|
|
||||||
for (int tunnel_length = 1;;tunnel_length++) {
|
for (int tunnel_length = 1;;tunnel_length++) {
|
||||||
end_tile += delta;
|
end_tile += delta;
|
||||||
|
|
||||||
if (!IsValidTile(end_tile)) return INVALID_TILE;
|
if (!IsValidTile(end_tile)) return INVALID_TILE;
|
||||||
if (tunnel_length > _settings_game.construction.max_tunnel_length) return INVALID_TILE;
|
if (tunnel_length > tunnel_length_limit) return INVALID_TILE;
|
||||||
|
|
||||||
GetTileSlope(end_tile, &end_z);
|
GetTileSlope(end_tile, &end_z);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user