diff --git a/include/decl.h b/include/decl.h index 7bb2b1aea..61f00fe40 100644 --- a/include/decl.h +++ b/include/decl.h @@ -1090,6 +1090,8 @@ struct instance_globals { shouldn't carry over from ordinary selling to credit selling */ boolean auto_credit; struct repo repo; + long int followmsg; /* last time of follow message */ + /* sp_lev.c */ char *lev_message; diff --git a/include/extern.h b/include/extern.h index 1bcbcef38..b7b46e81e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -27,6 +27,7 @@ E void NDECL(newgame); E void FDECL(welcome, (BOOLEAN_P)); E time_t NDECL(get_realtime); E int FDECL(argcheck, (int, char **, enum earlyarg)); +E void NDECL(early_init); /* ### apply.c ### */ diff --git a/src/allmain.c b/src/allmain.c index d81ce019d..21242e845 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -19,6 +19,15 @@ STATIC_DCL void FDECL(regen_hp, (int)); STATIC_DCL void FDECL(interrupt_multi, (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 moveloop(resuming) boolean resuming; diff --git a/src/decl.c b/src/decl.c index 84e16b280..4eb813ed8 100644 --- a/src/decl.c +++ b/src/decl.c @@ -611,6 +611,7 @@ const struct instance_globals g_init = { SELL_NORMAL, /* sell_how */ FALSE, /* auto_credit */ UNDEFINED_VALUES, /* repo */ + UNDEFINED_VALUES, /* followmsg */ /* sp_lev.c */ NULL, /* lev_message */ diff --git a/src/shk.c b/src/shk.c index 632d3b41c..1dabf32b3 100644 --- a/src/shk.c +++ b/src/shk.c @@ -25,7 +25,6 @@ STATIC_DCL void FDECL(kops_gone, (BOOLEAN_P)); 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 the_contents_of[] = "the contents of "; @@ -3692,7 +3691,7 @@ struct monst *shkp; eshkp->following = 0; return 0; } - if (g.moves > followmsg + 4) { + if (g.moves > g.followmsg + 4) { if (!Deaf && !muteshk(shkp)) verbalize("%s, %s! Didn't you forget to pay?", Hello(shkp), g.plname); @@ -3700,7 +3699,7 @@ struct monst *shkp; pline("%s holds out %s upturned %s.", Shknam(shkp), noit_mhis(shkp), mbodypart(shkp, HAND)); - followmsg = g.moves; + g.followmsg = g.moves; if (!rn2(9)) { pline("%s doesn't like customers who don't pay.", Shknam(shkp)); diff --git a/src/sys.c b/src/sys.c index e3a040bca..44ec02560 100644 --- a/src/sys.c +++ b/src/sys.c @@ -20,10 +20,6 @@ struct sysopt sysopt; void sys_early_init() { - decl_globals_init(); - objects_globals_init(); - monst_globals_init(); - sysopt.support = (char *) 0; sysopt.recover = (char *) 0; #ifdef SYSCF diff --git a/sys/be/bemain.c b/sys/be/bemain.c index 869f6c302..c1b81dda9 100644 --- a/sys/be/bemain.c +++ b/sys/be/bemain.c @@ -25,7 +25,7 @@ MAIN(int argc, char **argv) char *dir; boolean resuming = FALSE; /* assume new game */ - sys_early_init(); + early_init(); dir = nh_getenv("NETHACKDIR"); if (!dir) diff --git a/sys/mac/macmain.c b/sys/mac/macmain.c index 48be0f487..71bfaeeeb 100644 --- a/sys/mac/macmain.c +++ b/sys/mac/macmain.c @@ -39,7 +39,7 @@ main(void) int argc = 1; boolean resuming = FALSE; /* assume new game */ - sys_early_init(); + early_init(); windowprocs = mac_procs; InitMac(); diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index c3c05d703..ffe109337 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -77,7 +77,7 @@ char *argv[]; { boolean resuming; - sys_early_init(); + early_init(); resuming = pcmain(argc, argv); moveloop(resuming); nethack_exit(EXIT_SUCCESS); diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index fca896554..6237b46a3 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -58,7 +58,7 @@ char *argv[]; boolean resuming = FALSE; /* assume new game */ boolean plsel_once = FALSE; - sys_early_init(); + early_init(); #if defined(__APPLE__) { diff --git a/sys/vms/vmsmain.c b/sys/vms/vmsmain.c index ec70e39f6..29e5c8cd3 100644 --- a/sys/vms/vmsmain.c +++ b/sys/vms/vmsmain.c @@ -44,7 +44,7 @@ char *argv[]; privon(); #endif - sys_early_init(); + early_init(); atexit(byebye); g.hname = argv[0]; diff --git a/sys/wince/winhack.c b/sys/wince/winhack.c index bca6d5937..264643663 100644 --- a/sys/wince/winhack.c +++ b/sys/wince/winhack.c @@ -42,7 +42,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, char buf[NHSTR_BUFSIZE]; boolean resuming; - sys_early_init(); + early_init(); /* ensure that we don't access violate on a panic() */ windowprocs.win_raw_print = mswin_raw_print; diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index b8fb2aa19..bfc865140 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -97,7 +97,7 @@ char *argv[]; if (!GUILaunched) windowprocs.win_nhgetch = windows_console_custom_nhgetch; - sys_early_init(); + early_init(); #ifdef _MSC_VER # ifdef DEBUG /* set these appropriately for VS debugging */ diff --git a/win/win32/winhack.c b/win/win32/winhack.c index 6776b376f..6b08d8b96 100644 --- a/win/win32/winhack.c +++ b/win/win32/winhack.c @@ -123,7 +123,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, windowprocs.win_wait_synch = mswin_wait_synch; win10_init(); - sys_early_init(); + early_init(); /* init application structure */ _nethack_app.hApp = hInstance;