Codechange: Check airport layout would fit within map bounds before iterating tiles. (#7429)

This commit is contained in:
2019-03-30 22:20:26 +00:00
committed by GitHub
parent 32fda83d39
commit e1069eee05
4 changed files with 25 additions and 1 deletions

View File

@@ -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;