From ba5356603a6bfe2aeda04d7bd495c9f2c512ed41 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 12 Jan 2023 16:04:40 -0500 Subject: [PATCH] yn() A number of C compiler suites have a math.h library that includes a yn() function name that conflicts with NetHack's yn() macro: "The y0(), y1(), and yn() functions are Bessel functions of the second kind, for orders 0, 1, and n, respectively. The argument x must be positive. The argument n should be greater than or equal to zero. If n is less than zero, there will be a negative exponent in the result." At one point, isaac64.h included math.h, although that has since been removed. Some libraries used in NetHack (Qt for one) do include math.h and that required build work-arounds to avoid the conflict. Rename the NetHack macro from yn() to y_n() and avoid the math.h conflict altogether, eliminating the need for that particular work-around. --- include/hack.h | 4 ++-- outdated/sys/be/bemain.c | 2 +- outdated/sys/mac/macmain.c | 2 +- outdated/win/Qt3/qt3_win.cpp | 1 - src/apply.c | 4 ++-- src/bones.c | 6 +++--- src/cmd.c | 2 +- src/do.c | 6 +++--- src/eat.c | 4 ++-- src/fountain.c | 2 +- src/lock.c | 2 +- src/mhitu.c | 6 +++--- src/o_init.c | 2 +- src/objnam.c | 2 +- src/pager.c | 4 ++-- src/polyself.c | 4 ++-- src/potion.c | 10 +++++----- src/pray.c | 2 +- src/read.c | 4 ++-- src/rumors.c | 2 +- src/save.c | 4 ++-- src/shk.c | 4 ++-- src/spell.c | 4 ++-- src/steed.c | 4 ++-- src/teleport.c | 6 +++--- src/weapon.c | 2 +- sys/share/pcmain.c | 2 +- sys/share/pcunix.c | 4 ++-- sys/unix/unixmain.c | 2 +- sys/unix/unixunix.c | 2 +- sys/vms/vmsmain.c | 2 +- sys/windows/windmain.c | 6 +++--- win/Qt/qt_msg.h | 2 +- win/Qt/qt_pre.h | 1 - 34 files changed, 57 insertions(+), 59 deletions(-) diff --git a/include/hack.h b/include/hack.h index 27c8e0bcf..7fe0d7990 100644 --- a/include/hack.h +++ b/include/hack.h @@ -447,13 +447,13 @@ typedef uint32_t mmflags_nht; /* makemon MM_ flags */ #define MMOVE_NOMOVES 4 /* monster has no valid locations to move to */ /*** some utility macros ***/ -#define yn(query) yn_function(query, ynchars, 'n', TRUE) +#define y_n(query) yn_function(query, ynchars, 'n', TRUE) #define ynq(query) yn_function(query, ynqchars, 'q', TRUE) #define ynaq(query) yn_function(query, ynaqchars, 'y', TRUE) #define nyaq(query) yn_function(query, ynaqchars, 'n', TRUE) #define nyNaq(query) yn_function(query, ynNaqchars, 'n', TRUE) #define ynNaq(query) yn_function(query, ynNaqchars, 'y', TRUE) -/* YN() is same as yn() except doesn't save the response in do-again buffer */ +/* YN() is same as y_n() except doesn't save the response in do-again buffer */ #define YN(query) yn_function(query, ynchars, 'n', FALSE) /* Macros for scatter */ diff --git a/outdated/sys/be/bemain.c b/outdated/sys/be/bemain.c index 060f662b7..f08ababf6 100644 --- a/outdated/sys/be/bemain.c +++ b/outdated/sys/be/bemain.c @@ -85,7 +85,7 @@ attempt_restore: if (discover) You("are in non-scoring discovery mode."); if (discover || wizard) { - if (yn("Do you want to keep the save file?") == 'n') + if (y_n("Do you want to keep the save file?") == 'n') (void) delete_savefile(); else { nh_compress(fqname(gs.SAVEF, SAVEPREFIX, 0)); diff --git a/outdated/sys/mac/macmain.c b/outdated/sys/mac/macmain.c index 65fbe6273..91b677df5 100644 --- a/outdated/sys/mac/macmain.c +++ b/outdated/sys/mac/macmain.c @@ -99,7 +99,7 @@ attempt_restore: if (discover) You("are in non-scoring discovery mode."); if (discover || wizard) { - if (yn("Do you want to keep the save file?") == 'n') + if (y_n("Do you want to keep the save file?") == 'n') (void) delete_savefile(); else { nh_compress(fqname(gs.SAVEF, SAVEPREFIX, 0)); diff --git a/outdated/win/Qt3/qt3_win.cpp b/outdated/win/Qt3/qt3_win.cpp index bfa28d7f9..0613b214d 100644 --- a/outdated/win/Qt3/qt3_win.cpp +++ b/outdated/win/Qt3/qt3_win.cpp @@ -70,7 +70,6 @@ extern "C" { #undef max #undef alloc #undef lock -#undef yn } diff --git a/src/apply.c b/src/apply.c index cc0217d94..9b8804ff0 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1370,7 +1370,7 @@ use_candle(struct obj **optr) if ((q = strstri(qbuf, " to\033")) != 0) Strcpy(q, " to "); /* last, format final "attach candles to candelabrum?" query */ - if (yn(safe_qbuf(qbuf, qbuf, "?", otmp, yname, thesimpleoname, "it")) + if (y_n(safe_qbuf(qbuf, qbuf, "?", otmp, yname, thesimpleoname, "it")) == 'n') { use_lamp(obj); return; @@ -2776,7 +2776,7 @@ use_trap(struct obj *otmp) You("aren't very skilled at reaching from %s.", mon_nam(u.usteed)); Sprintf(buf, "Continue your attempt to set %s?", the(trapname(ttyp, FALSE))); - if (yn(buf) == 'y') { + if (y_n(buf) == 'y') { if (chance) { switch (ttyp) { case LANDMINE: /* set it off */ diff --git a/src/bones.c b/src/bones.c index d5920ccca..d986d22c1 100644 --- a/src/bones.c +++ b/src/bones.c @@ -415,7 +415,7 @@ savebones(int how, time_t when, struct obj *corpse) if (nhfp) { close_nhfile(nhfp); if (wizard) { - if (yn("Bones file already exists. Replace it?") == 'y') { + if (y_n("Bones file already exists. Replace it?") == 'y') { if (delete_bonesfile(&u.uz)) goto make_bones; else @@ -620,7 +620,7 @@ getbones(void) } else { ok = TRUE; if (wizard) { - if (yn("Get bones?") == 'n') { + if (y_n("Get bones?") == 'n') { close_nhfile(nhfp); compress_bonesfile(); return 0; @@ -679,7 +679,7 @@ getbones(void) u.uroleplay.numbones++; if (wizard) { - if (yn("Unlink bones?") == 'n') { + if (y_n("Unlink bones?") == 'n') { compress_bonesfile(); return ok; } diff --git a/src/cmd.c b/src/cmd.c index 823f7490a..4d1fa6c81 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -6604,7 +6604,7 @@ paranoid_query(boolean be_paranoid, const char *prompt) promptprefix = "\"Yes\" or \"No\": "; } while (ParanoidConfirm && strcmpi(ans, "no") && --trylimit); } else { - confirmed_ok = (yn(prompt) == 'y'); + confirmed_ok = (y_n(prompt) == 'y'); } return confirmed_ok; } diff --git a/src/do.c b/src/do.c index 959d16674..6f639dbd9 100644 --- a/src/do.c +++ b/src/do.c @@ -1125,7 +1125,7 @@ dodown(void) if (on_level(&valley_level, &u.uz) && !u.uevent.gehennom_entered) { You("are standing at the gate to Gehennom."); pline("Unspeakable cruelty and harm lurk down there."); - if (yn("Are you sure you want to enter?") != 'y') + if (y_n("Are you sure you want to enter?") != 'y') return ECMD_OK; pline("So be it."); u.uevent.gehennom_entered = 1; /* don't ask again */ @@ -1145,7 +1145,7 @@ dodown(void) You("don't fit %s easily.", down_or_thru); Sprintf(qbuf, "Try to squeeze %s?", down_or_thru); - if (yn(qbuf) == 'y') { + if (y_n(qbuf) == 'y') { if (!rn2(3)) { actn = "manage to squeeze"; losehp(Maybe_Half_Phys(rnd(4)), @@ -1223,7 +1223,7 @@ doup(void) if (ledger_no(&u.uz) == 1) { if (iflags.debug_fuzzer) return ECMD_OK; - if (yn("Beware, there will be no return! Still climb?") != 'y') + if (y_n("Beware, there will be no return! Still climb?") != 'y') return ECMD_OK; } if (!next_to_u()) { diff --git a/src/eat.c b/src/eat.c index fd989b56d..88f05ca2f 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1490,7 +1490,7 @@ consume_tin(const char *mesg) what = the(what); pline("It smells like %s.", what); - if (yn("Eat it?") == 'n') { + if (y_n("Eat it?") == 'n') { if (Verbose(0, consume_tin1)) You("discard the open tin."); if (!Hallucination) @@ -1546,7 +1546,7 @@ consume_tin(const char *mesg) tin->dknown = tin->known = 1; } - if (yn("Eat it?") == 'n') { + if (y_n("Eat it?") == 'n') { if (Verbose(0, consume_tin2)) You("discard the open tin."); tin = costly_tin(COST_OPEN); diff --git a/src/fountain.c b/src/fountain.c index 6a066f059..eab56f12e 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -203,7 +203,7 @@ dryup(coordxy x, coordxy y, boolean isyou) return; } if (isyou && wizard) { - if (yn("Dry up fountain?") == 'n') + if (y_n("Dry up fountain?") == 'n') return; } /* FIXME: sight-blocking clouds should use block_point() when diff --git a/src/lock.c b/src/lock.c index 46d2576df..824a37683 100644 --- a/src/lock.c +++ b/src/lock.c @@ -107,7 +107,7 @@ picklock(void) /* unfortunately we don't have a 'tknown' flag to record "known to be trapped" so declining to disarm and then retrying lock manipulation will find it all over again */ - if (yn("You find a trap! Do you want to try to disarm it?") == 'y') { + if (y_n("You find a trap! Do you want to try to disarm it?") == 'y') { const char *what; boolean alreadyunlocked; diff --git a/src/mhitu.c b/src/mhitu.c index 59a946488..0658c2287 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1861,7 +1861,7 @@ doseduce(struct monst *mon) " looks pretty. May I have it?\"", ring, xname, simpleonames, "ring"); makeknown(RIN_ADORNMENT); - if (yn(qbuf) == 'n') + if (y_n(qbuf) == 'n') continue; } else pline("%s decides she'd like %s, and takes it.", @@ -1891,7 +1891,7 @@ doseduce(struct monst *mon) " looks pretty. Would you wear it for me?\"", ring, xname, simpleonames, "ring"); makeknown(RIN_ADORNMENT); - if (yn(qbuf) == 'n') + if (y_n(qbuf) == 'n') continue; } else { pline("%s decides you'd look prettier wearing %s,", @@ -2143,7 +2143,7 @@ mayberem(struct monst *mon, } else if (rn2(20) < ACURR(A_CHA)) { Sprintf(qbuf, "\"Shall I remove your %s, %s?\"", str, (!rn2(2) ? "lover" : !rn2(2) ? "dear" : "sweetheart")); - if (yn(qbuf) == 'n') + if (y_n(qbuf) == 'n') return; } else { char hairbuf[BUFSZ]; diff --git a/src/o_init.c b/src/o_init.c index 5a93fa985..d9902248f 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -887,7 +887,7 @@ doclassdisco(void) but requires at least one artifact discovery for other styles [could fix that by forcing the 'a' choice into the pick-class menu when running in wizard mode] */ - if (wizard && yn("Dump information about all artifacts?") == 'y') { + if (wizard && y_n("Dump information about all artifacts?") == 'y') { dump_artifact_info(tmpwin); ct = NROFARTIFACTS; /* non-zero vs zero is what matters below */ break; diff --git a/src/objnam.c b/src/objnam.c index db089f7c4..d7e2eb40e 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -4611,7 +4611,7 @@ readobjnam(char *bp, struct obj *no_wish) rn1cnt = 6 - d.gsize; if (d.cnt > rn1cnt && (!wizard || gp.program_state.wizkit_wishing - || yn("Override glob weight limit?") != 'y')) + || y_n("Override glob weight limit?") != 'y')) d.cnt = rn1cnt; d.otmp->owt *= (unsigned) d.cnt; } diff --git a/src/pager.c b/src/pager.c index fd7d1bd36..59e7489cf 100644 --- a/src/pager.c +++ b/src/pager.c @@ -904,7 +904,7 @@ checkfile(char *inp, struct permonst *pm, boolean user_typed_name, (int) (sizeof question - 1 - (strlen(question) + 2))); Strcat(question, "\"?"); - if (yn(question) == 'y') + if (y_n(question) == 'y') yes_to_moreinfo = TRUE; } @@ -1868,7 +1868,7 @@ do_supplemental_info(char *name, struct permonst *pm, boolean without_asking) copynchars(eos(question), entrytext, (int) (sizeof question - 1 - (strlen(question) + 2))); Strcat(question, "\"?"); - if (yn(question) == 'y') + if (y_n(question) == 'y') yes_to_moreinfo = TRUE; } if (yes_to_moreinfo) { diff --git a/src/polyself.c b/src/polyself.c index 0c9141701..379101353 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -626,7 +626,7 @@ polyself(int psflags) if (controllable_poly) { Sprintf(buf, "Become %s?", an(pmname(&mons[mntmp], gvariant))); - if (yn(buf) != 'y') + if (y_n(buf) != 'y') return; } } @@ -1559,7 +1559,7 @@ dogaze(void) Sprintf(qbuf, "Really %s %s?", (adtyp == AD_CONF) ? "confuse" : "attack", mon_nam(mtmp)); - if (yn(qbuf) != 'y') + if (y_n(qbuf) != 'y') continue; } setmangry(mtmp, TRUE); diff --git a/src/potion.c b/src/potion.c index a728ccfa4..3b4a55995 100644 --- a/src/potion.c +++ b/src/potion.c @@ -538,7 +538,7 @@ dodrink(void) if (IS_FOUNTAIN(levl[u.ux][u.uy].typ) /* not as low as floor level but similar restrictions apply */ && can_reach_floor(FALSE)) { - if (yn("Drink from the fountain?") == 'y') { + if (y_n("Drink from the fountain?") == 'y') { drinkfountain(); return ECMD_TIME; } @@ -548,7 +548,7 @@ dodrink(void) if (IS_SINK(levl[u.ux][u.uy].typ) /* not as low as floor level but similar restrictions apply */ && can_reach_floor(FALSE)) { - if (yn("Drink from the sink?") == 'y') { + if (y_n("Drink from the sink?") == 'y') { drinksink(); return ECMD_TIME; } @@ -556,7 +556,7 @@ dodrink(void) } /* Or are you surrounded by water? */ if (Underwater && !u.uswallow) { - if (yn("Drink the water around you?") == 'y') { + if (y_n("Drink the water around you?") == 'y') { pline("Do you know what lives in this water?"); return ECMD_TIME; } @@ -2248,7 +2248,7 @@ dodip(void) Snprintf(qbuf, sizeof(qbuf), "%s%s into the fountain?", Dip_, Verbose(3, dodip1) ? obuf : shortestname); /* "Dip into the fountain?" */ - if (yn(qbuf) == 'y') { + if (y_n(qbuf) == 'y') { obj->pickup_prev = 0; dipfountain(obj); return ECMD_TIME; @@ -2260,7 +2260,7 @@ dodip(void) Snprintf(qbuf, sizeof(qbuf), "%s%s into the %s?", Dip_, Verbose(3, dodip2) ? obuf : shortestname, pooltype); /* "Dip into the {pool, moat, &c}?" */ - if (yn(qbuf) == 'y') { + if (y_n(qbuf) == 'y') { if (Levitation) { floating_above(pooltype); } else if (u.usteed && !is_swimmer(u.usteed->data) diff --git a/src/pray.c b/src/pray.c index 2eda2f7fc..86aecc06e 100644 --- a/src/pray.c +++ b/src/pray.c @@ -2044,7 +2044,7 @@ dopray(void) from the do-again buffer, so need to suppress this response too; otherwise subsequent ^A would use this answer for "are you sure?" and bypass confirmation */ - if ((ParanoidPray ? YN(forcesuccess) : yn(forcesuccess)) == 'y') { + if ((ParanoidPray ? YN(forcesuccess) : y_n(forcesuccess)) == 'y') { u.ublesscnt = 0; if (u.uluck < 0) u.uluck = 0; diff --git a/src/read.c b/src/read.c index 2c74ab965..144508c41 100644 --- a/src/read.c +++ b/src/read.c @@ -583,7 +583,7 @@ doread(void) maintained illiterate conduct so far, and this mail scroll didn't come from bones, ask for confirmation */ if (!u.uconduct.literate) { - if (!scroll->spe && yn( + if (!scroll->spe && y_n( "Reading mail will violate \"illiterate\" conduct. Read anyway?" ) != 'y') return ECMD_OK; @@ -3064,7 +3064,7 @@ create_particular_creation( Sprintf(buf, "Creating %s instead; force %s?", mons[d->which].pmnames[NEUTRAL], mons[firstchoice].pmnames[NEUTRAL]); - if (yn(buf) == 'y') + if (y_n(buf) == 'y') d->which = firstchoice; } whichpm = &mons[d->which]; diff --git a/src/rumors.c b/src/rumors.c index 883621261..8b41a3feb 100644 --- a/src/rumors.c +++ b/src/rumors.c @@ -715,7 +715,7 @@ doconsult(struct monst *oracl) return ECMD_OK; Sprintf(qbuf, "\"Then dost thou desire a major one?\" (%d %s)", major_cost, currency((long) major_cost)); - if (yn(qbuf) != 'y') + if (y_n(qbuf) != 'y') return ECMD_OK; u_pay = (umoney < (long) major_cost) ? (int) umoney : major_cost; break; diff --git a/src/save.c b/src/save.c index d6a512ecc..3266f4a3c 100644 --- a/src/save.c +++ b/src/save.c @@ -51,7 +51,7 @@ int dosave(void) { clear_nhwindow(WIN_MESSAGE); - if (yn("Really save?") == 'n') { + if (y_n("Really save?") == 'n') { clear_nhwindow(WIN_MESSAGE); if (gm.multi > 0) nomul(0); @@ -118,7 +118,7 @@ dosave0(void) close_nhfile(nhfp); clear_nhwindow(WIN_MESSAGE); There("seems to be an old save file."); - if (yn("Overwrite the old file?") == 'n') { + if (y_n("Overwrite the old file?") == 'n') { nh_compress(fq_save); goto done; } diff --git a/src/shk.c b/src/shk.c index e4a376600..ee321282a 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1751,7 +1751,7 @@ dopayobj( (void) safe_qbuf(qbuf, (char *) 0, qsfx, obj, (quan == 1L) ? Doname2 : doname, ansimpleoname, (quan == 1L) ? "that" : "those"); - if (yn(qbuf) == 'n') { + if (y_n(qbuf) == 'n') { buy = PAY_SKIP; /* don't want to buy */ } else if (quan < bp->bquan && !consumed) { /* partly used goods */ obj->quan = bp->bquan - save_quan; /* used up amount */ @@ -4492,7 +4492,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify) Sprintf(qbuf, "%sYou did %ld %s worth of damage!%s Pay?", !animal ? cad(TRUE) : "", cost_of_damage, currency(cost_of_damage), !animal ? "\"" : ""); - if (yn(qbuf) != 'n') { + if (y_n(qbuf) != 'n') { boolean is_seen, was_seen = canseemon(shkp), was_outside = !inhishop(shkp); coordxy sx = shkp->mx, sy = shkp->my; diff --git a/src/spell.c b/src/spell.c index 00bb28eb3..f4c2e8a02 100644 --- a/src/spell.c +++ b/src/spell.c @@ -543,7 +543,7 @@ study_book(register struct obj* spellbook) /* hero has just been told what spell this book is for; it may have been undiscovered if spell was learned via divine gift */ makeknown(booktype); - if (yn("Refresh your memory anyway?") == 'n') + if (y_n("Refresh your memory anyway?") == 'n') return 0; } @@ -565,7 +565,7 @@ study_book(register struct obj* spellbook) Sprintf(qbuf, "This spellbook is %sdifficult to comprehend. Continue?", (read_ability < 12 ? "very " : "")); - if (yn(qbuf) != 'y') { + if (y_n(qbuf) != 'y') { spellbook->in_use = FALSE; return 1; } diff --git a/src/steed.c b/src/steed.c index b9891a944..99a7eb101 100644 --- a/src/steed.c +++ b/src/steed.c @@ -170,7 +170,7 @@ doride(void) if (u.usteed) { dismount_steed(DISMOUNT_BYCHOICE); } else if (getdir((char *) 0) && isok(u.ux + u.dx, u.uy + u.dy)) { - if (wizard && yn("Force the mount to succeed?") == 'y') + if (wizard && y_n("Force the mount to succeed?") == 'y') forcemount = TRUE; return (mount_steed(m_at(u.ux + u.dx, u.uy + u.dy), forcemount) ? ECMD_TIME : ECMD_OK); @@ -220,7 +220,7 @@ mount_steed( legs_in_no_shape("riding", FALSE); Sprintf(qbuf, "Heal your leg%s?", ((HWounded_legs & BOTH_SIDES) == BOTH_SIDES) ? "s" : ""); - if (force && wizard && yn(qbuf) == 'y') + if (force && wizard && y_n(qbuf) == 'y') heal_legs(0); else return (FALSE); diff --git a/src/teleport.c b/src/teleport.c index 77def1b31..a9039cc20 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -565,7 +565,7 @@ scrolltele(struct obj* scroll) You_feel("disoriented for a moment."); /* don't discover the scroll [at least not yet for wizard override]; disorientation doesn't reveal that this is a teleport attempt */ - if (!wizard || yn("Override?") != 'y') + if (!wizard || y_n("Override?") != 'y') return; } if (((Teleport_control || (scroll && scroll->blessed)) && !Stunned) @@ -738,7 +738,7 @@ dotele( if (trap) { if (trap->ttyp == LEVEL_TELEP && trap->tseen) { - if (yn("There is a level teleporter here. Trigger it?") == 'y') { + if (y_n("There is a level teleporter here. Trigger it?") == 'y') { level_tele_trap(trap, FORCETRAP); /* deliberate jumping will always take time even if it doesn't * work */ @@ -749,7 +749,7 @@ dotele( trap_once = trap->once; /* trap may get deleted, save this */ if (trap->once) { pline("This is a vault teleport, usable once only."); - if (yn("Jump in?") == 'n') { + if (y_n("Jump in?") == 'n') { trap = 0; } else { deltrap(trap); diff --git a/src/weapon.c b/src/weapon.c index d77eba458..7f2308669 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -1172,7 +1172,7 @@ enhance_weapon_skill(void) /* player knows about #enhance, don't show tip anymore */ gc.context.enhance_tip = TRUE; - if (wizard && yn("Advance skills without practice?") == 'y') + if (wizard && y_n("Advance skills without practice?") == 'y') speedy = TRUE; do { diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 764ae8f94..2a7464755 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -472,7 +472,7 @@ attempt_restore: if (discover) You("are in non-scoring discovery mode."); if (discover || wizard) { - if (yn("Do you want to keep the save file?") == 'n') + if (y_n("Do you want to keep the save file?") == 'n') (void) delete_savefile(); else { nh_compress(fqname(gs.SAVEF, SAVEPREFIX, 0)); diff --git a/sys/share/pcunix.c b/sys/share/pcunix.c index 582dbb93f..8bccd1184 100644 --- a/sys/share/pcunix.c +++ b/sys/share/pcunix.c @@ -136,13 +136,13 @@ getlock(void) if (iflags.window_inited) { #ifdef SELF_RECOVER - c = yn("There are files from a game in progress under your name. " + c = y_n("There are files from a game in progress under your name. " "Recover?"); #else pline("There is already a game in progress under your name."); pline("You may be able to use \"recover %s\" to get it back.\n", tbuf); - c = yn("Do you want to destroy the old game?"); + c = y_n("Do you want to destroy the old game?"); #endif } else { #if defined(MSDOS) && defined(NO_TERMS) diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index c9dc92f3f..01dcf220e 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -248,7 +248,7 @@ main(int argc, char *argv[]) wd_message(); if (discover || wizard) { /* this seems like a candidate for paranoid_confirmation... */ - if (yn("Do you want to keep the save file?") == 'n') { + if (y_n("Do you want to keep the save file?") == 'n') { (void) delete_savefile(); } else { (void) chmod(fq_save, FCMASK); /* back to readable */ diff --git a/sys/unix/unixunix.c b/sys/unix/unixunix.c index 46e44cc7c..6ac443fcf 100644 --- a/sys/unix/unixunix.c +++ b/sys/unix/unixunix.c @@ -169,7 +169,7 @@ getlock(void) if (iflags.window_inited) { /* this is a candidate for paranoid_confirmation */ - c = yn(destroy_old_game_prompt); + c = y_n(destroy_old_game_prompt); } else { (void) raw_printf("\n%s [yn] ", destroy_old_game_prompt); (void) fflush(stdout); diff --git a/sys/vms/vmsmain.c b/sys/vms/vmsmain.c index 37777af6e..a043c0149 100644 --- a/sys/vms/vmsmain.c +++ b/sys/vms/vmsmain.c @@ -207,7 +207,7 @@ attempt_restore: resuming = TRUE; /* not starting new game */ wd_message(); if (discover || wizard) { - if (yn("Do you want to keep the save file?") == 'n') + if (y_n("Do you want to keep the save file?") == 'n') (void) delete_savefile(); else (void) chmod(fq_save, FCMASK); /* back to readable */ diff --git a/sys/windows/windmain.c b/sys/windows/windmain.c index ef8b8517e..b92ec5164 100644 --- a/sys/windows/windmain.c +++ b/sys/windows/windmain.c @@ -697,7 +697,7 @@ attempt_restore: if (discover) You("are in non-scoring discovery mode."); if (discover || wizard) { - if (yn("Do you want to keep the save file?") == 'n') + if (y_n("Do you want to keep the save file?") == 'n') (void) delete_savefile(); else { nh_compress(fqname(gs.SAVEF, SAVEPREFIX, 0)); @@ -1466,7 +1466,7 @@ other_self_recover_prompt(void) c = 'n'; ct = 0; if (iflags.window_inited || WINDOWPORT(curses)) { - c = yn("There are files from a game in progress under your name. " + c = y_n("There are files from a game in progress under your name. " "Recover?"); } else { c = 'n'; @@ -1493,7 +1493,7 @@ other_self_recover_prompt(void) } if (pl == 1 && (c == 'n' || c == 'N')) { /* no to recover */ - c = yn("Are you sure you wish to destroy the old game, rather than try to " + c = y_n("Are you sure you wish to destroy the old game, rather than try to " "recover it? [yn] "); pl = 2; if (!ismswin && !iscurses) { diff --git a/win/Qt/qt_msg.h b/win/Qt/qt_msg.h index b3274bc13..11b2f54de 100644 --- a/win/Qt/qt_msg.h +++ b/win/Qt/qt_msg.h @@ -33,7 +33,7 @@ public: void RehighlightPrompt(); bool hilit_mesgs(); void unhighlight_mesgs(); - // for adding the answer for yn() to its prompt string + // for adding the answer for y_n() to its prompt string void AddToStr(const char *answerbuf); private: diff --git a/win/Qt/qt_pre.h b/win/Qt/qt_pre.h index b25c396b7..346e78136 100644 --- a/win/Qt/qt_pre.h +++ b/win/Qt/qt_pre.h @@ -11,7 +11,6 @@ #undef Warning #undef msleep #undef wizard -#undef yn #undef min #undef max