Index: commandline.doc ================================================================== --- commandline.doc +++ commandline.doc @@ -23,11 +23,11 @@ -T Mode for testing some internal functions of Free Hero Mesh and SDL. You probably do not need to use this mode yourself. --a (not implemented yet) +-a Autotest levels, ensuring that the provided solution is valid. -c Only load classes and then terminate. This can be used to test that the class definition file does not contain syntax errors, or it can be ADDED config.doc Index: config.doc ================================================================== --- /dev/null +++ config.doc @@ -0,0 +1,122 @@ +Configuration can be set in two ways. There is the .heromeshrc file in +your home directory, which is a X resource manager file, and you can also +specify settings in command-line arguments after the puzzle set name, each +of which is a X resource manager string. + +In the .heromeshrc file, the first component of each resource is the name +of the puzzle set (you can use ? for all puzzle sets); in command-line, +that is omitted, and the setting name is the first component. + +Some settings are boolean. For boolean settings, anything that starts with +"0", "n", "N", "f", or "F" is false, and anything that starts with "1", +"y", "Y", "t", or "T" is true. If neither, the default setting is used. + +See bindings.doc for key/mouse bindings. + + +=== Resources === + +.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. + +.editTitle + The window title to use in edit mode. A tilde is replaced by the name of + the puzzle set. + +.gameTitle + The window title to use in game mode. A tilde is replaced by the name of + the puzzle set. + +.gamma + Gamma setting. If this is set, colours are gamma corrected by the number + specified here. The default setting is 1.0. + +.imageSize + The picture size to use, up to 255. If the puzzle set contains pictures + of the requested size, it will use those, otherwise it will try to make + the pictures it does have larger by integer scaling; if that also does + not work, then it is an error. + +.keyRepeat + The keyboard repeat rate, which are two numbers, first the key repeating + delay and then the key repeating interval. + +.level + Specifies the 1-based order number of the level to start at. + +.margin + The X coordinate of the left margin. To the left is the status area, and + to the right of the margin is the playfield. This should be at least 64, + or the picture size, whichever is greater. + +.palette + If defined, the file name of the palette to use (if not set, then the + internal palette is used instead). The file format is hex rrggbb format + separated by any kind of whitespaces. + +.progress + If nonzero, how many steps between dots in the progress report for the + auto testing most. + +.screenFlags + SDL flags: d = double buffer, f = full screen, h = use hardware surface, + n = no window frame, p = hardware palette, r = allow the window to be + resized, y = asynchronous blit, z = no parachute. Some flags might not + work if the window manager does not support them. + +.screenHeight + Height of the window (not counting the border), in pixels. + +.screenWidth + Width of the window (not counting the border), in pixels. + +.showInventory + True means to show the inventory in the margin by default; false means + to show the move list in the margin by default. Either way, it is + possible to change the display at run time. + +.sqlCoveringIndexScan + Boolean controlling if SQLite will use covering index scans. + +.sqlExtensions + Names of SQLite extensions with spaces in between. + +.sqlFile + Name of the user cache database. If not set, then it will use the file + called .heromeshsession in the home directory. + +.sqlInit + SQL codes to execute when Free Hero Mesh starts. + +.sqlMemStatus + Boolean controlling if SQL memory status is available. + +.sqlSmallAllocations + Boolean controlling if SQLite will try to make small allocations. + +.stackProtection + Controls protection from stack overflows; this only works if the C + compiler supports this feature, otherwise there is no effect. If the + first character is ? then the stack protection test mode will be + activated; it will display the call stack usage. The first character + may also be < or > for a stack growing down or up, followed by the + maximum number of bytes to use (in decimal, or hexadecimal with "0x" + at first). Note that not all C functions will check for the stack + protection, so it will use a small amount more than specified here. + +.traceAll + If true, then all classes and messages are allowed for tracing. However, + there is no effect unless tracing is enabled. + +.traceObject + If defined, and tracing is enabled, then it is an error for the + specified object to be freed during the game; you can use this to + debug errors with the use of a specific non-existent objects. You + specify as the object ID number and generation number, separated by + a colon. (This is how it is displayed in the examination screen.) + +.tracePrefix + If defined, trace output is prefixed by the specified text. + Index: game.c ================================================================== --- game.c +++ game.c @@ -700,10 +700,68 @@ } quit: save_replay(); exit(0); } + +void run_auto_test(void) { + Uint8 rc=0; + int lvl,pro,i,n; + const char*t; + setbuf(stdout,0); + solution_replay=1; + optionquery[1]=Q_progress; + t=xrm_get_resource(resourcedb,optionquery,optionquery,2); + pro=t?strtol(t,0,10):0; + optionquery[1]=Q_level; + t=xrm_get_resource(resourcedb,optionquery,optionquery,2); + if(n=lvl=t?strtol(t,0,10):0) goto start; + for(n=1;n<=level_nindex;n++) { + if(lvl) break; + start: + printf("Level %d",n); + if(t=load_level(-n)) { + printf(": Error during loading: %s\n",t); + rc=1; continue; + } + load_replay(); + if(!replay_count) { + printf(": Solution is absent, invalid, or for wrong version of this level\n"); + rc=1; continue; + } + if(t=init_level()) { + printf(": Error during initialization: %s\n",t); + rc=1; continue; + } + if(gameover==-1) { + printf(": Lose during initialization\n"); + rc=1; continue; + } + for(i=0;ioptind) read_options(argc-optind,argv+optind); *optionquery=xrm_make_quark(globalclassname,0)?:xrm_anyq; #ifdef __GNUC__ stack_protect_mark=__builtin_frame_address(0); @@ -893,12 +894,13 @@ max_objects=strtoll(xrm_get_resource(resourcedb,optionquery,optionquery,2)?:"",0,0)?:0xFFFF0000L; set_tracing(); annihilate(); optionquery[1]=Q_level; if(level_ord=strtol(xrm_get_resource(resourcedb,optionquery,optionquery,2)?:"",0,10)) log_if_error(load_level(-level_ord)); + if(main_options['a']) run_auto_test(); if(main_options['x']) { fprintf(stderr,"Ready for executing SQL statements.\n"); do_sql_mode(); return 0; } for(;;) { if(main_options['e']) run_editor(); else run_game(); } } Index: man6/heromesh.6 ================================================================== --- man6/heromesh.6 +++ man6/heromesh.6 @@ -21,11 +21,10 @@ Dump the hash table. .IP -L Display all tokens being read from the class definition file. .IP -a Autotest levels, ensuring that the provided solution is valid. -(Not implemented yet) .IP -c Only load classes and then terminate. This can be used to verify that the class definition file does not contain syntax errors. You can also use it with some other options to display details. .IP -e Index: quarks ================================================================== --- quarks +++ quarks @@ -214,6 +214,7 @@ stackProtection maxObjects traceAll traceObject showInventory +progress Index: quarks.h ================================================================== --- quarks.h +++ quarks.h @@ -179,10 +179,11 @@ #define Q_stackProtection 180 #define Q_maxObjects 181 #define Q_traceAll 182 #define Q_traceObject 183 #define Q_showInventory 184 +#define Q_progress 185 static const char*const global_quarks[]={ "screenWidth", "screenHeight", "margin", "palette", @@ -363,10 +364,11 @@ "stackProtection", "maxObjects", "traceAll", "traceObject", "showInventory", + "progress", 0}; #ifdef HEROMESH_BINDINGS static const SDLKey quark_to_key[Q_undo+1-Q_backspace]={ SDLK_BACKSPACE, SDLK_TAB,