Auto bailout on quit or death

This commit is contained in:
jl777
2019-02-10 07:42:52 -11:00
parent 82b8ae689a
commit 8919dd6523
5 changed files with 15 additions and 17 deletions

View File

@@ -270,6 +270,7 @@ over:
if ( rs->guiflag != 0 && rs->needflush == 0 )
rs->needflush = (uint32_t)time(NULL);
q_comm = FALSE;
rogue_bailout();
return;
when 'i': after = FALSE; inventory(rs,pack, 0);
when 'I': after = FALSE; picky_inven(rs);

View File

@@ -184,6 +184,7 @@ 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

View File

@@ -275,6 +275,7 @@ death(struct rogue_state *rs,char monst)
move(LINES - 1, 0);
refresh();
score(purse, amulet ? 3 : 0, monst);
rogue_bailout();
printf("[Press return to continue]");
fflush(stdout);
if ( fgets(prbuf,10,stdin) != 0 )

View File

@@ -185,7 +185,18 @@ int32_t rogue_setplayerdata(struct rogue_state *rs,char *gametxidstr)
return(retval);
}
void rogue_progress(uint64_t seed,char *keystrokes,int32_t num) // use seed to lookup gametxid
void rogue_bailout()
{
char cmd[32768],hexstr[32768]; int32_t i;
for (i=0; i<num; i++)
sprintf(&hexstr[i<<1],"%02x",keystrokes[i]);
hexstr[i<<1] = 0;
sprintf(cmd,"./komodo-cli -ac_name=ROGUE cclib bailout 17 \\\"[%%22%s%%22]\\\" >> keystrokes.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;
for (i=0; i<num; i++)

View File

@@ -131,22 +131,6 @@
// cclib register 17 \"[%22a49f90d6b5a226132a8615c9b55b254629611565c69246ea58f7a02059b847bf%22,%22f3a4a61cfa0dd43733b06d1368c199594258e0f3db983dc1b9b10768a5671909%22]\"
// cclib keystrokes 17 \"[%220a4ecb345ca3090f4acad63f889c3668e46e245cb00ca4b8b57c4677b1ee95b2%22,%22deadbeef%22]\"
// cclib bailout 17 \"[%22a49f90d6b5a226132a8615c9b55b254629611565c69246ea58f7a02059b847bf%22]\"
// eef1d0091a88d85bdac1ede9d31db8504bc466a6695fdf259dac623fce09e0dd
/*
2409 gold.209 hp.17 strength.16 level.3 exp.22 3
object (2 rations of food) x.0 y.0 type.58 pack.(a:97)
object (+1 ring mail [protection 4] (being worn)) x.0 y.0 type.93 pack.(b:98)
object (A +1,+1 mace (weapon in hand)) x.0 y.0 type.41 pack.(c:99)
object (A +1,+0 short bow) x.0 y.0 type.41 pack.(d:100)
object (25 +0,+0 arrows) x.0 y.0 type.41 pack.(e:101)
object (A scroll titled 'zokkli ta grebot sristael') x.61 y.12 type.63 pack.(f:102)
object (A scroll titled 'val riip') x.42 y.18 type.63 pack.(g:103)
d1000000110000001000000003000000160000000700000003000000000000003a0000000000000002000000000000000000000000000000000000001000000000000000000000000000000000000000000000005d00000000000000010000000100000000000000000000000600000012000000000000000000000000000000000000000000000029000000ffffffff010000000000000001000000010000000000000012000000000000003278340000000000317833000000000029000000ffffffff0100000002000000010000000000000000000000120000000000000031783100000000003178310000000000290000000200000019000000030000000000000000000000000000001e00000000000000317831000000000032783300000000003f00000000000000010000000000000000000000000000000b0000001000000000000000307830000000000030783000000000003f00000000000000010000000800000000000000000000000b000000100000000000000030783000000000003078300000000000 packsize.7 n.396
(0 319) (1 9) (2 3) (3 3) (6 1) (7 1) (8 1) (11 2) (16 4) (17 1) (18 3) (22 1) (25 1) (30 1) (41 3) (48 8) (49 7) (50 2) (51 2) (52 1) (58 1) (63 2) (93 1) (120 10) (209 1) (255 8) nonz.26
extracted $$$gold.209 hp.17 strength.16 level.3 exp.22 dl.3 n.1 size.1228
*/
#define MAXPACK 23