summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/viewmap.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-12-04 18:06:10 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-12-04 18:06:10 +0100
commitff921f5e14ace24dfff646f0cffcebc0d9ac9762 (patch)
treee74b2aef7351e74e97b0698aff86b81abede86cd /crawl-ref/source/viewmap.cc
parent9bf71eb23e7e7650f060883d53da92dd05b7b22d (diff)
downloadcrawl-ref-ff921f5e14ace24dfff646f0cffcebc0d9ac9762.tar.gz
crawl-ref-ff921f5e14ace24dfff646f0cffcebc0d9ac9762.zip
Drop map_shadow, use a bitmap and update it incrementally.
Copying the whole map_knowledge every turn was really costly. We don't care about any fields of the map other than the "seen" flag, too. Thus, we can move it into a bitmap and update only changes rather than everything. This means we need to update the entire bitmap once exploration starts, but that's a small fraction of the cost: qw profiles: before: 9.55% check_for_interesting_features() 0.18% start_explore(bool) after: 0.29% start_explore(bool) 0.10% check_for_interesting_features()
Diffstat (limited to 'crawl-ref/source/viewmap.cc')
-rw-r--r--crawl-ref/source/viewmap.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/crawl-ref/source/viewmap.cc b/crawl-ref/source/viewmap.cc
index a46716e911..bb8e0e760b 100644
--- a/crawl-ref/source/viewmap.cc
+++ b/crawl-ref/source/viewmap.cc
@@ -716,6 +716,7 @@ static void _unforget_map()
// Don't overwrite known squares, nor magic-mapped with
// magic-mapped data -- what was forgotten is less up to date.
env.map_knowledge(*ri) = old(*ri);
+ env.map_seen.set(*ri);
}
}
@@ -727,6 +728,7 @@ static void _forget_map()
continue;
env.map_knowledge(*ri).flags &= ~MAP_SEEN_FLAG;
env.map_knowledge(*ri).flags |= MAP_MAGIC_MAPPED_FLAG;
+ env.map_seen.set(*ri, false);
}
}