More globals moved to instance_globals.

This commit is contained in:
Bart House
2018-12-19 21:26:35 -08:00
parent b7a0e69998
commit 576eece500
65 changed files with 498 additions and 505 deletions

View File

@@ -8,11 +8,6 @@
#define E extern
E int NDECL((*occupation));
E int NDECL((*afternmv));
E const char *hname;
E int hackpid;
#if defined(UNIX) || defined(VMS)
E int locknum;
#endif
@@ -27,22 +22,6 @@ E char SAVEP[];
/* max size of a windowtype option */
#define WINTYPELEN 16
E char chosen_windowtype[WINTYPELEN];
E NEARDATA int bases[MAXOCLASSES];
E NEARDATA int multi;
E const char *multi_reason;
E NEARDATA int nroom;
E NEARDATA int nsubroom;
E NEARDATA int occtime;
E NEARDATA int warn_obj_cnt; /* count of monsters meeting criteria */
E int x_maze_max, y_maze_max;
E int otg_temp;
E NEARDATA int in_doagain;
E struct dgn_topology { /* special dungeon levels for speed */
d_level d_oracle_level;
@@ -696,6 +675,24 @@ struct instance_globals {
/* dbridge.c */
struct entity occupants[ENTITIES];
/* decl.c */
int NDECL((*occupation));
int NDECL((*afternmv));
const char *hname; /* name of the game (argv[0] of main) */
int hackpid;
char chosen_windowtype[WINTYPELEN];
int bases[MAXOCLASSES];
int multi;
const char *multi_reason;
int nroom;
int nsubroom;
int occtime;
int warn_obj_cnt; /* count of monsters meeting criteria */
int x_maze_max;
int y_maze_max;
int otg_temp; /* used by object_to_glyph() [otg] */
int in_doagain;
/* dig.c */
boolean did_dig_msg;

View File

@@ -292,9 +292,9 @@
/* This has the unfortunate side effect of needing a global variable */
/* to store a result. 'otg_temp' is defined and declared in decl.{ch}. */
#define random_obj_to_glyph() \
((otg_temp = random_object()) == CORPSE \
((g.otg_temp = random_object()) == CORPSE \
? random_monster() + GLYPH_BODY_OFF \
: otg_temp + GLYPH_OBJ_OFF)
: g.otg_temp + GLYPH_OBJ_OFF)
#define obj_to_glyph(obj) \
(((obj)->otyp == STATUE) \

View File

@@ -106,7 +106,7 @@ enum roomtype_types {
#define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS * 2))
#define ROOM_INDEX(x) ((x) -rooms)
#define SUBROOM_INDEX(x) ((x) -subrooms)
#define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == nroom)
#define IS_LAST_SUBROOM_PTR(x) (!nsubroom || SUBROOM_INDEX(x) == nsubroom)
#define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == g.nroom)
#define IS_LAST_SUBROOM_PTR(x) (!g.nsubroom || SUBROOM_INDEX(x) == g.nsubroom)
#endif /* MKROOM_H */

View File

@@ -370,7 +370,7 @@
/* unconscious() includes u.usleep but not is_fainted(); the multi test is
redundant but allows the function calls to be skipped most of the time */
#define Unaware (multi < 0 && (unconscious() || is_fainted()))
#define Unaware (g.multi < 0 && (unconscious() || is_fainted()))
#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(youmonst.data))