summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/command.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/command.cc')
-rw-r--r--crawl-ref/source/command.cc31
1 files changed, 27 insertions, 4 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 2f348e68e3..b6f92d2690 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -44,6 +44,7 @@
#include "player.h"
#include "quiver.h"
#include "religion.h"
+#include "skills2.h"
#include "spl-cast.h"
#include "spl-util.h"
#include "state.h"
@@ -1035,6 +1036,24 @@ static bool _item_filter(std::string key, std::string body)
return (item_types_by_name(key).base_type == OBJ_UNASSIGNED);
}
+static bool _skill_filter(std::string key, std::string body)
+{
+ key = lowercase_string(key);
+ std::string name;
+ for (int i = 0; i < NUM_SKILLS; i++)
+ {
+ // There are a couple of NULL entries in the skill set.
+ if (!skill_name(i))
+ continue;
+
+ name = lowercase_string(skill_name(i));
+
+ if (name.find(key) != std::string::npos)
+ return (false);
+ }
+ return (true);
+}
+
static bool _feature_filter(std::string key, std::string body)
{
return (feat_by_desc(key) == DNGN_UNSEEN);
@@ -1165,7 +1184,7 @@ static bool _find_description(bool &again, std::string& error_inout)
if (! error_inout.empty())
mpr(error_inout.c_str(), MSGCH_PROMPT);
- mpr("Describe a (M)onster, (S)pell, (I)tem, (F)eature, (G)od "
+ mpr("Describe a (M)onster, (S)pell, s(K)ill, (I)tem, (F)eature, (G)od "
"or (B)ranch?", MSGCH_PROMPT);
int ch = toupper(getch());
@@ -1195,6 +1214,10 @@ static bool _find_description(bool &again, std::string& error_inout)
type = "spell";
filter = _spell_filter;
break;
+ case 'K':
+ type = "skill";
+ filter = _skill_filter;
+ break;
case 'I':
type = "item";
extra = " Enter a single letter to list items displayed by "
@@ -1295,19 +1318,19 @@ static bool _find_description(bool &again, std::string& error_inout)
{
error_inout = "No monsters with symbol '";
error_inout += regex;
- error_inout += "'";
+ error_inout += "'.";
}
else if (by_item_symbol)
{
error_inout = "No items with symbol '";
error_inout += regex;
- error_inout += "'";
+ error_inout += "'.";
}
else
{
error_inout = "No matching ";
error_inout += type;
- error_inout += "s";
+ error_inout += "s.";
}
return (false);
}