split g into multiple structures

The consolidation of global variables from scattered source
files into decl.c and declared in decl.h was begun in 3.7.0.
Their placement in common files was done for centralized
initialization and potential re-initialization during a
"play again" scenario.

It wasn't really necessary for all of them to be housed in a
single huge structure to meet the "play again" requirement,
and the single huge structure has been a little unwieldy when
it comes to maintenance.

Following this commit, instead of one single extremely large structure
named 'g' to house all of the relocated global variables, they
are distributed into several ga through gz.

To make things easy for the developer, each variable is placed
into the struct corresponding to the starting letter of the variable.
That way, no lookup is required in order to know which struct houses
a particular variable, it is a simple match to the starting letter
for all the centralized global variables.

A global variable named 'amulets', would be found in ga.
    ga.amulets
     ^ ^
A global varable named 'move', would be found in gm.
    gm.moves
     ^ ^
A global variable named 'val_for_n_or_more' would be found in gv.
    gv.val_for_n_or_more
     ^ ^
A global variable named 'youmonst' would be found in gy.
    gy.youmonst
     ^ ^
This commit is contained in:
nhmall
2022-11-29 21:53:21 -05:00
parent e64ed2859d
commit 02a48aa8cf
193 changed files with 10764 additions and 10148 deletions

View File

@@ -13,7 +13,7 @@ typedef struct align { /* alignment & record */
} align;
/* bounds for "record" -- respect initial alignments of 10 */
#define ALIGNLIM (10L + (g.moves / 200L))
#define ALIGNLIM (10L + (gm.moves / 200L))
#define A_NONE (-128) /* the value range of type */

View File

@@ -41,7 +41,7 @@ struct attribs {
};
#define ATTRMAX(x) \
((x == A_STR && Upolyd) ? uasmon_maxStr() : g.urace.attrmax[x])
#define ATTRMIN(x) (g.urace.attrmin[x])
((x == A_STR && Upolyd) ? uasmon_maxStr() : gu.urace.attrmax[x])
#define ATTRMIN(x) (gu.urace.attrmin[x])
#endif /* ATTRIB_H */

View File

@@ -133,7 +133,7 @@ struct context_info {
/* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */
/* 8: travel */
unsigned startingpet_mid; /* monster id number for initial pet */
int current_fruit; /* fruit->fid corresponding to g.pl_fruit[] */
int current_fruit; /* fruit->fid corresponding to gp.pl_fruit[] */
int mysteryforce; /* adjusts how often "mysterious force" kicks in */
int rndencode; /* randomized escape sequence introducer */
int warnlevel; /* threshold (digit) to warn about unseen mons */

File diff suppressed because it is too large Load Diff

View File

@@ -19,7 +19,7 @@
* Returns the head of the list of objects that the player can see
* at location (x,y). [Vestige of unimplemented invisible objects.]
*/
#define vobj_at(x, y) (g.level.objects[x][y])
#define vobj_at(x, y) (gl.level.objects[x][y])
/*
* sensemon()
@@ -63,7 +63,7 @@
*/
#define _mon_warning(mon) \
(Warning && !(mon)->mpeaceful && (mdistu(mon) < 100) \
&& (((int) ((mon)->m_lev / 4)) >= g.context.warnlevel))
&& (((int) ((mon)->m_lev / 4)) >= gc.context.warnlevel))
/*
* mon_visible()
@@ -250,11 +250,11 @@
((int) U_AP_TYPE == M_AP_NOTHING) \
? hero_glyph \
: ((int) U_AP_TYPE == M_AP_FURNITURE) \
? cmap_to_glyph((int) g.youmonst.mappearance) \
? cmap_to_glyph((int) gy.youmonst.mappearance) \
: ((int) U_AP_TYPE == M_AP_OBJECT) \
? objnum_to_glyph((int) g.youmonst.mappearance) \
? objnum_to_glyph((int) gy.youmonst.mappearance) \
/* else U_AP_TYPE == M_AP_MONSTER */ \
: monnum_to_glyph((int) g.youmonst.mappearance, Ugender)))
: monnum_to_glyph((int) gy.youmonst.mappearance, Ugender)))
/*
* NetHack glyphs
@@ -637,7 +637,7 @@ enum glyph_offsets {
/* The hero's glyph when seen as a monster.
*/
#define hero_glyph \
monnum_to_glyph((Upolyd || !flags.showrace) ? u.umonnum : g.urace.mnum, \
monnum_to_glyph((Upolyd || !flags.showrace) ? u.umonnum : gu.urace.mnum, \
(Ugender))
/*
@@ -801,8 +801,8 @@ enum glyph_offsets {
#define obj_is_piletop(obj) \
((obj)->where == OBJ_FLOOR \
/*&& g.level.objects[(obj)->ox][(obj)->oy]*/ \
&& g.level.objects[(obj)->ox][(obj)->oy]->nexthere)
/*&& gl.level.objects[(obj)->ox][(obj)->oy]*/ \
&& gl.level.objects[(obj)->ox][(obj)->oy]->nexthere)
#define glyph_is_body_piletop(glyph) \
(((glyph) >= GLYPH_BODY_PILETOP_OFF) \
@@ -906,9 +906,9 @@ enum glyph_offsets {
/* These have 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(rng) \
((g.otg_temp = random_object(rng)) == CORPSE \
((go.otg_temp = random_object(rng)) == CORPSE \
? (random_monster(rng) + GLYPH_BODY_OFF) \
: (g.otg_temp + GLYPH_OBJ_OFF))
: (go.otg_temp + GLYPH_OBJ_OFF))
#define corpse_to_glyph(obj) \
((int) ((obj)->corpsenm + (obj_is_piletop(obj) \
? GLYPH_BODY_PILETOP_OFF \

View File

@@ -246,7 +246,7 @@ typedef struct mapseen {
struct mapseen_rooms {
Bitfield(seen, 1);
Bitfield(untended, 1); /* flag for shop without shk */
} msrooms[(MAXNROFROOMS + 1) * 2]; /* same size as g.rooms[] */
} msrooms[(MAXNROFROOMS + 1) * 2]; /* same size as gr.rooms[] */
/* dead heroes; might not have graves or ghosts */
struct cemetery *final_resting_place; /* same as level.bonesinfo */
} mapseen;

View File

@@ -189,7 +189,7 @@ struct debug_flags {
*/
struct instance_flags {
boolean debug_fuzzer; /* fuzz testing */
boolean defer_plname; /* X11 hack: askname() might not set g.plname */
boolean defer_plname; /* X11 hack: askname() might not set gp.plname */
boolean herecmd_menu; /* use menu when mouseclick on yourself */
boolean invis_goldsym; /* gold symbol is ' '? */
boolean in_lua; /* executing a lua script */

View File

@@ -405,7 +405,7 @@ extern struct nomakedefs_s nomakedefs;
#define BUFSZ 256 /* for getlin buffers */
#define QBUFSZ 128 /* for building question text */
#define TBUFSZ 300 /* g.toplines[] buffer max msg: 3 81char names */
#define TBUFSZ 300 /* gt.toplines[] buffer max msg: 3 81char names */
/* plus longest prefix plus a few extra words */
/* COLBUFSZ is the larger of BUFSZ and COLNO */

View File

@@ -275,10 +275,10 @@ typedef struct sortloot_item Loot;
#define MATCH_WARN_OF_MON(mon) \
(Warn_of_mon \
&& ((g.context.warntype.obj & (mon)->data->mflags2) != 0 \
|| (g.context.warntype.polyd & (mon)->data->mflags2) != 0 \
|| (g.context.warntype.species \
&& (g.context.warntype.species == (mon)->data))))
&& ((gc.context.warntype.obj & (mon)->data->mflags2) != 0 \
|| (gc.context.warntype.polyd & (mon)->data->mflags2) != 0 \
|| (gc.context.warntype.species \
&& (gc.context.warntype.species == (mon)->data))))
typedef uint32_t mmflags_nht; /* makemon MM_ flags */
@@ -415,7 +415,7 @@ typedef uint32_t mmflags_nht; /* makemon MM_ flags */
/* Flags to control find_mid() */
#define FM_FMON 0x01 /* search the fmon chain */
#define FM_MIGRATE 0x02 /* search the migrating monster chain */
#define FM_MYDOGS 0x04 /* search g.mydogs */
#define FM_MYDOGS 0x04 /* search gm.mydogs */
#define FM_EVERYWHERE (FM_FMON | FM_MIGRATE | FM_MYDOGS)
/* Flags to control pick_[race,role,gend,align] routines in role.c */

View File

@@ -122,8 +122,8 @@ struct eshk {
long credit; /* amount credited to customer */
long debit; /* amount of debt for using unpaid items */
long loan; /* shop-gold picked (part of debit) */
int shoptype; /* the value of g.rooms[shoproom].rtype */
schar shoproom; /* index in g.rooms; set by inshop() */
int shoptype; /* the value of gr.rooms[shoproom].rtype */
schar shoproom; /* index in gr.rooms; set by inshop() */
schar unused; /* to force alignment for stupid compilers */
boolean following; /* following customer since he owes us sth */
boolean surcharge; /* angry shk inflates prices */

View File

@@ -39,10 +39,10 @@ struct shclass {
const char *const *shknms; /* list of shopkeeper names for this type */
};
/* the normal rooms on the current level are described in g.rooms[0..n] for
/* the normal rooms on the current level are described in gr.rooms[0..n] for
* some n<MAXNROFROOMS
* the vault, if any, is described by g.rooms[n+1]
* the next g.rooms entry has hx -1 as a flag
* the vault, if any, is described by gr.rooms[n+1]
* the next gr.rooms entry has hx -1 as a flag
* there is at most one non-vault special room on a level
*/
@@ -87,7 +87,7 @@ enum roomtype_types {
#define SHARED 1 /* indicates normal shared boundary */
#define SHARED_PLUS 2 /* indicates shared boundary - extra adjacent-square
* searching required */
#define ROOMOFFSET 3 /* (levl[x][y].roomno - ROOMOFFSET) gives g.rooms[] index,
#define ROOMOFFSET 3 /* (levl[x][y].roomno - ROOMOFFSET) gives gr.rooms[] index,
* for inside-squares and non-shared boundaries */
/* Values for needfill */
@@ -98,14 +98,14 @@ enum roomtype_types {
#define FILL_LVFLAGS 2 /* special rooms only; set the room's rtype and level
flags as appropriate, but do not put anything in it */
#define IS_ROOM_PTR(x) ((x) >= g.rooms && (x) < g.rooms + MAXNROFROOMS)
#define IS_ROOM_PTR(x) ((x) >= gr.rooms && (x) < gr.rooms + MAXNROFROOMS)
#define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS)
#define IS_SUBROOM_PTR(x) \
((x) >= g.subrooms && (x) < g.subrooms + MAXNROFROOMS)
((x) >= gs.subrooms && (x) < gs.subrooms + MAXNROFROOMS)
#define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) <= (MAXNROFROOMS * 2))
#define ROOM_INDEX(x) ((x) - g.rooms)
#define SUBROOM_INDEX(x) ((x) - g.subrooms)
#define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == g.nroom)
#define IS_LAST_SUBROOM_PTR(x) (!g.nsubroom || SUBROOM_INDEX(x) == g.nsubroom)
#define ROOM_INDEX(x) ((x) - gr.rooms)
#define SUBROOM_INDEX(x) ((x) - gs.subrooms)
#define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == gn.nroom)
#define IS_LAST_SUBROOM_PTR(x) (!gn.nsubroom || SUBROOM_INDEX(x) == gn.nsubroom)
#endif /* MKROOM_H */

View File

@@ -117,7 +117,7 @@
#define is_gnome(ptr) (((ptr)->mflags2 & M2_GNOME) != 0L)
#define is_orc(ptr) (((ptr)->mflags2 & M2_ORC) != 0L)
#define is_human(ptr) (((ptr)->mflags2 & M2_HUMAN) != 0L)
#define your_race(ptr) (((ptr)->mflags2 & g.urace.selfmask) != 0L)
#define your_race(ptr) (((ptr)->mflags2 & gu.urace.selfmask) != 0L)
#define is_bat(ptr) \
((ptr) == &mons[PM_BAT] || (ptr) == &mons[PM_GIANT_BAT] \
|| (ptr) == &mons[PM_VAMPIRE_BAT])
@@ -133,8 +133,8 @@
#define is_wanderer(ptr) (((ptr)->mflags2 & M2_WANDER) != 0L)
#define always_hostile(ptr) (((ptr)->mflags2 & M2_HOSTILE) != 0L)
#define always_peaceful(ptr) (((ptr)->mflags2 & M2_PEACEFUL) != 0L)
#define race_hostile(ptr) (((ptr)->mflags2 & g.urace.hatemask) != 0L)
#define race_peaceful(ptr) (((ptr)->mflags2 & g.urace.lovemask) != 0L)
#define race_hostile(ptr) (((ptr)->mflags2 & gu.urace.hatemask) != 0L)
#define race_peaceful(ptr) (((ptr)->mflags2 & gu.urace.lovemask) != 0L)
#define extra_nasty(ptr) (((ptr)->mflags2 & M2_NASTY) != 0L)
#define strongmonst(ptr) (((ptr)->mflags2 & M2_STRONG) != 0L)
#define can_breathe(ptr) attacktype(ptr, AT_BREA)

View File

@@ -199,7 +199,7 @@ enum ms_sounds {
passed to mkclass() as if it dealt with mons[].geno bits */
#define G_IGNORE 0x8000 /* for mkclass(), ignore G_GENOD|G_EXTINCT */
/* for g.mvitals[].mvflags (variant during game), along with G_NOCORPSE */
/* for gm.mvitals[].mvflags (variant during game), along with G_NOCORPSE */
#define G_KNOWN 0x04 /* have been encountered */
#define G_GENOD 0x02 /* have been genocided */
#define G_EXTINCT 0x01 /* population control; create no more */

View File

@@ -68,8 +68,8 @@ enum m_ap_types {
#define M_AP_TYPMASK 0x7
#define M_AP_F_DKNOWN 0x8
#define U_AP_TYPE (g.youmonst.m_ap_type & M_AP_TYPMASK)
#define U_AP_FLAG (g.youmonst.m_ap_type & ~M_AP_TYPMASK)
#define U_AP_TYPE (gy.youmonst.m_ap_type & M_AP_TYPMASK)
#define U_AP_FLAG (gy.youmonst.m_ap_type & ~M_AP_TYPMASK)
#define M_AP_TYPE(m) ((m)->m_ap_type & M_AP_TYPMASK)
#define M_AP_FLAG(m) ((m)->m_ap_type & ~M_AP_TYPMASK)
@@ -206,7 +206,7 @@ struct monst {
#define MON_NOWEP(mon) ((mon)->mw = (struct obj *) 0)
#define DEADMONSTER(mon) ((mon)->mhp < 1)
#define is_starting_pet(mon) ((mon)->m_id == g.context.startingpet_mid)
#define is_starting_pet(mon) ((mon)->m_id == gc.context.startingpet_mid)
#define is_vampshifter(mon) \
((mon)->cham == PM_VAMPIRE || (mon)->cham == PM_VAMPIRE_LEADER \
|| (mon)->cham == PM_VLAD_THE_IMPALER)
@@ -218,7 +218,7 @@ struct monst {
|| (mon)->isshk \
|| (mon)->isgd \
|| (mon)->data == &mons[PM_ORACLE] \
|| (mon)->m_id == g.quest_status.leader_m_id)
|| (mon)->m_id == gq.quest_status.leader_m_id)
/* mimic appearances that block vision/light */
#define is_lightblocker_mappear(mon) \

View File

@@ -298,7 +298,7 @@ struct obj {
/* Eggs and other food */
#define MAX_EGG_HATCH_TIME 200 /* longest an egg can remain unhatched */
#define stale_egg(egg) \
((g.moves - (egg)->age) > (2 * MAX_EGG_HATCH_TIME))
((gm.moves - (egg)->age) > (2 * MAX_EGG_HATCH_TIME))
#define ofood(o) ((o)->otyp == CORPSE || (o)->otyp == EGG || (o)->otyp == TIN)
/* note: sometimes eggs and tins have special corpsenm values that
shouldn't be used as an index into mons[] */
@@ -415,8 +415,8 @@ struct obj {
|| (o)->otyp == POT_POLYMORPH)
/* achievement tracking; 3.6.x did this differently */
#define is_mines_prize(o) ((o)->o_id == g.context.achieveo.mines_prize_oid)
#define is_soko_prize(o) ((o)->o_id == g.context.achieveo.soko_prize_oid)
#define is_mines_prize(o) ((o)->o_id == gc.context.achieveo.mines_prize_oid)
#define is_soko_prize(o) ((o)->o_id == gc.context.achieveo.soko_prize_oid)
#define is_art(o,art) ((o) && (o)->oartifact == (art))
#define u_wield_art(art) is_art(uwep, art)

View File

@@ -89,7 +89,7 @@ enum levl_typ_types {
#define IS_DOOR(typ) ((typ) == DOOR)
#define IS_DOORJOIN(typ) (IS_ROCK(typ) || (typ) == IRONBARS)
#define IS_TREE(typ) \
((typ) == TREE || (g.level.flags.arboreal && (typ) == STONE))
((typ) == TREE || (gl.level.flags.arboreal && (typ) == STONE))
#define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */
#define IS_ROOM(typ) ((typ) >= ROOM) /* ROOM, STAIRS, furniture.. */
#define ZAP_POS(typ) ((typ) >= POOL)
@@ -345,7 +345,7 @@ struct damage {
an existing bones level; if so, most recent victim will be first in list */
struct cemetery {
struct cemetery *next; /* next struct is previous dead character... */
/* "g.plname" + "-ROLe" + "-RACe" + "-GENder" + "-ALIgnment" + \0 */
/* "gp.plname" + "-ROLe" + "-RACe" + "-GENder" + "-ALIgnment" + \0 */
char who[PL_NSIZ + 4 * (1 + 3) + 1];
/* death reason, same as in score/log file */
char how[100 + 1]; /* [DTHSZ+1] */
@@ -403,9 +403,9 @@ typedef struct {
/*
* Macros for compatibility with old code. Someday these will go away.
*/
#define levl g.level.locations
#define fobj g.level.objlist
#define fmon g.level.monlist
#define levl gl.level.locations
#define fobj gl.level.objlist
#define fmon gl.level.monlist
/*
* Covert a trap number into the defsym graphics array.
@@ -415,43 +415,43 @@ typedef struct {
#define trap_to_defsym(t) (S_arrow_trap + (t) - 1)
#define defsym_to_trap(d) ((d) - S_arrow_trap + 1)
#define OBJ_AT(x, y) (g.level.objects[x][y] != (struct obj *) 0)
#define OBJ_AT(x, y) (gl.level.objects[x][y] != (struct obj *) 0)
/*
* Macros for encapsulation of level.monsters references.
*/
#if 0
#define MON_AT(x, y) \
(g.level.monsters[x][y] != (struct monst *) 0 \
&& !(g.level.monsters[x][y])->mburied)
(gl.level.monsters[x][y] != (struct monst *) 0 \
&& !(gl.level.monsters[x][y])->mburied)
#define MON_BURIED_AT(x, y) \
(g.level.monsters[x][y] != (struct monst *) 0 \
&& (g.level.monsters[x][y])->mburied)
(gl.level.monsters[x][y] != (struct monst *) 0 \
&& (gl.level.monsters[x][y])->mburied)
#else /* without 'mburied' */
#define MON_AT(x, y) (g.level.monsters[x][y] != (struct monst *) 0)
#define MON_AT(x, y) (gl.level.monsters[x][y] != (struct monst *) 0)
#endif
#ifdef EXTRA_SANITY_CHECKS
#define place_worm_seg(m, x, y) \
do { \
if (g.level.monsters[x][y] && g.level.monsters[x][y] != m) \
if (gl.level.monsters[x][y] && gl.level.monsters[x][y] != m) \
impossible("place_worm_seg over mon"); \
g.level.monsters[x][y] = m; \
gl.level.monsters[x][y] = m; \
} while(0)
#define remove_monster(x, y) \
do { \
if (!g.level.monsters[x][y]) \
if (!gl.level.monsters[x][y]) \
impossible("no monster to remove"); \
g.level.monsters[x][y] = (struct monst *) 0; \
gl.level.monsters[x][y] = (struct monst *) 0; \
} while(0)
#else
#define place_worm_seg(m, x, y) g.level.monsters[x][y] = m
#define remove_monster(x, y) g.level.monsters[x][y] = (struct monst *) 0
#define place_worm_seg(m, x, y) gl.level.monsters[x][y] = m
#define remove_monster(x, y) gl.level.monsters[x][y] = (struct monst *) 0
#endif
#define m_at(x, y) (MON_AT(x, y) ? g.level.monsters[x][y] : (struct monst *) 0)
#define m_at(x, y) (MON_AT(x, y) ? gl.level.monsters[x][y] : (struct monst *) 0)
#define m_buried_at(x, y) \
(MON_BURIED_AT(x, y) ? g.level.monsters[x][y] : (struct monst *) 0)
(MON_BURIED_AT(x, y) ? gl.level.monsters[x][y] : (struct monst *) 0)
/* restricted movement, potential luck penalties */
#define Sokoban g.level.flags.sokoban_rules
#define Sokoban gl.level.flags.sokoban_rules
/*
* These prototypes are in extern.h but some of the code which uses them

View File

@@ -28,9 +28,9 @@ enum spellknowledge {
#define ALL_MAP 0x1
#define ALL_SPELLS 0x2
#define decrnknow(spell) g.spl_book[spell].sp_know--
#define spellid(spell) g.spl_book[spell].sp_id
#define spellknow(spell) g.spl_book[spell].sp_know
#define decrnknow(spell) gs.spl_book[spell].sp_know--
#define spellid(spell) gs.spl_book[spell].sp_id
#define spellknow(spell) gs.spl_book[spell].sp_know
/* how much Pw a spell of level lvl costs to cast? */
#define SPELL_LEV_PW(lvl) ((lvl) * 5)

View File

@@ -163,7 +163,7 @@ struct symset_customization {
extern const struct symdef defsyms[MAXPCHARS + 1]; /* defaults */
#define WARNCOUNT 6 /* number of different warning levels */
extern const struct symdef def_warnsyms[WARNCOUNT];
#define SYMHANDLING(ht) (g.symset[g.currentgraphics].handling == (ht))
#define SYMHANDLING(ht) (gs.symset[gc.currentgraphics].handling == (ht))
#endif /* !MAKEDEFS_C */
#endif /* SYM_H */

View File

@@ -21,9 +21,9 @@
* couldsee() - Returns true if the hero has a clear line of sight to
* the location.
*/
#define cansee(x, y) ((g.viz_array[y][x] & IN_SIGHT) != 0)
#define couldsee(x, y) ((g.viz_array[y][x] & COULD_SEE) != 0)
#define templit(x, y) ((g.viz_array[y][x] & TEMP_LIT) != 0)
#define cansee(x, y) ((gv.viz_array[y][x] & IN_SIGHT) != 0)
#define couldsee(x, y) ((gv.viz_array[y][x] & COULD_SEE) != 0)
#define templit(x, y) ((gv.viz_array[y][x] & TEMP_LIT) != 0)
/*
* The following assume the monster is not blind.

View File

@@ -23,8 +23,8 @@ struct RoleName {
struct RoleAdvance {
/* "fix" is the fixed amount, "rnd" is the random amount */
xint16 infix, inrnd; /* at character initialization */
xint16 lofix, lornd; /* gained per level < g.urole.xlev */
xint16 hifix, hirnd; /* gained per level >= g.urole.xlev */
xint16 lofix, lornd; /* gained per level < gu.urole.xlev */
xint16 hifix, hirnd; /* gained per level >= gu.urole.xlev */
};
struct u_have {
@@ -228,8 +228,8 @@ struct Role {
};
extern const struct Role roles[]; /* table of available roles */
#define Role_if(X) (g.urole.mnum == (X))
#define Role_switch (g.urole.mnum)
#define Role_if(X) (gu.urole.mnum == (X))
#define Role_switch (gu.urole.mnum)
/* used during initialization for race, gender, and alignment
as well as for character class */
@@ -278,8 +278,8 @@ struct Race {
};
extern const struct Race races[]; /* Table of available races */
#define Race_if(X) (g.urace.mnum == (X))
#define Race_switch (g.urace.mnum)
#define Race_if(X) (gu.urace.mnum == (X))
#define Race_switch (gu.urace.mnum)
/*** Unified structure specifying gender information ***/
struct Gender {

View File

@@ -67,7 +67,7 @@
#define HSick_resistance u.uprops[SICK_RES].intrinsic
#define ESick_resistance u.uprops[SICK_RES].extrinsic
#define Sick_resistance (HSick_resistance || ESick_resistance \
|| defended(&g.youmonst, AD_DISE))
|| defended(&gy.youmonst, AD_DISE))
/* Intrinsics only */
#define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */
@@ -88,13 +88,13 @@
/* ...means blind because of a cover */
#define Blind \
((u.uroleplay.blind || Blinded || Blindfolded \
|| !haseyes(g.youmonst.data)) \
|| !haseyes(gy.youmonst.data)) \
&& !(ublindf && ublindf->oartifact == ART_EYES_OF_THE_OVERWORLD))
/* ...the Eyes operate even when you really are blind
or don't have any eyes */
#define Blindfolded_only \
(Blindfolded && ublindf->oartifact != ART_EYES_OF_THE_OVERWORLD \
&& !u.uroleplay.blind && !Blinded && haseyes(g.youmonst.data))
&& !u.uroleplay.blind && !Blinded && haseyes(gy.youmonst.data))
/* ...blind because of a blindfold, and *only* that */
#define Sick u.uprops[SICK].intrinsic
@@ -255,11 +255,11 @@
#define HMagical_breathing u.uprops[MAGICAL_BREATHING].intrinsic
#define EMagical_breathing u.uprops[MAGICAL_BREATHING].extrinsic
#define Amphibious \
(HMagical_breathing || EMagical_breathing || amphibious(g.youmonst.data))
(HMagical_breathing || EMagical_breathing || amphibious(gy.youmonst.data))
/* Get wet, may go under surface */
#define Breathless \
(HMagical_breathing || EMagical_breathing || breathless(g.youmonst.data))
(HMagical_breathing || EMagical_breathing || breathless(gy.youmonst.data))
#define Underwater (u.uinwater)
/* Note that Underwater and u.uinwater are both used in code.
@@ -377,9 +377,9 @@
/* 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 (g.multi < 0 && (unconscious() || is_fainted()))
#define Unaware (gm.multi < 0 && (unconscious() || is_fainted()))
#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(g.youmonst.data))
#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(gy.youmonst.data))
/* _Hitchhikers_Guide_to_the_Galaxy_ on uses for 'towel': "wrap it round
your head to ward off noxious fumes" [we require it to be damp or wet] */