From 90104081ec1d5f429cdf73998bca2e0b67df78d3 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sat, 21 Nov 2009 18:39:01 -0600 Subject: Make ugly_thing_colour_offset() take only a color instead of a monster. --- crawl-ref/source/mon-util.cc | 7 ++----- crawl-ref/source/mon-util.h | 2 +- crawl-ref/source/monster.cc | 5 ++++- crawl-ref/source/tilepick.cc | 2 +- 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; -- cgit v1.2.3-54-g00ecf