update book tribute

Changes to be committed:
	modified:   doc/fixes35.0
	modified:   include/extern.h
	modified:   src/do_name.c
	modified:   src/objnam.c

This pretty much completes the code portion of the book tribute.
- The book will appear in the rare books shop.
- When you read the book, a random passage is drawn for a
  tribute file (suggested by Mike).
- The book cannot be renamed because it already has a
  name (observed/suggested by Sean).

The data file (dat/tribute) has a few test passages, but needs to be
filled out. Sean and Mike Stephenson have indicated that
possibly they may be able to help contribute to that. Ideally,
there should be at least one passage from each of the books.
This commit is contained in:
nhmall
2015-04-04 21:20:34 -04:00
parent 5432ba7f44
commit b383cc6a2c
4 changed files with 53 additions and 4 deletions

View File

@@ -1112,6 +1112,7 @@ show more explicit reason why player was helpless at death
added new hallucinatory-only gods
options to create the character blind or nudist
moving clouds on the plane of air
tribute to Terry Pratchett
Platform- and/or Interface-Specific New Features

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 extern.h $NHDT-Date: 1426966688 2015/03/21 19:38:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.411 $ */
/* NetHack 3.5 extern.h $NHDT-Date: 1428196810 2015/04/05 01:20:10 $ $NHDT-Branch: nhmall-booktribute $:$NHDT-Revision: 1.451 $ */
/* NetHack 3.5 extern.h $Date: 2013/11/05 00:57:53 $ $Revision: 1.380 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -396,6 +396,7 @@ E struct obj *FDECL(realloc_obj,
(struct obj *, int, genericptr_t, int, const char *));
E char *FDECL(coyotename, (struct monst *,char *));
E const char *FDECL(noveltitle, (int *));
E const char *FDECL(lookup_novel, (const char *, int *));
/* ### do_wear.c ### */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 do_name.c $NHDT-Date: 1426558927 2015/03/17 02:22:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.53 $ */
/* NetHack 3.5 do_name.c $NHDT-Date: 1428196077 2015/04/05 01:07:57 $ $NHDT-Branch: nhmall-booktribute $:$NHDT-Revision: 1.64 $ */
/* NetHack 3.5 do_name.c $Date: 2012/01/29 03:00:17 $ $Revision: 1.49 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -474,6 +474,12 @@ register struct obj *obj;
const char *aname;
short objtyp;
/* Do this now because there's no point in even asking for a name */
if (obj->otyp == SPE_NOVEL) {
pline("%s already has a published name.", Ysimple_name2(obj));
return;
}
Sprintf(qbuf, "What do you want to name %s ",
is_plural(obj) ? "these" : "this");
(void)safe_qbuf(qbuf, qbuf, "?", obj, xname, simpleonames, "item");
@@ -1152,6 +1158,7 @@ char *buf;
return buf;
}
/* make sure "The Colour of Magic" remains the first entry in here */
static const char * const sir_Terry_novels[] = {
"The Colour of Magic", "The Light Fantastic", "Equal Rites",
"Mort", "Sourcery", "Wyrd Sisters", "Pyramids", "Guards! Guards!",
@@ -1181,6 +1188,25 @@ int *novidx;
return sir_Terry_novels[j];
}
const char *
lookup_novel(lookname, idx)
const char *lookname;
int *idx;
{
int k;
/* Take American or U.K. spelling of this one */
if (strcmpi(lookname, "The Color of Magic") == 0)
lookname = sir_Terry_novels[0];
for (k = 0; k < SIZE(sir_Terry_novels); ++k) {
if (strcmpi(lookname, sir_Terry_novels[k]) == 0) {
if (idx) *idx = k;
return sir_Terry_novels[k];
}
}
return (const char *)0;
}
/*do_name.c*/

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 objnam.c $NHDT-Date: 1427440866 2015/03/27 07:21:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.109 $ */
/* NetHack 3.5 objnam.c $NHDT-Date: 1428196817 2015/04/05 01:20:17 $ $NHDT-Branch: nhmall-booktribute $:$NHDT-Revision: 1.120 $ */
/* NetHack 3.5 objnam.c $Date: 2011/10/27 02:24:54 $ $Revision: 1.101 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3008,6 +3008,15 @@ typfnd:
}
}
if (typ && wizard) {
if (typ == SPE_NOVEL) {
if (name && !lookup_novel((char *)name, (int *)0)) {
pline("There's no novel by that name.");
return ((struct obj *)0);
}
}
}
/*
* Create the object, then fine-tune it.
*/
@@ -3200,10 +3209,22 @@ typfnd:
aname = artifact_name(name, &objtyp);
if (aname && objtyp == otmp->otyp) name = aname;
/* 3.6.0 tribute - fix up novel */
if (otmp->otyp == SPE_NOVEL) {
int novidx = 0;
const char *novelname;
novelname = lookup_novel(name, &novidx);
if (novelname) {
otmp->novelidx = novidx;
name = novelname;
}
}
otmp = oname(otmp, name);
if (otmp->oartifact) {
otmp->quan = 1L;
u.uconduct.wisharti++; /* KMH, conduct */
u.uconduct.wisharti++;
}
}