shk followmsg moved to instance globals. early_init introduced.

This commit is contained in:
Bart House
2018-12-25 17:46:52 -08:00
parent cfb0e3ef78
commit ed096f74c3
14 changed files with 23 additions and 15 deletions
+2
View File
@@ -1090,6 +1090,8 @@ struct instance_globals {
shouldn't carry over from ordinary selling to credit selling */ shouldn't carry over from ordinary selling to credit selling */
boolean auto_credit; boolean auto_credit;
struct repo repo; struct repo repo;
long int followmsg; /* last time of follow message */
/* sp_lev.c */ /* sp_lev.c */
char *lev_message; char *lev_message;
+1
View File
@@ -27,6 +27,7 @@ E void NDECL(newgame);
E void FDECL(welcome, (BOOLEAN_P)); E void FDECL(welcome, (BOOLEAN_P));
E time_t NDECL(get_realtime); E time_t NDECL(get_realtime);
E int FDECL(argcheck, (int, char **, enum earlyarg)); E int FDECL(argcheck, (int, char **, enum earlyarg));
E void NDECL(early_init);
/* ### apply.c ### */ /* ### apply.c ### */
+9
View File
@@ -19,6 +19,15 @@ STATIC_DCL void FDECL(regen_hp, (int));
STATIC_DCL void FDECL(interrupt_multi, (const char *)); STATIC_DCL void FDECL(interrupt_multi, (const char *));
STATIC_DCL void FDECL(debug_fields, (const char *)); STATIC_DCL void FDECL(debug_fields, (const char *));
void
early_init()
{
decl_globals_init();
objects_globals_init();
monst_globals_init();
sys_early_init();
}
void void
moveloop(resuming) moveloop(resuming)
boolean resuming; boolean resuming;
+1
View File
@@ -611,6 +611,7 @@ const struct instance_globals g_init = {
SELL_NORMAL, /* sell_how */ SELL_NORMAL, /* sell_how */
FALSE, /* auto_credit */ FALSE, /* auto_credit */
UNDEFINED_VALUES, /* repo */ UNDEFINED_VALUES, /* repo */
UNDEFINED_VALUES, /* followmsg */
/* sp_lev.c */ /* sp_lev.c */
NULL, /* lev_message */ NULL, /* lev_message */
+2 -3
View File
@@ -25,7 +25,6 @@ STATIC_DCL void FDECL(kops_gone, (BOOLEAN_P));
extern const struct shclass shtypes[]; /* defined in shknam.c */ extern const struct shclass shtypes[]; /* defined in shknam.c */
STATIC_VAR NEARDATA long int followmsg; /* last time of follow message */
STATIC_VAR const char and_its_contents[] = " and its contents"; STATIC_VAR const char and_its_contents[] = " and its contents";
STATIC_VAR const char the_contents_of[] = "the contents of "; STATIC_VAR const char the_contents_of[] = "the contents of ";
@@ -3692,7 +3691,7 @@ struct monst *shkp;
eshkp->following = 0; eshkp->following = 0;
return 0; return 0;
} }
if (g.moves > followmsg + 4) { if (g.moves > g.followmsg + 4) {
if (!Deaf && !muteshk(shkp)) if (!Deaf && !muteshk(shkp))
verbalize("%s, %s! Didn't you forget to pay?", verbalize("%s, %s! Didn't you forget to pay?",
Hello(shkp), g.plname); Hello(shkp), g.plname);
@@ -3700,7 +3699,7 @@ struct monst *shkp;
pline("%s holds out %s upturned %s.", pline("%s holds out %s upturned %s.",
Shknam(shkp), noit_mhis(shkp), Shknam(shkp), noit_mhis(shkp),
mbodypart(shkp, HAND)); mbodypart(shkp, HAND));
followmsg = g.moves; g.followmsg = g.moves;
if (!rn2(9)) { if (!rn2(9)) {
pline("%s doesn't like customers who don't pay.", pline("%s doesn't like customers who don't pay.",
Shknam(shkp)); Shknam(shkp));
-4
View File
@@ -20,10 +20,6 @@ struct sysopt sysopt;
void void
sys_early_init() sys_early_init()
{ {
decl_globals_init();
objects_globals_init();
monst_globals_init();
sysopt.support = (char *) 0; sysopt.support = (char *) 0;
sysopt.recover = (char *) 0; sysopt.recover = (char *) 0;
#ifdef SYSCF #ifdef SYSCF
+1 -1
View File
@@ -25,7 +25,7 @@ MAIN(int argc, char **argv)
char *dir; char *dir;
boolean resuming = FALSE; /* assume new game */ boolean resuming = FALSE; /* assume new game */
sys_early_init(); early_init();
dir = nh_getenv("NETHACKDIR"); dir = nh_getenv("NETHACKDIR");
if (!dir) if (!dir)
+1 -1
View File
@@ -39,7 +39,7 @@ main(void)
int argc = 1; int argc = 1;
boolean resuming = FALSE; /* assume new game */ boolean resuming = FALSE; /* assume new game */
sys_early_init(); early_init();
windowprocs = mac_procs; windowprocs = mac_procs;
InitMac(); InitMac();
+1 -1
View File
@@ -77,7 +77,7 @@ char *argv[];
{ {
boolean resuming; boolean resuming;
sys_early_init(); early_init();
resuming = pcmain(argc, argv); resuming = pcmain(argc, argv);
moveloop(resuming); moveloop(resuming);
nethack_exit(EXIT_SUCCESS); nethack_exit(EXIT_SUCCESS);
+1 -1
View File
@@ -58,7 +58,7 @@ char *argv[];
boolean resuming = FALSE; /* assume new game */ boolean resuming = FALSE; /* assume new game */
boolean plsel_once = FALSE; boolean plsel_once = FALSE;
sys_early_init(); early_init();
#if defined(__APPLE__) #if defined(__APPLE__)
{ {
+1 -1
View File
@@ -44,7 +44,7 @@ char *argv[];
privon(); privon();
#endif #endif
sys_early_init(); early_init();
atexit(byebye); atexit(byebye);
g.hname = argv[0]; g.hname = argv[0];
+1 -1
View File
@@ -42,7 +42,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine,
char buf[NHSTR_BUFSIZE]; char buf[NHSTR_BUFSIZE];
boolean resuming; boolean resuming;
sys_early_init(); early_init();
/* ensure that we don't access violate on a panic() */ /* ensure that we don't access violate on a panic() */
windowprocs.win_raw_print = mswin_raw_print; windowprocs.win_raw_print = mswin_raw_print;
+1 -1
View File
@@ -97,7 +97,7 @@ char *argv[];
if (!GUILaunched) if (!GUILaunched)
windowprocs.win_nhgetch = windows_console_custom_nhgetch; windowprocs.win_nhgetch = windows_console_custom_nhgetch;
sys_early_init(); early_init();
#ifdef _MSC_VER #ifdef _MSC_VER
# ifdef DEBUG # ifdef DEBUG
/* set these appropriately for VS debugging */ /* set these appropriately for VS debugging */
+1 -1
View File
@@ -123,7 +123,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
windowprocs.win_wait_synch = mswin_wait_synch; windowprocs.win_wait_synch = mswin_wait_synch;
win10_init(); win10_init();
sys_early_init(); early_init();
/* init application structure */ /* init application structure */
_nethack_app.hApp = hInstance; _nethack_app.hApp = hInstance;