1
0
Fork 0

(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.

release/1.2
frosch 2011-07-30 12:28:49 +00:00
parent 059d43fca8
commit 9c239bb988
1 changed files with 4 additions and 4 deletions

View File

@ -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;