summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/industry_cmd.cpp8
-rw-r--r--src/industry_gui.cpp26
2 files changed, 5 insertions, 29 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 84a321757..c400cb33b 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1236,9 +1236,9 @@ 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)) {
if (!IsTileType(cur_tile, MP_HOUSE)) {
- _error_message = STR_029D_CAN_ONLY_BE_BUILT_IN_TOWNS;
+ _error_message = STR_030D_CAN_ONLY_BE_BUILT_IN_TOWNS;
return false;
}
if (CmdFailed(DoCommand(cur_tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR))) return false;
@@ -1253,7 +1253,7 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable
/* It is almost impossible to have a fully flat land in TG, so what we
* do is that we check if we can make the land flat later on. See
* CheckIfCanLevelIndustryPlatform(). */
- return !refused_slope || (_patches.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape);
+ return !refused_slope || (_patches.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape && !_ignore_restrictions);
}
static bool CheckIfIndustryIsAllowed(TileIndex tile, int type, const Town *t)
@@ -1558,7 +1558,7 @@ static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint
if (!_check_new_industry_procs[indspec->check_proc](tile)) return NULL;
}
- if (!custom_shape_check && _patches.land_generator == LG_TERRAGENESIS && _generating_world && !CheckIfCanLevelIndustryPlatform(tile, 0, it, type)) return NULL;
+ if (!custom_shape_check && _patches.land_generator == LG_TERRAGENESIS && _generating_world && !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, 0, it, type)) return NULL;
if (!CheckIfTooCloseToIndustry(tile, type)) return NULL;
const Town *t = CheckMultipleIndustryInTown(tile, type);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index e9f692dac..1154b0a1d 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -26,30 +26,6 @@
#include "newgrf_text.h"
#include "date.h"
-extern Industry *CreateNewIndustry(TileIndex tile, IndustryType type);
-
-/**
- * Search callback function for TryBuildIndustry
- * @param tile to test
- * @param data that is passed by the caller. In this case, the type of industry been tested
- * @return the success (or not) of the operation
- */
-static bool SearchTileForIndustry(TileIndex tile, uint32 data)
-{
- return CreateNewIndustry(tile, data) != NULL;
-}
-
-/**
- * Perform a 9*9 tiles circular search around a tile
- * in order to find a suitable zone to create the desired industry
- * @param tile to start search for
- * @param type of the desired industry
- * @return the success (or not) of the operation
- */
-static bool TryBuildIndustry(TileIndex tile, int type)
-{
- return CircularTileSearch(tile, 9, SearchTileForIndustry, type);
-}
bool _ignore_restrictions;
/** Names of the widgets of the dynamic place industries gui */
@@ -307,7 +283,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
_current_player = OWNER_NONE;
_generating_world = true;
_ignore_restrictions = true;
- success = TryBuildIndustry(e->we.place.tile, WP(w, fnd_d).select);
+ success = DoCommandP(e->we.place.tile, WP(w, fnd_d).select, InteractiveRandomRange(indsp->num_table), NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
if (!success) {
SetDParam(0, indsp->name);
ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE, e->we.place.pt.x, e->we.place.pt.y);