diff options
author | Matthew Cline <zelgadis@sourceforge.net> | 2009-10-25 00:23:09 -0700 |
---|---|---|
committer | Matthew Cline <zelgadis@sourceforge.net> | 2009-10-25 00:23:09 -0700 |
commit | a0ae32c8f8a04398b4b99880069eb31a26b43eff (patch) | |
tree | e619d8de305de18bb7c9fc1ead65ee33a1377f33 /crawl-ref/source/directn.cc | |
parent | 83d7fbfa11973abf823ed07f4c7b39956fc6aa4a (diff) | |
download | crawl-ref-a0ae32c8f8a04398b4b99880069eb31a26b43eff.tar.gz crawl-ref-a0ae32c8f8a04398b4b99880069eb31a26b43eff.zip |
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.
Diffstat (limited to 'crawl-ref/source/directn.cc')
-rw-r--r-- | crawl-ref/source/directn.cc | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index dc49279f14..ca40ea7fdc 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -2873,18 +2873,6 @@ void setup_feature_descs_short() base_desc_to_short[i->first] = i->second.get_string(); } -static std::string _marker_feature_description(const coord_def &p) -{ - std::vector<map_marker*> markers = env.markers.get_markers_at(p); - for (int i = 0, size = markers.size(); i < size; ++i) - { - const std::string desc = markers[i]->feature_description(); - if (!desc.empty()) - return (desc); - } - return (""); -} - #ifndef DEBUG_DIAGNOSTICS // Is a feature interesting enough to 'v'iew it, even if a player normally // doesn't care about descriptions, i.e. does the description hold important @@ -2899,6 +2887,17 @@ std::string feature_description(const coord_def& where, bool bloody, description_level_type dtype, bool add_stop, bool base_desc) { + std::string marker_desc = + env.markers.property_at(where, MAT_ANY, "feature_description"); + + if (!marker_desc.empty()) + { + if (bloody) + marker_desc += ", spattered with blood"; + + return thing_do_grammar(dtype, add_stop, false, marker_desc); + } + dungeon_feature_type grid = grd(where); if (grid == DNGN_SECRET_DOOR) grid = grid_secret_door_appearance(where); @@ -2916,6 +2915,11 @@ std::string feature_description(const coord_def& where, bool bloody, desc += "detected secret "; desc += noun; + const std::string door_desc_suffix = + env.markers.property_at(where, MAT_ANY, + "door_description_suffix"); + desc += door_desc_suffix; + if (bloody) desc += ", spattered with blood"; @@ -2946,9 +2950,10 @@ std::string feature_description(const coord_def& where, bool bloody, return shop_name(where, add_stop); case DNGN_ENTER_PORTAL_VAULT: + // Should have been handled at the top of the function. return (thing_do_grammar( dtype, add_stop, false, - _marker_feature_description(where))); + "UNAMED PORTAL VAULT ENTRY")); default: return (feature_description(grid, NUM_TRAPS, bloody, dtype, add_stop, base_desc)); |