@@ -608,9 +608,9 @@ public:
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_INDUSTRIES, STR_ERROR_MUST_FOUND_TOWN_FIRST, WL_INFO);
} else {
extern void GenerateIndustries();
_generating_world = true;
Backup<bool> old_generating_world(_generating_world, true, FILE_LINE);
GenerateIndustries();
_generating_world = false;
old_generating_world.Restore();
}
@@ -712,15 +712,15 @@ public:
Backup<CompanyID> cur_company(_current_company, OWNER_NONE, FILE_LINE);
_ignore_restrictions = true;
DoCommandP(tile, (layout_index << 8) | this->selected_type, seed,
CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY), &CcBuildIndustry);
cur_company.Restore();
_ignore_restrictions = false;
success = DoCommandP(tile, (layout_index << 8) | this->selected_type, seed, CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY));
@@ -16,6 +16,7 @@
#include "object_base.h"
#include "company_base.h"
#include "company_func.h"
#include "core/backup_type.hpp"
#include "table/strings.h"
@@ -279,8 +280,8 @@ CommandCost CmdTerraformLand(TileIndex t
bool indirectly_cleared = coa != nullptr && coa->first_tile != t;
/* Check tiletype-specific things, and add extra-cost */
const bool curr_gen = _generating_world;
if (_game_mode == GM_EDITOR) _generating_world = true; // used to create green terraformed land
Backup<bool> old_generating_world(_generating_world, FILE_LINE);
if (_game_mode == GM_EDITOR) old_generating_world.Change(true); // used to create green terraformed land
DoCommandFlag tile_flags = flags | DC_AUTO | DC_FORCE_CLEAR_TILE;
if (pass == 0) {
tile_flags &= ~DC_EXEC;
@@ -292,7 +293,7 @@ CommandCost CmdTerraformLand(TileIndex t
cost = _tile_type_procs[GetTileType(t)]->terraform_tile_proc(t, tile_flags, z_min, tileh);
_generating_world = curr_gen;
if (cost.Failed()) {
_terraform_err_tile = t;
return cost;
@@ -8,6 +8,7 @@
/** @file terraform_gui.cpp GUI related to terraforming the map. */
#include "stdafx.h"
#include "clear_map.h"
@@ -54,7 +55,7 @@ static void GenerateDesertArea(TileIndex
{
if (_game_mode != GM_EDITOR) return;
TileArea ta(start, end);
for (TileIndex tile : ta) {
@@ -62,7 +63,7 @@ static void GenerateDesertArea(TileIndex
DoCommandP(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
MarkTileDirtyByTile(tile);
InvalidateWindowClassesData(WC_TOWN_VIEW, 0);
@@ -497,7 +498,7 @@ static void ResetLandscapeConfirmationCa
if (confirmed) {
/* Set generating_world to true to get instant-green grass after removing
* company property. */
/* Delete all companies */
for (Company *c : Company::Iterate()) {
@@ -505,7 +506,7 @@ static void ResetLandscapeConfirmationCa
delete c;
/* Delete all station signs */
for (BaseStation *st : BaseStation::Iterate()) {
@@ -27,6 +27,7 @@
#include "querystring_gui.h"
#include "window_func.h"
#include "townname_func.h"
#include "core/geometry_func.hpp"
#include "genworld.h"
#include "stringfilter_type.h"
@@ -1184,15 +1185,16 @@ public:
this->SetFocusedWidget(WID_TF_TOWN_NAME_EDITBOX);
break;
case WID_TF_MANY_RANDOM_TOWNS:
case WID_TF_MANY_RANDOM_TOWNS: {
UpdateNearestTownForRoadTiles(true);
if (!GenerateTowns(this->town_layout)) {
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_TOWN, STR_ERROR_NO_SPACE_FOR_TOWN, WL_INFO);
UpdateNearestTownForRoadTiles(false);
case WID_TF_SIZE_SMALL: case WID_TF_SIZE_MEDIUM: case WID_TF_SIZE_LARGE: case WID_TF_SIZE_RANDOM:
this->town_size = (TownSize)(widget - WID_TF_SIZE_SMALL);
Status change: