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

@@ -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 */