diff --git a/src/cc/rogue/list.c b/src/cc/rogue/list.c index 622af60cd..59abef98c 100644 --- a/src/cc/rogue/list.c +++ b/src/cc/rogue/list.c @@ -19,6 +19,58 @@ int total = 0; /* total dynamic memory bytes */ #endif +/* + * discard: + * Free up an item + */ + +int32_t itemcounter; +THING *thingptrs[100000]; +int32_t numptrs; + +int32_t thing_find(THING *ptr) +{ + for (i=0; i_t._t_type,thingptrs[i]->o_type,thingptrs[i]->o_type); + free(thingptrs[i]); + } + memset(thingptrs,0,sizeof(thingptrs)); + numptrs = 0; +} + /* * detach: * takes an item out of whatever linked list it might be in @@ -77,49 +129,7 @@ _free_list(THING **ptr) } } -/* - * discard: - * Free up an item - */ -int32_t itemcounter; -THING *thingptrs[100000]; -int32_t numptrs; - -void -discard(THING *item) -{ -#ifdef MASTER - total--; -#endif - if ( 0 ) - { - int32_t i; - for (i=0; i_t._t_type,thingptrs[i]->o_type,thingptrs[i]->o_type); - free(thingptrs[i]); - } - memset(thingptrs,0,sizeof(thingptrs)); - numptrs = 0; -} /* * new_item @@ -139,7 +149,7 @@ new_item(void) #else item = (THING *)calloc(1, sizeof *item); #endif - if ( 0 ) + if ( 1 ) { thingptrs[numptrs++] = item; if ( (++itemcounter % 100) == 0 ) diff --git a/src/cc/rogue/main.c b/src/cc/rogue/main.c index 6b466e9a0..d58e45e47 100644 --- a/src/cc/rogue/main.c +++ b/src/cc/rogue/main.c @@ -742,7 +742,7 @@ int32_t rogue_sendrawtransaction(char *rawtx) void rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char *keystrokes,int32_t num) { - char cmd[16384],hexstr[16384],params[32768],*retstr,*rawtx,*pastkeys; int32_t i,numpastkeys; cJSON *retjson; + char cmd[16384],hexstr[16384],params[32768],*retstr,*rawtx,*pastkeys,*pastcmp,*keys; int32_t i,len,numpastkeys; cJSON *retjson; //fprintf(stderr,"rogue_progress num.%d\n",num); if ( rs->guiflag != 0 && Gametxidstr[0] != 0 ) { @@ -767,6 +767,25 @@ void rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char * // if not matching... panic? if ( 0 && (pastkeys= rogue_keystrokesload(&numpastkeys,seed,1)) != 0 ) { + sprintf(params,"[\"extract\",\"17\",\"[%%22%s%%22]\"]",Gametxidstr); + if ( (retstr= komodo_issuemethod(USERPASS,"cclib",params,ROGUE_PORT)) != 0 ) + { + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (keys= jstr(retjson,"keystrokes")) != 0 ) + { + len = strlen(keys) / 2; + pastcmp = (char *)malloc(len + 1) + decode_hex(pastcmp,len,keys); + if ( len != numpastkeys || memcmp(pastcmp,pastkeys,len) != 0 ) + { + fprintf(stderr,"pastcmp[%d] != pastkeys[%d]?\n",len,numpastkeys); + } + free(pastcmp); + } + free_json(retjson); + } + } free(pastkeys); } diff --git a/src/cc/rogue/rogue.c b/src/cc/rogue/rogue.c index 478e3d2ed..5e5a66e06 100644 --- a/src/cc/rogue/rogue.c +++ b/src/cc/rogue/rogue.c @@ -286,7 +286,7 @@ char *rogue_keystrokesload(int32_t *numkeysp,uint64_t seed,int32_t counter) fclose(fp); num += fsize; counter++; - fprintf(stderr,"loaded %ld from (%s) total %d\n",fsize,fname,num); + //fprintf(stderr,"loaded %ld from (%s) total %d\n",fsize,fname,num); } *numkeysp = num; return(keystrokes); diff --git a/src/cc/rogue/rogue.h b/src/cc/rogue/rogue.h index 8c1101fc6..ba57adbe6 100644 --- a/src/cc/rogue/rogue.h +++ b/src/cc/rogue/rogue.h @@ -824,6 +824,7 @@ void doctor(struct rogue_state *rs,int); void playit(struct rogue_state *rs); struct room *roomin(struct rogue_state *rs,coord *cp); +int32_t thing_find(THING *ptr); #define MAXDAEMONS 20 diff --git a/src/cc/rogue/state.c b/src/cc/rogue/state.c index b0176a042..b649e32ee 100644 --- a/src/cc/rogue/state.c +++ b/src/cc/rogue/state.c @@ -1429,6 +1429,11 @@ rs_write_object(struct rogue_state *rs,FILE *savef, THING *o) struct rogue_packitem *item; if (write_error) return(WRITESTAT); + if ( thing_find(o) < 0 ) + { + fprintf(stderr,"cant find thing.%p in list\n",o); + return(0); + } if ( o->_o._o_packch != 0 ) { item = &rs->P.roguepack[rs->P.packsize]; @@ -1478,6 +1483,7 @@ rs_write_object(struct rogue_state *rs,FILE *savef, THING *o) rs_write_int(savef, o->_o._o_flags); rs_write_int(savef, o->_o._o_group); rs_write_string(savef, o->_o._o_label); + fprintf(stderr,"label.%p\n",o->_o._o_label); return(WRITESTAT); }