refine PR #946 - named armor
Move the new stuff from PR #946 out of xname() into new routine armor_simple_name(). Noticed while testing: tweak 'call object type' so that it doesn't list instances of pre-discovered armor as likely candidates since assigning a name to such wasn't showing up in the discoveries list. Add "silver shield" as wishing synonym for "polished silver shield".
This commit is contained in:
@@ -1906,6 +1906,7 @@ extern void savenames(NHFILE *);
|
||||
extern void restnames(NHFILE *);
|
||||
extern void discover_object(int, boolean, boolean);
|
||||
extern void undiscover_object(int);
|
||||
extern boolean interesting_to_discover(int);
|
||||
extern int choose_disco_sort(int);
|
||||
extern int dodiscovered(void);
|
||||
extern int doclassdisco(void);
|
||||
@@ -1968,6 +1969,7 @@ extern char *makeplural(const char *);
|
||||
extern char *makesingular(const char *);
|
||||
extern struct obj *readobjnam(char *, struct obj *);
|
||||
extern int rnd_class(int, int);
|
||||
extern const char *armor_simple_name(struct obj *);
|
||||
extern const char *suit_simple_name(struct obj *);
|
||||
extern const char *cloak_simple_name(struct obj *);
|
||||
extern const char *helm_simple_name(struct obj *);
|
||||
|
||||
@@ -1489,6 +1489,9 @@ call_ok(struct obj *obj)
|
||||
if (!obj || !objtyp_is_callable(obj->otyp))
|
||||
return GETOBJ_EXCLUDE;
|
||||
|
||||
if (!interesting_to_discover(obj->otyp))
|
||||
return GETOBJ_DOWNPLAY;
|
||||
|
||||
return GETOBJ_SUGGEST;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
static void setgemprobs(d_level *);
|
||||
static void shuffle(int, int, boolean);
|
||||
static void shuffle_all(void);
|
||||
static boolean interesting_to_discover(int);
|
||||
static int QSORTCALLBACK discovered_cmp(const genericptr, const genericptr);
|
||||
static char *oclass_to_name(char, char *);
|
||||
|
||||
@@ -447,8 +446,9 @@ undiscover_object(int oindx)
|
||||
register boolean found = FALSE;
|
||||
|
||||
/* find the object; shift those behind it forward one slot */
|
||||
for (dindx = gb.bases[acls]; dindx < NUM_OBJECTS && gd.disco[dindx] != 0
|
||||
&& objects[dindx].oc_class == acls;
|
||||
for (dindx = gb.bases[acls];
|
||||
dindx < NUM_OBJECTS && gd.disco[dindx] != 0
|
||||
&& objects[dindx].oc_class == acls;
|
||||
dindx++)
|
||||
if (found)
|
||||
gd.disco[dindx - 1] = gd.disco[dindx];
|
||||
@@ -467,7 +467,7 @@ undiscover_object(int oindx)
|
||||
}
|
||||
}
|
||||
|
||||
static boolean
|
||||
boolean
|
||||
interesting_to_discover(int i)
|
||||
{
|
||||
/* Pre-discovered objects are now printed with a '*' */
|
||||
|
||||
74
src/objnam.c
74
src/objnam.c
@@ -621,34 +621,21 @@ xname_flags(
|
||||
if (is_boots(obj) || is_gloves(obj))
|
||||
Strcpy(buf, "pair of ");
|
||||
|
||||
if (obj->otyp >= ELVEN_SHIELD && obj->otyp <= ORCISH_SHIELD
|
||||
&& !dknown) {
|
||||
Strcpy(buf, "shield");
|
||||
break;
|
||||
}
|
||||
if (obj->otyp == SHIELD_OF_REFLECTION && !dknown) {
|
||||
Strcpy(buf, "smooth shield");
|
||||
break;
|
||||
if (!dknown) {
|
||||
if (obj->otyp >= ELVEN_SHIELD && obj->otyp <= ORCISH_SHIELD) {
|
||||
Strcpy(buf, "shield");
|
||||
break;
|
||||
} else if (obj->otyp == SHIELD_OF_REFLECTION) {
|
||||
Strcpy(buf, "smooth shield");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nn) {
|
||||
if (nn)
|
||||
Strcat(buf, actualn);
|
||||
} else if (un) {
|
||||
if (is_boots(obj))
|
||||
Strcat(buf, boots_simple_name(obj));
|
||||
else if (is_gloves(obj))
|
||||
Strcat(buf, gloves_simple_name(obj));
|
||||
else if (is_cloak(obj))
|
||||
Strcpy(buf, cloak_simple_name(obj));
|
||||
else if (is_helmet(obj))
|
||||
Strcpy(buf, helm_simple_name(obj));
|
||||
else if (is_shield(obj))
|
||||
Strcpy(buf, shield_simple_name(obj));
|
||||
else
|
||||
Strcpy(buf, "armor");
|
||||
Strcat(buf, " called ");
|
||||
Strcat(buf, un);
|
||||
} else
|
||||
else if (un)
|
||||
Sprintf(eos(buf), "%s called %s", armor_simple_name(obj), un);
|
||||
else
|
||||
Strcat(buf, dn);
|
||||
break;
|
||||
case FOOD_CLASS:
|
||||
@@ -3071,6 +3058,7 @@ static const struct alt_spellings {
|
||||
{ "gauntlets of ogre power", GAUNTLETS_OF_POWER },
|
||||
{ "gauntlets of giant strength", GAUNTLETS_OF_POWER },
|
||||
{ "elven chain mail", ELVEN_MITHRIL_COAT },
|
||||
{ "silver shield", SHIELD_OF_REFLECTION },
|
||||
{ "potion of sleep", POT_SLEEPING },
|
||||
{ "scroll of recharging", SCR_CHARGING },
|
||||
{ "recharging", SCR_CHARGING },
|
||||
@@ -4981,6 +4969,42 @@ Japanese_item_name(int i)
|
||||
return (const char *) 0;
|
||||
}
|
||||
|
||||
const char *
|
||||
armor_simple_name(struct obj *armor)
|
||||
{
|
||||
const char *result = 0;
|
||||
unsigned armcat = objects[armor->otyp].oc_armcat;
|
||||
|
||||
switch (armcat) {
|
||||
case ARM_SUIT:
|
||||
result = suit_simple_name(armor);
|
||||
break;
|
||||
case ARM_CLOAK:
|
||||
result = cloak_simple_name(armor);
|
||||
break;
|
||||
case ARM_HELM:
|
||||
result = helm_simple_name(armor);
|
||||
break;
|
||||
case ARM_GLOVES:
|
||||
result = gloves_simple_name(armor);
|
||||
break;
|
||||
case ARM_BOOTS:
|
||||
result = boots_simple_name(armor);
|
||||
break;
|
||||
case ARM_SHIELD:
|
||||
result = shield_simple_name(armor);
|
||||
break;
|
||||
case ARM_SHIRT:
|
||||
result = shirt_simple_name(armor);
|
||||
break;
|
||||
default:
|
||||
result = simpleonames(armor);
|
||||
impossible("unknown armor category (%s => %u)", result, armcat);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const char *
|
||||
suit_simple_name(struct obj *suit)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user