From: nethack.rankin Date: Sat, 2 Sep 2006 04:09:50 +0000 (+0000) Subject: eye message formatting (trunk only) X-Git-Tag: MOVE2GIT~920 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ba02dda004e9d2b80d3d8f1163251fd9175c1d5;p=nethack eye message formatting (trunk only) Noticed while making the Unaware changes; redo several eye/eyes messages to use vtense() instead of doing their own verb handling. --- diff --git a/src/dothrow.c b/src/dothrow.c index ccb89e0e6..1f645e504 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1595,16 +1595,17 @@ boolean from_invent; } else if (distu(x,y) <= 2) { if (!breathless(youmonst.data) || haseyes(youmonst.data)) { if (obj->otyp != POT_WATER) { - if (!breathless(youmonst.data)) - /* [what about "familiar odor" when known?] */ - You("smell a peculiar odor..."); - else { - int numeyes = eyecount(youmonst.data); - Your("%s water%s.", - (numeyes == 1) ? body_part(EYE) : - makeplural(body_part(EYE)), - (numeyes == 1) ? "s" : ""); - } + if (!breathless(youmonst.data)) { + /* [what about "familiar odor" when known?] */ + You("smell a peculiar odor..."); + } else { + const char *eyes = body_part(EYE); + + if (eyecount(youmonst.data) != 1) + eyes = makeplural(eyes); + Your("%s %s.", eyes, + vtense(eyes, "water")); + } } potionbreathe(obj); } diff --git a/src/mthrowu.c b/src/mthrowu.c index 2e3f645cc..0c366e0cd 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -391,13 +391,13 @@ struct obj *obj; /* missile (or stack providing it) */ something, body_part(FACE)); } else if(singleobj->otyp == BLINDING_VENOM) { - int num_eyes = eyecount(youmonst.data); + const char *eyes = body_part(EYE); + + if (eyecount(youmonst.data) != 1) + eyes = makeplural(eyes); /* venom in the eyes */ if(!Blind) pline_The("venom blinds you."); - else Your("%s sting%s.", - (num_eyes == 1) ? body_part(EYE) : - makeplural(body_part(EYE)), - (num_eyes == 1) ? "s" : ""); + else Your("%s %s.", eyes, vtense(eyes, "sting")); } } if (hitu && singleobj->otyp == EGG) { diff --git a/src/potion.c b/src/potion.c index cbff9a0d7..67759b4c6 100644 --- a/src/potion.c +++ b/src/potion.c @@ -213,8 +213,7 @@ boolean talk; { long old = Blinded; boolean u_could_see, can_see_now; - int eyecnt; - char buf[BUFSZ]; + const char *eyes; /* we need to probe ahead in case the Eyes of the Overworld are or will be overriding blindness */ @@ -238,10 +237,9 @@ boolean talk; if (!haseyes(youmonst.data)) { strange_feeling((struct obj *)0, (char *)0); } else if (Blindfolded) { - Strcpy(buf, body_part(EYE)); - eyecnt = eyecount(youmonst.data); - Your(eyemsg, (eyecnt == 1) ? buf : makeplural(buf), - (eyecnt == 1) ? "itches" : "itch"); + eyes = body_part(EYE); + if (eyecount(youmonst.data) != 1) eyes = makeplural(eyes); + Your(eyemsg, eyes, vtense(eyes, "itch")); } else { /* Eyes of the Overworld */ Your(vismsg, "brighten", Hallucination ? "sadder" : "normal"); @@ -264,10 +262,9 @@ boolean talk; if (!haseyes(youmonst.data)) { strange_feeling((struct obj *)0, (char *)0); } else if (Blindfolded) { - Strcpy(buf, body_part(EYE)); - eyecnt = eyecount(youmonst.data); - Your(eyemsg, (eyecnt == 1) ? buf : makeplural(buf), - (eyecnt == 1) ? "twitches" : "twitch"); + eyes = body_part(EYE); + if (eyecount(youmonst.data) != 1) eyes = makeplural(eyes); + Your(eyemsg, eyes, vtense(eyes, "twitch")); } else { /* Eyes of the Overworld */ Your(vismsg, "dim", Hallucination ? "happier" : "normal"); @@ -322,12 +319,10 @@ long mask; /* nonzero if resistance status should change by mask */ if (!haseyes(youmonst.data)) { strange_feeling((struct obj *)0, (char *)0); } else if (Blind) { - char buf[BUFSZ]; - int eyecnt = eyecount(youmonst.data); + const char *eyes = body_part(EYE); - Strcpy(buf, body_part(EYE)); - Your(eyemsg, (eyecnt == 1) ? buf : makeplural(buf), - (eyecnt == 1) ? "itches" : "itch"); + if (eyecount(youmonst.data) != 1) eyes = makeplural(eyes); + Your(eyemsg, eyes, vtense(eyes, "itch")); } else { /* Grayswandir */ Your(vismsg, "flatten", "normal"); } @@ -1367,10 +1362,11 @@ register struct obj *obj; if (!breathless(youmonst.data)) pline("Ulch! That potion smells terrible!"); else if (haseyes(youmonst.data)) { - int numeyes = eyecount(youmonst.data); - Your("%s sting%s!", - (numeyes == 1) ? body_part(EYE) : makeplural(body_part(EYE)), - (numeyes == 1) ? "s" : ""); + const char *eyes = body_part(EYE); + + if (eyecount(youmonst.data) != 1) + eyes = makeplural(eyes); + Your("%s %s!", eyes, vtense(eyes, "sting")); } break; } else { diff --git a/src/pray.c b/src/pray.c index 7640a0855..e7b6975fb 100644 --- a/src/pray.c +++ b/src/pray.c @@ -442,12 +442,10 @@ decurse: break; case TROUBLE_BLIND: { - int num_eyes = eyecount(youmonst.data); - const char *eye = body_part(EYE); + const char *eyes = body_part(EYE); - Your("%s feel%s better.", - (num_eyes == 1) ? eye : makeplural(eye), - (num_eyes == 1) ? "s" : ""); + if (eyecount(youmonst.data) != 1) eyes = makeplural(eyes); + Your("%s %s better.", eyes, vtense(eyes, "feel")); u.ucreamed = 0; make_blinded(0L,FALSE); break;