Mercurial > hg > openttd
changeset 8049:9007f88a1c87 draft
(svn r11609) -Fix [FS#1524]: wrong error messages were shown when trying to build some industries in the scenario editor.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 09 Dec 2007 18:51:25 +0000 |
parents | 27015788337e |
children | cbe6f0a1b5b5 |
files | src/industry_cmd.cpp src/industry_gui.cpp |
diffstat | 2 files changed, 5 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1236,9 +1236,9 @@ 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 @@ /* 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 @@ 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);
--- 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 @@ _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);