settings.c
changeset 3112 a6fda4d4c7ca
parent 3052 ebb8c7a94e5f
child 3115 24c7e92baa31
equal deleted inserted replaced
3111:750f37699a13 3112:a6fda4d4c7ca
     9 #include "sound.h"
     9 #include "sound.h"
    10 #include "string.h"
    10 #include "string.h"
    11 #include "variables.h"
    11 #include "variables.h"
    12 #include "network.h"
    12 #include "network.h"
    13 #include "settings.h"
    13 #include "settings.h"
       
    14 #include "saveload.h"
    14 
    15 
    15 typedef struct IniFile IniFile;
    16 typedef struct IniFile IniFile;
    16 typedef struct IniItem IniItem;
    17 typedef struct IniItem IniItem;
    17 typedef struct IniGroup IniGroup;
    18 typedef struct IniGroup IniGroup;
    18 typedef struct SettingsMemoryPool SettingsMemoryPool;
    19 typedef struct SettingsMemoryPool SettingsMemoryPool;
   828 	{"screenshot_format", SDT_STRINGBUF | (lengthof(_screenshot_format_name)<<16),			NULL,			_screenshot_format_name,NULL},
   829 	{"screenshot_format", SDT_STRINGBUF | (lengthof(_screenshot_format_name)<<16),			NULL,			_screenshot_format_name,NULL},
   829 	{"savegame_format",		SDT_STRINGBUF | (lengthof(_savegame_format)<<16),							NULL,			_savegame_format,				NULL},
   830 	{"savegame_format",		SDT_STRINGBUF | (lengthof(_savegame_format)<<16),							NULL,			_savegame_format,				NULL},
   830 	{"rightclick_emulate",SDT_BOOL,			(void*)false, &_rightclick_emulate, NULL},
   831 	{"rightclick_emulate",SDT_BOOL,			(void*)false, &_rightclick_emulate, NULL},
   831 	{NULL,								0,						NULL,					NULL,									NULL}
   832 	{NULL,								0,						NULL,					NULL,									NULL}
   832 };
   833 };
       
   834 
       
   835 
       
   836 static const SaveLoad _game_opt_desc[] = {
       
   837 	// added a new difficulty option (town attitude) in version 4
       
   838 	SLE_CONDARR(GameOptions,diff,						SLE_FILE_I16 | SLE_VAR_I32, 17, 0, 3),
       
   839 	SLE_CONDARR(GameOptions,diff,						SLE_FILE_I16 | SLE_VAR_I32, 18, 4, SL_MAX_VERSION),
       
   840 	SLE_VAR(GameOptions,diff_level,			SLE_UINT8),
       
   841 	SLE_VAR(GameOptions,currency,				SLE_UINT8),
       
   842 	SLE_VAR(GameOptions,kilometers,			SLE_UINT8),
       
   843 	SLE_VAR(GameOptions,town_name,			SLE_UINT8),
       
   844 	SLE_VAR(GameOptions,landscape,			SLE_UINT8),
       
   845 	SLE_VAR(GameOptions,snow_line,			SLE_UINT8),
       
   846 	SLE_VAR(GameOptions,autosave,				SLE_UINT8),
       
   847 	SLE_VAR(GameOptions,road_side,			SLE_UINT8),
       
   848 	SLE_END()
       
   849 };
       
   850 
       
   851 // Save load game options
       
   852 static void SaveLoad_OPTS(void)
       
   853 {
       
   854 	SlObject(&_opt, _game_opt_desc);
       
   855 }
   833 
   856 
   834 #ifdef ENABLE_NETWORK
   857 #ifdef ENABLE_NETWORK
   835 static const SettingDesc network_settings[] = {
   858 static const SettingDesc network_settings[] = {
   836 	{"sync_freq",				SDT_UINT16 | SDT_NOSAVE,	(void*)100,			&_network_sync_freq,		NULL},
   859 	{"sync_freq",				SDT_UINT16 | SDT_NOSAVE,	(void*)100,			&_network_sync_freq,		NULL},
   837 	{"frame_freq",			SDT_UINT8 | SDT_NOSAVE,	(void*)0,			&_network_frame_freq,		NULL},
   860 	{"frame_freq",			SDT_UINT8 | SDT_NOSAVE,	(void*)0,			&_network_frame_freq,		NULL},
  1163 	if (_patches.pf_maxdepth == 16 && _patches.pf_maxlength == 512) {
  1186 	if (_patches.pf_maxdepth == 16 && _patches.pf_maxlength == 512) {
  1164 		_patches.pf_maxdepth = 48;
  1187 		_patches.pf_maxdepth = 48;
  1165 		_patches.pf_maxlength = 4096;
  1188 		_patches.pf_maxlength = 4096;
  1166 	}
  1189 	}
  1167 }
  1190 }
       
  1191 
       
  1192 const ChunkHandler _setting_chunk_handlers[] = {
       
  1193 	{ 'OPTS', SaveLoad_OPTS, SaveLoad_OPTS, CH_RIFF | CH_LAST}
       
  1194 };