diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-12 23:27:37 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-12 23:27:37 +0100 |
commit | 86d2ebe14adcd77d1d6365070316ed426c7ddb9e (patch) | |
tree | 5b11a6df73f9b3bf472c1dda5c02f6f3fb483bc6 /crawl-ref/source/stuff.cc | |
parent | 4659bda92ee4748248f9ef5e5e978f155fb20672 (diff) | |
download | crawl-ref-86d2ebe14adcd77d1d6365070316ed426c7ddb9e.tar.gz crawl-ref-86d2ebe14adcd77d1d6365070316ed426c7ddb9e.zip |
An improved attempt at zapping monsters in starting LOS.
Now make sure that clouds don't temporarily block LOS
to monsters in view of the starting position. It's
possible that no clouds can exist at that point, but
this is safer.
Diffstat (limited to 'crawl-ref/source/stuff.cc')
-rw-r--r-- | crawl-ref/source/stuff.cc | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 377b9ba84a..4f4a11b76a 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -885,27 +885,21 @@ bool is_trap_square(dungeon_feature_type grid) // Does the equivalent of KILL_RESET on all monsters in LOS. Should only be // applied to new games. -void zap_los_monsters() +void zap_los_monsters(bool items_also) { - calc_show_los(); + // Not using player LOS since clouds might temporarily + // block monsters. + los_def los(you.pos(), opc_fullyopaque); + los.update(); - for (rectangle_iterator ri(crawl_view.vlos1, crawl_view.vlos2); ri; ++ri ) + for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri) { - const coord_def g = view2grid(*ri); - - if (!map_bounds(g)) - continue; - - if (!you.see_cell(g)) + if (!you.see_cell(*ri)) continue; - if (g == you.pos()) - continue; - - // At tutorial beginning disallow items in line of sight. - if (Options.tutorial_events[TUT_SEEN_FIRST_OBJECT]) + if (items_also) { - int item = igrd(g); + int item = igrd(*ri); if (item != NON_ITEM && mitm[item].is_valid() ) destroy_item(item); @@ -913,11 +907,8 @@ void zap_los_monsters() // If we ever allow starting with a friendly monster, // we'll have to check here. - monsters *mon = monster_at(g); - if (mon == NULL) - continue; - - if (mons_class_flag( mon->type, M_NO_EXP_GAIN )) + monsters *mon = monster_at(*ri); + if (mon == NULL || mons_class_flag(mon->type, M_NO_EXP_GAIN)) continue; #ifdef DEBUG_DIAGNOSTICS |