summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-06 12:33:39 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-06 12:33:39 +0000
commitb6f9c63b61bef7db683362e7731920a913a65d88 (patch)
tree27987ce6358686f53c49e47d4c2ca7a2ac4bc12e /crawl-ref
parentdad292b6867a8cc517295ad05388354843e5423e (diff)
downloadcrawl-ref-b6f9c63b61bef7db683362e7731920a913a65d88.tar.gz
crawl-ref-b6f9c63b61bef7db683362e7731920a913a65d88.zip
Fix crash when items have to be moved around after a labyrinth shift.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7392 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/effects.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index ba6c75f378..d0002e8f22 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2615,7 +2615,10 @@ void change_labyrinth(bool msg)
for (unsigned int i = 0; i < dirs.size(); i++)
{
const coord_def p = c + dirs[i];
- if (!grid_is_solid(grd(p)) && !grid_destroys_items(grd(p)))
+ if (!in_bounds(p))
+ continue;
+
+ if (_is_floor(grd(p)))
{
// Once a valid grid is found, move all items from the
// stack onto it.
@@ -2624,12 +2627,17 @@ void change_labyrinth(bool msg)
{
mitm[it].pos.x = p.x;
mitm[it].pos.y = p.y;
+ if (mitm[it].link == NON_ITEM)
+ {
+ // Link to the stack on the target grid p,
+ // or NON_ITEM, if empty.
+ mitm[it].link = igrd(p);
+ break;
+ }
it = mitm[it].link;
}
- // Link to the stack on the target grid p, or
- // NON_ITEM if empty.
- mitm[it].link = igrd(p);
+ // Move entire stack over to p.
igrd(p) = igrd(c);
igrd(c) = NON_ITEM;