From c9f5e47a78c5332e785ddf3c7c0b1b219c3010a0 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sat, 14 Nov 2009 22:53:39 +0100 Subject: Untangle map memory and get_symbol. --- crawl-ref/source/map_knowledge.cc | 11 +++++++++-- crawl-ref/source/showsymb.cc | 18 ++---------------- crawl-ref/source/showsymb.h | 4 +--- crawl-ref/source/viewchar.cc | 5 +++++ 4 files changed, 17 insertions(+), 21 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/map_knowledge.cc b/crawl-ref/source/map_knowledge.cc index e46d7fb45c..d79e727507 100644 --- a/crawl-ref/source/map_knowledge.cc +++ b/crawl-ref/source/map_knowledge.cc @@ -6,9 +6,10 @@ #include "dgnevent.h" #include "directn.h" #include "env.h" +#include "feature.h" +#include "mon-util.h" #include "notes.h" #include "overmap.h" -#include "showsymb.h" #include "stuff.h" #include "terrain.h" #include "view.h" @@ -26,7 +27,13 @@ unsigned map_cell::glyph() const { if (!object) return (' '); - return get_symbol(object, !(flags & MAP_SEEN_FLAG)); + if (object.cls < SH_MONSTER) + { + const feature_def &fdef = get_feature_def(object); + return ((flags & MAP_SEEN_FLAG) ? fdef.symbol : fdef.magic_symbol); + } + else + return (mons_char(object.mons)); } bool map_cell::known() const diff --git a/crawl-ref/source/showsymb.cc b/crawl-ref/source/showsymb.cc index b35fdaeeea..5b2c4bf528 100644 --- a/crawl-ref/source/showsymb.cc +++ b/crawl-ref/source/showsymb.cc @@ -122,8 +122,7 @@ static unsigned short _feat_colour(const coord_def &where, void get_symbol(const coord_def& where, show_type object, unsigned *ch, - unsigned short *colour, - bool magic_mapped) + unsigned short *colour) { ASSERT(ch != NULL); @@ -138,8 +137,7 @@ void get_symbol(const coord_def& where, } const feature_def &fdef = get_feature_def(object); - *ch = magic_mapped ? fdef.magic_symbol - : fdef.symbol; + *ch = fdef.symbol; // Note anything we see that's notable if (!where.origin() && fdef.is_notable()) @@ -158,13 +156,6 @@ void get_symbol(const coord_def& where, *colour = real_colour(*colour); } -unsigned get_symbol(show_type object, bool magic_mapped) -{ - unsigned ch; - get_symbol(coord_def(0,0), object, &ch, NULL, magic_mapped); - return (ch); -} - void get_show_symbol(show_type object, unsigned *ch, unsigned short *colour) { @@ -188,11 +179,6 @@ unsigned grid_character_at(const coord_def &c) return glych; } -dungeon_char_type get_feature_dchar(dungeon_feature_type feat) -{ - return (get_feature_def(feat).dchar); -} - int get_mons_colour(const monsters *mons) { int col = mons->colour; diff --git a/crawl-ref/source/showsymb.h b/crawl-ref/source/showsymb.h index 9bb23170ac..b44612ec40 100644 --- a/crawl-ref/source/showsymb.h +++ b/crawl-ref/source/showsymb.h @@ -19,11 +19,9 @@ unsigned get_screen_glyph( const coord_def &p ); int get_mons_colour(const monsters *mons); unsigned grid_character_at(const coord_def &c); -unsigned get_symbol(show_type object, bool magic_mapped); void get_symbol(const coord_def& where, show_type object, unsigned *ch, - unsigned short *colour, - bool magic_mapped = false); + unsigned short *colour); void get_show_symbol(show_type object, unsigned *ch, unsigned short *colour); #endif diff --git a/crawl-ref/source/viewchar.cc b/crawl-ref/source/viewchar.cc index a0cef43408..78818642bd 100644 --- a/crawl-ref/source/viewchar.cc +++ b/crawl-ref/source/viewchar.cc @@ -2,6 +2,7 @@ #include "viewchar.h" +#include "feature.h" #include "options.h" #include "state.h" @@ -101,3 +102,7 @@ int multibyte_strlen(const std::string &s) return (s.length()); } +dungeon_char_type get_feature_dchar(dungeon_feature_type feat) +{ + return (get_feature_def(feat).dchar); +} -- cgit v1.2.3-54-g00ecf