From 5d616ec6450d21982c204869e04dc4735bc0e88a Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Tue, 1 Dec 2009 09:19:17 +0100 Subject: Add general formatted_string::add_glyph, remove others. --- crawl-ref/source/externs.h | 1 + crawl-ref/source/format.cc | 12 +----------- crawl-ref/source/format.h | 3 +-- crawl-ref/source/state.cc | 3 ++- 4 files changed, 5 insertions(+), 14 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 51e2eea241..629fee3735 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -88,6 +88,7 @@ class player; class monster; class KillMaster; class ghost_demon; +struct glyph; struct coord_def { diff --git a/crawl-ref/source/format.cc b/crawl-ref/source/format.cc index 69e8b9be5a..a65613adff 100644 --- a/crawl-ref/source/format.cc +++ b/crawl-ref/source/format.cc @@ -491,19 +491,9 @@ formatted_string formatted_string::substr(size_t start, size_t substr_length) co return result; } -void formatted_string::add_glyph(const item_def *item) +void formatted_string::add_glyph(glyph g) { const int last_col = find_last_colour(); - glyph g = get_item_glyph(item); - this->textcolor(g.col); - this->cprintf("%s", stringize_glyph(g.ch).c_str()); - this->textcolor(last_col); -} - -void formatted_string::add_glyph(const monsters *mons) -{ - const int last_col = find_last_colour(); - glyph g = get_mons_glyph(mons); this->textcolor(g.col); this->cprintf("%s", stringize_glyph(g.ch).c_str()); this->textcolor(last_col); diff --git a/crawl-ref/source/format.h b/crawl-ref/source/format.h index 2c7105f89a..df5a1d182c 100644 --- a/crawl-ref/source/format.h +++ b/crawl-ref/source/format.h @@ -35,8 +35,7 @@ public: void cprintf(const std::string &s); void cgotoxy(int x, int y); void movexy(int delta_x, int delta_y); - void add_glyph(const monsters *mons); - void add_glyph(const item_def *item); + void add_glyph(glyph g); void textcolor(int color); formatted_string substr(size_t index, size_t length=std::string::npos) const; diff --git a/crawl-ref/source/state.cc b/crawl-ref/source/state.cc index 3a42af17f9..72f0e4f71d 100644 --- a/crawl-ref/source/state.cc +++ b/crawl-ref/source/state.cc @@ -20,6 +20,7 @@ #include "mon-util.h" #include "player.h" #include "religion.h" +#include "showsymb.h" #include "state.h" #include "tutorial.h" @@ -228,7 +229,7 @@ bool interrupt_cmd_repeat( activity_interrupt_type ai, #else formatted_string fs( channel_to_colour(MSGCH_WARN) ); fs.cprintf("%s (", mon->name(DESC_PLAIN, true).c_str()); - fs.add_glyph( mon ); + fs.add_glyph(get_mons_glyph(mon)); fs.cprintf(") in view: (%d,%d), see_cell: %s", mon->pos().x, mon->pos().y, you.see_cell(mon->pos())? "yes" : "no"); -- cgit v1.2.3-54-g00ecf