From 2d30613c3ae3111d5297bb1d8a28aae5587ddd0d Mon Sep 17 00:00:00 2001 From: yexo Date: Sat, 4 Sep 2010 00:16:33 +0000 Subject: (svn r20733) -Fix: when overbuilding an object with an industry, clear the complete object --- src/industry_cmd.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index acfcc3aa8..7d0321aaf 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -40,6 +40,7 @@ #include "core/pool_func.hpp" #include "subsidy_func.h" #include "core/backup_type.hpp" +#include "object_base.h" #include "table/strings.h" #include "table/industry_land.h" @@ -1694,7 +1695,9 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do *ip = NULL; + SmallVector object_areas(_cleared_object_areas); CommandCost ret = CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, random_initial_bits, founder, &custom_shape_check); + _cleared_object_areas = object_areas; if (ret.Failed()) return ret; if (HasBit(GetIndustrySpec(type)->callback_mask, CBM_IND_LOCATION)) { @@ -1794,10 +1797,12 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin if (num >= count) return CMD_ERROR; CommandCost ret = CommandCost(STR_ERROR_SITE_UNSUITABLE); + SmallVector object_areas(_cleared_object_areas); do { if (--count < 0) return ret; if (--num < 0) num = indspec->num_table - 1; ret = CheckIfIndustryTilesAreFree(tile, itt[num], num, it, random_initial_bits, _current_company); + _cleared_object_areas = object_areas; } while (ret.Failed()); ret = CreateNewIndustryHelper(tile, it, flags, indspec, num, random_var8f, random_initial_bits, _current_company, &ind); -- cgit v1.2.3-70-g09d2