diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-12 09:10:49 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-12 09:10:49 +0000 |
commit | a7e2693b2ed1e9b75a9cfefeaf4f9db4a1e694a6 (patch) | |
tree | 33f4ab6c2cfb8d74f626e50a5f5a3922d5de86a9 /crawl-ref/source/monplace.cc | |
parent | cc1f76cb96cfc86d2e587293f40577b4226d31e5 (diff) | |
download | crawl-ref-a7e2693b2ed1e9b75a9cfefeaf4f9db4a1e694a6.tar.gz crawl-ref-a7e2693b2ed1e9b75a9cfefeaf4f9db4a1e694a6.zip |
Dancing weapons fix for trunk.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9033 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monplace.cc')
-rw-r--r-- | crawl-ref/source/monplace.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 42e0f9f9f2..c6866b3a7b 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -1115,12 +1115,23 @@ static int _place_monster_aux(const mgen_data &mg, const bool summoned = mg.abjuration_duration >= 1 && mg.abjuration_duration <= 6; - if (mg.cls == MONS_DANCING_WEAPON && mg.number != 1) // ie not from spell + if (mg.cls == MONS_DANCING_WEAPON) { give_item(id, mg.power, summoned); - if (menv[id].inv[MSLOT_WEAPON] != NON_ITEM) - menv[id].colour = mitm[menv[id].inv[MSLOT_WEAPON]].colour; + // Dancing swords *always* have a weapon. Fail to + // create them otherwise. + const item_def* wpn = menv[id].weapon(); + if (!wpn) + { + menv[id].destroy_inventory(); + menv[id].reset(); + return (-1); + } + else + { + menv[id].colour = wpn->colour; + } } else if (mons_class_itemuse(mg.cls) >= MONUSE_STARTING_EQUIPMENT) { |