diff options
author | Peter Nelson <peter1138@openttd.org> | 2019-01-30 09:20:07 +0000 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-01-30 17:08:36 +0000 |
commit | e982b9131e9c92d70dd5994910c1eb8ca644f2f2 (patch) | |
tree | ebdf56b749ed0d6864974ae309ce88bc44228031 | |
parent | 8334a5733220d379a0d573e3bf61c4c9d9c874e4 (diff) | |
download | openttd-e982b9131e9c92d70dd5994910c1eb8ca644f2f2.tar.xz |
Fix #7142: Missing map bounds check when building long roads.
-rw-r--r-- | src/road_cmd.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 175e776e5..d9825c9bf 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -809,7 +809,9 @@ do_clear:; */ static bool CanConnectToRoad(TileIndex tile, RoadType rt, DiagDirection dir) { - RoadBits bits = GetAnyRoadBits(tile + TileOffsByDiagDir(dir), rt, false); + tile += TileOffsByDiagDir(dir); + if (!IsValidTile(tile)) return false; + RoadBits bits = GetAnyRoadBits(tile, rt, false); return (bits & DiagDirToRoadBits(ReverseDiagDir(dir))) != 0; } |