From ff54d82b00872d9e82e3db74dff655e915a831bc Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Wed, 1 Jun 2005 04:11:55 +0000 Subject: [PATCH] pettype=horse Accept OPTIONS=pettype:horse quietly instead of issuing "unrecognized pet type 'horse'" message. It doesn't actually do anything from player's perspective--knights always get a pony and other roles always get a cat or dog, as before. I had a much more elaborate version which recognized "pony" (plus "kitten", "little dog", "puppy" and assorted other variations of the acceptable types), but it was absurd overkill for something that never come up during actual play. If someone tries to specify "kitten" and gets "unrecongized type", it shouldn't take him longer to figure out "cat" is what's needed even without resorting to actually reading the Guidebook. Can someone generate an up to date Guidebook.txt and check it in? --- doc/Guidebook.mn | 6 +++++- doc/Guidebook.tex | 8 ++++++-- src/options.c | 16 +++++++++++----- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index dc7cbfbaf..84b2717fb 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -2051,7 +2051,11 @@ makes sense for windowing system interfaces that implement this feature. .lp pettype Specify the type of your initial pet, if you are playing a character class that uses multiple types of pets; or choose to have no initial pet at all. -Possible values are ``cat'', ``dog'' and ``none''. +Possible values are ``cat'', ``dog'', ``horse'', +and ``none''. +If the choice is not allowed for the role you are currently playing, +it will be silently ignored. For example, ``horse'' will only be +honored when playing a knight. Cannot be set with the `O' command. .lp pickup_burden When you pick up an item that would exceed this encumbrance diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index bdb61084e..e3d9f34d1 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -27,7 +27,7 @@ \begin{document} % % input file: guidebook.mn -% $Revision: 1.91 $ $Date: 2005/01/22 15:27:20 $ +% $Revision: 1.92 $ $Date: 2005/01/23 14:33:46 $ % %.ds h0 " %.ds h1 %.ds h2 \% @@ -2514,7 +2514,11 @@ makes sense for windowing system interfaces that implement this feature. \item[\ib{pettype}] Specify the type of your initial pet, if you are playing a character class that uses multiple types of pets; or choose to have no initial pet at all. -Possible values are ``{\tt cat}'', ``{\tt dog}'' and ``{\tt none}''. +Possible values are ``{\tt cat}'', ``{\tt dog}'', ``{\tt horse}'' +and ``{\tt none}''. +If the choice is not allowed for the role you are currently playing, +it will be silently ignored. For example, ``{\tt horse}'' will only be +honored when playing a knight. Cannot be set with the `{\tt O}' command. %.Ip \item[\ib{pickup\_burden}] diff --git a/src/options.c b/src/options.c index 50ce41dbf..ddd1a029f 100644 --- a/src/options.c +++ b/src/options.c @@ -1200,21 +1200,26 @@ boolean tinitial, tfrom_file; if (duplicate) complain_about_duplicate(opts,1); if ((op = string_for_env_opt(fullname, opts, negated)) != 0) { if (negated) bad_negation(fullname, TRUE); - else switch (*op) { + else switch (lowc(*op)) { case 'd': /* dog */ - case 'D': preferred_pet = 'd'; break; case 'c': /* cat */ - case 'C': case 'f': /* feline */ - case 'F': preferred_pet = 'c'; break; + case 'h': /* horse */ + case 'q': /* quadruped */ + /* avoids giving "unrecognized type of pet" but + pet_type(dog.c) won't actually honor this */ + preferred_pet = 'h'; + break; case 'n': /* no pet */ - case 'N': preferred_pet = 'n'; break; + case '*': /* random */ + preferred_pet = '\0'; + break; default: pline("Unrecognized pet type '%s'.", op); break; @@ -3271,6 +3276,7 @@ char *buf; else if (!strcmp(optname, "pettype")) Sprintf(buf, "%s", (preferred_pet == 'c') ? "cat" : (preferred_pet == 'd') ? "dog" : + (preferred_pet == 'h') ? "horse" : (preferred_pet == 'n') ? "none" : "random"); else if (!strcmp(optname, "pickup_burden")) Sprintf(buf, "%s", burdentype[flags.pickup_burden] );