summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monplace.cc
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-10-06 18:31:13 -0500
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-10-06 18:31:13 -0500
commitf408bf9c354f827c64e1416279b338a921545ff0 (patch)
treee7c9b77b1616c5efbbd9de3c9f7761b86c58395b /crawl-ref/source/monplace.cc
parent23ff814fd3727442f17b093612e2bd802e972c2e (diff)
downloadcrawl-ref-f408bf9c354f827c64e1416279b338a921545ff0.tar.gz
crawl-ref-f408bf9c354f827c64e1416279b338a921545ff0.zip
Make sure that all (very) ugly things in a band start with the same
colour.
Diffstat (limited to 'crawl-ref/source/monplace.cc')
-rw-r--r--crawl-ref/source/monplace.cc32
1 files changed, 27 insertions, 5 deletions
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index f300baa4ce..b44daf8f51 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -757,6 +757,9 @@ int place_monster(mgen_data mg, bool force_pos)
monster_type band_monsters[BIG_BAND]; // band monster types
band_monsters[0] = mg.cls;
+ // The (very) ugly thing band colour.
+ static unsigned char ugly_colour = BLACK;
+
if (mg.permit_bands())
{
#ifdef DEBUG_MON_CREATION
@@ -765,10 +768,25 @@ int place_monster(mgen_data mg, bool force_pos)
const band_type band = _choose_band(mg.cls, mg.power, band_size);
band_size++;
- for (int i = 1; i < band_size; i++)
- band_monsters[i] = _band_member( band, mg.power );
+ for (int i = 1; i < band_size; ++i)
+ {
+ band_monsters[i] = _band_member(band, mg.power);
+
+ // Get the (very) ugly thing band colour, so that all (very)
+ // ugly things in a band will start with it.
+ if ((band_monsters[i] == MONS_UGLY_THING
+ || band_monsters[i] == MONS_VERY_UGLY_THING)
+ && ugly_colour == BLACK)
+ {
+ ugly_colour = ugly_thing_random_colour();
+ }
+ }
}
+ // Set the (very) ugly thing band colour.
+ if (ugly_colour != BLACK)
+ mg.colour = ugly_colour;
+
// Returns 2 if the monster is placed near player-occupied stairs.
int pval = _is_near_stairs(mg.pos);
if (mg.proximity == PROX_NEAR_STAIRS)
@@ -890,6 +908,9 @@ int place_monster(mgen_data mg, bool force_pos)
id = _place_monster_aux(mg, true, force_pos);
+ // Reset the (very) ugly thing band colour.
+ ugly_colour = BLACK;
+
// Bail out now if we failed.
if (id == -1)
return (-1);
@@ -1235,8 +1256,8 @@ static int _place_monster_aux(const mgen_data &mg,
if (summoned)
{
- menv[id].mark_summoned( mg.abjuration_duration, true,
- mg.summon_type );
+ menv[id].mark_summoned(mg.abjuration_duration, true,
+ mg.summon_type);
}
menv[id].foe = mg.foe;
@@ -1245,7 +1266,8 @@ static int _place_monster_aux(const mgen_data &mg,
|| menv[id].type == MONS_VERY_UGLY_THING)
{
ghost_demon ghost;
- ghost.init_ugly_thing(menv[id].type == MONS_VERY_UGLY_THING);
+ ghost.init_ugly_thing(menv[id].type == MONS_VERY_UGLY_THING, false,
+ menv[id].colour);
menv[id].set_ghost(ghost, false);
menv[id].uglything_init();
}