From b0e7dda3593b5e6022799727f3eb177fae3a5987 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 15 Mar 2009 16:25:56 +0000 Subject: * Tweak shop command help for Tiles. * Hook card descriptions into database. This is far from optimal at the moment, e.g. searching for the portal card returns the Portal spell as best match. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9497 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/command.cc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/command.cc') diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 6dec8688a0..f758fd84bc 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -24,6 +24,7 @@ REVISION("$Rev$"); #include "cio.h" #include "database.h" #include "debug.h" +#include "decks.h" #include "describe.h" #include "files.h" #include "initfile.h" @@ -1108,6 +1109,20 @@ static bool _feature_filter(std::string key, std::string body) return (feat_by_desc(key) == DNGN_UNSEEN); } +static bool _card_filter(std::string key, std::string body) +{ + key = lowercase_string(key); + std::string name; + for (int i = 0; i < NUM_CARDS; ++i) + { + name = lowercase_string(card_name((card_type) i)); + + if (name.find(key) != std::string::npos) + return (false); + } + return (true); +} + typedef void (*db_keys_recap)(std::vector&); static void _recap_mon_keys(std::vector &keys) @@ -1459,8 +1474,8 @@ 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, s(K)ill, (I)tem, (F)eature, (G)od " - "or (B)ranch?", MSGCH_PROMPT); + mpr("Describe a (M)onster, (S)pell, s(K)ill, (I)tem, (F)eature, (G)od, " + "(B)ranch, or (C)ard?", MSGCH_PROMPT); int ch = toupper(getch()); std::string type; @@ -1493,6 +1508,10 @@ static bool _find_description(bool &again, std::string& error_inout) type = "skill"; filter = _skill_filter; break; + case 'C': + type = "card"; + filter = _card_filter; + break; case 'I': type = "item"; extra = " Enter a single letter to list items displayed by " -- cgit v1.2.3-54-g00ecf