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:
@@ -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) \
|
||||
|
||||
Reference in New Issue
Block a user