From cd3b0efe5d91b90f61b7770c4d3c9740174e5352 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 14 Apr 2015 19:41:44 +0300 Subject: [PATCH] Unify description of hero's visage into single function --- include/extern.h | 1 + src/apply.c | 11 +++++++++-- src/do_name.c | 5 +---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/extern.h b/include/extern.h index ebe38de5e..3a0535cf0 100644 --- a/include/extern.h +++ b/include/extern.h @@ -39,6 +39,7 @@ E void FDECL(m_unleash, (struct monst *,BOOLEAN_P)); E void NDECL(unleash_all); E boolean NDECL(next_to_u); E struct obj *FDECL(get_mleash, (struct monst *)); +E const char *NDECL(beautiful); E void FDECL(check_leash, (XCHAR_P,XCHAR_P)); E boolean FDECL(um_dist, (XCHAR_P,XCHAR_P,XCHAR_P)); E boolean FDECL(snuff_candle, (struct obj *)); diff --git a/src/apply.c b/src/apply.c index 40249be1f..e8b0bfea4 100644 --- a/src/apply.c +++ b/src/apply.c @@ -703,6 +703,14 @@ register xchar x, y; } } +const char * +beautiful() +{ + return (ACURR(A_CHA) > 14) ? + (poly_gender() == 1 ? "beautiful" : "handsome") : "ugly"; +} + + #define WEAK 3 /* from eat.c */ static const char look_str[] = "look %s."; @@ -720,8 +728,7 @@ struct obj *obj; if(!getdir((char *)0)) return 0; invis_mirror = Invis; useeit = !Blind && (!invis_mirror || See_invisible); - uvisage = (ACURR(A_CHA) > 14) ? - (poly_gender() == 1 ? "beautiful" : "handsome") : "ugly"; + uvisage = beautiful(); mirror = simpleonames(obj); /* "mirror" or "looking glass" */ if(obj->cursed && !rn2(2)) { if (!Blind) diff --git a/src/do_name.c b/src/do_name.c index c8a49a443..b89374804 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -421,10 +421,7 @@ do_mname() mtmp = u.usteed; else { pline("This %s creature is called %s and cannot be renamed.", - ACURR(A_CHA) > 14 ? - (flags.female ? "beautiful" : "handsome") : - "ugly", - plname); + beautiful(), plname); return; } } else