diff options
author | yexo <yexo@openttd.org> | 2010-09-03 21:50:51 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-09-03 21:50:51 +0000 |
commit | a45b598bfcbbe46acbf9ea95d280fbf8d60a7b47 (patch) | |
tree | 4d7e1ca33587bc8097b6b596b789c0cc4f1ca639 /src/landscape.cpp | |
parent | bd379e283f4730f11bc40e9c3b583b44f9bc0a0b (diff) | |
download | openttd-a45b598bfcbbe46acbf9ea95d280fbf8d60a7b47.tar.xz |
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
Diffstat (limited to 'src/landscape.cpp')
-rw-r--r-- | src/landscape.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/landscape.cpp b/src/landscape.cpp index 4804ea215..f3bcaa263 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -29,6 +29,7 @@ #include "landscape_type.h" #include "animated_tile_func.h" #include "core/random_func.hpp" +#include "object_base.h" #include "table/sprites.h" @@ -603,6 +604,9 @@ void ClearSnowLine() */ CommandCost CmdLandscapeClear(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { + for (uint i = 0; i < _cleared_object_areas.Length(); i++) { + if (_cleared_object_areas[i].Intersects(TileArea(tile, 1, 1))) return CommandCost(); + } return _tile_type_procs[GetTileType(tile)]->clear_tile_proc(tile, flags); } @@ -634,7 +638,9 @@ CommandCost CmdClearArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 for (int x = sx; x <= ex; ++x) { for (int y = sy; y <= ey; ++y) { + SmallVector<TileArea, 1> object_areas = _cleared_object_areas; CommandCost ret = DoCommand(TileXY(x, y), 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR); + _cleared_object_areas = object_areas; if (ret.Failed()) { last_error = ret; continue; |