diff options
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/command.cc | 15 | ||||
-rw-r--r-- | crawl-ref/source/showsymb.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/showsymb.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/tutorial.cc | 6 |
4 files changed, 12 insertions, 17 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 834dca169a..89c59c8bdb 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -2100,9 +2100,6 @@ static void _add_formatted_keyhelp(column_composer &cols) " untrap, attack without move\n", true, true, _cmdhelp_textfilter); - unsigned ch; - // Initialise colour to quiet some Valgrind warnings. - unsigned short colour = BLACK; std::string item_types = "\n" "<h>Item types (and common commands)\n" @@ -2117,8 +2114,7 @@ static void _add_formatted_keyhelp(column_composer &cols) "<lightgrey>/</lightgrey> : wands (e<w>V</w>oke)\n" "<lightcyan>"; - get_show_symbol(show_type(SHOW_ITEM_BOOK), &ch, &colour); - item_types += static_cast<char>(ch); + item_types += static_cast<char>(get_item_symbol(SHOW_ITEM_BOOK)); item_types += "</lightcyan> : books (<w>r</w>ead, <w>M</w>emorise, <w>z</w>ap, <w>Z</w>ap)\n" "<brown>\\</brown> : staves and rods (<w>w</w>ield and e<w>v</w>oke)\n" @@ -2268,9 +2264,6 @@ static void _add_formatted_keyhelp(column_composer &cols) static void _add_formatted_tutorial_help(column_composer &cols) { - unsigned ch; - unsigned short colour; - std::ostringstream text; text << "<h>Item types (and common commands)\n" @@ -2284,13 +2277,11 @@ static void _add_formatted_tutorial_help(column_composer &cols) "<red>\"</red> : amulets (<w>P</w>ut on and <w>R</w>emove)\n" "<darkgrey>/</darkgrey> : wands (e<w>V</w>oke)\n" "<lightcyan>"; - get_show_symbol(show_type(SHOW_ITEM_BOOK), &ch, &colour); - text << static_cast<char>(ch); + text << static_cast<char>(get_item_symbol(SHOW_ITEM_BOOK)); text << "</lightcyan> : books (<w>r</w>ead, <w>M</w>emorise and " "<w>z</w>ap)\n" "<brown>"; - get_show_symbol(show_type(SHOW_ITEM_STAVE), &ch, &colour); - text << static_cast<char>(ch); + text << static_cast<char>(get_item_symbol(SHOW_ITEM_STAVE)); text << "</brown> : staves, rods (<w>w</w>ield and e<w>v</w>oke)\n" "\n" "<h>Movement and attacking\n" diff --git a/crawl-ref/source/showsymb.cc b/crawl-ref/source/showsymb.cc index 676673be22..788f78660c 100644 --- a/crawl-ref/source/showsymb.cc +++ b/crawl-ref/source/showsymb.cc @@ -116,6 +116,11 @@ static int _get_mons_colour(const monsters *mons) return (col); } +unsigned get_item_symbol(show_item_type it) +{ + return (get_feature_def(show_type(it)).symbol); +} + glyph get_item_glyph(const item_def *item) { glyph g; diff --git a/crawl-ref/source/showsymb.h b/crawl-ref/source/showsymb.h index 85939a5b61..ea89d87a0f 100644 --- a/crawl-ref/source/showsymb.h +++ b/crawl-ref/source/showsymb.h @@ -1,7 +1,7 @@ #ifndef SHOWSYMB_H #define SHOWSYMB_H -struct show_type; +#include "show.h" struct glyph { @@ -9,6 +9,7 @@ struct glyph unsigned short col; }; +unsigned get_item_symbol(show_item_type it); glyph get_item_glyph(const item_def *item); glyph get_mons_glyph(const monsters *mons); diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index 5d9edbebfa..e48dda9337 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -1737,8 +1737,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) #ifndef USE_TILE text << "('<w>"; - get_show_symbol(show_type(SHOW_ITEM_BOOK), &ch, &colour); - text << static_cast<char>(ch) + text << static_cast<char>(get_item_symbol(SHOW_ITEM_BOOK)) << "'</w>) " << "that you can read by typing <w>r</w>. " "If it's a spellbook you'll then be able to memorise spells " @@ -1989,8 +1988,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) #ifndef USE_TILE ", both of which are represented by '<w>"; - get_show_symbol(show_type(SHOW_ITEM_STAVE), &ch, &colour); - text << static_cast<char>(ch) + text << static_cast<char>(get_item_symbol(SHOW_ITEM_STAVE)) << "</w>'" #endif ". Both must be <w>w</w>ielded to be of use. " |