Quit handling
This commit is contained in:
@@ -264,14 +264,17 @@ over:
|
|||||||
when 'Q':
|
when 'Q':
|
||||||
after = FALSE;
|
after = FALSE;
|
||||||
q_comm = TRUE;
|
q_comm = TRUE;
|
||||||
quit(0);
|
if ( quit(0) > 0 )
|
||||||
if ( rs->guiflag != 0 && rs->needflush == 0 )
|
{
|
||||||
rs->needflush = (uint32_t)time(NULL);
|
if ( rs->guiflag != 0 )
|
||||||
|
{
|
||||||
|
if (rs->needflush == 0 )
|
||||||
|
rs->needflush = (uint32_t)time(NULL);
|
||||||
|
rogue_bailout(rs);
|
||||||
|
} else rs->replaydone = (uint32_t)time(NULL);
|
||||||
|
}
|
||||||
q_comm = FALSE;
|
q_comm = FALSE;
|
||||||
if ( rs->guiflag != 0 )
|
return;
|
||||||
rogue_bailout(rs);
|
|
||||||
else rs->replaydone = (uint32_t)time(NULL);
|
|
||||||
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);
|
||||||
when 'd': drop(rs);
|
when 'd': drop(rs);
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ void getltchars(void);
|
|||||||
void leave(int);
|
void leave(int);
|
||||||
void my_exit(int st);
|
void my_exit(int st);
|
||||||
void playltchars(void);
|
void playltchars(void);
|
||||||
void quit(int);
|
int32_t quit(int);
|
||||||
void resetltchars(void);
|
void resetltchars(void);
|
||||||
void set_order(int *order, int numthings);
|
void set_order(int *order, int numthings);
|
||||||
void tstp(int ignored);
|
void tstp(int ignored);
|
||||||
|
|||||||
@@ -158,23 +158,10 @@ readchar(struct rogue_state *rs)
|
|||||||
{
|
{
|
||||||
static uint32_t counter;
|
static uint32_t counter;
|
||||||
if ( rs->ind < rs->numkeys )
|
if ( rs->ind < rs->numkeys )
|
||||||
{
|
|
||||||
//if ( rs->ind == rs->numkeys-1 )
|
|
||||||
// rs->replaydone = (uint32_t)time(NULL);
|
|
||||||
if ( rs->keystrokes[rs->ind] == 'Q' )
|
|
||||||
{
|
|
||||||
rs->ind++;
|
|
||||||
fprintf(stderr,"Q.(%c) ",rs->keystrokes[rs->ind]);
|
|
||||||
return('q');
|
|
||||||
}
|
|
||||||
return(rs->keystrokes[rs->ind++]);
|
return(rs->keystrokes[rs->ind++]);
|
||||||
}
|
|
||||||
if ( rs->replaydone != 0 && counter++ < 3 )
|
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 )
|
|
||||||
// return(ESCAPE);
|
|
||||||
//else
|
|
||||||
if ( counter < 3 || (counter & 1) == 0 )
|
if ( counter < 3 || (counter & 1) == 0 )
|
||||||
return('y');
|
return('y');
|
||||||
else return(ESCAPE);
|
else return(ESCAPE);
|
||||||
|
|||||||
@@ -618,8 +618,7 @@ playit(struct rogue_state *rs)
|
|||||||
* Have player make certain, then exit.
|
* Have player make certain, then exit.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
int32_t quit(int sig)
|
||||||
quit(int sig)
|
|
||||||
{
|
{
|
||||||
struct rogue_state *rs = &globalR;
|
struct rogue_state *rs = &globalR;
|
||||||
int oy, ox;
|
int oy, ox;
|
||||||
@@ -653,8 +652,9 @@ quit(int sig)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//score(rs,purse, 1, 0);
|
//score(rs,purse, 1, 0);
|
||||||
fprintf(stderr,"done!\n");
|
//fprintf(stderr,"done!\n");
|
||||||
}
|
}
|
||||||
|
return(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -667,6 +667,7 @@ quit(int sig)
|
|||||||
mpos = 0;
|
mpos = 0;
|
||||||
count = 0;
|
count = 0;
|
||||||
to_death = FALSE;
|
to_death = FALSE;
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user