summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dgn-shoals.cc
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-12-30 00:57:03 -0800
committerStefan O'Rear <stefanor@cox.net>2009-12-30 00:57:03 -0800
commit4db1d75dca2405e186a3e9869a2aa9e058cbf71f (patch)
tree87799a99c1980b14f32668f40817d581f64f203b /crawl-ref/source/dgn-shoals.cc
parent8a504d20b9992fea2daac06faa6ca5559ca63ae0 (diff)
downloadcrawl-ref-4db1d75dca2405e186a3e9869a2aa9e058cbf71f.tar.gz
crawl-ref-4db1d75dca2405e186a3e9869a2aa9e058cbf71f.zip
Allow tiles to destroy only some items.
Diffstat (limited to 'crawl-ref/source/dgn-shoals.cc')
-rw-r--r--crawl-ref/source/dgn-shoals.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/crawl-ref/source/dgn-shoals.cc b/crawl-ref/source/dgn-shoals.cc
index 367ca497d4..3547932a43 100644
--- a/crawl-ref/source/dgn-shoals.cc
+++ b/crawl-ref/source/dgn-shoals.cc
@@ -867,7 +867,7 @@ static void _shoals_run_tide(int &tide, int &acc)
}
static coord_def _shoals_escape_place_from(coord_def bad_place,
- bool monster_free)
+ actor *act, item_def *it)
{
int best_height = -1000;
coord_def chosen;
@@ -875,8 +875,8 @@ static coord_def _shoals_escape_place_from(coord_def bad_place,
{
coord_def p(*ai);
const dungeon_feature_type feat(grd(p));
- if (!feat_is_solid(feat) && !feat_destroys_items(feat)
- && (!monster_free || !actor_at(p)))
+ if ((!act || (feat_has_solid_floor(feat) && !actor_at(p)))
+ && (!it || !feat_destroys_item(feat, *it)))
{
if (best_height == -1000 || shoals_heights(p) > best_height)
{
@@ -894,12 +894,18 @@ static bool _shoals_tide_sweep_items_clear(coord_def c)
if (link == NON_ITEM)
return true;
- const coord_def target(_shoals_escape_place_from(c, false));
- // Don't abort tide entry because of items. If we can't sweep the
- // item clear here, let dungeon_terrain_changed teleport the item
- // to the nearest safe square.
- if (!target.origin())
- move_item_stack_to_grid(c, target);
+ for (stack_iterator si(c); si; ++si)
+ {
+ const coord_def target(_shoals_escape_place_from(c, NULL, &*si));
+ // Don't abort tide entry because of items. If we can't sweep the
+ // item clear here, let dungeon_terrain_changed teleport the item
+ // to the nearest safe square.
+ int id = si.link();
+
+ if (!target.origin())
+ move_item_to_grid(&id, target);
+ }
+
return true;
}
@@ -921,7 +927,7 @@ static bool _shoals_tide_sweep_actors_clear(coord_def c)
if (monster_habitable_grid(mvictim, DNGN_DEEP_WATER))
return true;
}
- coord_def evacuation_point(_shoals_escape_place_from(c, true));
+ coord_def evacuation_point(_shoals_escape_place_from(c, victim, NULL));
// The tide moves on even if we cannot evacuate the tile!
if (!evacuation_point.origin())
victim->move_to_pos(evacuation_point);