From b86f2dde44a8da7e12a6630cfe06589ee480b1c2 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Thu, 27 Nov 2008 06:28:38 +0000 Subject: When entering a portal vault, don't prompt wizards for which map to use if there's only one possibility to choose from. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7649 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/dungeon.cc | 2 +- crawl-ref/source/maps.cc | 8 ++++++++ crawl-ref/source/maps.h | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 86a283462e..75a22a57c2 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -2268,7 +2268,7 @@ static void _portal_vault_level(int level_number) const map_def *vault = random_map_for_place(level_id::current(), false); #ifdef WIZARD - if (!vault && you.wizard && random_map_for_tag(level_name, false)) + if (!vault && you.wizard && map_count_for_tag(level_name, false) > 1) { char buf[80]; diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index 37dab0e197..adc4df3f09 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -620,6 +620,14 @@ int map_count() return (vdefs.size()); } +int map_count_for_tag(const std::string &tag, + bool want_minivault, + bool check_depth) +{ + return _eligible_maps_for_selector( + map_selector::by_tag(tag, want_minivault, check_depth)).size(); +} + ///////////////////////////////////////////////////////////////////////////// // Reading maps from .des files. diff --git a/crawl-ref/source/maps.h b/crawl-ref/source/maps.h index a46f861866..ba1e9257f2 100644 --- a/crawl-ref/source/maps.h +++ b/crawl-ref/source/maps.h @@ -27,6 +27,8 @@ void fit_region_into_map_bounds(coord_def &pos, const coord_def &size); const map_def *map_by_index(int index); int map_count(); +int map_count_for_tag(const std::string &tag, bool want_minivault, + bool check_depth = false); const map_def *find_map_by_name(const std::string &name); const map_def *random_map_for_place(const level_id &place, bool mini = false); -- cgit v1.2.3-54-g00ecf