diff options
author | frosch <frosch@openttd.org> | 2010-11-21 17:05:23 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-11-21 17:05:23 +0000 |
commit | d5360390d00181b69a2aa90528a417d1299645d6 (patch) | |
tree | f27d3fe04e2c2b0462178f63e3b38dd7153cee72 /src/object_cmd.cpp | |
parent | 0580f3be0b35874cd8a4a3bb5f67f4ff32f270e6 (diff) | |
download | openttd-d5360390d00181b69a2aa90528a417d1299645d6.tar.xz |
(svn r21288) -Codechange: Add helper function to find entries in _cleared_object_areas.
Diffstat (limited to 'src/object_cmd.cpp')
-rw-r--r-- | src/object_cmd.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 0cf87a50e..a3af4eb59 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -371,6 +371,23 @@ static void ReallyClearObjectTile(Object *o) SmallVector<ClearedObjectArea, 4> _cleared_object_areas; +/** + * Find the entry in _cleared_object_areas which occupies a certain tile. + * @param tile Tile of interest + * @return Occupying entry, or NULL if none + */ +ClearedObjectArea *FindClearedObject(TileIndex tile) +{ + TileArea ta = TileArea(tile, 1, 1); + + const ClearedObjectArea *end = _cleared_object_areas.End(); + for (ClearedObjectArea *coa = _cleared_object_areas.Begin(); coa != end; coa++) { + if (coa->area.Intersects(ta)) return coa; + } + + return NULL; +} + static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags) { ObjectType type = GetObjectType(tile); |