summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/abyss.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 02:09:42 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 02:09:42 +0000
commit7bf26e5c3d35fb8e6238e7bfcb83adb32fe86522 (patch)
treedc79a45f336d113ef22cbee9572c54b04bb026bb /crawl-ref/source/abyss.cc
parenta99a3aecdf286e0c0d16c5162c6b75753832d18c (diff)
downloadcrawl-ref-7bf26e5c3d35fb8e6238e7bfcb83adb32fe86522.tar.gz
crawl-ref-7bf26e5c3d35fb8e6238e7bfcb83adb32fe86522.zip
When doing an Abyss area shift try to preserve Sanctuary, unless the
center of Sanctuary is outside of the area being preserved during the shift, in which case get rid of it. When doing an Abyss teleport into a totally new Abyss area remove sanctuary so the player can lay down a new on immediately, since the old one will be completely gone. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6316 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/abyss.cc')
-rw-r--r--crawl-ref/source/abyss.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index f0deac1c39..cc1844e233 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -32,6 +32,7 @@
#include "lev-pand.h"
#include "randart.h"
#include "stuff.h"
+#include "spells3.h"
#include "terrain.h"
#include "tiles.h"
#include "traps.h"
@@ -436,12 +437,37 @@ void area_shift(void)
// Preserve floor props around the player, primarily so that
// blood-splatter doesn't appear out of nowhere when doing an
// area shift.
+ //
+ // Also shift sanctuary center if it's close.
+ coord_def sanct_pos(0, 0);
FixedArray<unsigned short, LOS_DIAMETER, LOS_DIAMETER> fprops;
const coord_def los_delta(LOS_RADIUS, LOS_RADIUS);
radius_iterator ri(you.pos(), LOS_RADIUS);
for ( ; ri; ++ri )
+ {
fprops(you.pos() - *ri + los_delta) = env.map(*ri).property;
+ if (env.sanctuary_pos == *ri && env.sanctuary_time > 0)
+ sanct_pos = *ri;
+ }
+
+ // If sanctuary center is outside of preserved area then just get
+ // rid of it.
+ if (env.sanctuary_time > 0 && sanct_pos == coord_def(0, 0))
+ {
+ remove_sanctuary(false);
+
+ coord_def pos;
+ for (pos.x = 0; pos.x < LOS_DIAMETER; pos.x++)
+ for (pos.y = 0; pos.y < LOS_DIAMETER; pos.y++)
+ {
+ if (fprops(pos) == FPROP_SANCTUARY_1
+ || fprops(pos) == FPROP_SANCTUARY_2)
+ {
+ fprops(pos) = FPROP_NONE;
+ }
+ }
+ }
_xom_check_nearness_setup();
@@ -534,6 +560,11 @@ void area_shift(void)
for ( ; ri2; ++ri2 )
env.map(*ri2).property = fprops(you.pos() - *ri2 + los_delta);
+ if (sanct_pos != coord_def(0, 0))
+ {
+ env.sanctuary_pos = sanct_pos;
+ }
+
mgen_data mons;
mons.level_type = LEVEL_ABYSS;
mons.proximity = PROX_AWAY_FROM_PLAYER;
@@ -591,6 +622,8 @@ void abyss_teleport( bool new_area )
}
}
+ remove_sanctuary(false);
+
#ifdef DEBUG_ABYSS
mpr("New area Abyss teleport.", MSGCH_DIAGNOSTICS);
#endif