diff --git a/include/decl.h b/include/decl.h index 2cc7f965c..5e211f053 100644 --- a/include/decl.h +++ b/include/decl.h @@ -439,20 +439,8 @@ struct early_opt { boolean valallowed; }; -/* instance_context holds per game instance data that does not need to be - * persisted upon game exit. This game instance data is one of the first - * things initialized during the initialization of the game engine. - * It is initialized with icontext_initial_state found in decl.c */ - -#define PLAYAGAIN - -struct instance_context { - int oldcap; /* encumberance - pickup.c */ -}; - -E struct instance_context icontext; - -E void icontext_init(); +/* encumbrance */ +E int oldcap; #undef E diff --git a/src/decl.c b/src/decl.c index edfeb3a60..10f67f7de 100644 --- a/src/decl.c +++ b/src/decl.c @@ -215,6 +215,9 @@ NEARDATA struct monst *migrating_mons = (struct monst *) 0; NEARDATA struct mvitals mvitals[NUMMONS]; +/* originally from pickup.c */ +int oldcap = 0; /* encumbrance */ + NEARDATA struct c_color_names c_color_names = { "black", "amber", "golden", "light blue", "red", "green", "silver", "blue", "purple", "white", "orange" @@ -526,6 +529,8 @@ decl_early_init() ZERO(ubirthday); ZERO(urealtime); + ZERO(oldcap); + ZEROARRAY(lastseentyp); ZEROPTR(invent); @@ -607,18 +612,4 @@ decl_early_init() } #endif -const struct instance_context icontext_initial_state = { - 0, /* oldcap - last encumberance in pickup.c */ -}; - -struct instance_context icontext; - -void -icontext_init() -{ - icontext = icontext_initial_state; - - decl_early_init(); -}; - /*decl.c*/ diff --git a/src/pickup.c b/src/pickup.c index 83d5eb273..b32640dbd 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1558,7 +1558,7 @@ encumber_msg() { int newcap = near_capacity(); - if (icontext.oldcap < newcap) { + if (oldcap < newcap) { switch (newcap) { case 1: Your("movements are slowed slightly because of your load."); @@ -1576,7 +1576,7 @@ encumber_msg() break; } context.botl = 1; - } else if (icontext.oldcap > newcap) { + } else if (oldcap > newcap) { switch (newcap) { case 0: Your("movements are now unencumbered."); @@ -1595,7 +1595,7 @@ encumber_msg() context.botl = 1; } - icontext.oldcap = newcap; + oldcap = newcap; return newcap; } diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 932ec971e..9ffbeca51 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -97,7 +97,9 @@ char *argv[]; nethack_enter(argc, argv); - icontext_init(); +#ifdef PLAYAGAIN + decl_early_init(); +#endif sys_early_init(); #if defined(WIN32) && defined(TTY_GRAPHICS) diff --git a/sys/winnt/stubs.c b/sys/winnt/stubs.c index 9e16c6dce..ff3cf5919 100644 --- a/sys/winnt/stubs.c +++ b/sys/winnt/stubs.c @@ -37,7 +37,9 @@ char *argv[]; { boolean resuming; - icontext_init(); +#ifdef PLAYAGAIN + decl_early_init(); +#endif sys_early_init(); Strcpy(default_window_sys, "tty"); resuming = pcmain(argc, argv); diff --git a/win/win32/winhack.c b/win/win32/winhack.c index ef48d6b63..6db66261e 100644 --- a/win/win32/winhack.c +++ b/win/win32/winhack.c @@ -97,7 +97,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, win10_init(); - icontext_init(); +#ifdef PLAYAGAIN + decl_early_init(); +#endif sys_early_init(); /* init applicatio structure */