summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-19 23:39:20 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-19 23:39:20 -0800
commit62b43a841470611914a42bad9799d6ee8825c950 (patch)
treef946bfbf690d23ee33161ce09e894b0c2a539949 /crawl-ref/source
parent38cee7a5098ed1c6e6920df98370128a28df8e06 (diff)
downloadcrawl-ref-62b43a841470611914a42bad9799d6ee8825c950.tar.gz
crawl-ref-62b43a841470611914a42bad9799d6ee8825c950.zip
Fix X-map last travel memory for new 3D X-map
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/player.cc1
-rw-r--r--crawl-ref/source/player.h1
-rw-r--r--crawl-ref/source/travel.cc16
3 files changed, 11 insertions, 7 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 6948b7b5f6..2b2545a611 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -5398,6 +5398,7 @@ void player::init()
running.clear();
travel_x = 0;
travel_y = 0;
+ travel_z = level_id();
religion = GOD_NO_GOD;
piety = 0;
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 06b65d2d1f..9694298fdf 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -49,6 +49,7 @@ public:
// Coordinates of last travel target; note that this is never used by
// travel itself, only by the level-map to remember the last travel target.
short travel_x, travel_y;
+ level_id travel_z;
runrest running; // Nonzero if running/traveling.
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index f0965784ce..7502b38b37 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -472,9 +472,6 @@ void travel_init_new_level()
you.running.clear();
you.running = runmode;
- // Zero out last travel coords
- you.travel_x = you.travel_y = 0;
-
traps_inited = false;
curr_excludes.clear();
travel_cache.set_level_excludes();
@@ -2301,6 +2298,11 @@ void start_translevel_travel(const travel_target &pos)
return;
}
+ // Remember where we're going so we can easily go back if interrupted.
+ you.travel_x = pos.p.pos.x;
+ you.travel_y = pos.p.pos.y;
+ you.travel_z = pos.p.id;
+
if (!can_travel_interlevel())
{
start_travel(pos.p.pos);
@@ -2727,10 +2729,6 @@ void start_travel(const coord_def& p)
if (p == you.pos())
return;
- // Remember where we're going so we can easily go back if interrupted.
- you.travel_x = p.x;
- you.travel_y = p.y;
-
if (!i_feel_safe(true, true))
return;
@@ -2740,6 +2738,10 @@ void start_travel(const coord_def& p)
if (!is_travelsafe_square(p, true))
return;
+ you.travel_x = p.x;
+ you.travel_y = p.y;
+ you.travel_z = level_id::current();
+
you.running.pos = p;
level_target = level_pos(level_id::current(), p);