Modified objects initialization to support re-entry.
This commit is contained in:
@@ -545,7 +545,7 @@ struct instance_globals {
|
|||||||
|
|
||||||
E struct instance_globals g;
|
E struct instance_globals g;
|
||||||
|
|
||||||
E void instance_globals_init();
|
E void decl_globals_init();
|
||||||
|
|
||||||
|
|
||||||
#undef E
|
#undef E
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ E void FDECL(destroy_drawbridge, (int, int));
|
|||||||
|
|
||||||
/* ### decl.c ### */
|
/* ### decl.c ### */
|
||||||
|
|
||||||
E void NDECL(decl_init);
|
E void NDECL(decl_globals_init);
|
||||||
|
|
||||||
/* ### detect.c ### */
|
/* ### detect.c ### */
|
||||||
|
|
||||||
@@ -1651,7 +1651,7 @@ E void NDECL(rename_disco);
|
|||||||
|
|
||||||
/* ### objects.c ### */
|
/* ### objects.c ### */
|
||||||
|
|
||||||
E void NDECL(objects_init);
|
E void NDECL(objects_globals_init);
|
||||||
|
|
||||||
/* ### objnam.c ### */
|
/* ### objnam.c ### */
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,7 @@ boolean resuming;
|
|||||||
/* Note: these initializers don't do anything except guarantee that
|
/* Note: these initializers don't do anything except guarantee that
|
||||||
we're linked properly.
|
we're linked properly.
|
||||||
*/
|
*/
|
||||||
decl_init();
|
|
||||||
monst_init();
|
monst_init();
|
||||||
objects_init();
|
|
||||||
|
|
||||||
/* if a save file created in normal mode is now being restored in
|
/* if a save file created in normal mode is now being restored in
|
||||||
explore mode, treat it as normal restore followed by 'X' command
|
explore mode, treat it as normal restore followed by 'X' command
|
||||||
|
|||||||
@@ -318,13 +318,6 @@ const char *ARGV0;
|
|||||||
/* support for lint.h */
|
/* support for lint.h */
|
||||||
unsigned nhUse_dummy = 0;
|
unsigned nhUse_dummy = 0;
|
||||||
|
|
||||||
/* dummy routine used to force linkage */
|
|
||||||
void
|
|
||||||
decl_init()
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define IVMAGIC 0xdeadbeef
|
#define IVMAGIC 0xdeadbeef
|
||||||
|
|
||||||
const struct instance_globals g_init = {
|
const struct instance_globals g_init = {
|
||||||
@@ -420,7 +413,7 @@ const struct instance_globals g_init = {
|
|||||||
struct instance_globals g;
|
struct instance_globals g;
|
||||||
|
|
||||||
void
|
void
|
||||||
instance_globals_init()
|
decl_globals_init()
|
||||||
{
|
{
|
||||||
g = g_init;
|
g = g_init;
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ struct monst { struct monst *dummy; }; /* lint: struct obj's union */
|
|||||||
cost,sdam,ldam,oc1,oc2,nut,color) { obj }
|
cost,sdam,ldam,oc1,oc2,nut,color) { obj }
|
||||||
#define None (char *) 0 /* less visual distraction for 'no description' */
|
#define None (char *) 0 /* less visual distraction for 'no description' */
|
||||||
|
|
||||||
NEARDATA struct objdescr obj_descr[] =
|
NEARDATA struct objdescr obj_descr_init[] =
|
||||||
#else
|
#else
|
||||||
/* second pass -- object definitions */
|
/* second pass -- object definitions */
|
||||||
#define BITS(nmkn,mrg,uskn,ctnr,mgc,chrg,uniq,nwsh,big,tuf,dir,sub,mtrl) \
|
#define BITS(nmkn,mrg,uskn,ctnr,mgc,chrg,uniq,nwsh,big,tuf,dir,sub,mtrl) \
|
||||||
@@ -75,7 +75,7 @@ NEARDATA struct objdescr obj_descr[] =
|
|||||||
#define HARDGEM(n) (0)
|
#define HARDGEM(n) (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NEARDATA struct objclass objects[] =
|
NEARDATA struct objclass obj_init[] =
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* dummy object[0] -- description [2nd arg] *must* be NULL */
|
/* dummy object[0] -- description [2nd arg] *must* be NULL */
|
||||||
@@ -1169,13 +1169,14 @@ OBJECT(OBJ(None, None),
|
|||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
void NDECL(objects_init);
|
struct objdescr obj_descr[SIZE(obj_descr_init)];
|
||||||
|
struct objclass objects[SIZE(obj_init)];
|
||||||
|
|
||||||
/* dummy routine used to force linkage */
|
|
||||||
void
|
void
|
||||||
objects_init()
|
objects_globals_init()
|
||||||
{
|
{
|
||||||
return;
|
memcpy(obj_descr, obj_descr_init, sizeof(obj_descr));
|
||||||
|
memcpy(objects, obj_init, sizeof(objects));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !OBJECTS_PASS_2_ */
|
#endif /* !OBJECTS_PASS_2_ */
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ struct sysopt sysopt;
|
|||||||
void
|
void
|
||||||
sys_early_init()
|
sys_early_init()
|
||||||
{
|
{
|
||||||
|
decl_globals_init();
|
||||||
|
objects_globals_init();
|
||||||
|
|
||||||
sysopt.support = (char *) 0;
|
sysopt.support = (char *) 0;
|
||||||
sysopt.recover = (char *) 0;
|
sysopt.recover = (char *) 0;
|
||||||
#ifdef SYSCF
|
#ifdef SYSCF
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ char *argv[];
|
|||||||
|
|
||||||
nethack_enter(argc, argv);
|
nethack_enter(argc, argv);
|
||||||
|
|
||||||
instance_globals_init();
|
|
||||||
sys_early_init();
|
sys_early_init();
|
||||||
|
|
||||||
#if defined(WIN32) && defined(TTY_GRAPHICS)
|
#if defined(WIN32) && defined(TTY_GRAPHICS)
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ char *argv[];
|
|||||||
{
|
{
|
||||||
boolean resuming;
|
boolean resuming;
|
||||||
|
|
||||||
icontext_init();
|
early_init();
|
||||||
sys_early_init();
|
|
||||||
Strcpy(default_window_sys, "tty");
|
Strcpy(default_window_sys, "tty");
|
||||||
resuming = pcmain(argc, argv);
|
resuming = pcmain(argc, argv);
|
||||||
moveloop(resuming);
|
moveloop(resuming);
|
||||||
|
|||||||
@@ -109,8 +109,7 @@ struct lc_vardefs *FDECL(vardef_defined, (struct lc_vardefs *, char *, int));
|
|||||||
void FDECL(splev_add_from, (sp_lev *, sp_lev *));
|
void FDECL(splev_add_from, (sp_lev *, sp_lev *));
|
||||||
|
|
||||||
extern void NDECL(monst_init);
|
extern void NDECL(monst_init);
|
||||||
extern void NDECL(objects_init);
|
extern void NDECL(objects_globals_init);
|
||||||
extern void NDECL(decl_init);
|
|
||||||
|
|
||||||
void FDECL(add_opcode, (sp_lev *, int, genericptr_t));
|
void FDECL(add_opcode, (sp_lev *, int, genericptr_t));
|
||||||
|
|
||||||
@@ -256,12 +255,15 @@ char **argv;
|
|||||||
argc = SIZE(mac_argv);
|
argc = SIZE(mac_argv);
|
||||||
argv = mac_argv;
|
argv = mac_argv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
decl_globals_init();
|
||||||
|
objects_globals_init();
|
||||||
|
|
||||||
/* Note: these initializers don't do anything except guarantee that
|
/* Note: these initializers don't do anything except guarantee that
|
||||||
* we're linked properly.
|
* we're linked properly.
|
||||||
*/
|
*/
|
||||||
monst_init();
|
monst_init();
|
||||||
objects_init();
|
|
||||||
decl_init();
|
|
||||||
/* this one does something... */
|
/* this one does something... */
|
||||||
init_obj_classes();
|
init_obj_classes();
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ void NDECL(do_oracles);
|
|||||||
void NDECL(do_vision);
|
void NDECL(do_vision);
|
||||||
|
|
||||||
extern void NDECL(monst_init); /* monst.c */
|
extern void NDECL(monst_init); /* monst.c */
|
||||||
extern void NDECL(objects_init); /* objects.c */
|
extern void NDECL(objects_globals_init); /* objects.c */
|
||||||
|
|
||||||
static void NDECL(link_sanity_check);
|
static void NDECL(link_sanity_check);
|
||||||
static char *FDECL(name_file, (const char *, const char *));
|
static char *FDECL(name_file, (const char *, const char *));
|
||||||
@@ -296,7 +296,6 @@ link_sanity_check()
|
|||||||
we're linked properly.
|
we're linked properly.
|
||||||
*/
|
*/
|
||||||
monst_init();
|
monst_init();
|
||||||
objects_init();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,6 +305,8 @@ char *options;
|
|||||||
{
|
{
|
||||||
boolean more_than_one;
|
boolean more_than_one;
|
||||||
|
|
||||||
|
objects_globals_init();
|
||||||
|
|
||||||
link_sanity_check();
|
link_sanity_check();
|
||||||
|
|
||||||
/* construct the current version number */
|
/* construct the current version number */
|
||||||
|
|||||||
@@ -203,6 +203,8 @@ char *argv[];
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
objects_globals_init();
|
||||||
|
|
||||||
tilecount = 0;
|
tilecount = 0;
|
||||||
xoffset = yoffset = 0;
|
xoffset = yoffset = 0;
|
||||||
initflag = 0;
|
initflag = 0;
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ int set, entry;
|
|||||||
we're linked properly.
|
we're linked properly.
|
||||||
*/
|
*/
|
||||||
monst_init();
|
monst_init();
|
||||||
objects_init();
|
|
||||||
(void) def_char_to_objclass(']');
|
(void) def_char_to_objclass(']');
|
||||||
|
|
||||||
condnum = tilenum = 0;
|
condnum = tilenum = 0;
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||||||
|
|
||||||
win10_init();
|
win10_init();
|
||||||
|
|
||||||
instance_globals_init();
|
|
||||||
sys_early_init();
|
sys_early_init();
|
||||||
|
|
||||||
/* init applicatio structure */
|
/* init applicatio structure */
|
||||||
|
|||||||
Reference in New Issue
Block a user