summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-15 21:32:30 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-15 23:11:41 +0100
commitd13f2354db0c50108beccd90aea26ec416e20d07 (patch)
tree7fea3408b5b3006419feff73035198bf8cc1e560 /crawl-ref
parentddf80f7077a00bd04168c904b153fb1e657b9d38 (diff)
downloadcrawl-ref-d13f2354db0c50108beccd90aea26ec416e20d07.tar.gz
crawl-ref-d13f2354db0c50108beccd90aea26ec416e20d07.zip
Convert get_mons_glyph to return a glyph struct.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/format.cc8
-rw-r--r--crawl-ref/source/mon-info.cc4
-rw-r--r--crawl-ref/source/show.cc2
-rw-r--r--crawl-ref/source/showsymb.cc11
-rw-r--r--crawl-ref/source/showsymb.h5
-rw-r--r--crawl-ref/source/tutorial.cc11
6 files changed, 16 insertions, 25 deletions
diff --git a/crawl-ref/source/format.cc b/crawl-ref/source/format.cc
index d4c8d16a6c..69e8b9be5a 100644
--- a/crawl-ref/source/format.cc
+++ b/crawl-ref/source/format.cc
@@ -503,11 +503,9 @@ void formatted_string::add_glyph(const item_def *item)
void formatted_string::add_glyph(const monsters *mons)
{
const int last_col = find_last_colour();
- unsigned ch;
- unsigned short col;
- get_mons_glyph(mons, &ch, &col);
- this->textcolor(col);
- this->cprintf("%s", stringize_glyph(ch).c_str());
+ 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/mon-info.cc b/crawl-ref/source/mon-info.cc
index d32b8466d1..a569a2982b 100644
--- a/crawl-ref/source/mon-info.cc
+++ b/crawl-ref/source/mon-info.cc
@@ -48,7 +48,9 @@ monster_info::monster_info(const monsters *m)
if (mons_looks_distracted(m)) m_brands |= (1 << MB_DISTRACTED);
if (m->berserk()) m_brands |= (1 << MB_BERSERK);
- get_mons_glyph(m_mon, &m_glyph, &m_glyph_colour);
+ glyph g = get_mons_glyph(m_mon);
+ m_glyph = g.ch;
+ m_glyph_colour = g.col;
mons_get_damage_level(m_mon, m_damage_desc, m_damage_level);
// If no messages about wounds, don't display damage level either.
diff --git a/crawl-ref/source/show.cc b/crawl-ref/source/show.cc
index cc040dd408..2e25971d37 100644
--- a/crawl-ref/source/show.cc
+++ b/crawl-ref/source/show.cc
@@ -302,7 +302,7 @@ void show_def::_update_monster(const monsters* mons)
grid(e).cls = SH_MONSTER;
grid(e).mons = mons->type;
- grid(e).colour = get_mons_colour(mons);
+ grid(e).colour = get_mons_glyph(mons).col;
#ifdef USE_TILE
tile_place_monster(mons->pos().x, mons->pos().y, mons->mindex(), true);
diff --git a/crawl-ref/source/showsymb.cc b/crawl-ref/source/showsymb.cc
index 6fbcb10ca9..55f3f51892 100644
--- a/crawl-ref/source/showsymb.cc
+++ b/crawl-ref/source/showsymb.cc
@@ -65,7 +65,7 @@ void get_show_symbol(show_type object, unsigned *ch,
*colour = real_colour(*colour);
}
-int get_mons_colour(const monsters *mons)
+static int _get_mons_colour(const monsters *mons)
{
int col = mons->colour;
@@ -124,11 +124,12 @@ glyph get_item_glyph(const item_def *item)
return (g);
}
-void get_mons_glyph(const monsters *mons, unsigned *glych,
- unsigned short *glycol)
+glyph get_mons_glyph(const monsters *mons)
{
- *glycol = get_mons_colour(mons);
- get_symbol(coord_def(0,0), show_type(mons), glych, glycol);
+ glyph g;
+ g.ch = mons_char(mons->type);
+ g.col = _get_mons_colour(mons);
+ return (g);
}
unsigned get_screen_glyph( int x, int y )
diff --git a/crawl-ref/source/showsymb.h b/crawl-ref/source/showsymb.h
index 97ed0b90b1..10fc84500d 100644
--- a/crawl-ref/source/showsymb.h
+++ b/crawl-ref/source/showsymb.h
@@ -10,14 +10,11 @@ struct glyph
};
glyph get_item_glyph(const item_def *item);
+glyph get_mons_glyph(const monsters *mons);
-void get_mons_glyph(const monsters *mons, unsigned *glych,
- unsigned short *glycol);
unsigned get_screen_glyph( int x, int y );
unsigned get_screen_glyph( const coord_def &p );
-int get_mons_colour(const monsters *mons);
-
void get_symbol(const coord_def& where,
show_type object, unsigned *ch,
unsigned short *colour);
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index 6bf0ed1231..5d9edbebfa 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -1338,11 +1338,7 @@ void tutorial_first_monster(const monsters &mon)
"by hovering your mouse over its tile, and read the monster "
"description by clicking on it with your <w>right mouse button</w>."
#else
- unsigned ch;
- unsigned short col;
- get_mons_glyph(&mon, &ch, &col);
-
- text += _colourize_glyph(col, ch);
+ text += _colourize_glyph(get_mons_glyph(&mon));
text += " is a monster, usually depicted by a letter. Some typical "
"early monsters look like <brown>r</brown>, <green>l</green>, "
"<brown>K</brown> or <lightgrey>g</lightgrey>. ";
@@ -3234,10 +3230,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc)
text << "is a ";
#else
- unsigned short col;
- get_mons_glyph(m, &ch, &col);
-
- text << _colourize_glyph(col, ch) << " is a ";
+ text << _colourize_glyph(get_mons_glyph(m)) << " is a ";
#endif
text << m->name(DESC_PLAIN).c_str() << ". ";