cmdcount_t

Add a type to force g.{command_count,last_command_count,multi} to have the
same type (because cmd.c: g.multi = g.command_count;) and some resulting
cleanup.
This commit is contained in:
nhkeni
2022-02-27 20:01:49 -05:00
parent eeee725bf9
commit 3cf1b87914
4 changed files with 8 additions and 6 deletions
+5 -3
View File
@@ -676,6 +676,8 @@ struct _cmd_queue {
struct _cmd_queue *next; struct _cmd_queue *next;
}; };
typedef long cmdcount_t; /* Command counts */
/* /*
* 'g' -- instance_globals holds engine state that does not need to be * 'g' -- instance_globals holds engine state that does not need to be
* persisted upon game exit. The initialization state is well defined * persisted upon game exit. The initialization state is well defined
@@ -735,7 +737,7 @@ struct instance_globals {
coord clicklook_cc; coord clicklook_cc;
winid en_win; winid en_win;
boolean en_via_menu; boolean en_via_menu;
long last_command_count; cmdcount_t last_command_count;
struct ext_func_tab *ext_tlist; /* info for rhack() from doextcmd() */ struct ext_func_tab *ext_tlist; /* info for rhack() from doextcmd() */
/* dbridge.c */ /* dbridge.c */
@@ -748,9 +750,9 @@ struct instance_globals {
int hackpid; /* current process id */ int hackpid; /* current process id */
char chosen_windowtype[WINTYPELEN]; char chosen_windowtype[WINTYPELEN];
int bases[MAXOCLASSES + 1]; int bases[MAXOCLASSES + 1];
int multi; cmdcount_t multi;
char command_line[COLNO]; char command_line[COLNO];
long command_count; cmdcount_t command_count;
const char *multi_reason; const char *multi_reason;
char multireasonbuf[QBUFSZ]; /* note: smaller than usual [BUFSZ] */ char multireasonbuf[QBUFSZ]; /* note: smaller than usual [BUFSZ] */
int nroom; int nroom;
+1 -1
View File
@@ -276,7 +276,7 @@ extern const char *directionname(int);
extern int isok(int, int); extern int isok(int, int);
extern int get_adjacent_loc(const char *, const char *, xchar, xchar, coord *); extern int get_adjacent_loc(const char *, const char *, xchar, xchar, coord *);
extern const char *click_to_cmd(int, int, int); extern const char *click_to_cmd(int, int, int);
extern char get_count(char *, char, long, long *, boolean); extern char get_count(char *, char, long, cmdcount_t *, boolean);
#ifdef HANGUPHANDLING #ifdef HANGUPHANDLING
extern void hangup(int); extern void hangup(int);
extern void end_of_input(void); extern void end_of_input(void);
+1 -1
View File
@@ -533,7 +533,7 @@ exerchk(void)
exerper(); exerper();
if (g.moves >= g.context.next_attrib_check) { if (g.moves >= g.context.next_attrib_check) {
debugpline1("exerchk: ready to test. multi = %d.", g.multi); debugpline1("exerchk: ready to test. multi = %ld.", g.multi);
} }
/* Are we ready for a test? */ /* Are we ready for a test? */
if (g.moves >= g.context.next_attrib_check && !g.multi) { if (g.moves >= g.context.next_attrib_check && !g.multi) {
+1 -1
View File
@@ -4795,7 +4795,7 @@ get_count(
char *allowchars, char *allowchars,
char inkey, char inkey,
long maxcount, long maxcount,
long *count, cmdcount_t *count,
boolean historicmsg) /* whether to include in ^P history: True => yes */ boolean historicmsg) /* whether to include in ^P history: True => yes */
{ {
char qbuf[QBUFSZ]; char qbuf[QBUFSZ];