Alternate esc and y

This commit is contained in:
jl777
2019-02-16 09:00:32 -11:00
parent e9bddb1ed1
commit eba3ba86f6

View File

@@ -155,6 +155,7 @@ readchar(struct rogue_state *rs)
char ch = -1; char ch = -1;
if ( rs != 0 && rs->guiflag == 0 ) if ( rs != 0 && rs->guiflag == 0 )
{ {
static uint32_t counter;
if ( rs->ind < rs->numkeys ) if ( rs->ind < rs->numkeys )
{ {
//if ( rs->ind == rs->numkeys-1 ) //if ( rs->ind == rs->numkeys-1 )
@@ -162,13 +163,15 @@ readchar(struct rogue_state *rs)
//fprintf(stderr,"(%c) ",rs->keystrokes[rs->ind]); //fprintf(stderr,"(%c) ",rs->keystrokes[rs->ind]);
return(rs->keystrokes[rs->ind++]); return(rs->keystrokes[rs->ind++]);
} }
if ( rs->replaydone != 0 ) if ( rs->replaydone != 0 && counter++ < 3 )
fprintf(stderr,"replay finished but readchar called\n"); fprintf(stderr,"replay finished but readchar called\n");
rs->replaydone = (uint32_t)time(NULL); rs->replaydone = (uint32_t)time(NULL);
//if ( (rand() & 1) == 0 ) //if ( (rand() & 1) == 0 )
// return(ESCAPE); // return(ESCAPE);
//else //else
return('y'); if ( counter < 3 || (counter & 1) == 0 )
return('y');
else return(ESCAPE);
} }
if ( rs == 0 || rs->guiflag != 0 ) if ( rs == 0 || rs->guiflag != 0 )
{ {