Index: config.doc ================================================================== --- config.doc +++ config.doc @@ -19,10 +19,16 @@ .altImage If the puzzle set contains multiple pictures with the same name and size then this resource controls which of those pictures is selected. The default setting is zero. +.autoSave + If true, saves changes to the level and solution files when the program + terminates. If false (default), they are only saved to the user cache + database; to copy the changes to the level and solution files, you must + use the .u command in SQL mode (-x). + .editTitle The window title to use in edit mode. A tilde is replaced by the name of the puzzle set. .gameTitle Index: main.c ================================================================== --- main.c +++ main.c @@ -845,10 +845,17 @@ if(boolxrm(v,0)) { memset(message_trace,255,sizeof(message_trace)); for(i=0;i<0x4000;i++) if(classes[i]) classes[i]->cflags|=CF_TRACEIN|CF_TRACEOUT; } } + +static inline void set_autosave(void) { + const char*v; + optionquery[1]=Q_autoSave; + v=xrm_get_resource(resourcedb,optionquery,optionquery,2)?:""; + if(boolxrm(v,0)) atexit(flush_usercache); +} int main(int argc,char**argv) { int optind=1; while(argc>optind && argv[optind][0]=='-') { int i; @@ -913,7 +920,8 @@ fprintf(stderr,"Ready for executing SQL statements.\n"); no_dead_anim=1; do_sql_mode(); return 0; } + set_autosave(); for(;;) { if(main_options['e']) run_editor(); else run_game(); } } Index: quarks ================================================================== --- quarks +++ quarks @@ -215,6 +215,7 @@ maxObjects traceAll traceObject showInventory progress +autoSave Index: quarks.h ================================================================== --- quarks.h +++ quarks.h @@ -180,10 +180,11 @@ #define Q_maxObjects 181 #define Q_traceAll 182 #define Q_traceObject 183 #define Q_showInventory 184 #define Q_progress 185 +#define Q_autoSave 186 static const char*const global_quarks[]={ "screenWidth", "screenHeight", "margin", "palette", @@ -365,10 +366,11 @@ "maxObjects", "traceAll", "traceObject", "showInventory", "progress", + "autoSave", 0}; #ifdef HEROMESH_BINDINGS static const SDLKey quark_to_key[Q_undo+1-Q_backspace]={ SDLK_BACKSPACE, SDLK_TAB,