From 4364cec392d1352406906a551e3ffa3f72da61ba Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 6 Feb 2011 18:26:50 +0000 Subject: (svn r22001) -Codechange: Rename difficulty.number_industries to difficulty.industry_density. --- src/genworld_gui.cpp | 6 +++--- src/industry_cmd.cpp | 10 +++++----- src/industry_gui.cpp | 2 +- src/saveload/afterload.cpp | 16 ++++++++-------- src/saveload/oldloader_sl.cpp | 2 +- src/settings_type.h | 2 +- src/table/settings.h | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index a62c2e4f5..e8d983fd1 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -390,7 +390,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { } break; - case GLAND_INDUSTRY_PULLDOWN: SetDParam(0, _game_mode == GM_EDITOR ? STR_DISASTERS_OFF : _num_inds[_settings_newgame.difficulty.number_industries]); break; + case GLAND_INDUSTRY_PULLDOWN: SetDParam(0, _game_mode == GM_EDITOR ? STR_DISASTERS_OFF : _num_inds[_settings_newgame.difficulty.industry_density]); break; case GLAND_LANDSCAPE_PULLDOWN: SetDParam(0, _landscape[_settings_newgame.game_creation.land_generator]); break; case GLAND_TREE_PULLDOWN: SetDParam(0, _tree_placer[_settings_newgame.game_creation.tree_placer]); break; case GLAND_TERRAIN_PULLDOWN: SetDParam(0, _elevations[_settings_newgame.difficulty.terrain_type]); break; @@ -586,7 +586,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { break; case GLAND_INDUSTRY_PULLDOWN: // Number of industries - ShowDropDownMenu(this, _num_inds, _settings_newgame.difficulty.number_industries, GLAND_INDUSTRY_PULLDOWN, 0, 0); + ShowDropDownMenu(this, _num_inds, _settings_newgame.difficulty.industry_density, GLAND_INDUSTRY_PULLDOWN, 0, 0); break; case GLAND_RANDOM_BUTTON: // Random seed @@ -761,7 +761,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { break; case GLAND_INDUSTRY_PULLDOWN: - IConsoleSetSetting("difficulty.number_industries", index); + IConsoleSetSetting("difficulty.industry_density", index); break; case GLAND_TERRAIN_PULLDOWN: { diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 6ef93e91b..a11974e87 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1847,7 +1847,7 @@ static uint32 GetScaledIndustryGenerationProbability(IndustryType it, bool *forc uint32 chance = ind_spc->appear_creation[_settings_game.game_creation.landscape] * 16; // * 16 to increase precision if (!ind_spc->enabled || chance == 0 || ind_spc->num_table == 0 || !CheckIfCallBackAllowsAvailability(it, IACT_MAPGENERATION) || - (_game_mode != GM_EDITOR && _settings_game.difficulty.number_industries == ID_FUND_ONLY)) { + (_game_mode != GM_EDITOR && _settings_game.difficulty.industry_density == ID_FUND_ONLY)) { *force_at_least_one = false; return 0; } else { @@ -1868,7 +1868,7 @@ static uint32 GetScaledIndustryGenerationProbability(IndustryType it, bool *forc */ static uint16 GetIndustryGamePlayProbability(IndustryType it, byte *min_number) { - if (_settings_game.difficulty.number_industries == ID_FUND_ONLY) { + if (_settings_game.difficulty.industry_density == ID_FUND_ONLY) { *min_number = 0; return 0; } @@ -1903,7 +1903,7 @@ static uint GetNumberOfIndustries() }; assert(lengthof(numof_industry_table) == ID_END); - uint difficulty = (_game_mode != GM_EDITOR) ? _settings_game.difficulty.number_industries : (uint)ID_VERY_LOW; + uint difficulty = (_game_mode != GM_EDITOR) ? _settings_game.difficulty.industry_density : (uint)ID_VERY_LOW; return ScaleByMapSize(numof_industry_table[difficulty]); } @@ -1994,7 +1994,7 @@ void IndustryBuildData::Reset() void IndustryBuildData::MonthlyLoop() { static const int NEWINDS_PER_MONTH = 0x38000 / (10 * 12); // lower 16 bits is a float fraction, 3.5 industries per decade, divided by 10 * 12 months. - if (_settings_game.difficulty.number_industries == ID_FUND_ONLY) return; // 'no industries' setting, + if (_settings_game.difficulty.industry_density == ID_FUND_ONLY) return; // 'no industries' setting, /* To prevent running out of unused industries for the player to connect, * add a fraction of new industries each month, but only if the manager can keep up. */ @@ -2010,7 +2010,7 @@ void IndustryBuildData::MonthlyLoop() */ void GenerateIndustries() { - if (_game_mode != GM_EDITOR && _settings_game.difficulty.number_industries == ID_FUND_ONLY) return; // No industries in the game. + if (_game_mode != GM_EDITOR && _settings_game.difficulty.industry_density == ID_FUND_ONLY) return; // No industries in the game. uint32 industry_probs[NUM_INDUSTRYTYPES]; bool force_at_least_one[NUM_INDUSTRYTYPES]; diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 799044975..f3e2c2b1c 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -602,7 +602,7 @@ public: this->SetupArrays(); const IndustrySpec *indsp = (this->selected_type == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(this->selected_type); - if (indsp == NULL) this->enabled[this->selected_index] = _settings_game.difficulty.number_industries != ID_FUND_ONLY; + if (indsp == NULL) this->enabled[this->selected_index] = _settings_game.difficulty.industry_density != ID_FUND_ONLY; this->SetButtons(); } }; diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index dc021af33..abb2115b0 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -1448,10 +1448,10 @@ bool AfterLoadGame() } if (IsSavegameVersionBefore(58)) { - /* 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++; + /* Setting difficulty industry_density other than zero get bumped to +1 + * since a new option (very low at position 1) has been added */ + if (_settings_game.difficulty.industry_density > 0) { + _settings_game.difficulty.industry_density++; } /* Same goes for number of towns, although no test is needed, just an increment */ @@ -2563,10 +2563,10 @@ bool AfterLoadGame() } 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++; + /* Setting difficulty industry_density other than zero get bumped to +1 + * since a new option (minimal at position 1) has been added */ + if (_settings_game.difficulty.industry_density > 0) { + _settings_game.difficulty.industry_density++; } } diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index db2ea4dca..724249b72 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -1444,7 +1444,7 @@ static const OldChunks game_difficulty_chunk[] = { OCL_SVAR( OC_FILE_U16 | OC_VAR_U8, DifficultySettings, max_no_competitors ), OCL_NULL( 2), // competitor_start_time OCL_SVAR( OC_FILE_U16 | OC_VAR_U8, DifficultySettings, number_towns ), - OCL_SVAR( OC_FILE_U16 | OC_VAR_U8, DifficultySettings, number_industries ), + OCL_SVAR( OC_FILE_U16 | OC_VAR_U8, DifficultySettings, industry_density ), OCL_SVAR( OC_FILE_U16 | OC_VAR_U32, DifficultySettings, max_loan ), OCL_SVAR( OC_FILE_U16 | OC_VAR_U8, DifficultySettings, initial_interest ), OCL_SVAR( OC_FILE_U16 | OC_VAR_U8, DifficultySettings, vehicle_costs ), diff --git a/src/settings_type.h b/src/settings_type.h index c5ee6f125..2556aaf54 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -35,7 +35,7 @@ enum IndustryDensity { struct DifficultySettings { byte max_no_competitors; ///< the number of competitors (AIs) byte number_towns; ///< the amount of towns - byte number_industries; ///< The industry density. @see IndustryDensity + byte industry_density; ///< The industry density. @see IndustryDensity uint32 max_loan; ///< the maximum initial loan byte initial_interest; ///< amount of interest (to pay over the loan) byte vehicle_costs; ///< amount of money spent on vehicle running cost diff --git a/src/table/settings.h b/src/table/settings.h index 426f71350..95f7693fc 100644 --- a/src/table/settings.h +++ b/src/table/settings.h @@ -348,7 +348,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, ID_END-1, 0,ID_END-1, 1, STR_FUNDING_ONLY, DifficultyChange), + SDT_CONDVAR(GameSettings, difficulty.industry_density, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, ID_END-1, 0,ID_END-1, 1, STR_FUNDING_ONLY, 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-70-g09d2