Skip to content

Commit

Permalink
Fix OpenTTD#9527: Crash when trying to place multitile objects at map…
Browse files Browse the repository at this point in the history
… edge
  • Loading branch information
LordAro committed Aug 31, 2021
1 parent 5daf9a8 commit a6fbfb2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/object_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
int size_x = GB(spec->size, HasBit(view, 0) ? 4 : 0, 4);
int size_y = GB(spec->size, HasBit(view, 0) ? 0 : 4, 4);
TileArea ta(tile, size_x, size_y);
for (TileIndex t : ta) {
if (!IsValidTile(t)) return CMD_ERROR; // Might be off the map
}

if (type == OBJECT_OWNED_LAND) {
/* Owned land is special as it can be placed on any slope. */
Expand Down

0 comments on commit a6fbfb2

Please sign in to comment.