summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/libutil.h1
-rw-r--r--crawl-ref/source/makeitem.cc3
-rw-r--r--crawl-ref/source/monplace.cc3
3 files changed, 5 insertions, 2 deletions
diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h
index f6915dbb4d..0f425ff7cd 100644
--- a/crawl-ref/source/libutil.h
+++ b/crawl-ref/source/libutil.h
@@ -135,6 +135,7 @@ public:
{
val = newval;
}
+ unwind_var(T &val_) : val(val_), oldval(val_) { }
~unwind_var()
{
val = oldval;
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 97403f0f87..735d6b1c4a 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -2928,7 +2928,7 @@ static void give_monster_item(
set_item_ego_type( mthing, OBJ_WEAPONS, SPWPN_NORMAL );
}
- const int speed_inc = mon->speed_increment;
+ unwind_var<int> save_speedinc(mon->speed_increment);
if (!(pickupfn? (mon->*pickupfn)(mthing, false)
: mon->pickup_item(mthing, false, true)))
{
@@ -2939,7 +2939,6 @@ static void give_monster_item(
destroy_item(thing);
return ;
}
- mon->speed_increment = speed_inc;
if (!force_item || mthing.colour == BLACK)
item_colour( mthing );
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 20a7b2a4dc..a6ef07c3f1 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -578,6 +578,9 @@ static int place_monster_aux( int mon_type, beh_type behaviour, int target,
// Give these monsters a second weapon -- bwr
if (mons_wields_two_weapons(static_cast<monster_type>(mon_type)))
give_item( id, power );
+
+ unwind_var<int> save_speedinc(menv[id].speed_increment);
+ menv[id].wield_melee_weapon(false);
}
// give manticores 8 to 16 spike volleys.