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

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