diff options
author | Darkvater <darkvater@openttd.org> | 2006-03-01 21:15:25 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-03-01 21:15:25 +0000 |
commit | 4367870b18782051c9262e7d599341749c2206fa (patch) | |
tree | da0eb622b1bf0890ac530a04608e9efb49f320f3 | |
parent | 819d210acc501e10f20d83cd72176862e8068758 (diff) | |
download | openttd-4367870b18782051c9262e7d599341749c2206fa.tar.xz |
(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.
-rw-r--r-- | misc.c | 23 | ||||
-rw-r--r-- | saveload.c | 2 | ||||
-rw-r--r-- | settings.c | 27 |
3 files changed, 29 insertions, 23 deletions
@@ -658,28 +658,6 @@ static void Load_NAME(void) } } -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 @@ const ChunkHandler _misc_chunk_handlers[] = { { '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} }; diff --git a/saveload.c b/saveload.c index 25805eff2..20c27b6c5 100644 --- a/saveload.c +++ b/saveload.c @@ -1112,6 +1112,7 @@ static void UninitWriteZlib(void) // 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 @@ extern const ChunkHandler _animated_tile_chunk_handlers[]; static const ChunkHandler * const _chunk_handlers[] = { _misc_chunk_handlers, + _setting_chunk_handlers, _veh_chunk_handlers, _waypoint_chunk_handlers, _depot_chunk_handlers, diff --git a/settings.c b/settings.c index 555a7c329..5fa662cc3 100644 --- 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 @@ static const SettingDesc misc_settings[] = { {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 @@ void CheckConfig(void) _patches.pf_maxlength = 4096; } } + +const ChunkHandler _setting_chunk_handlers[] = { + { 'OPTS', SaveLoad_OPTS, SaveLoad_OPTS, CH_RIFF | CH_LAST} +}; |