summaryrefslogtreecommitdiff
path: root/src/industry_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-01-09 15:11:35 +0000
committerfrosch <frosch@openttd.org>2009-01-09 15:11:35 +0000
commit4fafb723aa7a69ebc53c4a9f734ad2dbe5c2a3e0 (patch)
tree03e4d9b6845a74cef4b140ca44cb3fcfee567f90 /src/industry_cmd.cpp
parent0464e9f864da7b71fdf7b568916596fbb8a614bb (diff)
downloadopenttd-4fafb723aa7a69ebc53c4a9f734ad2dbe5c2a3e0.tar.xz
(svn r14936) -Fix: INDUSTRYBEH_ONLY_NEARTOWN bypassed the clear-test and could e.g. result in incomplete clearing of protected houses.
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r--src/industry_cmd.cpp5
1 files changed, 3 insertions, 2 deletions
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;