mirror of https://github.com/OpenTTD/OpenTTD
(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.
parent
059d43fca8
commit
9c239bb988
|
@ -425,10 +425,6 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags)
|
||||||
Object *o = Object::GetByTile(tile);
|
Object *o = Object::GetByTile(tile);
|
||||||
TileArea ta = o->location;
|
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);
|
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!
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClearedObjectArea *cleared_area = _cleared_object_areas.Append();
|
||||||
|
cleared_area->first_tile = tile;
|
||||||
|
cleared_area->area = ta;
|
||||||
|
|
||||||
if (flags & DC_EXEC) ReallyClearObjectTile(o);
|
if (flags & DC_EXEC) ReallyClearObjectTile(o);
|
||||||
|
|
||||||
return cost;
|
return cost;
|
||||||
|
|
Loading…
Reference in New Issue