(svn r20729) -Fix [FS#4107]: assert when overbuilding object

This commit is contained in:
yexo
2010-09-03 21:50:51 +00:00
parent f85bd1f37f
commit 0d040f03e6
5 changed files with 25 additions and 0 deletions

View File

@@ -342,6 +342,8 @@ static void ReallyClearObjectTile(Object *o)
delete o;
}
SmallVector<TileArea, 4> _cleared_object_areas;
static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags)
{
ObjectType type = GetObjectType(tile);
@@ -351,6 +353,8 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags)
Object *o = Object::GetByTile(tile);
TileArea ta = o->location;
*_cleared_object_areas.Append() = 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!