summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2019-03-30 22:20:26 +0000
committerGitHub <noreply@github.com>2019-03-30 22:20:26 +0000
commite1069eee05b648a64ff5dac3dd5701b01cfa2034 (patch)
tree019da19b2cc4b98fc7fb0f09e1738db17fe8a307 /src/station_cmd.cpp
parent32fda83d3916197a46215c83ddd85b2e50128a02 (diff)
downloadopenttd-e1069eee05b648a64ff5dac3dd5701b01cfa2034.tar.xz
Codechange: Check airport layout would fit within map bounds before iterating tiles. (#7429)
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index b15fc1543..a79480448 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2268,6 +2268,7 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
/* Check if a valid, buildable airport was chosen for construction */
const AirportSpec *as = AirportSpec::Get(airport_type);
if (!as->IsAvailable() || layout >= as->num_table) return CMD_ERROR;
+ if (!as->IsWithinMapBounds(layout, tile)) return CMD_ERROR;
Direction rotation = as->rotation[layout];
int w = as->size_x;