}
}
- creature_ptr->update |= (PU_COMBINE | PU_REORDER);
+
+ /*
+ * Store what may have to be updated for the inventory (including
+ * autodestroy if set by something else). Then turn off those flags
+ * so that updates triggered by calling gain_exp() or set_food() below
+ * do not rearrange the inventory before the food item is destroyed in
+ * the pack.
+ */
+ BIT_FLAGS inventory_flags = (PU_COMBINE | PU_REORDER | (creature_ptr->update & PU_AUTODESTROY));
+ creature_ptr->update &= ~(PU_COMBINE | PU_REORDER | PU_AUTODESTROY);
if (!(object_is_aware(o_ptr)))
{
creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
-
/* Food can feed the player */
if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE))
{
if (o_ptr->tval == TV_STAFF &&
(item < 0) && (o_ptr->number > 1))
{
+ creature_ptr->update |= inventory_flags;
msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
return;
}
{
msg_format(_("この%sにはもう魔力が残っていない。", "The %s has no charges left."), staff);
o_ptr->ident |= (IDENT_EMPTY);
- creature_ptr->update |= (PU_COMBINE | PU_REORDER);
+ creature_ptr->update |= inventory_flags;
creature_ptr->window |= (PW_INVEN);
return;
}
creature_ptr->window |= (PW_INVEN | PW_EQUIP);
+ creature_ptr->update |= inventory_flags;
/* Don't eat a staff/wand itself */
return;
}
- else if ((PRACE_IS_(creature_ptr, RACE_DEMON) ||
+
+ if ((PRACE_IS_(creature_ptr, RACE_DEMON) ||
(mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
(o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
my_strchr("pht", r_info[o_ptr->pval].d_char)))
(void)set_food(creature_ptr, creature_ptr->food + o_ptr->pval);
}
+ creature_ptr->update |= inventory_flags;
vary_item(creature_ptr, item, -1);
}
used_up=FALSE;
}
- creature_ptr->update |= (PU_COMBINE | PU_REORDER);
+ /*
+ * Store what may have to be updated for the inventory (including
+ * autodestroy if set by something else). Then turn off those flags
+ * so that updates triggered by calling gain_exp() below do not
+ * rearrange the inventory before destroying the scroll in the pack.
+ */
+ BIT_FLAGS inventory_flags = (PU_COMBINE | PU_REORDER | (creature_ptr->update & PU_AUTODESTROY));
+ creature_ptr->update &= ~(PU_COMBINE | PU_REORDER | PU_AUTODESTROY);
if (!(object_is_aware(o_ptr)))
{
}
creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
-
+ creature_ptr->update |= inventory_flags;
/* Hack -- allow certain scrolls to be "preserved" */
if (!used_up)
chg_virtue(creature_ptr, V_CHANCE, 1);
chg_virtue(creature_ptr, V_KNOWLEDGE, -1);
}
- creature_ptr->update |= (PU_COMBINE | PU_REORDER);
+
+ /*
+ * Temporarily remove the flags for updating the inventory so
+ * gain_exp() does not reorder the inventory before the charge
+ * is deducted from the staff.
+ */
+ BIT_FLAGS inventory_flags = (PU_COMBINE | PU_REORDER | (creature_ptr->update & PU_AUTODESTROY));
+ creature_ptr->update &= ~(PU_COMBINE | PU_REORDER | PU_AUTODESTROY);
/* Tried the item */
object_tried(o_ptr);
}
creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
-
+ creature_ptr->update |= inventory_flags;
/* Hack -- some uses are "free" */
if (!use_charge) return;
sound(SOUND_ZAP);
ident = wand_effect(creature_ptr, o_ptr->sval, dir, FALSE, FALSE);
- creature_ptr->update |= (PU_COMBINE | PU_REORDER);
+
+ /*
+ * Temporarily remove the flags for updating the inventory so
+ * gain_exp() does not reorder the inventory before the charge
+ * is deducted from the wand.
+ */
+ BIT_FLAGS inventory_flags = (PU_COMBINE | PU_REORDER | (creature_ptr->update & PU_AUTODESTROY));
+ creature_ptr->update &= ~(PU_COMBINE | PU_REORDER | PU_AUTODESTROY);
if (!(object_is_aware(o_ptr)))
{
}
creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+ creature_ptr->window |= inventory_flags;
/* Use a single charge */
o_ptr->pval--;