diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-27 01:35:41 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-27 02:32:06 +0100 |
commit | 928479a2ce6674d27d6ef03d7a06f81803ccdfae (patch) | |
tree | f9c1a9ddd869efe1e725e870519cfc83b0259f75 /crawl-ref/source/misc.cc | |
parent | 2c33ddb4c83370db12567cdddaa7f4fe696481c9 (diff) | |
download | crawl-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/misc.cc')
-rw-r--r-- | crawl-ref/source/misc.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 9b38407047..5c65a8e799 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -124,8 +124,8 @@ static void _create_monster_hide(const item_def corpse) break; } - int mtype = corpse.orig_monnum - 1; - if (!invalid_monster_class(mtype) && mons_is_unique(mtype)) + monster_type mtype = static_cast<monster_type>(corpse.orig_monnum - 1); + if (!invalid_monster_type(mtype) && mons_is_unique(mtype)) item.inscription = mons_type_name(mtype, DESC_PLAIN); move_item_to_grid(&o, you.pos()); @@ -156,12 +156,12 @@ void turn_corpse_into_skeleton(item_def &item) void turn_corpse_into_chunks(item_def &item) { ASSERT(item.base_type == OBJ_CORPSES && item.sub_type == CORPSE_BODY); - - const int max_chunks = mons_weight(item.plus) / 150; + const monster_type montype = static_cast<monster_type>(item.plus); + const int max_chunks = mons_weight(montype) / 150; // Only fresh corpses bleed enough to colour the ground. if (!food_is_rotten(item)) - bleed_onto_floor(you.pos(), item.plus, max_chunks, true); + bleed_onto_floor(you.pos(), montype, max_chunks, true); item.base_type = OBJ_FOOD; item.sub_type = FOOD_CHUNK; @@ -1126,15 +1126,15 @@ static void _maybe_bloodify_square(const coord_def& where, int amount, // Currently flavour only: colour ground (and possibly adjacent squares) red. // "damage" depends on damage taken (or hitpoints, if damage higher), // or, for sacrifices, on the number of chunks possible to get out of a corpse. -void bleed_onto_floor(const coord_def& where, int montype, +void bleed_onto_floor(const coord_def& where, monster_type montype, int damage, bool spatter, bool smell_alert) { ASSERT(in_bounds(where)); - if (montype == -1 && !you.can_bleed()) + if (montype == MONS_PLAYER && !you.can_bleed()) return; - if (montype != -1) + if (montype != NUM_MONSTERS) { monsters m; m.type = montype; |