#include "angband.h"
#include "util.h"
+#include "main/sound-definitions-table.h"
-#include "player-race.h"
+#include "player/player-race.h"
#include "spells-summon.h"
#include "avatar.h"
-#include "player-status.h"
-#include "player-effects.h"
-#include "player-class.h"
+#include "player/player-status.h"
+#include "player/player-effects.h"
+#include "player/player-class.h"
#include "player-inventory.h"
-#include "spells.h"
+#include "spell/spells2.h"
+#include "spell/spells3.h"
#include "spells-status.h"
#include "spells-floor.h"
-#include "object-hook.h"
+#include "object/object-hook.h"
#include "cmd-basic.h"
-#include "floor.h"
-#include "objectkind.h"
-#include "view-mainwindow.h"
+#include "floor/floor.h"
+#include "object/object-kind.h"
+#include "view/display-main-window.h"
/*!
const int times = randint1(powerful ? 8 : 4);
for (k = 0; k < times; k++)
{
- if (summon_specific(0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
+ if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
ident = TRUE;
}
case SV_STAFF_IDENTIFY:
{
if (powerful) {
- if (!identify_fully(FALSE)) *use_charge = FALSE;
+ if (!identify_fully(creature_ptr, FALSE, 0)) *use_charge = FALSE;
}
else {
- if (!ident_spell(creature_ptr, FALSE)) *use_charge = FALSE;
+ if (!ident_spell(creature_ptr, FALSE, 0)) *use_charge = FALSE;
}
ident = TRUE;
break;
case SV_STAFF_DESTRUCTION:
{
- ident = destroy_area(creature_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x, (powerful ? 18 : 13) + randint0(5), FALSE);
+ ident = destroy_area(creature_ptr, creature_ptr->y, creature_ptr->x, (powerful ? 18 : 13) + randint0(5), FALSE);
break;
}
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);
/* An identification was made */
if (ident && !object_is_aware(o_ptr))
{
- object_aware(o_ptr);
+ object_aware(creature_ptr, o_ptr);
gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
}
creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
-
+ creature_ptr->update |= inventory_flags;
/* Hack -- some uses are "free" */
if (!use_charge) return;
/* Describe charges in the pack */
if (item >= 0)
{
- inven_item_charges(item);
+ inven_item_charges(creature_ptr, item);
}
/* Describe charges on the floor */
else
{
- floor_item_charges(0 - item);
+ floor_item_charges(creature_ptr->current_floor_ptr, 0 - item);
}
}