diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-12-04 18:06:10 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-12-04 18:06:10 +0100 |
commit | ff921f5e14ace24dfff646f0cffcebc0d9ac9762 (patch) | |
tree | e74b2aef7351e74e97b0698aff86b81abede86cd /crawl-ref/source/stairs.cc | |
parent | 9bf71eb23e7e7650f060883d53da92dd05b7b22d (diff) | |
download | crawl-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/stairs.cc')
-rw-r--r-- | crawl-ref/source/stairs.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc index de9c82da02..17baab785b 100644 --- a/crawl-ref/source/stairs.cc +++ b/crawl-ref/source/stairs.cc @@ -464,9 +464,8 @@ void up_stairs(dungeon_feature_type force_stair) _update_travel_cache(old_level, stair_pos); - env.map_shadow = env.map_knowledge; // Preventing obvious finding of stairs at your position. - env.map_shadow(you.pos()).flags |= MAP_SEEN_FLAG; + env.map_seen.set(you.pos()); viewwindow(); @@ -1051,9 +1050,8 @@ void down_stairs(dungeon_feature_type force_stair, bool force_known_shaft) trackers_init_new_level(true); _update_travel_cache(old_level, stair_pos); - env.map_shadow = env.map_knowledge; // Preventing obvious finding of stairs at your position. - env.map_shadow(you.pos()).flags |= MAP_SEEN_FLAG; + env.map_seen.set(you.pos()); viewwindow(); |