From e6788d465e047d9492d45f1d4620a772384ba2ef Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Mon, 23 Feb 2015 09:11:55 +0100 Subject: Revert "Limit scope of {set,unset}_stick_mode for readability" Turns out I'd missed at least one case where the stick would be activated without "stick_mode" being set, this would have the effect of inadvertently reducing/increasing the effective spell level depending on Magic-Device vs. $SPELL_SCHOOL skill level. This reverts commit 427c432e6d2805c88e4639c61b32975ee01735f8. --- src/cmd6.cc | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/cmd6.cc b/src/cmd6.cc index 74b192f6..39d15f59 100644 --- a/src/cmd6.cc +++ b/src/cmd6.cc @@ -3735,15 +3735,15 @@ void do_cmd_use_staff(void) return; } + /* Enter device mode */ + set_stick_mode(o_ptr); + /* Take a turn */ energy_use = 100; /* Not identified yet */ ident = FALSE; - /* Enter device mode */ - set_stick_mode(o_ptr); - /* get the chance */ int chance; { @@ -3751,9 +3751,6 @@ void do_cmd_use_staff(void) chance = spell_chance_device(spell); } - /* Leave device mode */ - unset_stick_mode(); - /* Extract object flags */ object_flags(o_ptr, &f1, &f2, &f3, &f4, &f5, &esp); @@ -3775,6 +3772,9 @@ void do_cmd_use_staff(void) if (flush_failure) flush(); msg_print("You failed to use the staff properly."); sound(SOUND_FAIL); + + /* Leave device mode */ + unset_stick_mode(); return; } @@ -3784,6 +3784,9 @@ void do_cmd_use_staff(void) if (flush_failure) flush(); msg_print("The staff has no charges left."); o_ptr->ident |= (IDENT_EMPTY); + + /* Leave device mode */ + unset_stick_mode(); return; } @@ -3809,6 +3812,9 @@ void do_cmd_use_staff(void) /* Hack -- some uses are "free" */ if (!use_charge) { + /* Leave device mode */ + unset_stick_mode(); + return; } @@ -3858,6 +3864,9 @@ void do_cmd_use_staff(void) { floor_item_charges(0 - item); } + + /* Leave device mode */ + unset_stick_mode(); } @@ -3940,9 +3949,6 @@ void do_cmd_aim_wand(void) chance = spell_chance_device(spell); } - /* Leave device mode */ - unset_stick_mode(); - /* Extract object flags */ object_flags(o_ptr, &f1, &f2, &f3, &f4, &f5, &esp); @@ -3958,6 +3964,9 @@ void do_cmd_aim_wand(void) if (flush_failure) flush(); msg_print("You failed to use the wand properly."); sound(SOUND_FAIL); + + /* Leave device mode */ + unset_stick_mode(); return; } @@ -3967,12 +3976,17 @@ void do_cmd_aim_wand(void) if (flush_failure) flush(); msg_print("The wand has no charges left."); o_ptr->ident |= (IDENT_EMPTY); + + /* Leave device mode */ + unset_stick_mode(); return; } + /* Sound */ sound(SOUND_ZAP); + /* Analyze the wand */ activate_stick(o_ptr->pval2, &obvious, &use_charge); @@ -3985,6 +3999,9 @@ void do_cmd_aim_wand(void) /* Hack -- some uses are "free" */ if (!use_charge) { + /* Leave device mode */ + unset_stick_mode(); + return; } @@ -4012,6 +4029,9 @@ void do_cmd_aim_wand(void) { floor_item_charges(0 - item); } + + /* Leave device mode */ + unset_stick_mode(); } -- cgit v1.2.3