diff --git a/include/mondata.h b/include/mondata.h index f777a1d6e..f565d9da1 100644 --- a/include/mondata.h +++ b/include/mondata.h @@ -260,5 +260,6 @@ #define pmname(ptr,g) ((((g) == MALE || (g) == FEMALE) && (ptr)->pmnames[g]) \ ? (ptr)->pmnames[g] : (ptr)->pmnames[NEUTRAL]) #endif +#define monsym(ptr) (def_monsyms[(int) (ptr)->mlet].sym) #endif /* MONDATA_H */ diff --git a/src/detect.c b/src/detect.c index 00960fba9..efba899fa 100644 --- a/src/detect.c +++ b/src/detect.c @@ -106,7 +106,7 @@ browse_map(unsigned ter_typ, const char *ter_explain) static void 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) : mtmp->mtame ? pet_to_glyph(mtmp, newsym_rn2) diff --git a/src/makemon.c b/src/makemon.c index 1253a1314..26c0dadd3 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1640,7 +1640,7 @@ rndmonst_adj(int minadj, int maxadj) if (montooweak(mndx, minmlev) || montoostrong(mndx, maxmlev)) continue; - if (upper && !isupper((uchar) def_monsyms[(int) ptr->mlet].sym)) + if (upper && !isupper(monsym(ptr))) continue; if (elemlevel && wrong_elem_type(ptr)) continue; diff --git a/src/mon.c b/src/mon.c index 65eb2837f..a5e626acf 100644 --- a/src/mon.c +++ b/src/mon.c @@ -4419,7 +4419,7 @@ pick_animal(void) /* rogue level should use monsters represented by uppercase letters only, but since chameleons aren't generated there (not uppercase!) 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)]; return res; } diff --git a/src/sp_lev.c b/src/sp_lev.c index bbeb5930a..504cadd6e 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -3306,7 +3306,7 @@ lspo_monster(lua_State *L) tmpmons.coord = SP_COORD_PACK(mx, my); 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);