Skip to content

Commit

Permalink
Looking up custom fruitnames in the encyclopedia.
Browse files Browse the repository at this point in the history
Looking up a custom fruitname in the encyclopedia will now yield
the encyclopedia entry for "fruit" if another matching database
entry is not found. This preserves the fun associated with naming
fruits after existing objects, while also preventing a failure to
find.
  • Loading branch information
Kestrel Gregorich-Trevor authored and PatR committed Oct 15, 2023
1 parent 83344e7 commit 47a25c8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,14 +862,20 @@ checkfile(
if (alt && (ap = strstri(alt, " (")) != 0 && ap > alt)
*ap = '\0';

/* If the object's name matches the player-specified fruitname,
then "fruit" is the alternate description. We do this here so that
if the fruit name is an extant object, looking at the fruit yields
that object's description. */
if (!alt && !strncmpi(dbase_str, gp.pl_fruit, PL_FSIZ))
alt = strcpy(newstr, obj_descr[SLIME_MOLD].oc_name);
/*
* If the object is named, then the name is the alternate description;
* otherwise, the result of makesingular() applied to the name is.
* This isn't strictly optimal, but named objects of interest to the
* user will usually be found under their name, rather than under
* their object type, so looking for a singular form is pointless.
*/
if (!alt)
else if (!alt)
alt = makesingular(dbase_str);

pass1found_in_file = FALSE;
Expand Down

0 comments on commit 47a25c8

Please sign in to comment.