Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -70,11 +70,11 @@ // Does not send any messages or otherwise notify anyone that it has been created. // Returns VOIDLINK if object cannot be created. Uint32 n; Class*cl=classes[c]; Object*o=calloc(1,sizeof(Object)+cl->uservars*sizeof(Value)); - if(!c || !cl || cl->cflags&(CF_GROUP|CF_NOCLASS1|CF_NOCLASS2)) goto bad; + if(!c || !cl || cl->cflags&(CF_GROUP|CF_NOCLASS2)) goto bad; if(!o) fatal("Allocation failed\n"); o->class=c; o->generation=generation_number; #define C(x) o->x=cl->x; C(height) C(weight) C(climb) C(density) C(volume) C(strength) C(arrivals) C(departures) C(temperature) Index: function.c ================================================================== --- function.c +++ function.c @@ -467,14 +467,14 @@ break; case 5: // QUIZ sqlite3_result_int(cxt,classes[cur->rowid]->cflags&CF_QUIZ?1:0); break; case 6: // TRACEIN - sqlite3_result_int(cxt,classes[cur->rowid]->oflags&OF_TRACEIN?1:0); + sqlite3_result_int(cxt,classes[cur->rowid]->cflags&CF_TRACEIN?1:0); break; case 7: // TRACEOUT - sqlite3_result_int(cxt,classes[cur->rowid]->oflags&OF_TRACEOUT?1:0); + sqlite3_result_int(cxt,classes[cur->rowid]->cflags&CF_TRACEOUT?1:0); break; case 8: // GROUP if(sqlite3_vtab_nochange(cxt)) return SQLITE_OK; if(classes[cur->rowid]->cflags&CF_GROUP) { char*s=sqlite3_mprintf(" "); @@ -499,15 +499,15 @@ Cursor*cur=(void*)pcur; cur->eof=0; if(argc) { cur->rowid=sqlite3_value_int64(*argv); cur->unique=1; - if(cur->rowid<=0 || cur->rowid>=0x4000 || !classes[cur->rowid] || classes[cur->rowid]->cflags&CF_NOCLASS2) cur->eof=1; + if(cur->rowid<=0 || cur->rowid>=0x4000 || !classes[cur->rowid] || (classes[cur->rowid]->cflags&CF_NOCLASS2)) cur->eof=1; } else { cur->unique=0; cur->rowid=1; - while(cur->rowid<0x4000 && (!classes[cur->rowid] || classes[cur->rowid]->cflags&CF_NOCLASS2)) ++cur->rowid; + while(cur->rowid<0x4000 && (!classes[cur->rowid] || (classes[cur->rowid]->cflags&CF_NOCLASS2))) ++cur->rowid; if(cur->rowid>=0x4000) cur->eof=1; } return SQLITE_OK; } @@ -515,30 +515,30 @@ Cursor*cur=(void*)pcur; if(cur->unique) { cur->eof=1; } else { ++cur->rowid; - while(cur->rowid<0x4000 && (!classes[cur->rowid] || classes[cur->rowid]->cflags&CF_NOCLASS2)) ++cur->rowid; + while(cur->rowid<0x4000 && (!classes[cur->rowid] || (classes[cur->rowid]->cflags&CF_NOCLASS2))) ++cur->rowid; if(cur->rowid>=0x4000) cur->eof=1; } return SQLITE_OK; } static int vt1_classes_update(sqlite3_vtab*vt,int argc,sqlite3_value**argv,sqlite3_int64*rowid) { sqlite3_int64 id; int v[3]; - if(argc!=5 || sqlite3_value_type(*argv)!=SQLITE_INTEGER) return SQLITE_CONSTRAINT_VTAB; + if(argc<2 || sqlite3_value_type(*argv)!=SQLITE_INTEGER) return SQLITE_CONSTRAINT_VTAB; id=sqlite3_value_int64(*argv); if(id!=sqlite3_value_int64(argv[1])) return SQLITE_CONSTRAINT_VTAB; if(id<=0 || id>=0x4000 || !classes[id]) return SQLITE_INTERNAL; - v[0]=sqlite3_value_int(argv[5]); - v[1]=sqlite3_value_int(argv[6]); - v[2]=sqlite3_value_int(argv[7]); + v[0]=sqlite3_value_int(argv[7]); + v[1]=sqlite3_value_int(argv[8]); + v[2]=sqlite3_value_int(argv[9]); if((v[0]|v[1]|v[2])&~1) return SQLITE_CONSTRAINT_CHECK; if(v[0]) classes[id]->cflags|=CF_QUIZ; else classes[id]->cflags&=~CF_QUIZ; - classes[id]->oflags&=~(OF_TRACEIN|OF_TRACEOUT); - classes[id]->oflags|=(v[1]?OF_TRACEIN:0)|(v[2]?OF_TRACEOUT:0); + classes[id]->cflags&=~(CF_TRACEIN|CF_TRACEOUT); + classes[id]->cflags|=(v[1]?CF_TRACEIN:0)|(v[2]?CF_TRACEOUT:0); return SQLITE_OK; } Module(vt_classes, .xColumn=vt1_classes_column, Index: heromesh.h ================================================================== --- heromesh.h +++ heromesh.h @@ -31,11 +31,11 @@ #define MVALUE(x) UVALUE(x,TY_MESSAGE) #define ZVALUE(x) UVALUE(x,TY_STRING) #define OVALUE(x) UVALUE(x,objects[x]->generation) #define ValueTo64(v) (((sqlite3_int64)((v).u))|(((sqlite3_int64)((v).t))<<32)) -#define N_MESSAGES 23 +#define N_MESSAGES 24 extern const char*const standard_message_names[]; extern const char*const standard_sound_names[]; extern const char*const heromesh_key_names[256]; extern sqlite3*userdb; @@ -94,10 +94,12 @@ #define CF_PLAYER 0x01 #define CF_INPUT 0x02 #define CF_COMPATIBLE 0x04 #define CF_QUIZ 0x08 #define CF_GROUP 0x10 // this is a group of classes; you can't create an object of this class +#define CF_TRACEIN 0x20 +#define CF_TRACEOUT 0x40 // same as CF_NOCLASS1 (no problem since CF_NOCLASS1 not used after class loading) #define CF_NOCLASS1 0x40 // if only the name has been loaded so far, from the .class file #define CF_NOCLASS2 0x80 // if only the name has been loaded so far, from the CLASS.DEF lump #define OF_INVISIBLE 0x0001 #define OF_VISUALONLY 0x0002 @@ -107,12 +109,11 @@ #define OF_USERSIGNAL 0x0020 #define OF_MOVED 0x0040 #define OF_DONE 0x0080 #define OF_KEYCLEARED 0x0100 #define OF_DESTROYED 0x0200 -#define OF_TRACEIN 0x4000 // These more properly belong in CF_ but there is room here for them -#define OF_TRACEOUT 0x8000 // see above +#define OF_BIZARRO 0x0400 typedef struct { const char*name; const char*edithelp; // not present if CF_GROUP const char*gamehelp; // not present if CF_GROUP Index: names.h ================================================================== --- names.h +++ names.h @@ -20,10 +20,11 @@ #define MSG_POSTINIT 18 #define MSG_END_TURN 19 #define MSG_CLEANUP 20 #define MSG_COLLIDING 21 #define MSG_COLLIDE 22 +#define MSG_BIZARRO_SWAP 23 const char*const standard_message_names[]={ "INIT", "CREATE", "DESTROY", "BEGIN_TURN", @@ -44,10 +45,11 @@ "POSTINIT", "END_TURN", "CLEANUP", "COLLIDING", "COLLIDE", + "BIZARRO_SWAP", }; #define SND_SPLASH 0 #define SND_POUR 1 #define SND_DOOR 2 #define SND_GLASS 3 Index: names.js ================================================================== --- names.js +++ names.js @@ -25,10 +25,11 @@ 19 = END_TURN // New 20 = CLEANUP 21 = COLLIDING 22 = COLLIDE + 23 = BIZARRO_SWAP `.split("\n").map(x=>/^ *([0-9]+) = ([^ ]*) *$/.exec(x)).filter(x=>x); const standard_sound_names=[]; ` SPLASH POUR