summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2010-07-02 16:34:07 +0000
committermichi_cc <michi_cc@openttd.org>2010-07-02 16:34:07 +0000
commita75583bbb6d600d51f76edc396279aa0fe6f4c32 (patch)
tree639e9c975e30bf83f8024b2823d7031eebf9d3d5
parentffdbb7ec81c74a5f0267ebe8e223be3e07d9d508 (diff)
downloadopenttd-a75583bbb6d600d51f76edc396279aa0fe6f4c32.tar.xz
(svn r20048) -Feature: Add a setting to forbid towns building level crossings.
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/saveload/saveload.cpp2
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/settings_type.h1
-rw-r--r--src/table/settings.h1
-rw-r--r--src/town_cmd.cpp1
6 files changed, 6 insertions, 1 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 7ea226de0..f5bdda74a 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1274,6 +1274,7 @@ STR_CONFIG_SETTING_TOWN_LAYOUT_2X2_GRID :2x2 grid
STR_CONFIG_SETTING_TOWN_LAYOUT_3X3_GRID :3x3 grid
STR_CONFIG_SETTING_TOWN_LAYOUT_RANDOM :random
STR_CONFIG_SETTING_ALLOW_TOWN_ROADS :{LTBLUE}Towns are allowed to build roads: {ORANGE}{STRING1}
+STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS :{LTBLUE}Towns are allowed to build level crossings: {ORANGE}{STRING1}
STR_CONFIG_SETTING_NOISE_LEVEL :{LTBLUE}Allow town controlled noise level for airports: {ORANGE}{STRING}
STR_CONFIG_SETTING_TOWN_FOUNDING :{LTBLUE}Founding towns in game: {ORANGE}{STRING1}
STR_CONFIG_SETTING_TOWN_FOUNDING_FORBIDDEN :forbidden
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index a2cfdf7df..e3a588795 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -47,7 +47,7 @@
#include "saveload_internal.h"
-extern const uint16 SAVEGAME_VERSION = 142;
+extern const uint16 SAVEGAME_VERSION = 143;
SavegameType _savegame_type; ///< type of savegame we are loading
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 77f1481d4..69f13f484 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1357,6 +1357,7 @@ static SettingEntry _settings_economy_towns[] = {
SettingEntry("economy.exclusive_rights"),
SettingEntry("economy.town_layout"),
SettingEntry("economy.allow_town_roads"),
+ SettingEntry("economy.allow_town_level_crossings"),
SettingEntry("economy.found_town"),
SettingEntry("economy.mod_road_rebuild"),
SettingEntry("economy.town_growth_rate"),
diff --git a/src/settings_type.h b/src/settings_type.h
index 0caca95ed..59fb454e4 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -350,6 +350,7 @@ struct EconomySettings {
TownFoundingByte found_town; ///< town founding, @see TownFounding
bool station_noise_level; ///< build new airports when the town noise level is still within accepted limits
uint16 town_noise_population[3]; ///< population to base decision on noise evaluation (@see town_council_tolerance)
+ bool allow_town_level_crossings; ///< towns are allowed to build level crossings
};
/** Settings related to stations. */
diff --git a/src/table/settings.h b/src/table/settings.h
index 9565d2602..42319982c 100644
--- a/src/table/settings.h
+++ b/src/table/settings.h
@@ -373,6 +373,7 @@ const SettingDesc _settings[] = {
SDT_CONDVAR(GameSettings, economy.town_layout, SLE_UINT8, 59, SL_MAX_VERSION, 0,MS,TL_ORIGINAL,TL_BEGIN,NUM_TLS - 1, 1, STR_CONFIG_SETTING_TOWN_LAYOUT, TownFoundingChanged),
SDT_CONDBOOL(GameSettings, economy.allow_town_roads, 113, SL_MAX_VERSION, 0,NN, true, STR_CONFIG_SETTING_ALLOW_TOWN_ROADS, NULL),
SDT_CONDVAR(GameSettings, economy.found_town, SLE_UINT8,128, SL_MAX_VERSION, 0,MS,TF_FORBIDDEN,TF_BEGIN,TF_END - 1, 1, STR_CONFIG_SETTING_TOWN_FOUNDING, TownFoundingChanged),
+ SDT_CONDBOOL(GameSettings, economy.allow_town_level_crossings, 143, SL_MAX_VERSION, 0,NN, true, STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS, NULL),
SDT_VAR(GameSettings, vehicle.train_acceleration_model, SLE_UINT8, 0,MS, 0, 0, 1, 1, STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL, TrainAccelerationModelChanged),
SDT_CONDVAR(GameSettings, vehicle.roadveh_acceleration_model, SLE_UINT8,139, SL_MAX_VERSION, 0,MS, 0, 0, 1, 1, STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL, RoadVehAccelerationModelChanged),
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 05adf6234..c318ae1ce 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1043,6 +1043,7 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t
_grow_town_result = GROWTH_SEARCH_STOPPED;
if (!_settings_game.economy.allow_town_roads && !_generating_world) return;
+ if (!_settings_game.economy.allow_town_level_crossings && IsTileType(tile, MP_RAILWAY)) return;
/* Remove hills etc */
if (!_settings_game.construction.build_on_slopes || Chance16(1, 6)) LevelTownLand(tile);