mons[NUMMONS] tweak
Add a couple of non-zero permonst flags to the terminator at the end of mons[] in case some code using a pointer to mons[NUMMONS] for "not a monster" unexpectedly references them. Also, eliminate some obsolete handling for conditional color support from monst.c.
This commit is contained in:
+7
-1
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 monsters.h $NHDT-Date: 1703845746 2023/12/29 10:29:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.117 $ */
|
/* NetHack 3.7 monsters.h $NHDT-Date: 1705092146 2024/01/12 20:42:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.119 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Michael Allison, 2006. */
|
/*-Copyright (c) Michael Allison, 2006. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -3351,6 +3351,12 @@
|
|||||||
| M2_STRONG | M2_COLLECT | M2_MAGIC,
|
| M2_STRONG | M2_COLLECT | M2_MAGIC,
|
||||||
M3_INFRAVISIBLE, 8, HI_DOMESTIC, APPRENTICE),
|
M3_INFRAVISIBLE, 8, HI_DOMESTIC, APPRENTICE),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* mons_init() in monst.c adds a terminator here, mons[NUMMONS].
|
||||||
|
* It is part of the mons[] array without introducing another type
|
||||||
|
* of monster.
|
||||||
|
*/
|
||||||
|
|
||||||
#if defined(MONS_ENUM) || defined(DUMP_ENUMS)
|
#if defined(MONS_ENUM) || defined(DUMP_ENUMS)
|
||||||
#undef MON
|
#undef MON
|
||||||
#undef MON3
|
#undef MON3
|
||||||
|
|||||||
+22
-27
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 monst.c $NHDT-Date: 1682205027 2023/04/22 23:10:27 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.97 $ */
|
/* NetHack 3.7 monst.c $NHDT-Date: 1705092160 2024/01/12 20:42:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.100 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Michael Allison, 2006. */
|
/*-Copyright (c) Michael Allison, 2006. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -8,63 +8,60 @@
|
|||||||
#include "wintype.h"
|
#include "wintype.h"
|
||||||
#include "sym.h"
|
#include "sym.h"
|
||||||
|
|
||||||
#ifdef C
|
|
||||||
#undef C
|
|
||||||
#endif
|
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
#define C(color) color
|
|
||||||
|
|
||||||
#define NO_ATTK \
|
#define NO_ATTK { 0, 0, 0, 0 }
|
||||||
{ \
|
|
||||||
0, 0, 0, 0 \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* monster type with single name */
|
||||||
#define MON(nam, sym, lvl, gen, atk, siz, mr1, mr2, \
|
#define MON(nam, sym, lvl, gen, atk, siz, mr1, mr2, \
|
||||||
flg1, flg2, flg3, d, col, bn) \
|
flg1, flg2, flg3, d, col, bn) \
|
||||||
{ \
|
{ \
|
||||||
{ (const char *) 0, (const char *) 0, nam }, \
|
{ (const char *) 0, (const char *) 0, nam }, \
|
||||||
PM_##bn, \
|
PM_##bn, \
|
||||||
sym, lvl, gen, atk, siz, mr1, mr2, flg1, flg2, flg3, d, C(col) \
|
sym, lvl, gen, atk, siz, mr1, mr2, flg1, flg2, flg3, d, col \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* monster type with distinct male, female, neuter names */
|
||||||
#define MON3(namm, namf, namn, sym, lvl, gen, atk, siz, mr1, mr2, \
|
#define MON3(namm, namf, namn, sym, lvl, gen, atk, siz, mr1, mr2, \
|
||||||
flg1, flg2, flg3, d, col, bn) \
|
flg1, flg2, flg3, d, col, bn) \
|
||||||
{ \
|
{ \
|
||||||
{ namm, namf, namn }, \
|
{ namm, namf, namn }, \
|
||||||
PM_##bn, \
|
PM_##bn, \
|
||||||
sym, lvl, gen, atk, siz, mr1, mr2, flg1, flg2, flg3, d, C(col) \
|
sym, lvl, gen, atk, siz, mr1, mr2, flg1, flg2, flg3, d, col \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LVL() and SIZ() collect several fields to cut down on number of args
|
/* LVL() and SIZ() collect several fields to cut down on number of args
|
||||||
* for MON()
|
* for MON()/MON3().
|
||||||
*/
|
*/
|
||||||
#define LVL(lvl, mov, ac, mr, aln) lvl, mov, ac, mr, aln
|
#define LVL(lvl, mov, ac, mr, aln) lvl, mov, ac, mr, aln
|
||||||
#define SIZ(wt, nut, snd, siz) wt, nut, snd, siz
|
#define SIZ(wt, nut, snd, siz) wt, nut, snd, siz
|
||||||
/* ATTK() and A() are to avoid braces and commas within args to MON() */
|
/* ATTK() and A() are to avoid braces and commas within args to MON() */
|
||||||
#define ATTK(at, ad, n, d) \
|
#define ATTK(at, ad, n, d) { at, ad, n, d }
|
||||||
{ \
|
#define A(a1, a2, a3, a4, a5, a6) { a1, a2, a3, a4, a5, a6 }
|
||||||
at, ad, n, d \
|
|
||||||
}
|
|
||||||
#define A(a1, a2, a3, a4, a5, a6) \
|
|
||||||
{ \
|
|
||||||
a1, a2, a3, a4, a5, a6 \
|
|
||||||
}
|
|
||||||
|
|
||||||
struct permonst mons_init[NUMMONS + 1] = {
|
struct permonst mons_init[NUMMONS + 1] = {
|
||||||
#include "monsters.h"
|
#include "monsters.h"
|
||||||
/*
|
/*
|
||||||
* array terminator
|
* Array terminator, added to the end of the entries in monsters.h.
|
||||||
|
*
|
||||||
|
* mons[NUMMONS] used to be all zero except "" instead of Null for
|
||||||
|
* the name field. Then the index field was added and the terminator
|
||||||
|
* uses NON_PM for that. Now, a few monster flags also get set.
|
||||||
*/
|
*/
|
||||||
#undef MON
|
#undef MON
|
||||||
#define MON(nam, sym, lvl, gen, atk, siz, mr1, mr2, \
|
#define MON(nam, sym, lvl, gen, atk, siz, mr1, mr2, \
|
||||||
flg1, flg2, flg3, d, col, bn) \
|
flg1, flg2, flg3, d, col, bn) \
|
||||||
{ \
|
{ \
|
||||||
{ (const char *) 0, (const char *) 0, nam }, \
|
{ (const char *) 0, (const char *) 0, nam }, \
|
||||||
NON_PM, \
|
NON_PM, \
|
||||||
sym, lvl, gen, atk, siz, mr1, mr2, flg1, flg2, flg3, d, C(col) \
|
sym, lvl, gen, atk, siz, mr1, mr2, flg1, flg2, flg3, d, col \
|
||||||
}
|
}
|
||||||
MON("", 0, LVL(0, 0, 0, 0, 0), (0),
|
MON("", 0, LVL(0, 0, 0, 0, 0),
|
||||||
|
G_NOGEN | G_NOCORPSE,
|
||||||
A(NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
|
A(NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
|
||||||
SIZ(0, 0, 0, 0), 0, 0, 0L, 0L, 0, 0, 0, 0),
|
SIZ(0, 0, 0, 0), 0, 0,
|
||||||
|
0L, M2_NOPOLY, 0,
|
||||||
|
0, 0, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef MON
|
#undef MON
|
||||||
@@ -86,8 +83,6 @@ const struct attack c_sa_no[NATTK] = SEDUCTION_ATTACKS_NO;
|
|||||||
|
|
||||||
/* for 'onefile' processing where end of this file isn't necessarily the
|
/* for 'onefile' processing where end of this file isn't necessarily the
|
||||||
end of the source code seen by the compiler */
|
end of the source code seen by the compiler */
|
||||||
#undef C
|
|
||||||
#define C(c) (0x1f & (c)) /* global.h */
|
|
||||||
#undef NO_ATTK
|
#undef NO_ATTK
|
||||||
#undef LVL
|
#undef LVL
|
||||||
#undef SIZ
|
#undef SIZ
|
||||||
|
|||||||
Reference in New Issue
Block a user