]> granicus.if.org Git - nethack/commitdiff
lifting vs removing
authornethack.allison <nethack.allison>
Sun, 11 Apr 2004 15:34:04 +0000 (15:34 +0000)
committernethack.allison <nethack.allison>
Sun, 11 Apr 2004 15:34:04 +0000 (15:34 +0000)
<Someone> wrote:
> You have much trouble removing u - a helmet.
> You have much trouble lifting a plate mail. Continue? [ynq] (q)
> You have much trouble removing R - a plate mail.
> You have much trouble removing N - a leather cloak.
> Why am I told that I have trouble "lifting" a plate mail?

1. Add strsubst() routine to hacklib to replace a word or phrase in a string in place.
2. Correct the inconsistency reported.

doc/fixes34.4
include/extern.h
src/hacklib.c
src/pickup.c

index e90e8a94bef164528414fdecbca9d6e261b457fe..dd4edf02be018c2f0db0d85678d4f991b7f0c47b 100644 (file)
@@ -20,6 +20,9 @@ player polymorphed as a xorn could not pick up items in pits
 don't display "turns to flee" message for a mimicing mimic
 dipping acid in a fountain could cause an explosion but not destroy the potion
 if your blindfold glows and you're not otherwise blinded, you can see it
+added strsubst() to hacklib
+be consistent with use of "removing" rather than "lifting" for encumber 
+       messages associated with taking things out of a bag of holding
 
 
 Platform- and/or Interface-Specific Fixes
index 81e6c958ecc9ba43ae1d070323f571747e3e5d26..ff09d477b7b320f2c6853fd6f37db722f0ae621b 100644 (file)
@@ -757,6 +757,7 @@ E char *FDECL(xcrypt, (const char *,char *));
 E boolean FDECL(onlyspace, (const char *));
 E char *FDECL(tabexpand, (char *));
 E char *FDECL(visctrl, (CHAR_P));
+E char *FDECL(strsubst, (char *,const char *,const char *));
 E const char *FDECL(ordin, (int));
 E char *FDECL(sitoa, (int));
 E int FDECL(sgn, (int));
index f94a9528c8adf10ae39e02566cca491210e2d06a..b8a1c5295412a16a85bcb9e15134c7b5788c3249 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)hacklib.c  3.4     2002/12/13      */
+/*     SCCS Id: @(#)hacklib.c  3.4     2004/04/11      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* Copyright (c) Robert Patrick Rankin, 1991             */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -24,6 +24,7 @@ NetHack, except that rounddiv may call panic().
        boolean         onlyspace       (const char *)
        char *          tabexpand       (char *)
        char *          visctrl         (char)
+       char *          strsubst        (char *, const char *, const char *)
        const char *    ordin           (int)
        char *          sitoa           (int)
        int             sgn             (int)
@@ -223,6 +224,27 @@ visctrl(c)         /* make a displayable string from a character */
     return ccc;
 }
 
+/* substitute a word or phrase in a string (in place) */
+/* caller is responsible for ensuring that bp points to big enough buffer */
+char *
+strsubst(bp, orig, replacement)
+    char *bp;
+    const char *orig, *replacement;
+{
+    char *found, buf[BUFSZ];
+
+    if (bp) {
+       found = strstr(bp, orig);
+       if (found) {
+               Strcpy(buf, found + strlen(orig));
+               Strcpy(found, replacement);
+               Strcat(bp, buf);
+       }
+    }
+    return bp;
+}
+
+
 const char *
 ordin(n)               /* return the ordinal suffix of a number */
     int n;                     /* note: should be non-negative */
index 23cb0272bb02abc3d8aec8cf9d41aa557447affd..429d2f4da4a0d2e7519cf5fac5ea156cc2321a17 100644 (file)
@@ -1175,6 +1175,7 @@ boolean telekinesis;
                        (next_encumbr > HVY_ENCUMBER) ? overloadmsg :
                        (next_encumbr > MOD_ENCUMBER) ? nearloadmsg :
                        moderateloadmsg);
+               if (container) (void) strsubst(qbuf,"lifting","removing");
                Sprintf(eos(qbuf), " %s. Continue?",
                        safe_qbuf(qbuf, sizeof(" . Continue?"),
                                doname(obj), an(simple_typename(obj->otyp)), "something"));