summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/overmap.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-15 11:02:27 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-15 11:02:27 +0000
commit325516c60743ee1241e9ca3d13e4fd8a36d19c94 (patch)
tree151760b072e644587218af90c0c0d7694256fb1a /crawl-ref/source/overmap.cc
parent298c1e905c0c3d04acdb1dd0c5e6bedce77dec3c (diff)
downloadcrawl-ref-325516c60743ee1241e9ca3d13e4fd8a36d19c94.tar.gz
crawl-ref-325516c60743ee1241e9ca3d13e4fd8a36d19c94.zip
Smarter exclusions, yay!
* Exclusions are now treated similarly to annotations and automatically added to the overmap (with the monster name if centered on a monster). * Exclusions remember whether they were placed automatically and if so, what monster triggered it. * If a grid that was previously autoexcluded comes back into sight and no longer contains the monster that triggered the autoexclusion (dead, moved away or invisible), the autoexclusion is removed again. I updated the tags, so it should be save compatible but I'm not making any promises. Also fix the Wild magic card not being documented correctly. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10679 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/overmap.cc')
-rw-r--r--crawl-ref/source/overmap.cc42
1 files changed, 37 insertions, 5 deletions
diff --git a/crawl-ref/source/overmap.cc b/crawl-ref/source/overmap.cc
index 5c1df7c285..26d797ef72 100644
--- a/crawl-ref/source/overmap.cc
+++ b/crawl-ref/source/overmap.cc
@@ -57,6 +57,7 @@ portal_vault_map_type portal_vaults_present;
portal_note_map_type portal_vault_notes;
portal_vault_colour_map_type portal_vault_colours;
annotation_map_type level_annotations;
+annotation_map_type level_exclusions;
static void _seen_altar( god_type god, const coord_def& pos );
static void _seen_staircase(dungeon_feature_type which_staircase,
@@ -721,14 +722,45 @@ void clear_level_annotation(level_id li)
level_annotations.erase(li);
}
-std::string get_level_annotation(level_id li)
+void set_level_exclusion_annotation(std::string str, level_id li)
+{
+ if (str.empty())
+ {
+ clear_level_exclusion_annotation(li);
+ return;
+ }
+
+ level_exclusions[li] = str;
+}
+
+void clear_level_exclusion_annotation(level_id li)
+{
+ level_exclusions.erase(li);
+}
+
+std::string get_level_annotation(level_id li, bool skip_excl)
{
annotation_map_type::const_iterator i = level_annotations.find(li);
- if (i == level_annotations.end())
+ if (skip_excl)
+ {
+ if (i == level_annotations.end())
+ return "";
+
+ return (i->second);
+ }
+
+ annotation_map_type::const_iterator j = level_exclusions.find(li);
+
+ if (i == level_annotations.end() && j == level_exclusions.end())
return "";
- return (i->second);
+ if (i == level_annotations.end())
+ return (j->second);
+ if (j == level_annotations.end())
+ return (i->second);
+
+ return (i->second + ", " + j->second);
}
bool level_annotation_has(std::string find, level_id li)
@@ -768,7 +800,7 @@ void annotate_level()
if (!get_level_annotation(li).empty())
{
mpr("Current level annotation is:", MSGCH_PROMPT);
- mpr(get_level_annotation(li).c_str() );
+ mpr(get_level_annotation(li, true).c_str() );
}
mpr("Set level annotation to what (using ! forces prompt)? ",
@@ -780,7 +812,7 @@ void annotate_level()
if (buf[0] == 0)
{
- if (get_level_annotation(li).length() > 0)
+ if (get_level_annotation(li, true).length() > 0)
{
if (!yesno("Really clear the annotation?"))
return;