static void shuffle(int, int, boolean);
static void shuffle_all(void);
static int QSORTCALLBACK discovered_cmp(const genericptr, const genericptr);
+static char *sortloot_descr(int, char *);
+static char *disco_typename(int);
static char *oclass_to_name(char, char *);
#ifdef TILES_IN_GLYPHMAP
}
void
-discover_object(int oindx, boolean mark_as_known, boolean credit_hero)
+discover_object(
+ int oindx,
+ boolean mark_as_known,
+ boolean credit_hero)
{
- if (!objects[oindx].oc_name_known) {
- register int dindx, acls = objects[oindx].oc_class;
+ if (!objects[oindx].oc_name_known
+ || (Role_if(PM_SAMURAI)
+ && Japanese_item_name(oindx, (const char *) 0))) {
+ int dindx, acls = objects[oindx].oc_class;
/* Loop thru disco[] 'til we find the target (which may have been
uname'd) or the next open slot; one or the other will be found
break;
gd.disco[dindx] = oindx;
+ /* if already known, we forced an item with a Japanese name into
+ disco[] but don't want to exercise wisdom or update perminv */
+ if (objects[oindx].oc_name_known)
+ return;
+
if (mark_as_known) {
objects[oindx].oc_name_known = 1;
if (credit_hero)
boolean
interesting_to_discover(int i)
{
+ /* most players who don't speak Japanese manage to figure out what
+ gunyoki, osaku, and so forth mean, but treat them as pre-discovered
+ to be disclosed by '\' */
+ if (Role_if(PM_SAMURAI) && Japanese_item_name(i, (const char *) 0))
+ return TRUE;
+
/* Pre-discovered objects are now printed with a '*' */
return (boolean) (objects[i].oc_uname != (char *) 0
|| (objects[i].oc_name_known
}
static char *
-sortloot_descr(int otyp,char * outbuf)
+sortloot_descr(int otyp, char *outbuf)
{
Loot sl_cookie;
struct obj o;
return n;
}
+/* augment obj_typename() with explanation of Japanese item names */
+static char *
+disco_typename(int otyp)
+{
+ char *result = obj_typename(otyp);
+
+ if (Role_if(PM_SAMURAI) && Japanese_item_name(otyp, (const char *) 0)) {
+ char buf[BUFSZ];
+ const char *actualn = (((otyp != MAGIC_HARP && otyp != WOODEN_HARP)
+ || objects[otyp].oc_name_known)
+ ? OBJ_NAME(objects[otyp])
+ /* undiscovered harp (since wooden harp is
+ non-magic so pre-discovered, only applies
+ to magic harp and will only be seen if
+ magic harp has been 'called' something) */
+ : "harp");
+
+ if (!actualn) { /* won't happen; used to pacify static analyzer */
+ ;
+ } else if (strstri(result, " called")) {
+ Sprintf(buf, " [%s] called", actualn);
+ (void) strsubst(result, " called", buf);
+ } else if (strstri(result, " (")) {
+ Sprintf(buf, " [%s] (", actualn);
+ (void) strsubst(result, " (", buf);
+ } else {
+ Sprintf(eos(result), " [%s]", actualn);
+ }
+ }
+ return result;
+}
+
/* the #known command - show discovered object types */
int
dodiscovered(void) /* free after Robert Viduya */
Strcpy(buf, objects[dis].oc_pre_discovered ? "* " : " ");
if (lootsort)
(void) sortloot_descr(dis, &buf[2]);
- Strcat(buf, obj_typename(dis));
+ Strcat(buf, disco_typename(dis));
if (!alphabetized && !lootsort)
putstr(tmpwin, 0, buf);
Strcpy(buf, objects[dis].oc_pre_discovered ? "* " : " ");
if (lootsort)
(void) sortloot_descr(dis, &buf[2]);
- Strcat(buf, obj_typename(dis));
+ Strcat(buf, disco_typename(dis));
if (!alphabetized && !lootsort)
putstr(tmpwin, 0, buf);
any.a_int = dis;
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, clr,
- obj_typename(dis), MENU_ITEMFLAGS_NONE);
+ disco_typename(dis), MENU_ITEMFLAGS_NONE);
}
}
if (ct == 0) {
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;
{ GLAIVE, "naginata" },
{ LOCK_PICK, "osaku" },
{ WOODEN_HARP, "koto" },
+ { MAGIC_HARP, "magic koto" },
{ KNIFE, "shito" },
{ PLATE_MAIL, "tanko" },
{ HELMET, "kabuto" },
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)
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)
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;