header file changes hack.h, decl.h/.c, system.h, wintty.h
- Move secondary preprocessor defines down further in config.h
so that they can be overridden via [platform]conf.h which is
included from global.h, specifically:
LIVELOGFILE when LIVELOG is defined
DUMPLOG_FILE when DUMPLOG is defined
- Minimize platform-specific, or compiler-specific code in hack.h and decl.h.
- reorganize src/decl.c to align with include/decl.h.
- a new header file cstd.h added, containing calls to C99
standard header files.
- hack.h, decl.h, and decl.c have been cleaned up and had code
moved so that things line up as follows:
hack.h defines values that are available to all
NetHack source files, contains enums for use in all
NetHack source files, and contains a number of
struct definitions for use in all NetHack source files.
It does not contain variable declarations or variable
definitions.
decl.h contains the extern declarations for variables that
are defined in decl.c. These variables are global and
available to all NetHack source files. The location of
the variables within decl.h was random, so give it some
order for now.
decl.c contains the definition of the variables declared in
decl.h, and initializes them where appropriate. The
variable definitions are laid out in much the
same order as their declarations in decl.h.
- wintty.h: There were some varying terminal-related prototypes in
system.h, and that was the only thing left that demanded that
system.h be included. Those have been replaced by an #include
<term.h> in include/wintty.h to get the more current (and hopefully
more correct) prototypes, rather than hardcoding them in NetHack
sources.
For edge-case platform compatiblity, there is no #include <term.h>
if the build defines NO_TERMCAP_HEADERS. In that case one set of
hardcoded prototypes is still used in include/wintty.h.
The added #include "term.h" is also bypassed for NO_TERMS builds (builds
that don't link to terminfo/termcap at all, but still present a tty
interface using platform or window-port specific functions to fulfill
the same role as that of terminfo/termcap).
- some scattered, unnecessary #include "integer.h" were removed from
various files, since that's always included in current NetHack-3.7
sources, either directly from config.h or indirectly from #include
"hack.h".
- system.h references removed.
- new cstd.h added; the #include "system.h" references in Makefiles
and project files (Xcode, visual studio), were replaced
with #include "cstd.h" references. A "make depends" is probably
warranted.
Also:
- Use of <term.h>, which defines clear_screen() as a macro, conflicts
with an actual function with that name in win/tty/termcap.c. The most
straight-forward course of action was to rename the NetHack function,
and change the references to it, from clear_screen() to
term_clear_screen(), so that was done.
This commit is contained in:
151
src/decl.c
151
src/decl.c
@@ -5,46 +5,6 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
const char quitchars[] = " \r\n\033";
|
||||
const char vowels[] = "aeiouAEIOU";
|
||||
const char ynchars[] = "yn";
|
||||
const char ynqchars[] = "ynq";
|
||||
const char ynaqchars[] = "ynaq";
|
||||
const char ynNaqchars[] = "yn#aq";
|
||||
NEARDATA long yn_number = 0L;
|
||||
|
||||
const char disclosure_options[] = "iavgco";
|
||||
|
||||
/* x/y/z deltas for the 10 movement directions (8 compass pts, 2 down/up) */
|
||||
const schar xdir[N_DIRS_Z] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 };
|
||||
const schar ydir[N_DIRS_Z] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 };
|
||||
const schar zdir[N_DIRS_Z] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 };
|
||||
/* redordered directions, cardinals first */
|
||||
const schar dirs_ord[N_DIRS] =
|
||||
{ DIR_W, DIR_N, DIR_E, DIR_S, DIR_NW, DIR_NE, DIR_SE, DIR_SW };
|
||||
|
||||
NEARDATA struct flag flags;
|
||||
NEARDATA boolean has_strong_rngseed = FALSE;
|
||||
NEARDATA struct instance_flags iflags;
|
||||
NEARDATA struct you u;
|
||||
NEARDATA time_t ubirthday;
|
||||
NEARDATA struct u_realtime urealtime;
|
||||
|
||||
NEARDATA struct obj *uwep, *uarm, *uswapwep,
|
||||
*uquiver, /* quiver */
|
||||
*uarmu, /* under-wear, so to speak */
|
||||
*uskin, /* dragon armor, if a dragon */
|
||||
*uarmc, *uarmh, *uarms, *uarmg,*uarmf, *uamul,
|
||||
*uright, *uleft, *ublindf, *uchain, *uball;
|
||||
|
||||
struct engr *head_engr;
|
||||
|
||||
const int shield_static[SHIELD_COUNT] = {
|
||||
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, /* 7 per row */
|
||||
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
|
||||
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
|
||||
};
|
||||
|
||||
const char * const nhcb_name[NUM_NHCB] = {
|
||||
"cmd_before",
|
||||
"level_enter",
|
||||
@@ -53,12 +13,10 @@ const char * const nhcb_name[NUM_NHCB] = {
|
||||
};
|
||||
|
||||
int nhcb_counts[NUM_NHCB] = DUMMY;
|
||||
|
||||
NEARDATA const struct c_color_names c_color_names = {
|
||||
"black", "amber", "golden", "light blue", "red", "green",
|
||||
"silver", "blue", "purple", "white", "orange"
|
||||
};
|
||||
|
||||
const char *c_obj_colors[] = {
|
||||
"black", /* CLR_BLACK */
|
||||
"red", /* CLR_RED */
|
||||
@@ -78,44 +36,19 @@ const char *c_obj_colors[] = {
|
||||
"white", /* CLR_WHITE */
|
||||
};
|
||||
|
||||
const struct c_common_strings c_common_strings = { "Nothing happens.",
|
||||
"That's enough tries!",
|
||||
"That is a silly thing to %s.",
|
||||
"shudder for a moment.",
|
||||
"something",
|
||||
"Something",
|
||||
"You can move again.",
|
||||
"Never mind.",
|
||||
"vision quickly clears.",
|
||||
{ "the", "your" },
|
||||
{ "mon", "you" } };
|
||||
|
||||
/* NOTE: the order of these words exactly corresponds to the
|
||||
order of oc_material values #define'd in objclass.h. */
|
||||
const char *materialnm[] = { "mysterious", "liquid", "wax", "organic",
|
||||
"flesh", "paper", "cloth", "leather",
|
||||
"wooden", "bone", "dragonhide", "iron",
|
||||
"metal", "copper", "silver", "gold",
|
||||
"platinum", "mithril", "plastic", "glass",
|
||||
"gemstone", "stone" };
|
||||
|
||||
char emptystr[] = {0}; /* non-const */
|
||||
|
||||
/* Global windowing data, defined here for multi-window-system support */
|
||||
NEARDATA winid WIN_MESSAGE, WIN_STATUS, WIN_MAP, WIN_INVEN;
|
||||
#ifdef WIN32
|
||||
boolean fqn_prefix_locked[PREFIX_COUNT] = { FALSE, FALSE, FALSE,
|
||||
FALSE, FALSE, FALSE,
|
||||
FALSE, FALSE, FALSE,
|
||||
FALSE };
|
||||
#endif
|
||||
|
||||
#ifdef PREFIXES_IN_USE
|
||||
const char *fqn_prefix_names[PREFIX_COUNT] = {
|
||||
"hackdir", "leveldir", "savedir", "bonesdir", "datadir",
|
||||
"scoredir", "lockdir", "sysconfdir", "configdir", "troubledir"
|
||||
const struct c_common_strings c_common_strings =
|
||||
{ "Nothing happens.",
|
||||
"That's enough tries!",
|
||||
"That is a silly thing to %s.",
|
||||
"shudder for a moment.",
|
||||
"something",
|
||||
"Something",
|
||||
"You can move again.",
|
||||
"Never mind.",
|
||||
"vision quickly clears.",
|
||||
{ "the", "your" },
|
||||
{ "mon", "you" }
|
||||
};
|
||||
#endif
|
||||
|
||||
const struct savefile_info default_sfinfo = {
|
||||
#ifdef NHSTDC
|
||||
@@ -140,7 +73,67 @@ const struct savefile_info default_sfinfo = {
|
||||
#endif
|
||||
};
|
||||
|
||||
const char disclosure_options[] = "iavgco";
|
||||
char emptystr[] = {0}; /* non-const */
|
||||
|
||||
NEARDATA struct flag flags; /* extern declaration is in flag.h, not decl.h */
|
||||
|
||||
/* Global windowing data, defined here for multi-window-system support */
|
||||
#ifdef WIN32
|
||||
boolean fqn_prefix_locked[PREFIX_COUNT] = { FALSE, FALSE, FALSE,
|
||||
FALSE, FALSE, FALSE,
|
||||
FALSE, FALSE, FALSE,
|
||||
FALSE };
|
||||
#endif
|
||||
#ifdef PREFIXES_IN_USE
|
||||
const char *fqn_prefix_names[PREFIX_COUNT] = {
|
||||
"hackdir", "leveldir", "savedir", "bonesdir", "datadir",
|
||||
"scoredir", "lockdir", "sysconfdir", "configdir", "troubledir"
|
||||
};
|
||||
#endif
|
||||
|
||||
/* x/y/z deltas for the 10 movement directions (8 compass pts, 2 down/up) */
|
||||
const schar xdir[N_DIRS_Z] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 };
|
||||
const schar ydir[N_DIRS_Z] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 };
|
||||
const schar zdir[N_DIRS_Z] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 };
|
||||
/* redordered directions, cardinals first */
|
||||
const schar dirs_ord[N_DIRS] =
|
||||
{ DIR_W, DIR_N, DIR_E, DIR_S, DIR_NW, DIR_NE, DIR_SE, DIR_SW };
|
||||
|
||||
NEARDATA boolean has_strong_rngseed = FALSE;
|
||||
struct engr *head_engr;
|
||||
NEARDATA struct instance_flags iflags;
|
||||
/* NOTE: the order of these words exactly corresponds to the
|
||||
order of oc_material values #define'd in objclass.h. */
|
||||
const char *materialnm[] = { "mysterious", "liquid", "wax", "organic",
|
||||
"flesh", "paper", "cloth", "leather",
|
||||
"wooden", "bone", "dragonhide", "iron",
|
||||
"metal", "copper", "silver", "gold",
|
||||
"platinum", "mithril", "plastic", "glass",
|
||||
"gemstone", "stone" };
|
||||
const char quitchars[] = " \r\n\033";
|
||||
NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo;
|
||||
const int shield_static[SHIELD_COUNT] = {
|
||||
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, /* 7 per row */
|
||||
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
|
||||
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
|
||||
};
|
||||
NEARDATA struct you u;
|
||||
NEARDATA time_t ubirthday;
|
||||
NEARDATA struct u_realtime urealtime;
|
||||
NEARDATA struct obj *uwep, *uarm, *uswapwep,
|
||||
*uquiver, /* quiver */
|
||||
*uarmu, /* under-wear, so to speak */
|
||||
*uskin, /* dragon armor, if a dragon */
|
||||
*uarmc, *uarmh, *uarms, *uarmg,*uarmf, *uamul,
|
||||
*uright, *uleft, *ublindf, *uchain, *uball;
|
||||
const char vowels[] = "aeiouAEIOU";
|
||||
NEARDATA winid WIN_MESSAGE, WIN_STATUS, WIN_MAP, WIN_INVEN;
|
||||
const char ynchars[] = "yn";
|
||||
const char ynqchars[] = "ynq";
|
||||
const char ynaqchars[] = "ynaq";
|
||||
const char ynNaqchars[] = "yn#aq";
|
||||
NEARDATA long yn_number = 0L;
|
||||
|
||||
#ifdef PANICTRACE
|
||||
const char *ARGV0;
|
||||
|
||||
Reference in New Issue
Block a user