lifting vs removing

<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.
This commit is contained in:
nethack.allison
2004-04-11 15:34:04 +00:00
parent 0e6afc5f34
commit 1194454b2f
4 changed files with 28 additions and 1 deletions

View 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

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

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

View 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"));