summaryrefslogtreecommitdiff
path: root/src/industry_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-12-09 18:51:25 +0000
committerrubidium <rubidium@openttd.org>2007-12-09 18:51:25 +0000
commita5106061442c778416d31b5f00cc73895b633016 (patch)
tree7bb8c5251984f5cf1544bba970237e8e5afb6f89 /src/industry_gui.cpp
parentaa39d2a618abff994f71b0f8a36b736ae0edbf98 (diff)
downloadopenttd-a5106061442c778416d31b5f00cc73895b633016.tar.xz
(svn r11609) -Fix [FS#1524]: wrong error messages were shown when trying to build some industries in the scenario editor.
Diffstat (limited to 'src/industry_gui.cpp')
-rw-r--r--src/industry_gui.cpp26
1 files changed, 1 insertions, 25 deletions
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);