add Japanese item names to discoveries list

When playing as a Samurai, add things like "osaku" to the discoveries
list even though they don't have separate descriptions to be used
when not yet discovered.  Non-magic ones are pre-discovered and
players can now use the '\' command to figure out what things like
"tanko" mean without resorting to '/?'.

"wooden harp" has been getting changed to "koto (harp)"; make that be
| koto [wooden harp] (koto)
"magic harp" has been staying as "magic harp (harp)"; add it to the
list of Japanese item names.  Since it's magic it isn't pre-discovered.
Once discovered it becomes
| magic koto [magic harp] (koto)

Those two needed special case handling, none of the other items did
aside from forcing them to be discoverable when lacking descriptions.
The discoveries list now has things like
| wakizashi [short sword]
| naginata [glaive] (single-edged polearm)
| gunyoki [food ration]
if--and only if--the hero is a Samurai.
This commit is contained in:
PatR
2023-01-18 22:00:57 -08:00
parent bb8656c190
commit 8952ea9bb5
5 changed files with 81 additions and 13 deletions

View File

@@ -54,7 +54,6 @@ static void readobjnam_parse_charges(struct _readobjnam_data *);
static int readobjnam_postparse1(struct _readobjnam_data *);
static int readobjnam_postparse2(struct _readobjnam_data *);
static int readobjnam_postparse3(struct _readobjnam_data *);
static const char *Japanese_item_name(int, const char *);
struct Jitem {
int item;
@@ -81,6 +80,7 @@ static const struct Jitem Japanese_items[] = {
{ GLAIVE, "naginata" },
{ LOCK_PICK, "osaku" },
{ WOODEN_HARP, "koto" },
{ MAGIC_HARP, "magic koto" },
{ KNIFE, "shito" },
{ PLATE_MAIL, "tanko" },
{ HELMET, "kabuto" },
@@ -177,8 +177,11 @@ obj_typename(int otyp)
const char *un = ocl->oc_uname;
int nn = ocl->oc_name_known;
if (Role_if(PM_SAMURAI))
if (Role_if(PM_SAMURAI)) {
actualn = Japanese_item_name(otyp, actualn);
if (otyp == WOODEN_HARP || otyp == MAGIC_HARP)
dn = "koto";
}
/* generic items don't have an actual-name; we shouldn't ever be called
for those; pacify static analyzer without resorting to impossible() */
if (!actualn)
@@ -518,8 +521,11 @@ xname_flags(
boolean known, dknown, bknown;
buf = nextobuf() + PREFIX; /* leave room for "17 -3 " */
if (Role_if(PM_SAMURAI))
if (Role_if(PM_SAMURAI)) {
actualn = Japanese_item_name(typ, actualn);
if (typ == WOODEN_HARP || typ == MAGIC_HARP)
dn = "koto";
}
/* generic items don't have an actual-name; we shouldn't ever be called
for those; pacify static analyzer without resorting to impossible() */
if (!actualn)
@@ -4966,7 +4972,7 @@ rnd_class(int first, int last)
return (first == last) ? first : STRANGE_OBJECT;
}
static const char *
const char *
Japanese_item_name(int i, const char *ordinaryname)
{
const struct Jitem *j = Japanese_items;