(svn r21969) -Feature: Introduce 'minimal' number of industries as a replacment for the old 'none' setting in the newgame window.

This commit is contained in:
alberth 2011-02-05 10:28:31 +00:00
parent 974c0f5166
commit bdf5a1c2f7
6 changed files with 16 additions and 7 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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),