diff options
author | Yexo <yexo@openttd.org> | 2009-01-21 01:37:20 +0000 |
---|---|---|
committer | Yexo <yexo@openttd.org> | 2009-01-21 01:37:20 +0000 |
commit | 2307adf8d26763342d874797aaa74a46fbd4baa6 (patch) | |
tree | 04d8b3c42eaacc7562b83679684d6bf7a51b7043 /src/ai | |
parent | e395533632234d7f2efdcf648b2dc8fc08ab4fe2 (diff) | |
download | openttd-2307adf8d26763342d874797aaa74a46fbd4baa6.tar.xz |
(svn r15187) -Fix: assert when an AI called AIRoad::GetNeighbourRoadCount on a tile at the north edge (bug found by SmatZ).
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/api/ai_road.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ai/api/ai_road.cpp b/src/ai/api/ai_road.cpp index a6a14656c..2e3137f23 100644 --- a/src/ai/api/ai_road.cpp +++ b/src/ai/api/ai_road.cpp @@ -422,10 +422,10 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia ::RoadTypes rts = ::RoadTypeToRoadTypes((::RoadType)GetCurrentRoadType()); int32 neighbour = 0; - if (NeighbourHasReachableRoad(rts, tile, DIAGDIR_NE)) neighbour++; + if (TileX(tile) > 0 && NeighbourHasReachableRoad(rts, tile, DIAGDIR_NE)) neighbour++; if (NeighbourHasReachableRoad(rts, tile, DIAGDIR_SE)) neighbour++; if (NeighbourHasReachableRoad(rts, tile, DIAGDIR_SW)) neighbour++; - if (NeighbourHasReachableRoad(rts, tile, DIAGDIR_NW)) neighbour++; + if (TileY(tile) > 0 && NeighbourHasReachableRoad(rts, tile, DIAGDIR_NW)) neighbour++; return neighbour; } |