-/* NetHack 3.6 u_init.c $NHDT-Date: 1503960969 2017/08/28 22:56:09 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.40 $ */
+/* NetHack 3.6 u_init.c $NHDT-Date: 1526755625 2018/05/19 18:47:05 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.42 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2017. */
/* NetHack may be freely redistributed. See license for details. */
{ PM_ORC, SMALL_SHIELD, ORCISH_SHIELD },
{ PM_ORC, RING_MAIL, ORCISH_RING_MAIL },
{ PM_ORC, CHAIN_MAIL, ORCISH_CHAIN_MAIL },
+ { PM_ORC, CRAM_RATION, TRIPE_RATION },
+ { PM_ORC, LEMBAS_WAFER, TRIPE_RATION },
{ PM_DWARF, SPEAR, DWARVISH_SPEAR },
{ PM_DWARF, SHORT_SWORD, DWARVISH_SHORT_SWORD },
{ PM_DWARF, HELMET, DWARVISH_IRON_HELM },
/* { PM_DWARF, SMALL_SHIELD, DWARVISH_ROUNDSHIELD }, */
/* { PM_DWARF, PICK_AXE, DWARVISH_MATTOCK }, */
+ { PM_DWARF, LEMBAS_WAFER, CRAM_RATION },
{ PM_GNOME, BOW, CROSSBOW },
{ PM_GNOME, ARROW, CROSSBOW_BOLT },
{ NON_PM, STRANGE_OBJECT, STRANGE_OBJECT }
int otyp, i;
while (trop->trclass) {
- if (trop->trotyp != UNDEF_TYP) {
- otyp = (int) trop->trotyp;
- if (urace.malenum != PM_HUMAN) {
- /* substitute specific items for generic ones */
- for (i = 0; inv_subs[i].race_pm != NON_PM; ++i)
- if (inv_subs[i].race_pm == urace.malenum
- && otyp == inv_subs[i].item_otyp) {
- otyp = inv_subs[i].subs_otyp;
- break;
- }
- }
+ otyp = (int) trop->trotyp;
+ if (otyp != UNDEF_TYP) {
obj = mksobj(otyp, TRUE, FALSE);
} else { /* UNDEF_TYP */
static NEARDATA short nocreate = STRANGE_OBJECT;
nocreate4 = otyp;
}
+ if (urace.malenum != PM_HUMAN) {
+ /* substitute race-specific items; this used to be in
+ the 'if (otyp != UNDEF_TYP) { }' block above, but then
+ substitutions didn't occur for randomly generated items
+ (particularly food) which have racial substitutes */
+ for (i = 0; inv_subs[i].race_pm != NON_PM; ++i)
+ if (inv_subs[i].race_pm == urace.malenum
+ && otyp == inv_subs[i].item_otyp) {
+ debugpline3("ini_inv: substituting %s for %s%s",
+ OBJ_NAME(objects[inv_subs[i].subs_otyp]),
+ (trop->trotyp == UNDEF_TYP) ? "random " : "",
+ OBJ_NAME(objects[otyp]));
+ otyp = obj->otyp = inv_subs[i].subs_otyp;
+ break;
+ }
+ }
+
/* nudist gets no armor */
if (u.uroleplay.nudist && obj->oclass == ARMOR_CLASS) {
dealloc_obj(obj);