From ccd6f1cf226c902e42b1e16a7a20259536b0eb53 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 25 Nov 2018 12:47:53 -0500 Subject: [PATCH] more orctown-related follow-up Under some circumstances, when all the marauding orcs belonging to the horde operating within the gnomish mines had been provided with their spoils and placed appropriately, there could still be some pillaged stuff left-over on the migrating obj chain. Orcs created by regular monster generation elsewhere would then be susceptable to receiving that stuff until it was used up. That part is fine, except that the orcs were then being named as part of the same horde operating within the mines. Now they will no longer be named as part of the Gnomish Mines horde. Mythos: There's a good chance that these particular orcs received the stolen goods from the Gnomish Mines horde. --- doc/fixes36.2 | 2 ++ include/extern.h | 2 +- src/do_name.c | 22 ++++++++++++++------ src/dokick.c | 11 +++++++--- src/mkmaze.c | 2 +- src/pager.c | 54 ++++++++++++++++++++++++++++++++++-------------- 6 files changed, 67 insertions(+), 26 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 5e4d30edf..9c54cd357 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -231,6 +231,8 @@ setting the inverse attribute for gold had the space before "$:" getting highlighted along with the gold field sortloot segfaulted when filtering a subset of items (seen with 'A' command) orctown: prevent Bad fruit #0 and some minor tuning +orctown: orcs beyond the mines were being given any left-over booty and named + as part of the same marauding gang operating within the mines make long extended commands list be more navigable simplify #wizidentify; don't rely on having bold menu entries ensure tmp_at() structures are initialized for all code paths when swallowed diff --git a/include/extern.h b/include/extern.h index 89910b0bb..ccd54c605 100644 --- a/include/extern.h +++ b/include/extern.h @@ -431,7 +431,7 @@ E struct obj *FDECL(realloc_obj, (struct obj *, int, genericptr_t, int, const char *)); E char *FDECL(coyotename, (struct monst *, char *)); E char *FDECL(rndorcname, (char *)); -E struct monst *FDECL(christen_orc, (struct monst *, char *)); +E struct monst *FDECL(christen_orc, (struct monst *, char *, char *)); E const char *FDECL(noveltitle, (int *)); E const char *FDECL(lookup_novel, (const char *, int *)); diff --git a/src/do_name.c b/src/do_name.c index aa688765a..e2e249b93 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -2088,18 +2088,28 @@ char *s; } struct monst * -christen_orc(mtmp, gang) +christen_orc(mtmp, gang, other) struct monst *mtmp; -char *gang; +char *gang, *other; { int sz = 0; char buf[BUFSZ], buf2[BUFSZ], *orcname; orcname = rndorcname(buf2); - sz = (int) (strlen(gang) + strlen(orcname) + sizeof " of " - sizeof ""); - if (gang && orcname && sz < BUFSZ) { - Sprintf(buf, "%s of %s", upstart(orcname), upstart(gang)); - mtmp = christen_monst(mtmp, buf); + sz = (int) ((gang ? strlen(gang) : other ? strlen(other) : 0) + + strlen(orcname) + sizeof " of " - sizeof ""); + if (sz < BUFSZ) { + boolean nameit = FALSE; + + if (gang && orcname) { + Sprintf(buf, "%s of %s", upstart(orcname), upstart(gang)); + nameit = TRUE; + } else if (other && orcname) { + Sprintf(buf, "%s%s", upstart(orcname), other); + nameit = TRUE; + } + if (nameit) + mtmp = christen_monst(mtmp, buf); } return mtmp; } diff --git a/src/dokick.c b/src/dokick.c index 3cce7395f..3274b15e9 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1680,7 +1680,8 @@ unsigned long deliverflags; { struct obj *otmp, *otmp2; int where, maxobj = 1; - + boolean at_crime_scene = In_mines(&u.uz); + if ((deliverflags & DF_RANDOM) && cnt > 1) maxobj = rnd(cnt); else if (deliverflags & DF_ALL) @@ -1702,8 +1703,12 @@ unsigned long deliverflags; /* special treatment for orcs and their kind */ if ((otmp->corpsenm & M2_ORC) != 0 && has_oname(otmp)) { - if (!has_mname(mtmp)) - mtmp = christen_orc(mtmp, ONAME(otmp)); + if (!has_mname(mtmp)) { + if (at_crime_scene || (!at_crime_scene && !rn2(2))) + mtmp = christen_orc(mtmp, + at_crime_scene ? ONAME(otmp) : (char *) 0, + " the Fence"); /* bought the stolen goods */ + } free_oname(otmp); } otmp->corpsenm = 0; diff --git a/src/mkmaze.c b/src/mkmaze.c index 6300fe56f..1dd52cb98 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -785,7 +785,7 @@ stolen_booty(VOID_ARGS) * member of the main orc horde. */ if (mtmp->data != &mons[PM_ORC_CAPTAIN]) - mtmp = christen_orc(mtmp, upstart(gang)); + mtmp = christen_orc(mtmp, upstart(gang), ""); } } /* Lastly, ensure there's several more orcs from the gang along the way. diff --git a/src/pager.c b/src/pager.c index f8146615d..b6776b497 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1346,8 +1346,9 @@ char *name; struct permonst *pm; boolean without_asking; { + int textidx = 0; winid datawin = WIN_ERR; - char *entrytext = name, *bp; + char *entrytext = name, *bp = (char *) 0, *bp2 = (char *) 0; char question[QBUFSZ]; boolean yes_to_moreinfo = FALSE; @@ -1357,7 +1358,8 @@ boolean without_asking; * available from data.base or other sources. */ if (name && pm && is_orc(pm) && (strlen(name) < (BUFSZ - 1)) - && (bp = strstri(name, " of ")) != 0) { + && ((bp = strstri(name, " of ")) != 0) || + (bp2 = strstri(name, " the Fence")) != 0) { char fullname[BUFSZ]; Strcpy(fullname, name); @@ -1372,28 +1374,50 @@ boolean without_asking; } if (yes_to_moreinfo) { int i, subs = 0; - char *gang = bp + 4; - static const char *text[] = { - "%s is a member of a marauding horde of orcs", - "rumored to have brutally attacked and plundered the ordinarily", - "sheltered town that is located deep within The Gnomish Mines.", - "", - "The members of that vicious horde proudly and defiantly acclaim", - "their allegiance to their leader %s in their names.", + char *gang = (char *) 0; + + if (bp) + textidx = 0; + else + textidx = 1; + + static const char *text[2][6] = { + { + "%s is a member of a marauding horde of orcs", + "rumored to have brutally attacked and plundered the ordinarily", + "sheltered town that is located deep within The Gnomish Mines.", + "", + "The members of that vicious horde proudly and defiantly acclaim", + "their allegiance to their leader %s in their names.", + }, + { + "%s is a nefarious orc who is known to acquire property", + "from thieves and sell it off for profit or gain.", + "The perpetrator was last seen hanging around the stairs leading", + "to the Gnomish Mines.", + "", + "", + } }; - *bp = '\0'; + if (bp) { + gang = bp + 4; + *bp = '\0'; + } else { + gang = ""; + } + datawin = create_nhwindow(NHW_MENU); - for (i = 0; i < SIZE(text); i++) { + for (i = 0; i < SIZE(text[textidx]); i++) { char buf[BUFSZ]; const char *txt; - if (strstri(text[i], "%s") != 0) { - Sprintf(buf, text[i], + if (strstri(text[textidx][i], "%s") != 0) { + Sprintf(buf, text[textidx][i], subs++ ? gang : fullname); txt = buf; } else - txt = text[i]; + txt = text[textidx][i]; putstr(datawin, 0, txt); } display_nhwindow(datawin, FALSE); -- 2.40.0