From a0ae32c8f8a04398b4b99880069eb31a26b43eff Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Sun, 25 Oct 2009 00:23:09 -0700 Subject: Let markers change the description of any feature Allow markers to change the short and/or long description of any feature, not just portal vault entrances. The feature_description() and feature_description_long() functions have been removed from the mapmark classes and turned into ordinary properties. Also added the marker property "door_description_suffix", which can be used to alter the short description of (known) doors by appending a string to them. --- crawl-ref/source/describe.cc | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'crawl-ref/source/describe.cc') diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index bcce934a0c..482d467f2c 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -2008,18 +2008,6 @@ std::string get_item_description( const item_def &item, bool verbose, return description.str(); } -static std::string _marker_feature_description(const coord_def &pos) -{ - std::vector markers = env.markers.get_markers_at(pos); - for (int i = 0, size = markers.size(); i < size; ++i) - { - const std::string desc = markers[i]->feature_description_long(); - if (!desc.empty()) - return (desc); - } - return (""); -} - static std::string _get_feature_description_wide(int feat) { return std::string(); @@ -2044,14 +2032,19 @@ void get_feature_desc(const coord_def &pos, describe_info &inf) bool custom_desc = false; - if (feat == DNGN_ENTER_PORTAL_VAULT) + const std::string marker_desc = + env.markers.property_at(pos, MAT_ANY, "feature_description_long"); + + if (!marker_desc.empty()) { - std::string _desc = _marker_feature_description(pos); - if (!_desc.empty()) - { - long_desc = _desc; - custom_desc = true; - } + long_desc = marker_desc; + custom_desc = true; + } + + if (feat == DNGN_ENTER_PORTAL_VAULT && !custom_desc) + { + long_desc = "UNDESCRIBE PORTAL VAULT ENTRANCE."; + custom_desc = true; } const CrawlHashTable &props = env.properties; -- cgit v1.2.3-54-g00ecf