]> granicus.if.org Git - nethack/commitdiff
cmdcount_t
authornhkeni <keni@his.com>
Mon, 28 Feb 2022 00:57:16 +0000 (19:57 -0500)
committernhkeni <keni@his.com>
Mon, 28 Feb 2022 01:01:49 +0000 (20:01 -0500)
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.

include/decl.h
include/extern.h
src/attrib.c
src/cmd.c

index 3735dadfe32bee83b7893a19c55141b2870c4c40..e065d0aa6840cbf8497b98ea80753a4345ca0fa3 100644 (file)
@@ -676,6 +676,8 @@ struct _cmd_queue {
     struct _cmd_queue *next;
 };
 
+typedef long cmdcount_t;       /* Command counts */
+
 /*
  * 'g' -- instance_globals holds engine state that does not need to be
  * persisted upon game exit.  The initialization state is well defined
@@ -735,7 +737,7 @@ struct instance_globals {
     coord clicklook_cc;
     winid en_win;
     boolean en_via_menu;
-    long last_command_count;
+    cmdcount_t last_command_count;
     struct ext_func_tab *ext_tlist; /* info for rhack() from doextcmd() */
 
     /* dbridge.c */
@@ -748,9 +750,9 @@ struct instance_globals {
     int hackpid; /* current process id */
     char chosen_windowtype[WINTYPELEN];
     int bases[MAXOCLASSES + 1];
-    int multi;
+    cmdcount_t multi;
     char command_line[COLNO];
-    long command_count;
+    cmdcount_t command_count;
     const char *multi_reason;
     char multireasonbuf[QBUFSZ]; /* note: smaller than usual [BUFSZ] */
     int nroom;
index c20a41f0ca5521fa35daf67c9a72010a30d23651..9fb0597ba9125d814661fa3d9098d8b3820e932c 100644 (file)
@@ -276,7 +276,7 @@ extern const char *directionname(int);
 extern int isok(int, int);
 extern int get_adjacent_loc(const char *, const char *, xchar, xchar, coord *);
 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
 extern void hangup(int);
 extern void end_of_input(void);
index 2a2dbf6e9199eb8ad76b733c253a6a599973b340..f6c30e42aba5df80b819483e9981142f3ae07977 100644 (file)
@@ -533,7 +533,7 @@ exerchk(void)
     exerper();
 
     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? */
     if (g.moves >= g.context.next_attrib_check && !g.multi) {
index e94c6cd8d4eae70c8e74ec1fea5103cd55cce662..2fb4134388106afcf31e8e3baca8b8afa20b8261 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -4795,7 +4795,7 @@ get_count(
     char *allowchars,
     char inkey,
     long maxcount,
-    long *count,
+    cmdcount_t *count,
     boolean historicmsg) /* whether to include in ^P history: True => yes */
 {
     char qbuf[QBUFSZ];