From 4fafb723aa7a69ebc53c4a9f734ad2dbe5c2a3e0 Mon Sep 17 00:00:00 2001 From: frosch Date: Fri, 9 Jan 2009 15:11:35 +0000 Subject: (svn r14936) -Fix: INDUSTRYBEH_ONLY_NEARTOWN bypassed the clear-test and could e.g. result in incomplete clearing of protected houses. --- src/industry_cmd.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 3c9262458..fa4800eba 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1264,7 +1264,8 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable refused_slope |= IsSlopeRefused(tileh, its->slopes_refused); } - if (ind_behav & (INDUSTRYBEH_ONLY_INTOWN | INDUSTRYBEH_TOWN1200_MORE)) { + if ((ind_behav & (INDUSTRYBEH_ONLY_INTOWN | INDUSTRYBEH_TOWN1200_MORE)) || // Tile must be a house + ((ind_behav & INDUSTRYBEH_ONLY_NEARTOWN) && IsTileType(cur_tile, MP_HOUSE))) { // Tile is allowed to be a house (and it is a house) if (!IsTileType(cur_tile, MP_HOUSE)) { _error_message = STR_030D_CAN_ONLY_BE_BUILT_IN_TOWNS; return false; @@ -1277,7 +1278,7 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable _current_company = old_company; if (not_clearable) return false; - } else if ((ind_behav & INDUSTRYBEH_ONLY_NEARTOWN) == 0 || !IsTileType(cur_tile, MP_HOUSE)) { + } else { /* Clear the tiles as OWNER_TOWN to not affect town rating, and to not clear protected buildings */ CompanyID old_company = _current_company; _current_company = OWNER_TOWN; -- cgit v1.2.3-70-g09d2