diff --git a/src/cc/cclib.cpp b/src/cc/cclib.cpp index ea39bbc41..441b43ccf 100644 --- a/src/cc/cclib.cpp +++ b/src/cc/cclib.cpp @@ -75,10 +75,6 @@ std::string CClib_rawtxgen(struct CCcontract_info *cp,uint8_t funcid,cJSON *para #ifdef BUILD_ROGUE int32_t rogue_replay(uint64_t seed,int32_t sleeptime); -bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx) -{ - return(true); -} UniValue rogue_newgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); UniValue rogue_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); UniValue rogue_gameinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); diff --git a/src/cc/rogue/command.c b/src/cc/rogue/command.c index b2ce396ab..e78e6b055 100644 --- a/src/cc/rogue/command.c +++ b/src/cc/rogue/command.c @@ -271,7 +271,7 @@ over: rs->needflush = (uint32_t)time(NULL); q_comm = FALSE; if ( rs->guiflag != 0 ) - rogue_bailout(); + rogue_bailout(rs); return; when 'i': after = FALSE; inventory(rs,pack, 0); when 'I': after = FALSE; picky_inven(rs); diff --git a/src/cc/rogue/extern.h b/src/cc/rogue/extern.h index 0791702d6..486d85ff1 100644 --- a/src/cc/rogue/extern.h +++ b/src/cc/rogue/extern.h @@ -184,7 +184,6 @@ void md_onsignal_default(void); int md_issymlink(char *sp); int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex); -void rogue_bailout(void); #endif diff --git a/src/cc/rogue/rip.c b/src/cc/rogue/rip.c index 032cc1b6d..a5b3e7208 100644 --- a/src/cc/rogue/rip.c +++ b/src/cc/rogue/rip.c @@ -277,7 +277,7 @@ death(struct rogue_state *rs,char monst) move(LINES - 1, 0); refresh(); score(rs,purse, amulet ? 3 : 0, monst); - rogue_bailout(); + rogue_bailout(rs); printf("[Press return to continue]"); fflush(stdout); if ( fgets(prbuf,10,stdin) != 0 ) diff --git a/src/cc/rogue/rogue.c b/src/cc/rogue/rogue.c index 307baab5f..305ae2b64 100644 --- a/src/cc/rogue/rogue.c +++ b/src/cc/rogue/rogue.c @@ -185,14 +185,6 @@ int32_t rogue_setplayerdata(struct rogue_state *rs,char *gametxidstr) return(retval); } -void rogue_bailout() -{ - char cmd[512]; - sprintf(cmd,"./komodo-cli -ac_name=ROGUE cclib bailout 17 \\\"[%%22%s%%22]\\\" >> bailout.log",Gametxidstr); - if ( system(cmd) != 0 ) - fprintf(stderr,"error issuing (%s)\n",cmd); -} - void rogue_progress(uint64_t seed,char *keystrokes,int32_t num) { char cmd[32768],hexstr[32768]; int32_t i; @@ -206,13 +198,27 @@ void rogue_progress(uint64_t seed,char *keystrokes,int32_t num) int32_t flushkeystrokes(struct rogue_state *rs) { - rogue_progress(rs->seed,rs->buffered,rs->num); - memset(rs->buffered,0,sizeof(rs->buffered)); - rs->counter++; - rs->num = 0; + if ( rs->num > 0 ) + { + rogue_progress(rs->seed,rs->buffered,rs->num); + memset(rs->buffered,0,sizeof(rs->buffered)); + rs->counter++; + rs->num = 0; + } return(0); } +void rogue_bailout(struct rogue_state *rs) +{ + char cmd[512]; + flushkeystrokes(rs); + sleep(5); + fprintf(stderr,"bailing out\n"); + sprintf(cmd,"./komodo-cli -ac_name=ROGUE cclib bailout 17 \\\"[%%22%s%%22]\\\" >> bailout.log",Gametxidstr); + if ( system(cmd) != 0 ) + fprintf(stderr,"error issuing (%s)\n",cmd); +} + int32_t rogue_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t num,struct rogue_player *player) { struct rogue_state *rs; FILE *fp; int32_t i; diff --git a/src/cc/rogue/rogue.h b/src/cc/rogue/rogue.h index 6e9a6600f..5eccb2e8c 100644 --- a/src/cc/rogue/rogue.h +++ b/src/cc/rogue/rogue.h @@ -359,6 +359,7 @@ int32_t flushkeystrokes(struct rogue_state *rs); int32_t rogue_restorepack(struct rogue_state *rs); void restore_player(struct rogue_state *rs); int32_t rogue_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t num,struct rogue_player *player); +void rogue_bailout(struct rogue_state *rs); /* * Help list diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index be4435056..9c7504e5f 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -126,7 +126,7 @@ // cclib register 17 \"[%22aa81321d8889f881fe3d7c68c905b7447d9143832b0abbef6c2cab49dff8b0cc%22]\" // ./rogue gui -> creates keystroke files // ./c cclib register 17 \"[%226d3243c6e5ab383898b28a87e01f6c00b5bdd9687020f17f5caacc8a61febd19%22,%222475182f9d5169d8a3249d17640e4eccd90f4ee43ab04791129b0fa3f177b14a%22]\" -// ./c cclib bailout 17 \"[%22aa81321d8889f881fe3d7c68c905b7447d9143832b0abbef6c2cab49dff8b0cc%22]\" +// ./c cclib bailout 17 \"[%226d3243c6e5ab383898b28a87e01f6c00b5bdd9687020f17f5caacc8a61febd19%22]\" #define MAXPACK 23 @@ -868,8 +868,6 @@ UniValue rogue_finishgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *param mtx.vout.push_back(CTxOut(cashout,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG)); } } - //for (i=0; i_o._o_type,o->_o._o_packch,o->_o._o_packch); } mtx.vout.push_back(MakeCC1vout(cp->evalcode,CCchange + (batonvalue-2*txfee),roguepk)); Myprivkey(mypriv); @@ -995,3 +993,9 @@ UniValue rogue_players(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) result.push_back(Pair("numplayerdata",a.size())); return(result); } + +bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx) +{ + return(true); +} +