src/settings.cpp
branchgamebalance
changeset 9907 3b068c3a1c74
parent 9906 6f41b8713b65
child 9908 0fa543611bbe
equal deleted inserted replaced
9906:6f41b8713b65 9907:3b068c3a1c74
  1264 	 * save the first 16 bits in the savegame. Question is why the values are still int32
  1264 	 * save the first 16 bits in the savegame. Question is why the values are still int32
  1265 	 * and why not byte for example? */
  1265 	 * and why not byte for example? */
  1266 	SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL,  0, 3),
  1266 	SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL,  0, 3),
  1267 	SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL,  4, 53),
  1267 	SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL,  4, 53),
  1268 	SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 20, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL, 54, SL_MAX_VERSION),
  1268 	SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 20, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL, 54, SL_MAX_VERSION),
  1269 	    SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 9, 0,  9, 0, STR_NULL, NULL),
  1269 	    SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 0, 0,  3, 0, STR_NULL, NULL),
  1270 	  SDT_OMANY(GameOptions, 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|BRR|custom", STR_NULL, NULL, NULL),
  1270 	  SDT_OMANY(GameOptions, 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|BRR|custom", STR_NULL, NULL, NULL),
  1271 	  SDT_OMANY(GameOptions, units,     SLE_UINT8, N, 0, 1,     2, "imperial|metric|si", STR_NULL, NULL, NULL),
  1271 	  SDT_OMANY(GameOptions, units,     SLE_UINT8, N, 0, 1,     2, "imperial|metric|si", STR_NULL, NULL, NULL),
  1272 	  SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0,    20, "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),
  1272 	  SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0,    20, "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),
  1273 	  SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0,     3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
  1273 	  SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0,     3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
  1274 	    SDT_VAR(GameOptions, snow_line, SLE_UINT8, 0, 0, 1, 0, 56, 0, STR_NULL, NULL),
  1274 	    SDT_VAR(GameOptions, snow_line, SLE_UINT8, 0, 0, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL),
  1275 	SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8, 0, 22,             N, 0, 0, 0, "", STR_NULL, NULL, NULL),
  1275 	SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8, 0, 22,             N, 0, 0, 0, "", STR_NULL, NULL, NULL),
  1276 	SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8,23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL, NULL),
  1276 	SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8,23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL, NULL),
  1277 	  SDT_OMANY(GameOptions, road_side, SLE_UINT8, 0, 0, 1,   1, "left|right", STR_NULL, NULL, NULL),
  1277 	  SDT_OMANY(GameOptions, road_side, SLE_UINT8, 0, 0, 1,   1, "left|right", STR_NULL, NULL, NULL),
  1278 	    SDT_END()
  1278 	    SDT_END()
  1279 };
  1279 };
  1508 };
  1508 };
  1509 
  1509 
  1510 static const SettingDesc _currency_settings[] = {
  1510 static const SettingDesc _currency_settings[] = {
  1511 	SDT_VAR(CurrencySpec, rate,    SLE_UINT16, S, 0,  1, 0, 100, 0, STR_NULL, NULL),
  1511 	SDT_VAR(CurrencySpec, rate,    SLE_UINT16, S, 0,  1, 0, 100, 0, STR_NULL, NULL),
  1512 	SDT_CHR(CurrencySpec, separator,           S, 0,        ".",    STR_NULL, NULL),
  1512 	SDT_CHR(CurrencySpec, separator,           S, 0,        ".",    STR_NULL, NULL),
  1513 	SDT_VAR(CurrencySpec, to_euro,  SLE_INT32, S, 0,  0, 0,1000, 0, STR_NULL, NULL),
  1513 	SDT_VAR(CurrencySpec, to_euro,  SLE_INT32, S, 0,  0, 0,3000, 0, STR_NULL, NULL),
  1514 	SDT_STR(CurrencySpec, prefix,   SLE_STRBQ, S, 0,       NULL,    STR_NULL, NULL),
  1514 	SDT_STR(CurrencySpec, prefix,   SLE_STRBQ, S, 0,       NULL,    STR_NULL, NULL),
  1515 	SDT_STR(CurrencySpec, suffix,   SLE_STRBQ, S, 0, " credits",    STR_NULL, NULL),
  1515 	SDT_STR(CurrencySpec, suffix,   SLE_STRBQ, S, 0, " credits",    STR_NULL, NULL),
  1516 	SDT_END()
  1516 	SDT_END()
  1517 };
  1517 };
  1518 
  1518 
  1678 	proc_list(ini, "servers", _network_host_list, lengthof(_network_host_list), NULL);
  1678 	proc_list(ini, "servers", _network_host_list, lengthof(_network_host_list), NULL);
  1679 	proc_list(ini, "bans",    _network_ban_list,  lengthof(_network_ban_list), NULL);
  1679 	proc_list(ini, "bans",    _network_ban_list,  lengthof(_network_ban_list), NULL);
  1680 #endif /* ENABLE_NETWORK */
  1680 #endif /* ENABLE_NETWORK */
  1681 }
  1681 }
  1682 
  1682 
       
  1683 extern void CheckDifficultyLevels();
       
  1684 
  1683 /** Load the values from the configuration files */
  1685 /** Load the values from the configuration files */
  1684 void LoadFromConfig()
  1686 void LoadFromConfig()
  1685 {
  1687 {
  1686 	IniFile *ini = ini_load(_config_file);
  1688 	IniFile *ini = ini_load(_config_file);
       
  1689 	ResetCurrencies(false); // Initialize the array of curencies, without preserving the custom one
  1687 	HandleSettingDescs(ini, ini_load_settings, ini_load_setting_list);
  1690 	HandleSettingDescs(ini, ini_load_settings, ini_load_setting_list);
  1688 	_grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false);
  1691 	_grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false);
  1689 	_grfconfig_static  = GRFLoadConfig(ini, "newgrf-static", true);
  1692 	_grfconfig_static  = GRFLoadConfig(ini, "newgrf-static", true);
  1690 	_news_display_opt  = NewsDisplayLoadConfig(ini, "news_display");
  1693 	_news_display_opt  = NewsDisplayLoadConfig(ini, "news_display");
       
  1694 	CheckDifficultyLevels();
  1691 	ini_free(ini);
  1695 	ini_free(ini);
  1692 }
  1696 }
  1693 
  1697 
  1694 /** Save the values to the configuration file */
  1698 /** Save the values to the configuration file */
  1695 void SaveToConfig()
  1699 void SaveToConfig()