Mercurial > hg > openttd
changeset 3112:3a5e0c62fb5e draft
(svn r3716) - Move the option settings (_game_opt_desc) from misc.c into settings.c. This will be merged with SettingDesc misc_settings above as they are actually the same. No functionality has changed beside the fact that the settings are now in a different Chunkhandler.
author | Darkvater <Darkvater@openttd.org> |
---|---|
date | Wed, 01 Mar 2006 21:15:25 +0000 |
parents | ba229b675f02 |
children | 500c991532b7 |
files | misc.c saveload.c settings.c |
diffstat | 3 files changed, 29 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/misc.c +++ b/misc.c @@ -658,28 +658,6 @@ } } -static const SaveLoad _game_opt_desc[] = { - // added a new difficulty option (town attitude) in version 4 - SLE_CONDARR(GameOptions,diff, SLE_FILE_I16 | SLE_VAR_I32, 17, 0, 3), - SLE_CONDARR(GameOptions,diff, SLE_FILE_I16 | SLE_VAR_I32, 18, 4, SL_MAX_VERSION), - SLE_VAR(GameOptions,diff_level, SLE_UINT8), - SLE_VAR(GameOptions,currency, SLE_UINT8), - SLE_VAR(GameOptions,kilometers, SLE_UINT8), - SLE_VAR(GameOptions,town_name, SLE_UINT8), - SLE_VAR(GameOptions,landscape, SLE_UINT8), - SLE_VAR(GameOptions,snow_line, SLE_UINT8), - SLE_VAR(GameOptions,autosave, SLE_UINT8), - SLE_VAR(GameOptions,road_side, SLE_UINT8), - SLE_END() -}; - -// Save load game options -static void SaveLoad_OPTS(void) -{ - SlObject(&_opt, _game_opt_desc); -} - - static const SaveLoadGlobVarList _date_desc[] = { SLEG_VAR(_date, SLE_UINT16), SLEG_VAR(_date_fract, SLE_UINT16), @@ -1003,6 +981,5 @@ { 'NAME', Save_NAME, Load_NAME, CH_ARRAY}, { 'DATE', SaveLoad_DATE, SaveLoad_DATE, CH_RIFF}, { 'VIEW', SaveLoad_VIEW, SaveLoad_VIEW, CH_RIFF}, - { 'OPTS', SaveLoad_OPTS, SaveLoad_OPTS, CH_RIFF}, { 'CHTS', Save_CHTS, Load_CHTS, CH_RIFF | CH_LAST} };
--- a/saveload.c +++ b/saveload.c @@ -1112,6 +1112,7 @@ // these define the chunks extern const ChunkHandler _misc_chunk_handlers[]; +extern const ChunkHandler _setting_chunk_handlers[]; extern const ChunkHandler _player_chunk_handlers[]; extern const ChunkHandler _engine_chunk_handlers[]; extern const ChunkHandler _veh_chunk_handlers[]; @@ -1127,6 +1128,7 @@ static const ChunkHandler * const _chunk_handlers[] = { _misc_chunk_handlers, + _setting_chunk_handlers, _veh_chunk_handlers, _waypoint_chunk_handlers, _depot_chunk_handlers,
--- a/settings.c +++ b/settings.c @@ -11,6 +11,7 @@ #include "variables.h" #include "network.h" #include "settings.h" +#include "saveload.h" typedef struct IniFile IniFile; typedef struct IniItem IniItem; @@ -831,6 +832,28 @@ {NULL, 0, NULL, NULL, NULL} }; + +static const SaveLoad _game_opt_desc[] = { + // added a new difficulty option (town attitude) in version 4 + SLE_CONDARR(GameOptions,diff, SLE_FILE_I16 | SLE_VAR_I32, 17, 0, 3), + SLE_CONDARR(GameOptions,diff, SLE_FILE_I16 | SLE_VAR_I32, 18, 4, SL_MAX_VERSION), + SLE_VAR(GameOptions,diff_level, SLE_UINT8), + SLE_VAR(GameOptions,currency, SLE_UINT8), + SLE_VAR(GameOptions,kilometers, SLE_UINT8), + SLE_VAR(GameOptions,town_name, SLE_UINT8), + SLE_VAR(GameOptions,landscape, SLE_UINT8), + SLE_VAR(GameOptions,snow_line, SLE_UINT8), + SLE_VAR(GameOptions,autosave, SLE_UINT8), + SLE_VAR(GameOptions,road_side, SLE_UINT8), + SLE_END() +}; + +// Save load game options +static void SaveLoad_OPTS(void) +{ + SlObject(&_opt, _game_opt_desc); +} + #ifdef ENABLE_NETWORK static const SettingDesc network_settings[] = { {"sync_freq", SDT_UINT16 | SDT_NOSAVE, (void*)100, &_network_sync_freq, NULL}, @@ -1165,3 +1188,7 @@ _patches.pf_maxlength = 4096; } } + +const ChunkHandler _setting_chunk_handlers[] = { + { 'OPTS', SaveLoad_OPTS, SaveLoad_OPTS, CH_RIFF | CH_LAST} +};