From 370dc08f2832bbbdae426ea35a0de6b2bd31a804 Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Sun, 15 Nov 2009 01:43:08 -0800 Subject: Travel exclude speedup Speed up is_excluded() by making the class exclude_set, which caches the set of excluded points, calculating the set only when exclusions are added or removed (or when an old level is loaded). NOTE: This recomputes the set of excluded points once upon entering level-map mode and once upon exiting it. If this takes to long on slow machines, this can be improved. --- crawl-ref/source/travel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/travel.h') diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h index 739d4a5fac..87216aa6e1 100644 --- a/crawl-ref/source/travel.h +++ b/crawl-ref/source/travel.h @@ -375,7 +375,7 @@ struct LevelInfo void clear_distances(); void set_level_excludes(); - const std::vector &get_excludes() const + const exclude_set &get_excludes() const { return excludes; } @@ -413,7 +413,7 @@ private: std::vector stairs; // Squares that are not safe to travel to. - std::vector excludes; + exclude_set excludes; std::vector stair_distances; // Dist between stairs level_id id; -- cgit v1.2.3-54-g00ecf