From 9ac2c2c57677819cc807894d008077e733c97691 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Fri, 6 Sep 2002 00:12:44 +0000 Subject: [PATCH] > I'm working on a Nethack port, and one of the header files a > library uses has a structure with a member named "red". Since > includes/decl.h #defines red to something, this totally loses. > > Attached is a patch which fixes the color defines. --- include/decl.h | 20 ++++++++++---------- src/artifact.c | 4 ++-- src/do.c | 6 +++--- src/do_wear.c | 2 +- src/dokick.c | 2 +- src/eat.c | 2 +- src/mon.c | 2 +- src/potion.c | 6 +++--- src/pray.c | 26 +++++++++++++------------- src/read.c | 32 ++++++++++++++++---------------- src/spell.c | 2 +- src/timeout.c | 6 +++--- src/uhitm.c | 4 ++-- src/wield.c | 2 +- src/wizard.c | 2 +- 15 files changed, 59 insertions(+), 59 deletions(-) diff --git a/include/decl.h b/include/decl.h index 996277027..01f80428d 100644 --- a/include/decl.h +++ b/include/decl.h @@ -270,16 +270,16 @@ E NEARDATA struct c_color_names { *const c_silver, *const c_blue, *const c_purple, *const c_white; } c_color_names; -#define Black c_color_names.c_black -#define amber c_color_names.c_amber -#define golden c_color_names.c_golden -#define light_blue c_color_names.c_light_blue -#define red c_color_names.c_red -#define green c_color_names.c_green -#define silver c_color_names.c_silver -#define blue c_color_names.c_blue -#define purple c_color_names.c_purple -#define White c_color_names.c_white +#define NH_BLACK c_color_names.c_black +#define NH_AMBER c_color_names.c_amber +#define NH_GOLDEN c_color_names.c_golden +#define NH_LIGHT_BLUE c_color_names.c_light_blue +#define NH_RED c_color_names.c_red +#define NH_GREEN c_color_names.c_green +#define NH_SILVER c_color_names.c_silver +#define NH_BLUE c_color_names.c_blue +#define NH_PURPLE c_color_names.c_purple +#define NH_WHITE c_color_names.c_white /* The names of the colors used for gems, etc. */ E const char *c_obj_colors[]; diff --git a/src/artifact.c b/src/artifact.c index da806018a..43b008c72 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1044,7 +1044,7 @@ int dieroll; /* needed for Magicbane and vorpal blades */ if (vis) { if(otmp->oartifact == ART_STORMBRINGER) pline_The("%s blade draws the life from %s!", - hcolor(Black), + hcolor(NH_BLACK), mon_nam(mdef)); else pline("%s draws the life from %s!", @@ -1071,7 +1071,7 @@ int dieroll; /* needed for Magicbane and vorpal blades */ "unholy blade" : "object"); else if (otmp->oartifact == ART_STORMBRINGER) pline_The("%s blade drains your life!", - hcolor(Black)); + hcolor(NH_BLACK)); else pline("%s drains your life!", The(distant_name(otmp, xname))); diff --git a/src/do.c b/src/do.c index 9c643913d..c0d44f91e 100644 --- a/src/do.c +++ b/src/do.c @@ -213,7 +213,7 @@ doaltarobj(obj) /* obj is an object dropped on an altar */ if ((obj->blessed || obj->cursed) && obj->oclass != COIN_CLASS) { There("is %s flash as %s %s the altar.", - an(hcolor(obj->blessed ? amber : Black)), + an(hcolor(obj->blessed ? NH_AMBER : NH_BLACK)), doname(obj), otense(obj, "hit")); if (!Hallucination) obj->bknown = 1; } else { @@ -345,10 +345,10 @@ giveback: break; case RIN_PROTECTION: pline_The("sink glows %s for a moment.", - hcolor((obj->spe<0) ? Black : silver)); + hcolor((obj->spe<0) ? NH_BLACK : NH_SILVER)); break; case RIN_WARNING: - pline_The("sink glows %s for a moment.", hcolor(White)); + pline_The("sink glows %s for a moment.", hcolor(NH_WHITE)); break; case RIN_TELEPORTATION: pline_The("sink momentarily vanishes."); diff --git a/src/do_wear.c b/src/do_wear.c index 1da405855..7afc3123f 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -321,7 +321,7 @@ Helmet_on() pline("%s for a moment.", Tobjnam(uarmh, "vibrate")); else pline("%s %s for a moment.", - Tobjnam(uarmh, "glow"), hcolor(Black)); + Tobjnam(uarmh, "glow"), hcolor(NH_BLACK)); curse(uarmh); } flags.botl = 1; /* reveal new alignment or INT & WIS */ diff --git a/src/dokick.c b/src/dokick.c index 327041fb5..6c9af6d22 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -912,7 +912,7 @@ dokick() You_hear("a gushing sound."); else pline("A %s ooze gushes up from the drain!", - hcolor(Black)); + hcolor(NH_BLACK)); (void) makemon(&mons[PM_BLACK_PUDDING], x, y, NO_MM_FLAGS); exercise(A_DEX, TRUE); diff --git a/src/eat.c b/src/eat.c index 02f9e4edc..00bb2e0cf 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1037,7 +1037,7 @@ opentin() /* called during each move whilst opening a tin */ } else { if (tin.tin->cursed) pline("It contains some decaying%s%s substance.", - Blind ? "" : " ", Blind ? "" : hcolor(green)); + Blind ? "" : " ", Blind ? "" : hcolor(NH_GREEN)); else pline("It contains spinach."); diff --git a/src/mon.c b/src/mon.c index 8b04754d6..f01cf85ab 100644 --- a/src/mon.c +++ b/src/mon.c @@ -286,7 +286,7 @@ warn_effects() if(!Blind && uwep && (warnlevel > lastwarnlev || moves > lastwarntime + warnDelay)) { Your("%s %s!", aobjnam(uwep, "glow"), - hcolor(light_blue)); + hcolor(NH_LIGHT_BLUE)); lastwarnlev = warnlevel; lastwarntime = moves; } diff --git a/src/potion.c b/src/potion.c index 7895526ea..466aa3e0c 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1571,7 +1571,7 @@ dodip() pline("%s %s %s.", Your_buf, aobjnam(obj, "softly glow"), - hcolor(amber)); + hcolor(NH_AMBER)); uncurse(obj); obj->bknown=1; poof: @@ -1582,7 +1582,7 @@ dodip() return(1); } else if(!obj->blessed) { if (useeit) { - tmp = hcolor(light_blue); + tmp = hcolor(NH_LIGHT_BLUE); pline("%s %s with a%s %s aura.", Your_buf, aobjnam(obj, "softly glow"), @@ -1604,7 +1604,7 @@ dodip() goto poof; } else if(!obj->cursed) { if (useeit) { - tmp = hcolor(Black); + tmp = hcolor(NH_BLACK); pline("%s %s with a%s %s aura.", Your_buf, aobjnam(obj, "glow"), diff --git a/src/pray.c b/src/pray.c index d39937484..7af5961b4 100644 --- a/src/pray.c +++ b/src/pray.c @@ -337,7 +337,7 @@ decurse: Your("%s %s.", what ? what : (const char *)aobjnam(otmp, "softly glow"), - hcolor(amber)); + hcolor(NH_AMBER)); update_inventory(); break; case TROUBLE_POISONED: @@ -445,7 +445,7 @@ aligntyp resp_god; if (!Disint_resistance) fry_by_god(resp_god); else { - You("bask in its %s glow for a minute...", Black); + You("bask in its %s glow for a minute...", NH_BLACK); godvoice(resp_god, "I believe it not!"); } if (Is_astralevel(&u.uz) || Is_sanctum(&u.uz)) { @@ -517,7 +517,7 @@ aligntyp resp_god; case 5: gods_angry(resp_god); if (!Blind && !Antimagic) pline("%s glow surrounds you.", - An(hcolor(Black))); + An(hcolor(NH_BLACK))); rndcurse(); break; case 7: @@ -664,7 +664,7 @@ gcrownu() { char swordbuf[BUFSZ]; - Sprintf(swordbuf, "%s sword", hcolor(Black)); + Sprintf(swordbuf, "%s sword", hcolor(NH_BLACK)); if (class_gift != STRANGE_OBJECT) { ; /* already got bonus above */ } else if (in_hand) { @@ -785,7 +785,7 @@ pleased(g_align) uwep->bknown = TRUE; if (!Blind) Your("%s %s%s.", aobjnam(uwep, "softly glow"), - hcolor(amber), repair_buf); + hcolor(NH_AMBER), repair_buf); else You_feel("the power of %s over your %s.", u_gname(), xname(uwep)); *repair_buf = '\0'; @@ -795,7 +795,7 @@ pleased(g_align) if (!Blind) Your("%s with %s aura%s.", aobjnam(uwep, "softly glow"), - an(hcolor(light_blue)), repair_buf); + an(hcolor(NH_LIGHT_BLUE)), repair_buf); else You_feel("the blessing of %s over your %s.", u_gname(), xname(uwep)); *repair_buf = '\0'; @@ -835,7 +835,7 @@ pleased(g_align) /* Otherwise, falls into next case */ case 2: if (!Blind) - You("are surrounded by %s glow.", an(hcolor(golden))); + You("are surrounded by %s glow.", an(hcolor(NH_GOLDEN))); /* if any levels have been lost (and not yet regained), treat this effect like blessed full healing */ if (u.ulevel < u.ulevelmax) { @@ -860,13 +860,13 @@ pleased(g_align) if (Blind) You_feel("the power of %s.", u_gname()); else You("are surrounded by %s aura.", - an(hcolor(light_blue))); + an(hcolor(NH_LIGHT_BLUE))); for(otmp=invent; otmp; otmp=otmp->nobj) { if (otmp->cursed) { uncurse(otmp); if (!Blind) { Your("%s %s.", aobjnam(otmp, "softly glow"), - hcolor(amber)); + hcolor(NH_AMBER)); otmp->bknown = TRUE; ++any; } @@ -973,7 +973,7 @@ water_prayer(bless_water) ((other && changed > 1L) ? "Some of the" : (other ? "One of the" : "The")), ((other || changed > 1L) ? "s" : ""), (changed > 1L ? "" : "s"), - (bless_water ? hcolor(light_blue) : hcolor(Black))); + (bless_water ? hcolor(NH_LIGHT_BLUE) : hcolor(NH_BLACK))); } return((boolean)(changed > 0L)); } @@ -1109,7 +1109,7 @@ dosacrifice() if (altaralign == A_CHAOTIC && u.ualign.type != A_CHAOTIC) { pline( "The blood floods the altar, which vanishes in %s cloud!", - an(hcolor(Black))); + an(hcolor(NH_BLACK))); levl[u.ux][u.uy].typ = ROOM; levl[u.ux][u.uy].altarmask = 0; if(Invisible) newsym(u.ux, u.uy); @@ -1311,8 +1311,8 @@ verbalize("In return for thy service, I grant thee the gift of Immortality!"); if (!Blind) pline_The("altar glows %s.", hcolor( - u.ualign.type == A_LAWFUL ? White : - u.ualign.type ? Black : (const char *)"gray")); + u.ualign.type == A_LAWFUL ? NH_WHITE : + u.ualign.type ? NH_BLACK : (const char *)"gray")); if (rnl(u.ulevel) > 6 && u.ualign.record > 0 && rnd(u.ualign.record) > (3*ALIGNLIM)/4) diff --git a/src/read.c b/src/read.c index d72cb3749..c80d7dada 100644 --- a/src/read.c +++ b/src/read.c @@ -270,7 +270,7 @@ int curse_bless; wand_explode(obj); return; } - if (obj->spe >= lim) p_glow2(obj,blue); + if (obj->spe >= lim) p_glow2(obj, NH_BLUE); else p_glow1(obj); } @@ -341,7 +341,7 @@ int curse_bless; else obj->spe += n; } - p_glow2(obj,blue); + p_glow2(obj, NH_BLUE); } else { n = rn1(5,10); /* 5..15 */ if (obj->spe + n <= 50) @@ -353,7 +353,7 @@ int curse_bless; else obj->spe += n; } - p_glow2(obj,White); + p_glow2(obj, NH_WHITE); } break; case OIL_LAMP: @@ -368,7 +368,7 @@ int curse_bless; } else if (is_blessed) { obj->spe = 1; obj->age = 1500; - p_glow2(obj,blue); + p_glow2(obj, NH_BLUE); } else { obj->spe = 1; obj->age += 750; @@ -380,7 +380,7 @@ int curse_bless; if (is_cursed) stripspe(obj); else if (is_blessed) { obj->spe = 6; - p_glow2(obj,blue); + p_glow2(obj, NH_BLUE); } else { if (obj->spe < 5) { obj->spe++; @@ -397,7 +397,7 @@ int curse_bless; obj->spe += rn1(10, 6); else obj->spe += rn1(5, 6); if (obj->spe > 50) obj->spe = 50; - p_glow2(obj,blue); + p_glow2(obj, NH_BLUE); } else { obj->spe += rnd(5); if (obj->spe > 50) obj->spe = 50; @@ -414,7 +414,7 @@ int curse_bless; } else if (is_blessed) { obj->spe += d(2,4); if (obj->spe > 20) obj->spe = 20; - p_glow2(obj,blue); + p_glow2(obj, NH_BLUE); } else { obj->spe += rnd(4); if (obj->spe > 20) obj->spe = 20; @@ -698,7 +698,7 @@ register struct obj *sobj; Your("%s %s covered by a %s %s %s!", xname(otmp), otense(otmp, "are"), sobj->cursed ? "mottled" : "shimmering", - hcolor(sobj->cursed ? Black : golden), + hcolor(sobj->cursed ? NH_BLACK : NH_GOLDEN), sobj->cursed ? "glow" : (is_shield(otmp) ? "layer" : "shield")); } @@ -732,7 +732,7 @@ register struct obj *sobj; otense(otmp, Blind ? "vibrate" : "glow"), (!Blind && !same_color) ? " " : nul, (Blind || same_color) ? nul : - hcolor(sobj->cursed ? Black : silver), + hcolor(sobj->cursed ? NH_BLACK : NH_SILVER), otense(otmp, "evaporate")); if(is_cloak(otmp)) (void) Cloak_off(); if(is_boots(otmp)) (void) Boots_off(); @@ -768,7 +768,7 @@ register struct obj *sobj; s == 0 ? "violently " : nul, otense(otmp, Blind ? "vibrate" : "glow"), (!Blind && !same_color) ? " " : nul, - (Blind || same_color) ? nul : hcolor(sobj->cursed ? Black : silver), + (Blind || same_color) ? nul : hcolor(sobj->cursed ? NH_BLACK : NH_SILVER), (s*s>1) ? "while" : "moment"); otmp->cursed = sobj->cursed; if (!otmp->blessed || sobj->cursed) @@ -797,7 +797,7 @@ register struct obj *sobj; return(1); } otmp->oerodeproof = sobj->cursed; - p_glow2(otmp,purple); + p_glow2(otmp, NH_PURPLE); break; } if(!sobj->cursed || !otmp || !otmp->cursed) { @@ -825,11 +825,11 @@ register struct obj *sobj; Your("%s begin to %s%s.", makeplural(body_part(HAND)), Blind ? "tingle" : "glow ", - Blind ? nul : hcolor(purple)); + Blind ? nul : hcolor(NH_PURPLE)); make_confused(HConfusion + rnd(100),FALSE); } else { pline("A %s%s surrounds your %s.", - Blind ? nul : hcolor(red), + Blind ? nul : hcolor(NH_RED), Blind ? "faint buzz" : " glow", body_part(HEAD)); make_confused(0L,TRUE); @@ -839,7 +839,7 @@ register struct obj *sobj; Your("%s%s %s%s.", makeplural(body_part(HAND)), Blind ? "" : " begin to glow", - Blind ? (const char *)"tingle" : hcolor(red), + Blind ? (const char *)"tingle" : hcolor(NH_RED), u.umconf ? " even more" : ""); u.umconf++; } else { @@ -851,7 +851,7 @@ register struct obj *sobj; Your("%s glow a%s brilliant %s.", makeplural(body_part(HAND)), u.umconf ? "n even more" : "", - hcolor(red)); + hcolor(NH_RED)); /* after a while, repeated uses become less effective */ if (u.umconf >= 40) u.umconf++; @@ -948,7 +948,7 @@ register struct obj *sobj; Your("%s covered by a %s %s %s!", aobjnam(uwep, "are"), sobj->cursed ? "mottled" : "shimmering", - hcolor(sobj->cursed ? purple : golden), + hcolor(sobj->cursed ? NH_PURPLE : NH_GOLDEN), sobj->cursed ? "glow" : "shield"); } if (uwep->oerodeproof && (uwep->oeroded || uwep->oeroded2)) { diff --git a/src/spell.c b/src/spell.c index baa5b5abc..924fea916 100644 --- a/src/spell.c +++ b/src/spell.c @@ -625,7 +625,7 @@ cast_protection() if (gain > 0) { if (!Blind) { - const char *hgolden = hcolor(golden); + const char *hgolden = hcolor(NH_GOLDEN); if (u.uspellprot) pline_The("%s haze around you becomes more dense.", diff --git a/src/timeout.c b/src/timeout.c index f23e5900f..a73a0d4b7 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -100,7 +100,7 @@ choke_dialogue() const char *str = choke_texts[SIZE(choke_texts)-i]; if (index(str, '%')) - pline(str, hcolor(blue)); + pline(str, hcolor(NH_BLUE)); else pline(str); } @@ -128,7 +128,7 @@ slime_dialogue() if (index(str, '%')) { if (i == 4L) { /* "you are turning green" */ if (!Blind) /* [what if you're already green?] */ - pline(str, hcolor(green)); + pline(str, hcolor(NH_GREEN)); } else pline(str, an(Hallucination ? rndmonnam() : "green slime")); } else @@ -202,7 +202,7 @@ nh_timeout() u.uspellprot--; find_ac(); if (!Blind) - Norep("The %s haze around you %s.", hcolor(golden), + Norep("The %s haze around you %s.", hcolor(NH_GOLDEN), u.uspellprot ? "becomes less dense" : "disappears"); } } diff --git a/src/uhitm.c b/src/uhitm.c index 4e1c1142f..bedf1733e 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -2283,13 +2283,13 @@ struct monst *mon; if (Blind) Your("%s stop tingling.", hands); else - Your("%s stop glowing %s.", hands, hcolor(red)); + Your("%s stop glowing %s.", hands, hcolor(NH_RED)); } else { if (Blind) pline_The("tingling in your %s lessens.", hands); else Your("%s no longer glow so brightly %s.", hands, - hcolor(red)); + hcolor(NH_RED)); } u.umconf--; } diff --git a/src/wield.c b/src/wield.c index f9f424a93..fad266953 100644 --- a/src/wield.c +++ b/src/wield.c @@ -620,7 +620,7 @@ chwepon(otmp, amount) register struct obj *otmp; register int amount; { - const char *color = hcolor((amount < 0) ? Black : blue); + const char *color = hcolor((amount < 0) ? NH_BLACK : NH_BLUE); const char *xtime; int otyp = STRANGE_OBJECT; diff --git a/src/wizard.c b/src/wizard.c index e6dbca12f..a49d7a247 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -528,7 +528,7 @@ intervene() break; case 2: if (!Blind) You("notice a %s glow surrounding you.", - hcolor(Black)); + hcolor(NH_BLACK)); rndcurse(); break; case 3: aggravate(); -- 2.40.0