Changeset - r11409:8d8f689361bf
[Not reviewed]
master
0 1 0
yexo - 15 years ago 2009-03-19 22:37:41
yexo@openttd.org
(svn r15771) -Fix (r13256): Settings from the [gameopt] section (from 0.6 config files) were overwritten with default values.
1 file changed with 6 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/settings.cpp
Show inline comments
 
@@ -1277,13 +1277,13 @@ static const SettingDesc _gameopt_settin
 
	 * XXX - To save file-space and since values are never bigger than about 10? only
 
	 * save the first 16 bits in the savegame. Question is why the values are still int32
 
	 * and why not byte for example?
 
	 * 'SLE_FILE_I16 | SLE_VAR_U16' in "diff_custom" is needed to get around SlArray() hack
 
	 * for savegames version 0 - though it is an array, it has to go through the byteswap process */
 
	 SDTG_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, SLE_FILE_I16 | SLE_VAR_U16,    C, 0, _old_diff_custom, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, 0,  3),
 
	 SDTG_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, SLE_UINT16,                    C, 0, _old_diff_custom, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, 4, 96),
 
	 SDTG_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, SLE_UINT16,                    C, 0, _old_diff_custom, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, 4, SL_MAX_VERSION),
 

	
 
	      SDT_VAR(GameSettings, difficulty.diff_level,    SLE_UINT8,                     0, 0, 0, 0,  3, 0, STR_NULL, NULL),
 
	    SDT_OMANY(GameSettings, locale.currency,          SLE_UINT8,                     N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRL|EEK|custom", STR_NULL, NULL, NULL),
 
	    SDT_OMANY(GameSettings, locale.units,             SLE_UINT8,                     N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL, NULL),
 
	/* There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI. */
 
	    SDT_OMANY(GameSettings, game_creation.town_name,  SLE_UINT8,                     0, 0, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
 
@@ -1905,21 +1905,22 @@ static IniFile *IniLoadConfig()
 
/** Load the values from the configuration files */
 
void LoadFromConfig()
 
{
 
	IniFile *ini = IniLoadConfig();
 
	ResetCurrencies(false); // Initialize the array of curencies, without preserving the custom one
 

	
 
	PrepareOldDiffCustom();
 
	ini_load_settings(ini, _gameopt_settings, "gameopt",  &_settings_newgame);
 
	HandleOldDiffCustom(false);
 

	
 
	HandleSettingDescs(ini, ini_load_settings, ini_load_setting_list);
 
	_grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false);
 
	_grfconfig_static  = GRFLoadConfig(ini, "newgrf-static", true);
 
	NewsDisplayLoadConfig(ini, "news_display");
 
	AILoadConfig(ini, "ai_players");
 

	
 
	PrepareOldDiffCustom();
 
	ini_load_settings(ini, _gameopt_settings, "gameopt",  &_settings_newgame);
 
	HandleOldDiffCustom(false);
 

	
 
	CheckDifficultyLevels();
 
	delete ini;
 
}
 

	
 
/** Save the values to the configuration file */
 
void SaveToConfig()
0 comments (0 inline, 0 general)