summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-07-30 12:28:49 +0000
committerfrosch <frosch@openttd.org>2011-07-30 12:28:49 +0000
commit9c239bb988199aba0380aafbb23a89b27626ab48 (patch)
treec7ce8373f320ee7939acd1025f419b916c333109 /src
parent059d43fca81b4769b8e77074d86720b20d0b4fbe (diff)
downloadopenttd-9c239bb988199aba0380aafbb23a89b27626ab48.tar.xz
(svn r22698) -Fix [FS#4694]: Only insert cleared object tiles into _cleared_object_areas if clearing actually succeeds, else subsequential tests of the same tile will be skipped and considered successful.
Diffstat (limited to 'src')
-rw-r--r--src/object_cmd.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index 17a053b3d..c81b212b7 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -425,10 +425,6 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags)
Object *o = Object::GetByTile(tile);
TileArea ta = o->location;
- ClearedObjectArea *cleared_area = _cleared_object_areas.Append();
- cleared_area->first_tile = tile;
- cleared_area->area = ta;
-
CommandCost cost(EXPENSES_CONSTRUCTION, spec->GetClearCost() * ta.w * ta.h / 5);
if (spec->flags & OBJECT_FLAG_CLEAR_INCOME) cost.MultiplyCost(-1); // They get an income!
@@ -486,6 +482,10 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags)
break;
}
+ ClearedObjectArea *cleared_area = _cleared_object_areas.Append();
+ cleared_area->first_tile = tile;
+ cleared_area->area = ta;
+
if (flags & DC_EXEC) ReallyClearObjectTile(o);
return cost;