summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/describe.cc
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-15 00:49:34 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-15 00:49:34 -0800
commit9454f08a3d4e98c0b6c2c64b495e20e1316ecc58 (patch)
treea7877de5b712191efdff02dc588f252d228fde93 /crawl-ref/source/describe.cc
parent05010f1d267b268e68821223680f34545c443f5c (diff)
parentb3db32a1027c60c2ceea9e44697b833e660cb295 (diff)
downloadcrawl-ref-9454f08a3d4e98c0b6c2c64b495e20e1316ecc58.tar.gz
crawl-ref-9454f08a3d4e98c0b6c2c64b495e20e1316ecc58.zip
Merge branch 'master' of git://crawl-ref.git.sourceforge.net/gitroot/crawl-ref/crawl-ref
Diffstat (limited to 'crawl-ref/source/describe.cc')
-rw-r--r--crawl-ref/source/describe.cc31
1 files changed, 30 insertions, 1 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index e75423ded2..e87434318a 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -54,6 +54,7 @@
#include "xom.h"
#define LONG_DESC_KEY "long_desc_key"
+#define QUOTE_KEY "quote_key"
// ========================================================================
// Internal Functions
@@ -2087,6 +2088,15 @@ void get_feature_desc(const coord_def &pos, describe_info &inf)
inf.body << _get_feature_description_wide(grd(pos));
inf.quote = getQuoteString(db_name);
+
+ // Quotes don't care about custom descriptions.
+ if (props.exists(QUOTE_KEY))
+ {
+ const CrawlHashTable &quote_table = props[QUOTE_KEY].get_table();
+
+ if (quote_table.exists(db_name))
+ inf.quote = quote_table[db_name].get_string();
+ }
}
void describe_feature_wide(const coord_def& pos)
@@ -2122,6 +2132,25 @@ void set_feature_desc_long(const std::string &raw_name,
desc_table[raw_name] = desc;
}
+void set_feature_quote(const std::string &raw_name,
+ const std::string &quote)
+{
+ ASSERT(!raw_name.empty());
+
+ CrawlHashTable &props = env.properties;
+
+ if (!props.exists(QUOTE_KEY))
+ props[QUOTE_KEY].new_table();
+
+ CrawlHashTable &quote_table = props[QUOTE_KEY].get_table();
+
+ if (quote.empty())
+ quote_table.erase(raw_name);
+ else
+ quote_table[raw_name] = quote;
+}
+
+
void get_item_desc(const item_def &item, describe_info &inf, bool terse)
{
// Don't use verbose descriptions if terse and the item contains spells,
@@ -2776,7 +2805,7 @@ void get_monster_db_desc(const monsters& mons, describe_info &inf,
// descriptions in Lua vaults by using MonPropsMarker. This is also the
// method used by set_feature_desc_long, etc. {due}
if (mons.props.exists("description"))
- inf.body << std::string(mons.props["description"]);
+ inf.body << mons.props["description"].get_string();
// Don't get description for player ghosts.
else if (mons.type != MONS_PLAYER_GHOST)
inf.body << getLongDescription(db_name);