monster swapping armor simplification
Slightly simplify yesterday's message adjustment made when a monster
takes off a piece of armor and puts on a different instance of the
same type of armor. ("a|an <something>" -> "another <something>")
This commit is contained in:
+6
-7
@@ -847,7 +847,7 @@ m_dowear_type(
|
|||||||
|
|
||||||
if (!creation) {
|
if (!creation) {
|
||||||
if (sawmon) {
|
if (sawmon) {
|
||||||
char buf[BUFSZ], oldarm[BUFSZ], newarm[BUFSZ];
|
char buf[BUFSZ], oldarm[BUFSZ], newarm[BUFSZ + sizeof "another "];
|
||||||
|
|
||||||
/* "<Mon> [removes <oldarm> and ]puts on <newarm>."
|
/* "<Mon> [removes <oldarm> and ]puts on <newarm>."
|
||||||
uses accessory verbs for armor but we can live with that */
|
uses accessory verbs for armor but we can live with that */
|
||||||
@@ -863,14 +863,13 @@ m_dowear_type(
|
|||||||
if newarm and oldarm have identical descriptions, substitute
|
if newarm and oldarm have identical descriptions, substitute
|
||||||
"another <newarm>" for "a|an <newarm>" */
|
"another <newarm>" for "a|an <newarm>" */
|
||||||
if (!strcmpi(newarm, oldarm)) {
|
if (!strcmpi(newarm, oldarm)) {
|
||||||
if (!strncmpi(newarm, "a ", 2)
|
/* size of newarm[] has been overallocated to guarantee
|
||||||
&& strlen(newarm) + sizeof "another " - sizeof "a "
|
enough room to insert "another " */
|
||||||
< sizeof newarm)
|
if (!strncmpi(newarm, "a ", 2))
|
||||||
(void) strsubst(newarm, "a ", "another ");
|
(void) strsubst(newarm, "a ", "another ");
|
||||||
else if (!strncmpi(newarm, "an ", 3)
|
else if (!strncmpi(newarm, "an ", 3))
|
||||||
&& strlen(newarm) + sizeof "another " - sizeof "an "
|
|
||||||
< sizeof newarm)
|
|
||||||
(void) strsubst(newarm, "an ", "another ");
|
(void) strsubst(newarm, "an ", "another ");
|
||||||
|
newarm[BUFSZ - 1] = '\0';
|
||||||
}
|
}
|
||||||
pline("%s%s puts on %s.", Monnam(mon), buf, newarm);
|
pline("%s%s puts on %s.", Monnam(mon), buf, newarm);
|
||||||
if (autocurse)
|
if (autocurse)
|
||||||
|
|||||||
Reference in New Issue
Block a user