zeromonst
Make 'zeromonst' global instead of local to makemon.c. Its address isn't used as a special value like &zeroobj, but it is useful to have available for initializing various pseudo-monsters. modified: include/decl.h src/decl.c, makemon.c, mkobj.c, mplayer.c, teleport.c
This commit is contained in:
+4
-2
@@ -243,7 +243,8 @@ E NEARDATA struct obj *migrating_objs;
|
|||||||
E NEARDATA struct obj *billobjs;
|
E NEARDATA struct obj *billobjs;
|
||||||
E NEARDATA struct obj *current_wand, *thrownobj, *kickedobj;
|
E NEARDATA struct obj *current_wand, *thrownobj, *kickedobj;
|
||||||
|
|
||||||
E NEARDATA struct obj zeroobj; /* init'd and defined in decl.c */
|
E NEARDATA struct obj zeroobj; /* for init; &zeroobj used as special value */
|
||||||
|
|
||||||
E NEARDATA anything zeroany; /* init'd and defined in decl.c */
|
E NEARDATA anything zeroany; /* init'd and defined in decl.c */
|
||||||
|
|
||||||
#include "you.h"
|
#include "you.h"
|
||||||
@@ -256,7 +257,8 @@ E NEARDATA struct u_realtime urealtime;
|
|||||||
#include "pm.h"
|
#include "pm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
E NEARDATA struct monst youmonst; /* init'd and defined in decl.c */
|
E NEARDATA struct monst zeromonst; /* for init of new or temp monsters */
|
||||||
|
E NEARDATA struct monst youmonst; /* monster details when hero is poly'd */
|
||||||
E NEARDATA struct monst *mydogs, *migrating_mons;
|
E NEARDATA struct monst *mydogs, *migrating_mons;
|
||||||
|
|
||||||
E NEARDATA struct mvitals {
|
E NEARDATA struct mvitals {
|
||||||
|
|||||||
+2
-1
@@ -194,8 +194,9 @@ NEARDATA struct obj *migrating_objs = (struct obj *) 0;
|
|||||||
/* objects not yet paid for */
|
/* objects not yet paid for */
|
||||||
NEARDATA struct obj *billobjs = (struct obj *) 0;
|
NEARDATA struct obj *billobjs = (struct obj *) 0;
|
||||||
|
|
||||||
/* used to zero all elements of a struct obj */
|
/* used to zero all elements of a struct obj and a struct monst */
|
||||||
NEARDATA struct obj zeroobj = DUMMY;
|
NEARDATA struct obj zeroobj = DUMMY;
|
||||||
|
NEARDATA struct monst zeromonst = DUMMY;
|
||||||
/* used to zero out union any; initializer deliberately omitted */
|
/* used to zero out union any; initializer deliberately omitted */
|
||||||
NEARDATA anything zeroany;
|
NEARDATA anything zeroany;
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
STATIC_VAR NEARDATA struct monst zeromonst;
|
|
||||||
|
|
||||||
/* this assumes that a human quest leader or nemesis is an archetype
|
/* this assumes that a human quest leader or nemesis is an archetype
|
||||||
of the corresponding role; that isn't so for some roles (tourist
|
of the corresponding role; that isn't so for some roles (tourist
|
||||||
for instance) but is for the priests and monks we use it for... */
|
for instance) but is for the priests and monks we use it for... */
|
||||||
@@ -23,7 +21,8 @@ STATIC_DCL void FDECL(m_initgrp, (struct monst *, int, int, int));
|
|||||||
STATIC_DCL void FDECL(m_initthrow, (struct monst *, int, int));
|
STATIC_DCL void FDECL(m_initthrow, (struct monst *, int, int));
|
||||||
STATIC_DCL void FDECL(m_initweap, (struct monst *));
|
STATIC_DCL void FDECL(m_initweap, (struct monst *));
|
||||||
STATIC_DCL void FDECL(m_initinv, (struct monst *));
|
STATIC_DCL void FDECL(m_initinv, (struct monst *));
|
||||||
STATIC_DCL boolean FDECL(makemon_rnd_goodpos, (struct monst *, unsigned, coord *));
|
STATIC_DCL boolean FDECL(makemon_rnd_goodpos, (struct monst *,
|
||||||
|
unsigned, coord *));
|
||||||
|
|
||||||
extern const int monstr[];
|
extern const int monstr[];
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -107,13 +107,11 @@ struct obj *otmp;
|
|||||||
{
|
{
|
||||||
if (!otmp->oextra)
|
if (!otmp->oextra)
|
||||||
otmp->oextra = newoextra();
|
otmp->oextra = newoextra();
|
||||||
|
|
||||||
if (!OMONST(otmp)) {
|
if (!OMONST(otmp)) {
|
||||||
struct monst *m = newmonst();
|
struct monst *m = newmonst();
|
||||||
|
|
||||||
/* newmonst() allocates memory but doesn't initialize anything */
|
*m = zeromonst;
|
||||||
(void) memset((genericptr_t) m, 0, sizeof (struct monst));
|
|
||||||
m->mextra = (struct mextra *) 0;
|
|
||||||
m->nmon = (struct monst *) 0;
|
|
||||||
OMONST(otmp) = m;
|
OMONST(otmp) = m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -331,12 +331,13 @@ boolean special;
|
|||||||
int pm, x, y;
|
int pm, x, y;
|
||||||
struct monst fakemon;
|
struct monst fakemon;
|
||||||
|
|
||||||
|
fakemon = zeromonst;
|
||||||
while (num) {
|
while (num) {
|
||||||
int tryct = 0;
|
int tryct = 0;
|
||||||
|
|
||||||
/* roll for character class */
|
/* roll for character class */
|
||||||
pm = PM_ARCHEOLOGIST + rn2(PM_WIZARD - PM_ARCHEOLOGIST + 1);
|
pm = PM_ARCHEOLOGIST + rn2(PM_WIZARD - PM_ARCHEOLOGIST + 1);
|
||||||
fakemon.data = &mons[pm];
|
set_mon_data(&fakemon, &mons[pm], -1);
|
||||||
|
|
||||||
/* roll for an available location */
|
/* roll for an available location */
|
||||||
do {
|
do {
|
||||||
|
|||||||
+3
-1
@@ -128,7 +128,9 @@ unsigned entflags;
|
|||||||
/* default to player's original monster type */
|
/* default to player's original monster type */
|
||||||
mdat = &mons[u.umonster];
|
mdat = &mons[u.umonster];
|
||||||
}
|
}
|
||||||
fakemon.data = mdat; /* set up for goodpos */
|
fakemon = zeromonst;
|
||||||
|
set_mon_data(&fakemon, mdat, -1); /* set up for goodpos */
|
||||||
|
|
||||||
good_ptr = good;
|
good_ptr = good;
|
||||||
range = 1;
|
range = 1;
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user