diff options
author | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-09 20:29:40 +0530 |
---|---|---|
committer | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-09 20:29:40 +0530 |
commit | 8b1fac167bcae924466d59df079106101f09892c (patch) | |
tree | 9b17140119b81d3a0d23988bce06cb9442d8eeec /crawl-ref/source | |
parent | f402990b9d7a17aa5e775c445891bc8428f40692 (diff) | |
download | crawl-ref-8b1fac167bcae924466d59df079106101f09892c.tar.gz crawl-ref-8b1fac167bcae924466d59df079106101f09892c.zip |
Don't let monsters wield stacks of throwing weapons (fixes NetHackish messages about monsters wielding 6 spears).
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/dbg-asrt.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/monster.cc | 16 |
2 files changed, 14 insertions, 5 deletions
diff --git a/crawl-ref/source/dbg-asrt.cc b/crawl-ref/source/dbg-asrt.cc index 50ebea9af5..f2bdc49270 100644 --- a/crawl-ref/source/dbg-asrt.cc +++ b/crawl-ref/source/dbg-asrt.cc @@ -635,7 +635,7 @@ void do_crash_dump() static void _BreakStrToDebugger(const char *mesg) { #if defined(TARGET_OS_MACOSX) || defined(TARGET_COMPILER_MINGW) - fprintf(stderr, mesg); + fprintf(stderr, "%s", mesg); // raise(SIGINT); // this is what DebugStr() does on OS X according to Tech Note 2030 int* p = NULL; // but this gives us a stack crawl... *p = 0; @@ -687,4 +687,3 @@ void DEBUGSTR(const char *format, ...) } #endif - diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 4667599a33..c2139a4b90 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -1322,8 +1322,8 @@ bool monsters::pickup_melee_weapon(item_def &item, int near) { // Throwable weapons may be picked up as though dual-wielding. const bool dual_wielding = (mons_wields_two_weapons(this) - || is_throwable(this, item)); - if (dual_wielding) + || is_throwable(this, item)); + if (dual_wielding && item.quantity == 1) { // If we have either weapon slot free, pick up the weapon. if (inv[MSLOT_WEAPON] == NON_ITEM) @@ -1347,6 +1347,11 @@ bool monsters::pickup_melee_weapon(item_def &item, int near) { weap = mslot_item(static_cast<mon_inv_type>(i)); + // If the weapon is a stack of throwing weaons, the monster + // will not use the stack as their primary melee weapon. + if (item.quantity != 1 && i == MSLOT_WEAPON) + continue; + if (!weap) { // If no weapon in this slot, mark this one. @@ -1928,8 +1933,13 @@ void monsters::wield_melee_weapon(int near) // Switch to the alternate weapon if it's not a ranged weapon, too, // or switch away from our main weapon if it's a ranged weapon. - if (alt && !is_range_weapon(*alt) || weap && !alt && type != MONS_STATUE) + // + // Don't switch to alt weapon if it's a stack of throwing weapons. + if (alt && !is_range_weapon(*alt) && alt->quantity == 1 + || weap && !alt && type != MONS_STATUE) + { swap_weapons(near); + } } } |