Auto bailout
This commit is contained in:
@@ -75,10 +75,6 @@ std::string CClib_rawtxgen(struct CCcontract_info *cp,uint8_t funcid,cJSON *para
|
|||||||
#ifdef BUILD_ROGUE
|
#ifdef BUILD_ROGUE
|
||||||
int32_t rogue_replay(uint64_t seed,int32_t sleeptime);
|
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_newgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *params);
|
||||||
UniValue rogue_pending(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);
|
UniValue rogue_gameinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params);
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ over:
|
|||||||
rs->needflush = (uint32_t)time(NULL);
|
rs->needflush = (uint32_t)time(NULL);
|
||||||
q_comm = FALSE;
|
q_comm = FALSE;
|
||||||
if ( rs->guiflag != 0 )
|
if ( rs->guiflag != 0 )
|
||||||
rogue_bailout();
|
rogue_bailout(rs);
|
||||||
return;
|
return;
|
||||||
when 'i': after = FALSE; inventory(rs,pack, 0);
|
when 'i': after = FALSE; inventory(rs,pack, 0);
|
||||||
when 'I': after = FALSE; picky_inven(rs);
|
when 'I': after = FALSE; picky_inven(rs);
|
||||||
|
|||||||
@@ -184,7 +184,6 @@ void md_onsignal_default(void);
|
|||||||
int md_issymlink(char *sp);
|
int md_issymlink(char *sp);
|
||||||
|
|
||||||
int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex);
|
int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex);
|
||||||
void rogue_bailout(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ death(struct rogue_state *rs,char monst)
|
|||||||
move(LINES - 1, 0);
|
move(LINES - 1, 0);
|
||||||
refresh();
|
refresh();
|
||||||
score(rs,purse, amulet ? 3 : 0, monst);
|
score(rs,purse, amulet ? 3 : 0, monst);
|
||||||
rogue_bailout();
|
rogue_bailout(rs);
|
||||||
printf("[Press return to continue]");
|
printf("[Press return to continue]");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if ( fgets(prbuf,10,stdin) != 0 )
|
if ( fgets(prbuf,10,stdin) != 0 )
|
||||||
|
|||||||
@@ -185,14 +185,6 @@ int32_t rogue_setplayerdata(struct rogue_state *rs,char *gametxidstr)
|
|||||||
return(retval);
|
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)
|
void rogue_progress(uint64_t seed,char *keystrokes,int32_t num)
|
||||||
{
|
{
|
||||||
char cmd[32768],hexstr[32768]; int32_t i;
|
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)
|
int32_t flushkeystrokes(struct rogue_state *rs)
|
||||||
{
|
{
|
||||||
rogue_progress(rs->seed,rs->buffered,rs->num);
|
if ( rs->num > 0 )
|
||||||
memset(rs->buffered,0,sizeof(rs->buffered));
|
{
|
||||||
rs->counter++;
|
rogue_progress(rs->seed,rs->buffered,rs->num);
|
||||||
rs->num = 0;
|
memset(rs->buffered,0,sizeof(rs->buffered));
|
||||||
|
rs->counter++;
|
||||||
|
rs->num = 0;
|
||||||
|
}
|
||||||
return(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)
|
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;
|
struct rogue_state *rs; FILE *fp; int32_t i;
|
||||||
|
|||||||
@@ -359,6 +359,7 @@ int32_t flushkeystrokes(struct rogue_state *rs);
|
|||||||
int32_t rogue_restorepack(struct rogue_state *rs);
|
int32_t rogue_restorepack(struct rogue_state *rs);
|
||||||
void restore_player(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);
|
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
|
* Help list
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
// cclib register 17 \"[%22aa81321d8889f881fe3d7c68c905b7447d9143832b0abbef6c2cab49dff8b0cc%22]\"
|
// cclib register 17 \"[%22aa81321d8889f881fe3d7c68c905b7447d9143832b0abbef6c2cab49dff8b0cc%22]\"
|
||||||
// ./rogue <seed> gui -> creates keystroke files
|
// ./rogue <seed> gui -> creates keystroke files
|
||||||
// ./c cclib register 17 \"[%226d3243c6e5ab383898b28a87e01f6c00b5bdd9687020f17f5caacc8a61febd19%22,%222475182f9d5169d8a3249d17640e4eccd90f4ee43ab04791129b0fa3f177b14a%22]\"
|
// ./c cclib register 17 \"[%226d3243c6e5ab383898b28a87e01f6c00b5bdd9687020f17f5caacc8a61febd19%22,%222475182f9d5169d8a3249d17640e4eccd90f4ee43ab04791129b0fa3f177b14a%22]\"
|
||||||
// ./c cclib bailout 17 \"[%22aa81321d8889f881fe3d7c68c905b7447d9143832b0abbef6c2cab49dff8b0cc%22]\"
|
// ./c cclib bailout 17 \"[%226d3243c6e5ab383898b28a87e01f6c00b5bdd9687020f17f5caacc8a61febd19%22]\"
|
||||||
|
|
||||||
|
|
||||||
#define MAXPACK 23
|
#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));
|
mtx.vout.push_back(CTxOut(cashout,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//for (i=0; i<P.packsize; i++)
|
|
||||||
// fprintf(stderr,"object (%s) type.%d pack.(%c:%d)\n",inv_name(o,FALSE),o->_o._o_type,o->_o._o_packch,o->_o._o_packch);
|
|
||||||
}
|
}
|
||||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CCchange + (batonvalue-2*txfee),roguepk));
|
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CCchange + (batonvalue-2*txfee),roguepk));
|
||||||
Myprivkey(mypriv);
|
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()));
|
result.push_back(Pair("numplayerdata",a.size()));
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx)
|
||||||
|
{
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user