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.
This commit is contained in:
nhmall
2023-01-12 16:04:40 -05:00
parent 6e136c6f7d
commit ba5356603a
34 changed files with 57 additions and 59 deletions

View File

@@ -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));

View File

@@ -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)

View File

@@ -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 */

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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) {