diff options
author | Shmuale Mark <shm.mark@gmail.com> | 2014-06-11 10:57:34 -0400 |
---|---|---|
committer | Shmuale Mark <shm.mark@gmail.com> | 2014-06-11 10:57:34 -0400 |
commit | bbcd8840a9d2cc1fa19d1d135fe6757c89ff2417 (patch) | |
tree | 60e992737ab6ca0459af89734db1105b37c7bca9 /crawl-ref/source/startup.cc | |
parent | 2cf48292452445b275df5d685341c721aadafa5e (diff) | |
download | crawl-ref-bbcd8840a9d2cc1fa19d1d135fe6757c89ff2417.tar.gz crawl-ref-bbcd8840a9d2cc1fa19d1d135fe6757c89ff2417.zip |
Move zap_los_monsters and apply it through glass.
Diffstat (limited to 'crawl-ref/source/startup.cc')
-rw-r--r-- | crawl-ref/source/startup.cc | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/crawl-ref/source/startup.cc b/crawl-ref/source/startup.cc index 103be4b1bf..34cec67303 100644 --- a/crawl-ref/source/startup.cc +++ b/crawl-ref/source/startup.cc @@ -10,6 +10,7 @@ #include "branch.h" #include "cio.h" #include "command.h" +#include "coordit.h" #include "ctest.h" #include "database.h" #include "dbg-maps.h" @@ -34,6 +35,7 @@ #include "message.h" #include "misc.h" #include "mon-cast.h" +#include "mon-death.h" #include "mon-util.h" #include "mutation.h" #include "newgame.h" @@ -192,6 +194,40 @@ static void _initialize() } } +/** KILL_RESETs all monsters in LOS. +* +* Uses LOS_DEFAULT since some arrival vaults have glass. +* @param items_also whether to zap items as well as monsters. +*/ +static void _zap_los_monsters(bool items_also) +{ + for (radius_iterator ri(you.pos(), LOS_DEFAULT); ri; ++ri) + { + if (items_also) + { + int item = igrd(*ri); + + if (item != NON_ITEM && mitm[item].defined()) + destroy_item(item); + } + + // If we ever allow starting with a friendly monster, + // we'll have to check here. + monster* mon = monster_at(*ri); + if (mon == NULL || mons_class_flag(mon->type, M_NO_EXP_GAIN)) + continue; + + dprf("Dismissing %s", + mon->name(DESC_PLAIN, true).c_str()); + + // Do a hard reset so the monster's items will be discarded. + mon->flags |= MF_HARD_RESET; + // Do a silent, wizard-mode monster_die() just to be extra sure the + // player sees nothing. + monster_die(mon, KILL_DISMISSED, NON_MONSTER, true, true); + } +} + static void _post_init(bool newc) { ASSERT(strwidth(you.your_name) <= kNameLen); @@ -303,7 +339,7 @@ static void _post_init(bool newc) // For a new game, wipe out monsters in LOS, and // for new hints mode games also the items. - zap_los_monsters(Hints.hints_events[HINT_SEEN_FIRST_OBJECT]); + _zap_los_monsters(Hints.hints_events[HINT_SEEN_FIRST_OBJECT]); if (crawl_state.game_is_zotdef()) fully_map_level(); |