From bdf5a1c2f7077323c26e1c99a22dcc80a7b50245 Mon Sep 17 00:00:00 2001 From: alberth Date: Sat, 5 Feb 2011 10:28:31 +0000 Subject: (svn r21969) -Feature: Introduce 'minimal' number of industries as a replacment for the old 'none' setting in the newgame window. --- src/genworld_gui.cpp | 2 +- src/industry_cmd.cpp | 7 +++---- src/lang/english.txt | 1 + src/saveload/afterload.cpp | 8 ++++++++ src/saveload/saveload.cpp | 3 ++- src/table/settings.h | 2 +- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 62814fb35..68ecd7f73 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -336,7 +336,7 @@ static const StringID _tree_placer[] = {STR_CONFIG_SETTING_TREE_PLACER_NONE, STR static const StringID _rotation[] = {STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE, STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_CLOCKWISE, INVALID_STRING_ID}; static const StringID _landscape[] = {STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL, STR_CONFIG_SETTING_LAND_GENERATOR_TERRA_GENESIS, INVALID_STRING_ID}; static const StringID _num_towns[] = {STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, STR_NUM_CUSTOM, INVALID_STRING_ID}; -static const StringID _num_inds[] = {STR_NONE, STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, INVALID_STRING_ID}; +static const StringID _num_inds[] = {STR_NONE, STR_MINIMAL, STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, INVALID_STRING_ID}; static const StringID _variety[] = {STR_VARIETY_NONE, STR_VARIETY_VERY_LOW, STR_VARIETY_LOW, STR_VARIETY_MEDIUM, STR_VARIETY_HIGH, STR_VARIETY_VERY_HIGH, INVALID_STRING_ID}; struct GenerateLandscapeWindow : public QueryStringBaseWindow { diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 84e35181b..b5dbf2efe 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1895,6 +1895,7 @@ static uint GetNumberOfIndustries() /* Number of industries on a 256x256 map. */ static const uint16 numof_industry_table[] = { 0, // none + 0, // minimal 10, // very low 25, // low 55, // normal @@ -2009,10 +2010,7 @@ void IndustryBuildData::MonthlyLoop() */ void GenerateIndustries() { - uint total_amount = GetNumberOfIndustries(); - - /* Do not create any industries? */ - if (total_amount == 0) return; + if (_settings_game.difficulty.number_industries == 0) return; // No industries. uint32 industry_probs[NUM_INDUSTRYTYPES]; bool force_at_least_one[NUM_INDUSTRYTYPES]; @@ -2025,6 +2023,7 @@ void GenerateIndustries() if (force_at_least_one[it]) num_forced++; } + uint total_amount = GetNumberOfIndustries(); if (total_prob == 0 || total_amount < num_forced) { /* Only place the forced ones */ total_amount = num_forced; diff --git a/src/lang/english.txt b/src/lang/english.txt index a3ea90b6a..0eb307633 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1027,6 +1027,7 @@ STR_DIFFICULTY_LEVEL_SETTING_CITY_APPROVAL :{LTBLUE}City co ############ range for difficulty settings ends STR_NONE :None +STR_MINIMAL :Minimal STR_NUM_VERY_LOW :Very Low STR_NUM_LOW :Low STR_NUM_NORMAL :Normal diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index a256087d2..2d428d5ce 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -2561,6 +2561,14 @@ bool AfterLoadGame() _settings_game.pf.reverse_at_signals = IsSavegameVersionBefore(100) || (_settings_game.pf.wait_oneway_signal != 255 && _settings_game.pf.wait_twoway_signal != 255 && _settings_game.pf.wait_for_pbs_path != 255); } + if (IsSavegameVersionBefore(160)) { + /* Setting difficulty number_industries other than zero get bumped to +1 + * since a new option (very low at position1) has been added */ + if (_settings_game.difficulty.number_industries > 0) { + _settings_game.difficulty.number_industries++; + } + } + /* Road stops is 'only' updating some caches */ AfterLoadRoadStops(); AfterLoadLabelMaps(); diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 9d22150ad..65a68ec2a 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -224,8 +224,9 @@ * 157 21862 * 158 21933 * 159 21962 + * 160 21968 */ -extern const uint16 SAVEGAME_VERSION = 159; ///< Current savegame version of OpenTTD. +extern const uint16 SAVEGAME_VERSION = 160; ///< Current savegame version of OpenTTD. SavegameType _savegame_type; ///< type of savegame we are loading diff --git a/src/table/settings.h b/src/table/settings.h index 92129a832..c74c70501 100644 --- a/src/table/settings.h +++ b/src/table/settings.h @@ -347,7 +347,7 @@ const SettingDesc _settings[] = { SDT_CONDVAR(GameSettings, difficulty.max_no_competitors, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 0,0,MAX_COMPANIES-1,1,STR_NULL, MaxNoAIsChange), SDT_CONDNULL( 1, 97, 109), SDT_CONDVAR(GameSettings, difficulty.number_towns, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 2, 0, 4, 1, STR_NUM_VERY_LOW, DifficultyChange), - SDT_CONDVAR(GameSettings, difficulty.number_industries, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 4, 0, 4, 1, STR_NONE, DifficultyChange), + SDT_CONDVAR(GameSettings, difficulty.number_industries, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 5, 0, 5, 1, STR_NONE, DifficultyChange), SDT_CONDVAR(GameSettings, difficulty.max_loan, SLE_UINT32, 97, SL_MAX_VERSION, 0,NS|CR,300000,100000,500000,50000,STR_NULL, DifficultyChange), SDT_CONDVAR(GameSettings, difficulty.initial_interest, SLE_UINT8, 97, SL_MAX_VERSION, 0,NS, 2, 2, 4, 1, STR_NULL, DifficultyChange), SDT_CONDVAR(GameSettings, difficulty.vehicle_costs, SLE_UINT8, 97, SL_MAX_VERSION, 0,NS, 0, 0, 2, 1, STR_SEA_LEVEL_LOW, DifficultyChange), -- cgit v1.2.3-54-g00ecf