From f5b0269efde99613163d99346035b53a82661ceb Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sun, 15 Nov 2009 22:10:59 +0100 Subject: Replace get_show_symbol by get_show_glyph. --- crawl-ref/source/directn.cc | 11 ++++------- crawl-ref/source/showsymb.cc | 15 +++++++++------ crawl-ref/source/showsymb.h | 2 +- crawl-ref/source/tutorial.cc | 42 +++++++++--------------------------------- 4 files changed, 23 insertions(+), 47 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 496cef14c2..4293da9428 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -673,15 +673,12 @@ void full_describe_view() std::string desc = ""; #ifndef USE_TILE const coord_def e = c - you.pos() + coord_def(8,8); - show_type object = env.show(e); - unsigned short col = object.colour; - unsigned ch; - get_show_symbol(object, &ch, &col); - const std::string colour_str = colour_to_str(col); + glyph g = get_show_glyph(env.show(e)); + const std::string colour_str = colour_to_str(g.col); desc = "(<" + colour_str + ">"; - desc += stringize_glyph(ch); - if (ch == '<') + desc += stringize_glyph(g.ch); + if (g.ch == '<') desc += '<'; desc += ") "; diff --git a/crawl-ref/source/showsymb.cc b/crawl-ref/source/showsymb.cc index eb815c41e8..1fb25beb8c 100644 --- a/crawl-ref/source/showsymb.cc +++ b/crawl-ref/source/showsymb.cc @@ -51,18 +51,21 @@ void get_symbol(const coord_def& where, *colour = real_colour(*colour); } -void get_show_symbol(show_type object, unsigned *ch, - unsigned short *colour) +glyph get_show_glyph(show_type object) { + glyph g; + g.col = object.colour; if (object.cls < SH_MONSTER) { - *ch = get_feature_def(object).symbol; + const feature_def &fdef = get_feature_def(object); + g.ch = fdef.symbol; // Don't clobber with BLACK, because the colour should be already set. - if (get_feature_def(object).colour != BLACK) - *colour = get_feature_def(object).colour; + if (fdef.colour != BLACK) + g.col = fdef.colour; } - *colour = real_colour(*colour); + g.col = real_colour(g.col); + return (g); } static int _get_mons_colour(const monsters *mons) diff --git a/crawl-ref/source/showsymb.h b/crawl-ref/source/showsymb.h index c99198e69e..f11d1cac89 100644 --- a/crawl-ref/source/showsymb.h +++ b/crawl-ref/source/showsymb.h @@ -13,13 +13,13 @@ unsigned get_feat_symbol(dungeon_feature_type feat); unsigned get_item_symbol(show_item_type it); glyph get_item_glyph(const item_def *item); glyph get_mons_glyph(const monsters *mons); +glyph get_show_glyph(show_type object); unsigned get_screen_glyph( const coord_def &p ); void get_symbol(const coord_def& where, show_type object, unsigned *ch, unsigned short *colour); -void get_show_symbol(show_type object, unsigned *ch, unsigned short *colour); #endif diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index e48dda9337..4386c0a663 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -1688,9 +1688,6 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) #ifndef USE_TILE const coord_def e = gc - you.pos() + coord_def(9,9); - unsigned ch; - unsigned short colour; - show_type object; #endif Options.tut_just_triggered = true; @@ -2037,11 +2034,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) if (monster_at(gc)) DELAY_EVENT; - object = env.show(e); - colour = object.colour; - { unsigned short dummy; get_show_symbol( object, &ch, &dummy ); } - - text << _colourize_glyph(colour, ch) << " "; + text << _colourize_glyph(get_show_glyph(env.show(e))) << " "; #else tiles.place_cursor(CURSOR_TUTORIAL, gc); tiles.add_text_tag(TAG_TUTORIAL, "Stairs", gc); @@ -2068,11 +2061,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) text << "These "; #ifndef USE_TILE - object = env.show(e); - colour = object.colour; - get_show_symbol( object, &ch, &colour ); - - text << _colourize_glyph(colour, ch); + text << _colourize_glyph(get_show_glyph(env.show(e))); text << " "; #else tiles.place_cursor(CURSOR_TUTORIAL, gc); @@ -2097,11 +2086,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) DELAY_EVENT; // FIXME: Branch entrance character is not being colored yellow. - object = env.show(e); - colour = object.colour; - { unsigned short dummy; get_show_symbol( object, &ch, &dummy ); } - - text << _colourize_glyph(colour, ch) << " "; + text << _colourize_glyph(get_show_glyph(env.show(e))) << " "; #else tiles.place_cursor(CURSOR_TUTORIAL, gc); tiles.add_text_tag(TAG_TUTORIAL, "Branch stairs", gc); @@ -2135,11 +2120,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) if (monster_at(gc)) DELAY_EVENT; - object = env.show(e); - colour = object.colour; - { unsigned short dummy; get_show_symbol( object, &ch, &dummy ); } - - text << _colourize_glyph(colour, ch) << " "; + text << _colourize_glyph(get_show_glyph(env.show(e))) << " "; #else tiles.place_cursor(CURSOR_TUTORIAL, gc); tiles.add_text_tag(TAG_TUTORIAL, "Portal", gc); @@ -2208,14 +2189,12 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) text << "An unwary adventurer will occasionally stumble into one " "of these nasty constructions"; #ifndef USE_TILE - object = env.show(e); - colour = object.colour; - get_show_symbol( object, &ch, &colour ); + glyph g = get_show_glyph(env.show(e)); - if (ch == ' ' || colour == BLACK) - colour = LIGHTCYAN; + if (g.ch == ' ' || g.col == BLACK) + g.col = LIGHTCYAN; - text << " depicted by " << _colourize_glyph(colour, '^'); + text << " depicted by " << _colourize_glyph(g.col, '^'); #endif text << ". They can do physical damage (with darts or needles, for " "example) or have other, more magical effects, like " @@ -2225,10 +2204,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) case TUT_SEEN_ALTAR: text << "That "; #ifndef USE_TILE - object = env.show(e); - colour = object.colour; - get_show_symbol( object, &ch, &colour ); - text << _colourize_glyph(colour, ch) << " "; + text << _colourize_glyph(get_show_glyph(env.show(e))) << " "; #else { tiles.place_cursor(CURSOR_TUTORIAL, gc); -- cgit v1.2.3-54-g00ecf