summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-21 18:39:01 -0600
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-21 18:39:01 -0600
commit90104081ec1d5f429cdf73998bca2e0b67df78d3 (patch)
tree1b877a97a7861397b4f04ecd06e08354ecef27d5 /crawl-ref/source
parente64350b0f7fc7837bb13abd5cba7f140a21e60de (diff)
downloadcrawl-ref-90104081ec1d5f429cdf73998bca2e0b67df78d3.tar.gz
crawl-ref-90104081ec1d5f429cdf73998bca2e0b67df78d3.zip
Make ugly_thing_colour_offset() take only a color instead of a monster.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/mon-util.cc7
-rw-r--r--crawl-ref/source/mon-util.h2
-rw-r--r--crawl-ref/source/monster.cc5
-rw-r--r--crawl-ref/source/tilepick.cc2
4 files changed, 8 insertions, 8 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 36301c5ad6..2a2c2e5280 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1689,14 +1689,11 @@ unsigned char ugly_thing_random_colour()
return (RANDOM_ELEMENT(ugly_colour_values));
}
-int ugly_thing_colour_offset(const monsters *mon)
+int ugly_thing_colour_offset(const unsigned char colour)
{
- if (mon->type != MONS_UGLY_THING && mon->type != MONS_VERY_UGLY_THING)
- return (-1);
-
for (unsigned i = 0; i < ARRAYSZ(ugly_colour_values); ++i)
{
- if (make_low_colour(mon->colour) == ugly_colour_values[i])
+ if (make_low_colour(colour) == ugly_colour_values[i])
return (i);
}
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 0f35d19e26..e1e5491c94 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -667,7 +667,7 @@ bool monster_senior(const monsters *first, const monsters *second,
bool fleeing = false);
monster_type draco_subspecies(const monsters *mon);
unsigned char ugly_thing_random_colour();
-int ugly_thing_colour_offset(const monsters *mon);
+int ugly_thing_colour_offset(const unsigned char colour);
std::string draconian_colour_name(monster_type mon_type);
monster_type draconian_colour_by_name(const std::string &colour);
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 51d6ffd883..15fd301813 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -1944,7 +1944,10 @@ static const char *ugly_colour_names[] = {
static std::string _ugly_thing_colour_name(const monsters *mon)
{
- const int colour_offset = ugly_thing_colour_offset(mon);
+ int colour_offset = -1;
+
+ if (mon->type == MONS_UGLY_THING || mon->type == MONS_VERY_UGLY_THING)
+ colour_offset = ugly_thing_colour_offset(mon->colour);
if (colour_offset == -1)
return ("buggy");
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index ba1a5e941b..8f9fdc232d 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -358,7 +358,7 @@ int tileidx_monster_base(const monsters *mon, bool detected)
{
const int ugly_tile = (type == MONS_VERY_UGLY_THING) ?
TILEP_MONS_VERY_UGLY_THING : TILEP_MONS_UGLY_THING;
- int colour_offset = ugly_thing_colour_offset(mon);
+ int colour_offset = ugly_thing_colour_offset(mon->colour);
if (detected || colour_offset == -1)
colour_offset = 0;