]> granicus.if.org Git - nethack/commitdiff
<email deleted>
authornethack.allison <nethack.allison>
Fri, 6 Sep 2002 00:12:44 +0000 (00:12 +0000)
committernethack.allison <nethack.allison>
Fri, 6 Sep 2002 00:12:44 +0000 (00:12 +0000)
> 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.

15 files changed:
include/decl.h
src/artifact.c
src/do.c
src/do_wear.c
src/dokick.c
src/eat.c
src/mon.c
src/potion.c
src/pray.c
src/read.c
src/spell.c
src/timeout.c
src/uhitm.c
src/wield.c
src/wizard.c

index 99627702770e7e645f9773392d298f34805e0b7f..01f80428d728b8a96eb561a7558b111c338316d5 100644 (file)
@@ -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[];
index da806018a060909e8117228140e4b91dca9c8bd2..43b008c72de444eb707855c38cbc1798c0314ac1 100644 (file)
@@ -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)));
index 9c643913dcbab4df0dedec090d93ba15d5f9a7a9..c0d44f91ecdf13ce453dedfe54fd611fdcde48c6 100644 (file)
--- 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.");
index 1da405855d5781e288a71d4b9aa28d4c57c4ba4c..7afc3123f5e390f3b7b94a66d3fdfd4f59ca240f 100644 (file)
@@ -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 */
index 327041fb589a988cb199f4ba29fea89ff7d4f8fa..6c9af6d223f322da135a07f61845693bbafb8d55 100644 (file)
@@ -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);
index 02f9e4edcb83cec15de5b0a78e8721bbaa75104d..00bb2e0cf4320792e23679da2998a3e0ca2fd145 100644 (file)
--- 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.");
 
index 8b04754d62d58b976563691c653b08bd1abcad7a..f01cf85ab90aa3b49b620b55e89e2e8cdb1b2bcd 100644 (file)
--- 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;
        }
index 7895526eaeab70b008c4e288f7b5a1e951e8baa1..466aa3e0caeeaff6878054454e7c3630afc69354 100644 (file)
@@ -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"),
index d39937484c7bf3cb699d142a7011f47baaeda0fc..7af5961b40cbb133cb64a0857bc4712a7321390e 100644 (file)
@@ -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)
index d72cb37497c6c3cd8ee940c7f4dde364de51ec53..c80d7dadae85a6e40bc7fdbaac041b0c0a645452 100644 (file)
@@ -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)) {
index baa5b5abcafbc9ae1feb557e27d05001c22ae83d..924fea916558e3fb5ed1e867f61b4ae3af63045f 100644 (file)
@@ -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.",
index f23e5900ff52e0818b6e5e3d0950187234e60908..a73a0d4b746ee863fcaba1702d32886b53cdb4f9 100644 (file)
@@ -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");
            }
        }
index 4e1c1142f91a27a8f8688cb884bfff0cf6329e2e..bedf1733e35a206f3c9f4099b246bc12bdbc6308 100644 (file)
@@ -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--;
 }
index f9f424a9350e3b3f8dbd9575b7b4cb85ee6e7a96..fad266953090b487480c18cba8cfe36d64b09587 100644 (file)
@@ -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;
 
index e6dbca12f4f76789776bf8552b3afa737543cb01..a49d7a24798fe01b1c56ea20436d5b74150363a8 100644 (file)
@@ -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();