1256 * XXX - To save file-space and since values are never bigger than about 10? only |
1256 * XXX - To save file-space and since values are never bigger than about 10? only |
1257 * save the first 16 bits in the savegame. Question is why the values are still int32 |
1257 * save the first 16 bits in the savegame. Question is why the values are still int32 |
1258 * and why not byte for example? */ |
1258 * and why not byte for example? */ |
1259 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), |
1259 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), |
1260 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, SL_MAX_VERSION), |
1260 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, SL_MAX_VERSION), |
1261 SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 9, 0, 9, 0, STR_NULL, NULL), |
1261 SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 0, 0, 3, 0, STR_NULL, NULL), |
1262 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), |
1262 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), |
1263 SDT_OMANY(GameOptions, units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL, NULL), |
1263 SDT_OMANY(GameOptions, units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL, NULL), |
1264 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), |
1264 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), |
1265 SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0, 3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape), |
1265 SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0, 3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape), |
1266 SDT_VAR(GameOptions, snow_line, SLE_UINT8, 0, 0, 1, 0, 56, 0, STR_NULL, NULL), |
1266 SDT_VAR(GameOptions, snow_line, SLE_UINT8, 0, 0, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL), |
1267 SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8, 0, 22, N, 0, 0, 0, "", STR_NULL, NULL, NULL), |
1267 SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8, 0, 22, N, 0, 0, 0, "", STR_NULL, NULL, NULL), |
1268 SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8,23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL, NULL), |
1268 SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8,23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL, NULL), |
1269 SDT_OMANY(GameOptions, road_side, SLE_UINT8, 0, 0, 1, 1, "left|right", STR_NULL, NULL, NULL), |
1269 SDT_OMANY(GameOptions, road_side, SLE_UINT8, 0, 0, 1, 1, "left|right", STR_NULL, NULL, NULL), |
1270 SDT_END() |
1270 SDT_END() |
1271 }; |
1271 }; |
1670 proc_list(ini, "servers", _network_host_list, lengthof(_network_host_list), NULL); |
1670 proc_list(ini, "servers", _network_host_list, lengthof(_network_host_list), NULL); |
1671 proc_list(ini, "bans", _network_ban_list, lengthof(_network_ban_list), NULL); |
1671 proc_list(ini, "bans", _network_ban_list, lengthof(_network_ban_list), NULL); |
1672 #endif /* ENABLE_NETWORK */ |
1672 #endif /* ENABLE_NETWORK */ |
1673 } |
1673 } |
1674 |
1674 |
|
1675 extern void CheckDifficultyLevels(); |
|
1676 |
1675 /** Load the values from the configuration files */ |
1677 /** Load the values from the configuration files */ |
1676 void LoadFromConfig() |
1678 void LoadFromConfig() |
1677 { |
1679 { |
1678 IniFile *ini = ini_load(_config_file); |
1680 IniFile *ini = ini_load(_config_file); |
|
1681 ResetCurrencies(false); // Initialize the array of curencies, without preserving the custom one |
1679 HandleSettingDescs(ini, ini_load_settings, ini_load_setting_list); |
1682 HandleSettingDescs(ini, ini_load_settings, ini_load_setting_list); |
1680 _grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false); |
1683 _grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false); |
1681 _grfconfig_static = GRFLoadConfig(ini, "newgrf-static", true); |
1684 _grfconfig_static = GRFLoadConfig(ini, "newgrf-static", true); |
1682 _news_display_opt = NewsDisplayLoadConfig(ini, "news_display"); |
1685 _news_display_opt = NewsDisplayLoadConfig(ini, "news_display"); |
|
1686 CheckDifficultyLevels(); |
1683 ini_free(ini); |
1687 ini_free(ini); |
1684 } |
1688 } |
1685 |
1689 |
1686 /** Save the values to the configuration file */ |
1690 /** Save the values to the configuration file */ |
1687 void SaveToConfig() |
1691 void SaveToConfig() |