Index: edit.c ================================================================== --- edit.c +++ edit.c @@ -314,10 +314,13 @@ static int editor_command(int prev,int cmd,int number,int argc,sqlite3_stmt*args,void*aux) { switch(cmd) { case '^c': // Select class/image class_image_select(); return 0; + case '^L': // Select level + load_level(number); + return 1; case '^P': // Play return -2; case '^Q': // Quit return -1; default: Index: heromesh.h ================================================================== --- heromesh.h +++ heromesh.h @@ -70,10 +70,11 @@ unsigned char*read_lump(int sol,int lvl,long*sz,sqlite3_value**us); void write_lump(int sol,int lvl,long sz,const unsigned char*data); const char*load_level(int lvl); void set_cursor(int id); +const char*log_if_error(const char*t); #define FIL_SOLUTION 1 #define FIL_LEVEL 0 #define LUMP_LEVEL_IDX (-1) #define LUMP_CLASS_DEF (-2) Index: main.c ================================================================== --- main.c +++ main.c @@ -792,10 +792,15 @@ fatal("%p %p :: %lld\n",v,stack_protect_mark,(long long)(((char*)stack_protect_mark)-v)); } if(v[1]) stack_protect_mark=((char*)stack_protect_mark)+strtoll(v+1,0,0); } #endif + +const char*log_if_error(const char*t) { + if(t && main_options['v']) fprintf(stderr,"!! %s\n",t); + return t; +} int main(int argc,char**argv) { int optind=1; while(argc>optind && argv[optind][0]=='-') { int i; @@ -839,12 +844,14 @@ load_classes(); load_level_index(); optionquery[1]=Q_maxObjects; max_objects=strtoll(xrm_get_resource(resourcedb,optionquery,optionquery,2)?:"",0,0)?:0xFFFF0000L; 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['x']) { fprintf(stderr,"Ready for executing SQL statements.\n"); do_sql_mode(); return 0; } for(;;) { if(main_options['e']) run_editor(); else run_game(); } }