summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilereg.cc
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-11 00:41:28 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-11 00:41:28 +0000
commita84ce421489674dd1078dcf642011c8ef82b8cf3 (patch)
tree84a0f048e43b159f55761d447b70d32dd8bd3d93 /crawl-ref/source/tilereg.cc
parentaece73f4451a17501468cae9df21daa6548432e1 (diff)
downloadcrawl-ref-a84ce421489674dd1078dcf642011c8ef82b8cf3.tar.gz
crawl-ref-a84ce421489674dd1078dcf642011c8ef82b8cf3.zip
Turning back on minimap for labyrinths, but fixing it so that it recenters during map rot, as if the forgotten squares were never seen. (Sorry, jpeg. If you can see it using 'X', I think you should be able to also see it on the minimap.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8404 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tilereg.cc')
-rw-r--r--crawl-ref/source/tilereg.cc37
1 files changed, 34 insertions, 3 deletions
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 9193ea8749..700f1caeed 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1783,7 +1783,7 @@ void MapRegion::render()
m_buf_lines.draw();
}
-void MapRegion::update_offsets()
+void MapRegion::recenter()
{
// adjust offsets to center map
ox = (wx - dx * (m_max_gx - m_min_gx)) / 2;
@@ -1805,7 +1805,38 @@ void MapRegion::set(int gx, int gy, map_feature f)
m_min_gy = std::min(m_min_gy, gy);
m_max_gy = std::max(m_max_gy, gy);
- update_offsets();
+ recenter();
+}
+
+void MapRegion::update_bounds()
+{
+ int min_gx = m_min_gx;
+ int max_gx = m_max_gx;
+ int min_gy = m_min_gy;
+ int max_gy = m_max_gy;
+
+ m_min_gx = GXM;
+ m_max_gx = 0;
+ m_min_gy = GYM;
+ m_max_gy = 0;
+
+ for (int x = min_gx; x <= max_gx; x++)
+ {
+ for (int y = min_gy; y <= max_gy; y++)
+ {
+ map_feature f = (map_feature)m_buf[x + y * mx];
+ if (f == MF_UNSEEN)
+ continue;
+
+ m_min_gx = std::min(m_min_gx, x);
+ m_max_gx = std::max(m_max_gx, x);
+ m_min_gy = std::min(m_min_gy, y);
+ m_max_gy = std::max(m_max_gy, y);
+ }
+ }
+
+ recenter();
+ m_dirty = true;
}
void MapRegion::set_window(const coord_def &start, const coord_def &end)
@@ -1828,7 +1859,7 @@ void MapRegion::clear()
m_win_end.x = -1;
m_win_end.y = -1;
- update_offsets();
+ recenter();
if (m_buf)
memset(m_buf, 0, sizeof(*m_buf) * mx * my);