boolean valallowed;
};
-/* encumbrance */
-E int oldcap;
+/* 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();
#undef E
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"
ZERO(ubirthday);
ZERO(urealtime);
- ZERO(oldcap);
-
ZEROARRAY(lastseentyp);
ZEROPTR(invent);
}
#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*/
{
int newcap = near_capacity();
- if (oldcap < newcap) {
+ if (icontext.oldcap < newcap) {
switch (newcap) {
case 1:
Your("movements are slowed slightly because of your load.");
break;
}
context.botl = 1;
- } else if (oldcap > newcap) {
+ } else if (icontext.oldcap > newcap) {
switch (newcap) {
case 0:
Your("movements are now unencumbered.");
context.botl = 1;
}
- oldcap = newcap;
+ icontext.oldcap = newcap;
return newcap;
}
nethack_enter(argc, argv);
-#ifdef PLAYAGAIN
- decl_early_init();
-#endif
+ icontext_init();
sys_early_init();
#if defined(WIN32) && defined(TTY_GRAPHICS)
{
boolean resuming;
-#ifdef PLAYAGAIN
- decl_early_init();
-#endif
+ icontext_init();
sys_early_init();
Strcpy(default_window_sys, "tty");
resuming = pcmain(argc, argv);
win10_init();
-#ifdef PLAYAGAIN
- decl_early_init();
-#endif
+ icontext_init();
sys_early_init();
/* init applicatio structure */