summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-03-07 21:36:13 +0000
committeryexo <yexo@openttd.org>2009-03-07 21:36:13 +0000
commit3f73152b7fb810f57a6d4048c484b13aad6c51b3 (patch)
treee1b368856d13091d71acd60e01d77065ab0fe402
parent3ca01c64f72b827076c2a76065749b1c1288b106 (diff)
downloadopenttd-3f73152b7fb810f57a6d4048c484b13aad6c51b3.tar.xz
(svn r15639) -Change: When you disable "Towns are allowed to build roads", pressing "Expand" in the town window in the scenario editor will no longer build roads.
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/town_cmd.cpp13
2 files changed, 10 insertions, 4 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index fb7384c02..4eee41026 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -606,6 +606,7 @@ STR_CANNOT_GENERATE_TOWN :{WHITE}Can't bu
STR_NO_SPACE_FOR_TOWN :{WHITE}...there is no more space on the map
STR_023B_INCREASE_SIZE_OF_TOWN :{BLACK}Increase size of town
STR_023C_EXPAND :{BLACK}Expand
+STR_TOWN_EXPAND_WARN_NO_ROADS :{WHITE}The town will not build roads. You can enable building of roads via Advanced Settings->Economy->Towns.
STR_023D_RANDOM_TOWN :{BLACK}Random Town
STR_023E_BUILD_TOWN_IN_RANDOM_LOCATION :{BLACK}Build town in random location
STR_0285_CAN_T_BUILD_HERE :{WHITE}Can't build {STRING} here...
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index fdb846936..4432f17a3 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1981,7 +1981,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
hs = GetHouseSpecs(house);
}
- if ((hs->extra_flags & BUILDING_IS_HISTORICAL) && !_generating_world) continue;
+ if ((hs->extra_flags & BUILDING_IS_HISTORICAL) && !_generating_world && _game_mode != GM_EDITOR) continue;
}
if (_cur_year < hs->min_year || _cur_year > hs->max_year) continue;
@@ -2025,7 +2025,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
byte construction_counter = 0;
byte construction_stage = 0;
- if (_generating_world) {
+ if (_generating_world || _game_mode == GM_EDITOR) {
uint32 r = Random();
construction_stage = TOWN_HOUSE_COMPLETED;
@@ -2166,7 +2166,13 @@ CommandCost CmdRenameTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/** Called from GUI */
void ExpandTown(Town *t)
{
- _generating_world = true;
+ /* Warn the users if towns are not allowed to build roads,
+ * but do this only onces per openttd run. */
+ static bool warned_no_roads = false;
+ if (!_settings_game.economy.allow_town_roads && !warned_no_roads) {
+ ShowErrorMessage(INVALID_STRING_ID, STR_TOWN_EXPAND_WARN_NO_ROADS, 0, 0);
+ warned_no_roads = true;
+ }
/* The more houses, the faster we grow */
uint amount = RandomRange(ClampToU16(t->num_houses / 10)) + 3;
@@ -2180,7 +2186,6 @@ void ExpandTown(Town *t)
UpdateTownRadius(t);
UpdateTownMaxPass(t);
- _generating_world = false;
}
extern const byte _town_action_costs[8] = {