diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-12-22 08:06:20 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-12-22 08:06:20 +0000 |
commit | aecf0e083febd320abd59473440d33b333e7de17 (patch) | |
tree | 134c0e53e6fc767d909cda7da1161920df4b2d77 /crawl-ref/source/command.cc | |
parent | f6f2678aadaa63aa091c7a1282894487518f211a (diff) | |
download | crawl-ref-aecf0e083febd320abd59473440d33b333e7de17.tar.gz crawl-ref-aecf0e083febd320abd59473440d33b333e7de17.zip |
_do_description() now only appends stats/info/spells/etc when looking up spells
and items. Fixes a bug where the branch Dis was listed as being a level 4
Conjuraion/Air spell found in several spellbooks, and presumably fixes other
bugs of the same type (if any exist).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7910 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/command.cc')
-rw-r--r-- | crawl-ref/source/command.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index ac066af80a..d3b1d66784 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -1299,7 +1299,8 @@ static void _append_spells(std::string &desc, const item_def &item) } -static bool _do_description(std::string key, std::string footer = "") +static bool _do_description(std::string key, std::string type, + std::string footer = "") { std::string desc = getLongDescription(key); std::string quote = getQuoteString(key); @@ -1386,7 +1387,8 @@ static bool _do_description(std::string key, std::string footer = "") else { int thing_created = get_item_slot(); - if (thing_created != NON_ITEM) + if (thing_created != NON_ITEM + && (type == "item" || type == "spell")) { char name[80]; strncpy(name, key.c_str(), sizeof(name)); @@ -1604,7 +1606,7 @@ static bool _find_description(bool &again, std::string& error_inout) return (false); } else if (key_list.size() == 1) - return _do_description(key_list[0]); + return _do_description(key_list[0], type); if (exact_match) { @@ -1612,7 +1614,7 @@ static bool _find_description(bool &again, std::string& error_inout) footer += regex; footer += "'. To see non-exact matches, press space."; - if (!_do_description(regex, footer)) + if (!_do_description(regex, type, footer)) { DEBUGSTR("do_description() returned false for exact_match"); return (false); @@ -1690,7 +1692,7 @@ static bool _find_description(bool &again, std::string& error_inout) else key = *((std::string*) sel[0]->data); - if (_do_description(key)) + if (_do_description(key, type)) { if (getch() == 0) getch(); |