From 4973016b5011454ea3648710b604b3c4d0ecec57 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sun, 15 Nov 2009 21:49:09 +0100 Subject: Add get_item_symbol to showsymb. --- crawl-ref/source/command.cc | 15 +++------------ crawl-ref/source/showsymb.cc | 5 +++++ crawl-ref/source/showsymb.h | 3 ++- crawl-ref/source/tutorial.cc | 6 ++---- 4 files changed, 12 insertions(+), 17 deletions(-) (limited to 'crawl-ref') 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" "Item types (and common commands)\n" @@ -2117,8 +2114,7 @@ static void _add_formatted_keyhelp(column_composer &cols) "/ : wands (eVoke)\n" ""; - get_show_symbol(show_type(SHOW_ITEM_BOOK), &ch, &colour); - item_types += static_cast(ch); + item_types += static_cast(get_item_symbol(SHOW_ITEM_BOOK)); item_types += " : books (read, Memorise, zap, Zap)\n" "\\ : staves and rods (wield and evoke)\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 << "Item types (and common commands)\n" @@ -2284,13 +2277,11 @@ static void _add_formatted_tutorial_help(column_composer &cols) "\" : amulets (Put on and Remove)\n" "/ : wands (eVoke)\n" ""; - get_show_symbol(show_type(SHOW_ITEM_BOOK), &ch, &colour); - text << static_cast(ch); + text << static_cast(get_item_symbol(SHOW_ITEM_BOOK)); text << " : books (read, Memorise and " "zap)\n" ""; - get_show_symbol(show_type(SHOW_ITEM_STAVE), &ch, &colour); - text << static_cast(ch); + text << static_cast(get_item_symbol(SHOW_ITEM_STAVE)); text << " : staves, rods (wield and evoke)\n" "\n" "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 << "('"; - get_show_symbol(show_type(SHOW_ITEM_BOOK), &ch, &colour); - text << static_cast(ch) + text << static_cast(get_item_symbol(SHOW_ITEM_BOOK)) << "') " << "that you can read by typing r. " "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 '"; - get_show_symbol(show_type(SHOW_ITEM_STAVE), &ch, &colour); - text << static_cast(ch) + text << static_cast(get_item_symbol(SHOW_ITEM_STAVE)) << "'" #endif ". Both must be wielded to be of use. " -- cgit v1.2.3-54-g00ecf