fix bug in mon.c reported by paxed
Also adds a shorthand macro
monsym(&mons[n])
for getting the default symbol, used in the bugfix.
This commit is contained in:
@@ -260,5 +260,6 @@
|
|||||||
#define pmname(ptr,g) ((((g) == MALE || (g) == FEMALE) && (ptr)->pmnames[g]) \
|
#define pmname(ptr,g) ((((g) == MALE || (g) == FEMALE) && (ptr)->pmnames[g]) \
|
||||||
? (ptr)->pmnames[g] : (ptr)->pmnames[NEUTRAL])
|
? (ptr)->pmnames[g] : (ptr)->pmnames[NEUTRAL])
|
||||||
#endif
|
#endif
|
||||||
|
#define monsym(ptr) (def_monsyms[(int) (ptr)->mlet].sym)
|
||||||
|
|
||||||
#endif /* MONDATA_H */
|
#endif /* MONDATA_H */
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ browse_map(unsigned ter_typ, const char *ter_explain)
|
|||||||
static void
|
static void
|
||||||
map_monst(struct monst *mtmp, boolean showtail)
|
map_monst(struct monst *mtmp, boolean showtail)
|
||||||
{
|
{
|
||||||
int glyph = (def_monsyms[(int) mtmp->data->mlet].sym == ' ')
|
int glyph = (monsym(mtmp->data) == ' ')
|
||||||
? detected_mon_to_glyph(mtmp, newsym_rn2)
|
? detected_mon_to_glyph(mtmp, newsym_rn2)
|
||||||
: mtmp->mtame
|
: mtmp->mtame
|
||||||
? pet_to_glyph(mtmp, newsym_rn2)
|
? pet_to_glyph(mtmp, newsym_rn2)
|
||||||
|
|||||||
@@ -1640,7 +1640,7 @@ rndmonst_adj(int minadj, int maxadj)
|
|||||||
|
|
||||||
if (montooweak(mndx, minmlev) || montoostrong(mndx, maxmlev))
|
if (montooweak(mndx, minmlev) || montoostrong(mndx, maxmlev))
|
||||||
continue;
|
continue;
|
||||||
if (upper && !isupper((uchar) def_monsyms[(int) ptr->mlet].sym))
|
if (upper && !isupper(monsym(ptr)))
|
||||||
continue;
|
continue;
|
||||||
if (elemlevel && wrong_elem_type(ptr))
|
if (elemlevel && wrong_elem_type(ptr))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -4419,7 +4419,7 @@ pick_animal(void)
|
|||||||
/* rogue level should use monsters represented by uppercase letters
|
/* rogue level should use monsters represented by uppercase letters
|
||||||
only, but since chameleons aren't generated there (not uppercase!)
|
only, but since chameleons aren't generated there (not uppercase!)
|
||||||
we don't perform a lot of retries */
|
we don't perform a lot of retries */
|
||||||
if (Is_rogue_level(&u.uz) && !isupper((uchar) mons[res].mlet))
|
if (Is_rogue_level(&u.uz) && !isupper(monsym(&mons[res])))
|
||||||
res = ga.animal_list[rn2(ga.animal_list_count)];
|
res = ga.animal_list[rn2(ga.animal_list_count)];
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3306,7 +3306,7 @@ lspo_monster(lua_State *L)
|
|||||||
tmpmons.coord = SP_COORD_PACK(mx, my);
|
tmpmons.coord = SP_COORD_PACK(mx, my);
|
||||||
|
|
||||||
if (tmpmons.id != NON_PM && tmpmons.class == -1)
|
if (tmpmons.id != NON_PM && tmpmons.class == -1)
|
||||||
tmpmons.class = def_monsyms[(int) mons[tmpmons.id].mlet].sym;
|
tmpmons.class = monsym(&mons[tmpmons.id]);
|
||||||
|
|
||||||
create_monster(&tmpmons, gc.coder->croom);
|
create_monster(&tmpmons, gc.coder->croom);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user