summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-27 01:35:41 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-10-27 02:32:06 +0100
commit928479a2ce6674d27d6ef03d7a06f81803ccdfae (patch)
treef9c1a9ddd869efe1e725e870519cfc83b0259f75 /crawl-ref/source/monstuff.cc
parent2c33ddb4c83370db12567cdddaa7f4fe696481c9 (diff)
downloadcrawl-ref-928479a2ce6674d27d6ef03d7a06f81803ccdfae.tar.gz
crawl-ref-928479a2ce6674d27d6ef03d7a06f81803ccdfae.zip
Convert some ints to monster_type.
There's a whole lot of places that pass monster_type as int, often with varying meanings for the value -1. This moves some of these to monster_type, introducing MONS_NO_MONSTER and MONS_PLAYER as new invalid special values. Also improve on the autoexclude descriptions.
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 74bc150b01..5db6f375b4 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1667,7 +1667,7 @@ int monster_die(monsters *monster, killer_type killer,
// If the killer is already dead treat it like an
// anonymous monster.
- if (killer_mon->type == -1)
+ if (killer_mon->type == MONS_NO_MONSTER)
anon = true;
}
@@ -1991,6 +1991,7 @@ int monster_die(monsters *monster, killer_type killer,
return (corpse);
}
+// Clean up after a dead monster.
void monster_cleanup(monsters *monster)
{
crawl_state.mon_gone(monster);
@@ -2093,7 +2094,7 @@ void alert_nearby_monsters(void)
}
}
-static bool _valid_morph(monsters *monster, int new_mclass)
+static bool _valid_morph(monsters *monster, monster_type new_mclass)
{
const dungeon_feature_type current_tile = grd(monster->pos());
@@ -8217,9 +8218,10 @@ static bool _monster_eat_single_corpse(monsters *monster, item_def& item,
if (item.base_type != OBJ_CORPSES || item.sub_type != CORPSE_BODY)
return (false);
+ monster_type mt = static_cast<monster_type>(item.plus);
if (do_heal)
{
- monster->hit_points += 1 + random2(mons_weight(item.plus)) / 100;
+ monster->hit_points += 1 + random2(mons_weight(mt)) / 100;
// Limited growth factor here - should 77 really be the cap? {dlb}:
monster->hit_points = std::min(100, monster->hit_points);
@@ -8237,13 +8239,13 @@ static bool _monster_eat_single_corpse(monsters *monster, item_def& item,
// from misc.cc:turn_corpse_into_chunks() and the butchery-related
// delays in delay.cc:stop_delay().
- const int max_chunks = mons_weight(item.plus) / 150;
+ const int max_chunks = mons_weight(mt) / 150;
// Only fresh corpses bleed enough to colour the ground.
if (!food_is_rotten(item))
- bleed_onto_floor(monster->pos(), item.plus, max_chunks, true);
+ bleed_onto_floor(monster->pos(), mt, max_chunks, true);
- if (mons_skeleton(item.plus) && one_chance_in(3))
+ if (mons_skeleton(mt) && one_chance_in(3))
turn_corpse_into_skeleton(item);
else
destroy_item(item.index());