summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/command.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-18 17:36:50 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-18 17:36:50 +0000
commit50c201eae4fa07d6901dc5632c294660fb1a0745 (patch)
tree01fce245e2693ab4c54ef55d06ffdf89fd035390 /crawl-ref/source/command.cc
parent88b3b611b4a78d557eed9f2266c74bdad2b38cd8 (diff)
downloadcrawl-ref-50c201eae4fa07d6901dc5632c294660fb1a0745.tar.gz
crawl-ref-50c201eae4fa07d6901dc5632c294660fb1a0745.zip
Outsource the tutorial descriptions of skills, and make them searchable
in the database. Apply Zaba's patch to view skills from the skill menu ('m'). The melee, ranged and magic skills currently only have really generic descriptions shamelessly copied from the tutorial. There's a front end function get_skill_description that appends extra information like what types of unarmed attacks the current character is capable of (kicking, clawing, punching, ...) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5955 c06c8d41-db1a-0410-9941-cceddc491573
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);
}