From 12f74fc875b1de8089676ee8e78461f75dce6b00 Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Tue, 27 Oct 2009 20:25:02 -0700 Subject: (MONS_PROGRAM_BUG || -1) --> MONS_NO_MONSTER Change MONS_PROGRAM_BUG to MONS_NO_MONSTER when "no monster" is what was meant. Now all instances of MONS_PROGRAM_BUG should indicated some sort of failure or error. Also, fixed some places which were still using -1 instead of MONS_NO_MONSTER. --- crawl-ref/source/beam.cc | 2 +- crawl-ref/source/command.cc | 4 ++-- crawl-ref/source/debug.cc | 18 +++++++++--------- crawl-ref/source/dungeon.cc | 32 ++++++++++++++++---------------- crawl-ref/source/effects.cc | 6 +++--- crawl-ref/source/externs.h | 2 +- crawl-ref/source/fight.cc | 2 +- crawl-ref/source/godabil.cc | 2 +- crawl-ref/source/it_use3.cc | 2 +- crawl-ref/source/mapdef.cc | 2 +- crawl-ref/source/mapdef.h | 2 +- crawl-ref/source/mon-util.cc | 21 +++++++++++---------- crawl-ref/source/monplace.cc | 8 ++++---- crawl-ref/source/monplace.h | 4 ++-- crawl-ref/source/monstuff.cc | 11 ++++++----- crawl-ref/source/mstuff2.cc | 8 ++++---- crawl-ref/source/spells1.cc | 2 +- crawl-ref/source/spells2.cc | 4 ++-- crawl-ref/source/spells2.h | 2 +- crawl-ref/source/spells3.cc | 4 ++-- crawl-ref/source/spl-cast.cc | 2 +- crawl-ref/source/xom.cc | 2 +- 22 files changed, 72 insertions(+), 70 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 80a117748e..89b038d6dd 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -4812,7 +4812,7 @@ void bolt::affect_monster(monsters* mon) } // Give the callbacks a dead-but-valid monster object. - if (mon->type == -1) + if (mon->type == MONS_NO_MONSTER) { orig.hit_points = -1; mon = &orig; diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index d66b8c1726..e78e45e07e 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -1355,12 +1355,12 @@ static bool _do_description(std::string key, std::string type, mon.base_monster = mon_num; break; default: - mon.base_monster = MONS_PROGRAM_BUG; + mon.base_monster = MONS_NO_MONSTER; break; } } else - mon.base_monster = MONS_PROGRAM_BUG; + mon.base_monster = MONS_NO_MONSTER; describe_monsters(mon, true); return (false); diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 2a6be21159..b855513ea0 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -500,7 +500,7 @@ void wizard_create_spec_monster_name() { // Try again with habitat HT_LAND. // (Will be changed to the necessary terrain type in dgn_place_monster.) - place = find_newmons_square(MONS_PROGRAM_BUG, you.pos()); + place = find_newmons_square(MONS_NO_MONSTER, you.pos()); } if (!in_bounds(place)) @@ -2625,8 +2625,8 @@ void debug_stethoscope(int mon) mons.ac, mons.ev, mons_resist_magic( &mons ), mons.speed, mons.speed_increment, - mons.base_monster != MONS_PROGRAM_BUG ? " base=" : "", - mons.base_monster != MONS_PROGRAM_BUG ? + mons.base_monster != MONS_NO_MONSTER ? " base=" : "", + mons.base_monster != MONS_NO_MONSTER ? get_monster_data(mons.base_monster)->name : "", mons.number, mons.flags ); @@ -2651,9 +2651,9 @@ void debug_stethoscope(int mon) mons_is_lurking(&mons) ? "lurk" : "unknown"), mons.behaviour, - ((mons.foe == MHITYOU) ? "you" : - (mons.foe == MHITNOT) ? "none" : - (menv[mons.foe].type == -1) ? "unassigned monster" + ((mons.foe == MHITYOU) ? "you" : + (mons.foe == MHITNOT) ? "none" : + (menv[mons.foe].type == MONS_NO_MONSTER) ? "unassigned monster" : menv[mons.foe].name(DESC_PLAIN, true).c_str()), mons.foe, mons.foe_memory, @@ -2815,7 +2815,7 @@ void debug_item_scan( void ) mpr("Unlinked temporary item:", MSGCH_ERROR); _dump_item( name, i, mitm[i] ); } - else if (mon != NULL && mon->type == -1) + else if (mon != NULL && mon->type == MONS_NO_MONSTER) { mpr("Unlinked item held by dead monster:", MSGCH_ERROR); _dump_item( name, i, mitm[i] ); @@ -2901,7 +2901,7 @@ void debug_item_scan( void ) { const monsters& monster = menv[i]; - if (monster.type == -1) + if (monster.type == MONS_NO_MONSTER) continue; if (monster.name(DESC_PLAIN, true).find("questionable") != @@ -4566,7 +4566,7 @@ int fsim_kit_equip(const std::string &kit) void debug_fight_statistics(bool use_defaults, bool defence) { int punching_bag = get_monster_by_name(Options.fsim_mons); - if (punching_bag == -1 || punching_bag == MONS_PROGRAM_BUG) + if (punching_bag == -1 || punching_bag == MONS_NO_MONSTER) punching_bag = MONS_WORM; int mindex = _create_fsim_monster(punching_bag, 500); diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 5ed80fb079..16d55cded1 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -970,7 +970,7 @@ void dgn_reset_level() for (int i = 0; i < MAX_MONSTERS; i++) menv[i].reset(); - env.mons_alloc.init(MONS_PROGRAM_BUG); + env.mons_alloc.init(MONS_NO_MONSTER); // Zap clouds env.cgrid.init(EMPTY_CLOUD); @@ -1711,7 +1711,7 @@ static char _fix_black_colour(char incol) void dgn_set_colours_from_monsters() { - if (env.mons_alloc[9] < 0 || env.mons_alloc[9] == MONS_PROGRAM_BUG + if (env.mons_alloc[9] < 0 || env.mons_alloc[9] == MONS_NO_MONSTER || env.mons_alloc[9] >= NUM_MONSTERS) { if (env.floor_colour == BLACK) @@ -1723,7 +1723,7 @@ void dgn_set_colours_from_monsters() _fix_black_colour(mons_class_colour(env.mons_alloc[9])); } - if (env.mons_alloc[8] < 0 || env.mons_alloc[8] == MONS_PROGRAM_BUG + if (env.mons_alloc[8] < 0 || env.mons_alloc[8] == MONS_NO_MONSTER || env.mons_alloc[8] >= NUM_MONSTERS) { if (env.rock_colour == BLACK) @@ -3380,7 +3380,7 @@ static monster_type _pick_unique(int lev) if (player_branch_depth() > 1 && one_chance_in(3)) return MONS_DISSOLUTION; - return MONS_PROGRAM_BUG; + return MONS_NO_MONSTER; } else if (player_in_branch(BRANCH_LAIR)) { @@ -3389,7 +3389,7 @@ static monster_type _pick_unique(int lev) else if (player_branch_depth() < 3 && one_chance_in(4)) return MONS_PRINCE_RIBBIT; else - return MONS_PROGRAM_BUG; + return MONS_NO_MONSTER; } // First, pick generic unique depending on depth. @@ -3406,7 +3406,7 @@ static monster_type _pick_unique(int lev) if (which_unique == MONS_AZRAEL && (player_in_branch(BRANCH_SWAMP) || player_in_branch(BRANCH_SHOALS))) { - return MONS_PROGRAM_BUG; + return MONS_NO_MONSTER; } // If applicable, replace it with one of the uniques appearing @@ -3454,30 +3454,30 @@ static int _place_uniques(int level_number, char level_type) while (one_chance_in(3)) { - monster_type which_unique = MONS_PROGRAM_BUG; + monster_type which_unique = MONS_NO_MONSTER; - while (which_unique == MONS_PROGRAM_BUG + while (which_unique == MONS_NO_MONSTER || you.unique_creatures[which_unique]) { which_unique = _pick_unique(level_number); // Sometimes, we just quit if a unique is already placed. - if (which_unique == MONS_PROGRAM_BUG + if (which_unique == MONS_NO_MONSTER || you.unique_creatures[which_unique] && !one_chance_in(3)) { - which_unique = MONS_PROGRAM_BUG; + which_unique = MONS_NO_MONSTER; break; } } // Usually, we'll have quit after a few tries. Make sure we have // a valid unique. - if (which_unique == MONS_PROGRAM_BUG) + if (which_unique == MONS_NO_MONSTER) break; mgen_data mg(which_unique, BEH_SLEEP, 0, 0, coord_def(), MHITNOT, MG_PERMIT_BANDS, - GOD_NO_GOD, MONS_PROGRAM_BUG, 0, BLACK, + GOD_NO_GOD, MONS_NO_MONSTER, 0, BLACK, level_number, PROX_ANYWHERE); mg.map_mask = MMT_NO_MONS; @@ -3520,7 +3520,7 @@ static int _place_monster_vector(std::vector montypes, static void _place_aquatic_monsters(int level_number, char level_type) { int lava_spaces = 0, water_spaces = 0; - std::vector swimming_things(4u, MONS_PROGRAM_BUG); + std::vector swimming_things(4u, MONS_NO_MONSTER); // Count the number of lava and water tiles {dlb}: for (int x = 0; x < GXM; x++) @@ -4735,12 +4735,12 @@ int dgn_place_monster(mons_spec &mspec, int tries = 100; do mg.cls = pick_random_monster(mspec.place, lev, lev); - while (mg.cls != MONS_PROGRAM_BUG + while (mg.cls != MONS_NO_MONSTER && mons_class_is_zombified(mspec.monbase) && !mons_zombie_size(mg.cls) && tries-- > 0); - if (mg.cls == MONS_PROGRAM_BUG + if (mg.cls == MONS_NO_MONSTER || (mons_class_is_zombified(mspec.monbase) && !mons_zombie_size(mg.cls))) { @@ -4786,7 +4786,7 @@ int dgn_place_monster(mons_spec &mspec, if (mons_class_is_zombified(mg.base_type)) { if (mons_class_is_zombified(mg.cls)) - mg.base_type = MONS_PROGRAM_BUG; + mg.base_type = MONS_NO_MONSTER; else std::swap(mg.base_type, mg.cls); } diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 770eb74959..a73b69d800 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -2703,7 +2703,7 @@ static void _hell_effects() int temp_rand = random2(17); spschool_flag_type which_miscast = SPTYP_RANDOM; bool summon_instead = false; - monster_type which_beastie = MONS_PROGRAM_BUG; + monster_type which_beastie = MONS_NO_MONSTER; mpr((temp_rand == 0) ? "\"You will not leave this place.\"" : (temp_rand == 1) ? "\"Die, mortal!\"" : @@ -4409,7 +4409,7 @@ static int _mushroom_ring(item_def &corpse, int & seen_count) MHITNOT, MG_FORCE_PLACE, GOD_NO_GOD, - MONS_PROGRAM_BUG, + MONS_NO_MONSTER, 0, corpse.colour); @@ -4502,7 +4502,7 @@ int spawn_corpse_mushrooms(item_def &corpse, MHITNOT, MG_FORCE_PLACE, GOD_NO_GOD, - MONS_PROGRAM_BUG, + MONS_NO_MONSTER, 0, corpse.colour), false); diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 3b9ae64d08..425f263d21 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -762,7 +762,7 @@ struct mon_display unsigned glyph; unsigned colour; - mon_display(monster_type m = MONS_PROGRAM_BUG, + mon_display(monster_type m = MONS_NO_MONSTER, unsigned gly = 0, unsigned col = 0) : type(m), glyph(gly), colour(col) { } }; diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index c769a4f563..522ad3dbe5 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -2795,7 +2795,7 @@ static bool _make_zombie(monsters* mon, int corpse_class, int corpse_index, // NOTE: Isn't called if monster dies from poisoning caused by chaos. void melee_attack::chaos_killed_defender(monsters* mon) { - ASSERT(mon->type != -1 && mon->type != MONS_PROGRAM_BUG); + ASSERT(mon->type != -1 && mon->type != MONS_NO_MONSTER); ASSERT(in_bounds(mon->pos())); ASSERT(!defender->alive()); diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc index 96a5c0395c..cb6499325d 100644 --- a/crawl-ref/source/godabil.cc +++ b/crawl-ref/source/godabil.cc @@ -248,7 +248,7 @@ void yred_make_enslaved_soul(monsters *mon, bool force_hostile, { mon->type = mons_zombie_size(soul_type) == Z_BIG ? MONS_ABOMINATION_LARGE : MONS_ABOMINATION_SMALL; - mon->base_monster = MONS_PROGRAM_BUG; + mon->base_monster = MONS_NO_MONSTER; } else { diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index a18b5627f6..f059f78805 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -584,7 +584,7 @@ static bool _box_of_beasts(item_def &box) if (x_chance_in_y(60 + you.skills[SK_EVOCATIONS], 100)) { - monster_type beasty = MONS_PROGRAM_BUG; + monster_type beasty = MONS_NO_MONSTER; // If you worship a good god, don't summon an evil beast (in // this case, the hell hound). diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index acaf48f3e9..960531bc8c 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -2527,7 +2527,7 @@ mons_spec mons_list::get_hydra_spec(const std::string &name) const nheads = 20; } - return mons_spec(MONS_HYDRA, MONS_PROGRAM_BUG, nheads); + return mons_spec(MONS_HYDRA, MONS_NO_MONSTER, nheads); } // Handle draconians specified as: diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h index 73edbccf18..41c5bc3c33 100644 --- a/crawl-ref/source/mapdef.h +++ b/crawl-ref/source/mapdef.h @@ -461,7 +461,7 @@ class mons_spec std::string monname; mons_spec(int id = RANDOM_MONSTER, - monster_type base = MONS_PROGRAM_BUG, + monster_type base = MONS_NO_MONSTER, int num = 0, int gw = 10, int ml = 0, bool _fixmons = false, bool awaken = false, bool patrol = false) diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index b7002de4a4..c22e4d943e 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -692,13 +692,12 @@ bool mons_is_skeletal(int mc) bool invalid_monster(const monsters *mon) { - return (!mon || mon->type == -1); + return (!mon || invalid_monster_type(mon->type)); } bool invalid_monster_type(monster_type mt) { return (mt < 0 || mt >= NUM_MONSTERS - || mon_entry[mt] == -1 || mon_entry[mt] == mon_entry[MONS_PROGRAM_BUG]); } @@ -1950,7 +1949,7 @@ void define_monster(monsters &mons) mons.speed = speed; mons.speed_increment = 70; - if (mons.base_monster == MONS_PROGRAM_BUG) + if (mons.base_monster == MONS_NO_MONSTER) mons.base_monster = monbase; if (mons.number == 0) @@ -2173,7 +2172,7 @@ static std::string _str_monam(const monsters& mon, description_level_type desc, case MONS_DRACONIAN_ANNIHILATOR: case MONS_DRACONIAN_KNIGHT: case MONS_DRACONIAN_SCORCHER: - if (mon.base_monster != MONS_PROGRAM_BUG) // database search + if (mon.base_monster != MONS_NO_MONSTER) // database search result += _draconian_colour_name(mon.base_monster) + " "; break; @@ -3598,7 +3597,7 @@ void monsters::reset() flags = 0; experience = 0L; type = MONS_NO_MONSTER; - base_monster = MONS_PROGRAM_BUG; + base_monster = MONS_NO_MONSTER; hit_points = 0; max_hit_points = 0; hit_dice = 0; @@ -4498,7 +4497,7 @@ bool monsters::pickup(item_def &item, int slot, int near, bool force_merge) name(DESC_PLAIN, true).c_str()); } } - else if (other_mon->type == -1) + else if (other_mon->type == MONS_NO_MONSTER) { mprf(MSGCH_DIAGNOSTICS, "Item %s, held by dead monster, being " "picked up by monster %s.", @@ -6358,7 +6357,7 @@ void monsters::ghost_init() foe = MHITNOT; foe_memory = 0; colour = ghost->colour; - number = MONS_PROGRAM_BUG; + number = MONS_NO_MONSTER; load_spells(MST_GHOST); inv.init(NON_ITEM); @@ -6804,13 +6803,15 @@ static bool _prepare_del_ench(monsters* mon, const mon_enchant &me) { monsters* other_mon = &menv[mgrd(mon->pos())]; - if (other_mon->type == -1 || other_mon->type == MONS_PROGRAM_BUG) + if (other_mon->type == MONS_NO_MONSTER + || other_mon->type == MONS_PROGRAM_BUG) { mgrd(mon->pos()) = midx; - mprf(MSGCH_ERROR, "mgrd(%d,%d) points to dead monster, even " + mprf(MSGCH_ERROR, "mgrd(%d,%d) points to %s monster, even " "though it contains submerged monster %s (see bug 2293518)", mon->pos().x, mon->pos().y, + other_mon->type == MONS_NO_MONSTER ? "dead" : "buggy", mon->name(DESC_PLAIN, true).c_str()); if (mon->pos() != you.pos()) @@ -8240,7 +8241,7 @@ void monsters::check_awaken(int) const monsterentry *monsters::find_monsterentry() const { - return (type == -1 || type == MONS_PROGRAM_BUG) ? NULL + return (type == MONS_NO_MONSTER || type == MONS_PROGRAM_BUG) ? NULL : get_monster_data(type); } diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index e0515efdfd..6d6b5a5bc3 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -736,7 +736,7 @@ int place_monster(mgen_data mg, bool force_pos) mg.pos, mg.map_mask, &stair_type, &mg.power); - if (mg.cls == MONS_PROGRAM_BUG) + if (mg.cls == MONS_NO_MONSTER) return (-1); // (3) Decide on banding (good lord!) @@ -967,7 +967,7 @@ int place_monster(mgen_data mg, bool force_pos) // (5) For each band monster, loop call to place_monster_aux(). for (int i = 1; i < band_size; i++) { - if (band_monsters[i] == MONS_PROGRAM_BUG) + if (band_monsters[i] == MONS_NO_MONSTER) break; band_template.cls = band_monsters[i]; @@ -1408,7 +1408,7 @@ static void _define_zombie(int mid, monster_type ztype, monster_type cs, } // That is, random creature from which to fashion undead. - if (ztype == MONS_PROGRAM_BUG) + if (ztype == MONS_NO_MONSTER) { // How OOD this zombie can be. int relax = 5; @@ -2317,7 +2317,7 @@ int mons_place(mgen_data mg) #endif int mon_count = 0; for (int il = 0; il < MAX_MONSTERS; il++) - if (menv[il].type != -1) + if (menv[il].type != MONS_NO_MONSTER) mon_count++; if (mg.cls == WANDERING_MONSTER) diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h index 9d97a84365..61f9c8b630 100644 --- a/crawl-ref/source/monplace.h +++ b/crawl-ref/source/monplace.h @@ -114,7 +114,7 @@ struct mgen_data // If the monster is zombie-like, or a specialised draconian, this // is the base monster that the monster is based on - should be - // set to MONS_PROGRAM_BUG when not used. + // set to MONS_NO_MONSTER when not used. monster_type base_type; // Determines the behaviour of the monster after it is generated. This @@ -191,7 +191,7 @@ struct mgen_data unsigned short mfoe = MHITNOT, unsigned monflags = 0, god_type which_god = GOD_NO_GOD, - monster_type base = MONS_PROGRAM_BUG, + monster_type base = MONS_NO_MONSTER, int monnumber = 0, int moncolour = BLACK, int monpower = you.your_level, diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 4943bbf923..6d0f36f105 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -319,7 +319,8 @@ void monster_drop_ething(monsters *monster, bool mark_item_origins, int fill_out_corpse(const monsters* monster, item_def& corpse, bool allow_weightless) { - ASSERT(monster->type != -1 && monster->type != MONS_PROGRAM_BUG); + ASSERT(monster->type >= 0 && monster->type != MONS_PROGRAM_BUG + && monster->type < NUM_MONSTERS); corpse.clear(); int summon_type; @@ -2347,7 +2348,7 @@ bool monster_polymorph(monsters *monster, monster_type targetc, // deal with mons_sec monster->type = targetc; - monster->base_monster = MONS_PROGRAM_BUG; + monster->base_monster = MONS_NO_MONSTER; monster->number = 0; // Note: define_monster() will clear out all enchantments! - bwr @@ -5919,7 +5920,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem) { monsters *targ = &menv[i]; - if (targ->type == -1 || targ->type == MONS_PROGRAM_BUG) + if (targ->type == MONS_NO_MONSTER) continue; if (distance(monster->pos(), targ->pos()) >= 5) @@ -7678,7 +7679,7 @@ static void _handle_monster_move(monsters *monster) _mons_in_cloud(monster); - if (monster->type == -1) + if (monster->type == MONS_NO_MONSTER) { monster->speed_increment = 1; break; @@ -7978,7 +7979,7 @@ static void _handle_monster_move(monsters *monster) } } - if (monster->type != -1 && monster->hit_points < 1) + if (monster->type != MONS_NO_MONSTER && monster->hit_points < 1) monster_die(monster, KILL_MISC, NON_MONSTER); } diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index 65c9732ec8..ca687ed978 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -108,7 +108,7 @@ static void _do_high_level_summon(monsters *monster, bool monsterNearby, { monster_type which_mons = mpicker(); - if (which_mons == MONS_PROGRAM_BUG) + if (which_mons == MONS_NO_MONSTER) continue; create_monster( @@ -311,7 +311,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, if (create_monster( mgen_data(MONS_KRAKEN_TENTACLE, SAME_ATTITUDE(monster), 3, spell_cast, monster->pos(), monster->foe, 0, god, - MONS_PROGRAM_BUG, kraken_index, monster->colour, + MONS_NO_MONSTER, kraken_index, monster->colour, you.your_level, PROX_CLOSE_TO_PLAYER, you.level_type)) == -1) { @@ -922,7 +922,7 @@ void mons_cast_noise(monsters *monster, bolt &pbolt, spell_type spell_cast) else if (monster->foe == MHITNOT && !monster->confused()) target = "NONEXISTENT FOE"; else if (!invalid_monster_index(monster->foe) - && menv[monster->foe].type == -1) + && menv[monster->foe].type == MONS_NO_MONSTER) { target = "DEAD FOE"; } @@ -2826,7 +2826,7 @@ int clone_mons(const monsters* orig, bool quiet, bool* obvious, // Is there an open slot in menv? int midx = NON_MONSTER; for (int i = 0; i < MAX_MONSTERS; i++) - if (menv[i].type == -1) + if (menv[i].type == MONS_NO_MONSTER) { midx = i; break; diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index e2c5f71e5f..96a64f7f24 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -1100,7 +1100,7 @@ void abjuration(int pow) { monsters* const monster = &menv[i]; - if (monster->type == -1 || !mons_near(monster)) + if (monster->type == MONS_NO_MONSTER || !mons_near(monster)) continue; if (mons_wont_attack(monster)) diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index e04e780531..09ccfee26b 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -1244,7 +1244,7 @@ bool cast_summon_elemental(int pow, god_type god, dist smove; const int dur = std::min(2 + (random2(pow) / 5), 6); - const bool any_elemental = (restricted_type == MONS_PROGRAM_BUG); + const bool any_elemental = (restricted_type == MONS_NO_MONSTER); while (true) { @@ -1795,7 +1795,7 @@ int fungal_bloom() MHITNOT, MG_FORCE_PLACE, GOD_NO_GOD, - MONS_PROGRAM_BUG, + MONS_NO_MONSTER, 0, colour), false); diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h index c1b1ff2c9f..06e4e70452 100644 --- a/crawl-ref/source/spells2.h +++ b/crawl-ref/source/spells2.h @@ -52,7 +52,7 @@ bool cast_summon_swarm(int pow, god_type god = GOD_NO_GOD, bool permanent = false); bool cast_call_canine_familiar(int pow, god_type god = GOD_NO_GOD); bool cast_summon_elemental(int pow, god_type god = GOD_NO_GOD, - monster_type restricted_type = MONS_PROGRAM_BUG, + monster_type restricted_type = MONS_NO_MONSTER, int unfriendly = 2); bool cast_summon_ice_beast(int pow, god_type god = GOD_NO_GOD); bool cast_summon_ugly_thing(int pow, god_type god = GOD_NO_GOD); diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 64c27c7fa1..7ea2fff9b4 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1218,7 +1218,7 @@ bool cast_twisted_resurrection(int pow, god_type god) 0, 0, you.pos(), MHITYOU, MG_FORCE_BEH, god, - MONS_PROGRAM_BUG, 0, colour)); + MONS_NO_MONSTER, 0, colour)); if (monster == -1) { @@ -2113,7 +2113,7 @@ bool recall(char type_recalled) { monster = &menv[loopy]; - if (monster->type == -1) + if (monster->type == MONS_NO_MONSTER) continue; if (!mons_friendly(monster)) diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 94fa9df9cf..61af644b42 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1043,7 +1043,7 @@ static void _try_monster_cast(spell_type spell, int powc, int midx; for (midx = 0; midx < MAX_MONSTERS; midx++) - if (menv[midx].type == -1) + if (menv[midx].type == MONS_NO_MONSTER) break; if (midx == MAX_MONSTERS) diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 601461a8d8..55ac7cab6a 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -1194,7 +1194,7 @@ static int _xom_confuse_monsters(int sever, bool debug = false) { monster = &menv[i]; - if (monster->type == -1 || !mons_near(monster) + if (monster->type == MONS_NO_MONSTER || !mons_near(monster) || mons_wont_attack(monster) || !mons_class_is_confusable(monster->type) || one_chance_in(20)) -- cgit v1.2.3-54-g00ecf