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 +++++++++++++++++++++-- crawl-ref/source/menu.cc | 4 ---- crawl-ref/source/shopping.cc | 17 ++++++++--------- crawl-ref/source/spl-cast.cc | 4 ++-- 4 files changed, 31 insertions(+), 17 deletions(-) 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 " diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc index f760fd2c13..277f6f0bac 100644 --- a/crawl-ref/source/menu.cc +++ b/crawl-ref/source/menu.cc @@ -118,11 +118,7 @@ Menu::Menu( const formatted_string &fs ) select_filter(), highlighter(new MenuHighlighter), num(-1), lastch(0), alive(false), last_selected(-1) { -#ifdef USE_TILE - mdisplay = new MenuDisplayText(this); -#else mdisplay = new MenuDisplayText(this); -#endif mdisplay->set_num_columns(1); int colour = LIGHTGREY; diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc index 15fb4b87de..982cbb910c 100644 --- a/crawl-ref/source/shopping.cc +++ b/crawl-ref/source/shopping.cc @@ -105,12 +105,11 @@ static void _list_shop_keys(const std::string &purchasable, bool viewing) + (viewing ? "Examine" : "Buy"); } snprintf(buf, sizeof buf, + "[x/Esc" #ifdef USE_TILE - "[x/Esc/R-Click] exit" -#else - "[x/Esc] exit" + "/R-Click" #endif - " [!] %s %s", + "] exit [!] %s %s", (viewing ? "to select items " : "to examine items"), pkeys.c_str()); @@ -120,13 +119,13 @@ static void _list_shop_keys(const std::string &purchasable, bool viewing) cgotoxy(1, numlines, GOTO_CRT); fs = formatted_string::parse_string( + "[Enter" #ifdef USE_TILE - "[?/*] inventory [\\] known items " - "[Enter/L-Click] make purchase"); -#else - "[Enter] make purchase [\\] list known items " - "[?/*] inventory"); + "/L-Click" #endif + "] make purchase [\\] list known items " + "[?/*] inventory"); + fs.cprintf("%*s", get_number_of_cols() - fs.length() - 1, ""); fs.display(); } diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index c39774e896..88ffe247ae 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -182,8 +182,8 @@ static std::string _spell_extra_description(spell_type spell) int list_spells(bool toggle_with_I, bool viewing) { - ToggleableMenu spell_menu(MF_SINGLESELECT | MF_ANYPRINTABLE | - MF_ALWAYS_SHOW_MORE | MF_ALLOW_FORMATTING); + ToggleableMenu spell_menu(MF_SINGLESELECT | MF_ANYPRINTABLE + | MF_ALWAYS_SHOW_MORE | MF_ALLOW_FORMATTING); #ifdef USE_TILE { // [enne] - Hack. Make title an item so that it's aligned. -- cgit v1.2.3-54-g00ecf