diff options
-rw-r--r-- | crawl-ref/source/abl-show.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/acr.cc | 21 | ||||
-rw-r--r-- | crawl-ref/source/beam.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/cloud.cc | 24 | ||||
-rw-r--r-- | crawl-ref/source/decks.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/delay.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/effects.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/hiscores.cc | 88 | ||||
-rw-r--r-- | crawl-ref/source/hiscores.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/misc.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/mutation.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/ouch.cc | 22 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/spells2.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/spells4.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/terrain.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/traps.cc | 7 |
19 files changed, 124 insertions, 122 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index ae9e4b55d5..a7b28f2bfe 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -2412,7 +2412,7 @@ static void _lugonu_bends_space() random_blink(false, true); const int damage = roll_dice(1, 4); - ouch(damage, 0, KILLED_BY_WILD_MAGIC, "a spatial distortion"); + ouch(damage, NON_MONSTER, KILLED_BY_WILD_MAGIC, "a spatial distortion"); } //////////////////////////////////////////////////////////////////////// diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 4c790d439d..e7a82f98ff 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2406,7 +2406,7 @@ void process_command( command_type cmd ) case CMD_QUIT: if (yes_or_no("Are you sure you want to quit")) - ouch(INSTANT_DEATH, 0, KILLED_BY_QUITTING); + ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_QUITTING); else canned_msg(MSG_OK); break; @@ -2514,8 +2514,9 @@ static void _decrement_durations() if (res_fire > 0) { - ouch( (((random2avg(9, 2) + 1) * you.time_taken) / - (1 + (res_fire * res_fire))) / 10, 0, KILLED_BY_BURNING ); + ouch((((random2avg(9, 2) + 1) * you.time_taken) / + (1 + (res_fire * res_fire))) / 10, NON_MONSTER, + KILLED_BY_BURNING); } if (res_fire <= 0) @@ -2703,7 +2704,7 @@ static void _decrement_durations() if (you.duration[DUR_CONDENSATION_SHIELD] > 0 && player_res_cold() < 0) { mpr( "You feel very cold." ); - ouch( 2 + random2avg(13, 2), 0, KILLED_BY_FREEZING ); + ouch(2 + random2avg(13, 2), NON_MONSTER, KILLED_BY_FREEZING); } if ( _decrement_a_duration(DUR_MAGIC_SHIELD, @@ -2907,7 +2908,7 @@ static void _decrement_durations() else if (x_chance_in_y(you.rotting, 20)) { mpr("You feel your flesh rotting away.", MSGCH_WARN); - ouch(1, 0, KILLED_BY_ROTTING); + ouch(1, NON_MONSTER, KILLED_BY_ROTTING); rot_hp(1); you.rotting--; } @@ -2923,7 +2924,7 @@ static void _decrement_durations() if (one_chance_in(400)) { mpr("You feel your flesh rotting away.", MSGCH_WARN); - ouch(1, 0, KILLED_BY_ROTTING); + ouch(1, NON_MONSTER, KILLED_BY_ROTTING); rot_hp(1); if (you.rotting > 0) @@ -2939,18 +2940,18 @@ static void _decrement_durations() { if (you.duration[DUR_POISONING] > 10 && random2(you.duration[DUR_POISONING]) >= 8) { - ouch(random2(10) + 5, 0, KILLED_BY_POISON); + ouch(random2(10) + 5, NON_MONSTER, KILLED_BY_POISON); mpr("You feel extremely sick.", MSGCH_DANGER); } else if (you.duration[DUR_POISONING] > 5 && coinflip()) { - ouch((coinflip()? 3 : 2), 0, KILLED_BY_POISON); + ouch((coinflip() ? 3 : 2), NON_MONSTER, KILLED_BY_POISON); mpr("You feel very sick.", MSGCH_WARN); } else { // the poison running through your veins."); - ouch(1, 0, KILLED_BY_POISON); + ouch(1, NON_MONSTER, KILLED_BY_POISON); mpr("You feel sick."); } @@ -3188,7 +3189,7 @@ static void _world_reacts() if (you.hunger <= 100) { mpr( "You have starved to death.", MSGCH_FOOD ); - ouch( INSTANT_DEATH, 0, KILLED_BY_STARVATION ); + ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_STARVATION); } } diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 04ae6eb964..483e8cede8 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3362,7 +3362,7 @@ static void _beam_ouch(int dam, bolt &beam) // The order of this is important. if (YOU_KILL(beam.thrower) && beam.aux_source.empty()) { - ouch(dam, 0, KILLED_BY_TARGETTING); + ouch(dam, NON_MONSTER, KILLED_BY_TARGETTING); } else if (MON_KILL(beam.thrower)) { @@ -3376,8 +3376,8 @@ static void _beam_ouch(int dam, bolt &beam) } else // KILL_MISC || (YOU_KILL && aux_source) { - ouch( dam, beam.beam_source, KILLED_BY_WILD_MAGIC, - beam.aux_source.c_str() ); + ouch(dam, beam.beam_source, KILLED_BY_WILD_MAGIC, + beam.aux_source.c_str()); } } @@ -3853,7 +3853,7 @@ static int _affect_player( bolt &beam, item_def *item ) if (beam.aux_source.empty()) beam.aux_source = "by nerve-wracking pain"; - _beam_ouch( roll_dice( beam.damage ), beam ); + _beam_ouch(roll_dice(beam.damage), beam); beam.obvious_effect = true; break; @@ -3879,7 +3879,7 @@ static int _affect_player( bolt &beam, item_def *item ) beam.damage.size /= 3; } } - _beam_ouch( roll_dice( beam.damage ), beam ); + _beam_ouch(roll_dice(beam.damage), beam); beam.obvious_effect = true; break; @@ -3889,7 +3889,7 @@ static int _affect_player( bolt &beam, item_def *item ) if (beam.aux_source.empty()) beam.aux_source = "a disintegration bolt"; - _beam_ouch( roll_dice( beam.damage ), beam ); + _beam_ouch(roll_dice(beam.damage), beam); beam.obvious_effect = true; break; @@ -4099,7 +4099,7 @@ static int _affect_player( bolt &beam, item_def *item ) beam.foe_hurt++; } - _beam_ouch( hurted, beam ); + _beam_ouch(hurted, beam); return (_range_used_on_hit( beam )); } diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index a085f75d79..5dd3ec65f8 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -479,17 +479,17 @@ void in_a_cloud() hurted -= random2(player_AC()); - if (hurted < 1) + if (hurted < 0) hurted = 0; else - ouch( hurted, cl, KILLED_BY_CLOUD, "flame" ); + ouch(hurted, cl, KILLED_BY_CLOUD, "flame"); } else { canned_msg(MSG_YOU_RESIST); hurted += ((random2avg(23, 3) + 10) * you.time_taken) / 10; hurted /= (1 + resist * resist); - ouch( hurted, cl, KILLED_BY_CLOUD, "flame" ); + ouch(hurted, cl, KILLED_BY_CLOUD, "flame"); } expose_player_to_element(BEAM_FIRE, 7); break; @@ -504,8 +504,8 @@ void in_a_cloud() if (hurted < 1) hurted = 0; else - ouch( (hurted * you.time_taken) / 10, cl, KILLED_BY_CLOUD, - "noxious fumes" ); + ouch((hurted * you.time_taken) / 10, cl, KILLED_BY_CLOUD, + "noxious fumes"); if (1 + random2(27) >= you.experience_level) { @@ -530,14 +530,14 @@ void in_a_cloud() if (hurted < 0) hurted = 0; - ouch( hurted, cl, KILLED_BY_CLOUD, "freezing vapour" ); + ouch(hurted, cl, KILLED_BY_CLOUD, "freezing vapour"); } else { canned_msg(MSG_YOU_RESIST); hurted += ((random2avg(23, 3) + 10) * you.time_taken) / 10; hurted /= (1 + resist * resist); - ouch( hurted, cl, KILLED_BY_CLOUD, "freezing vapour" ); + ouch(hurted, cl, KILLED_BY_CLOUD, "freezing vapour"); } expose_player_to_element(BEAM_COLD, 7); break; @@ -547,8 +547,8 @@ void in_a_cloud() mpr("You are engulfed in poison gas!"); if (!player_res_poison()) { - ouch( (random2(10) * you.time_taken) / 10, cl, KILLED_BY_CLOUD, - "poison gas" ); + ouch((random2(10) * you.time_taken) / 10, cl, KILLED_BY_CLOUD, + "poison gas"); poison_player(1); } break; @@ -581,8 +581,8 @@ void in_a_cloud() if (hurted < 0) hurted = 0; - ouch( (hurted * you.time_taken) / 10, cl, KILLED_BY_CLOUD, - "steam" ); + ouch((hurted * you.time_taken) / 10, cl, KILLED_BY_CLOUD, + "steam"); break; } @@ -599,7 +599,7 @@ void in_a_cloud() if (hurted < 0) hurted = 0; - ouch( hurted, cl, KILLED_BY_CLOUD, "foul pestilence" ); + ouch(hurted, cl, KILLED_BY_CLOUD, "foul pestilence"); potion_effect(POT_SLOWING, 5); if (you.hp_max > 4 && coinflip()) diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 92edae8b0a..8ba664fb9e 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1944,7 +1944,10 @@ static void _focus_card(int power, deck_rarity_type rarity) for (int i = 0; i < 3; ++i) if (*max_statp[i] < 1 || *base_statp[i] < 1) - ouch(INSTANT_DEATH, 0, kill_types[i], cause.c_str(), true); + { + ouch(INSTANT_DEATH, NON_MONSTER, kill_types[i], cause.c_str(), + true); + } // The player survived! Yay! you.redraw_strength = true; @@ -2001,7 +2004,10 @@ static void _shuffle_card(int power, deck_rarity_type rarity) for (int i = 0; i < 3; ++i) if (new_base[i] < 1 || new_max[i] < 1) - ouch(INSTANT_DEATH, 0, kill_types[i], cause.c_str(), true); + { + ouch(INSTANT_DEATH, NON_MONSTER, kill_types[i], cause.c_str(), + true); + } // The player survived! diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index c7d3af3397..eb9fd015d5 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -1043,7 +1043,7 @@ static void _finish_delay(const delay_queue_item &delay) { default: if (!you.can_pass_through_feat(grd(pass))) - ouch(1 + you.hp, 0, KILLED_BY_PETRIFICATION); + ouch(1 + you.hp, NON_MONSTER, KILLED_BY_PETRIFICATION); break; case DNGN_SECRET_DOOR: // oughtn't happen diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 70e5843bf0..2d21ad2004 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -537,9 +537,9 @@ bool lose_stat(unsigned char which_stat, unsigned char stat_loss, bool force, if (newValue < 1) { if (cause == NULL) - ouch(INSTANT_DEATH, 0, kill_type); + ouch(INSTANT_DEATH, NON_MONSTER, kill_type); else - ouch(INSTANT_DEATH, 0, kill_type, cause, see_source); + ouch(INSTANT_DEATH, NON_MONSTER, kill_type, cause, see_source); } diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 01babe6070..0adefdc5b0 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -777,69 +777,61 @@ void scorefile_entry::init_death_cause(int dam, int dsrc, // for death by monster if ((death_type == KILLED_BY_MONSTER || death_type == KILLED_BY_BEAM) - && death_source >= 0 && death_source < MAX_MONSTERS) + && !invalid_monster_index(death_source)) { const monsters *monster = &menv[death_source]; - if (monster->type >= 0 && monster->type < NUM_MONSTERS) + death_source = monster->type; + mon_num = monster->base_monster; + + // Previously the weapon was only used for dancing weapons, + // but now we pass it in as a string through the scorefile + // entry to be appended in hiscores_format_single in long or + // medium scorefile formats. + if (death_type == KILLED_BY_MONSTER + && monster->inv[MSLOT_WEAPON] != NON_ITEM) { - death_source = monster->type; - mon_num = monster->base_monster; - - // Previously the weapon was only used for dancing weapons, - // but now we pass it in as a string through the scorefile - // entry to be appended in hiscores_format_single in long or - // medium scorefile formats. - if (death_type == KILLED_BY_MONSTER - && monster->inv[MSLOT_WEAPON] != NON_ITEM) + // [ds] The highscore entry may be constructed while the player + // is alive (for notes), so make sure we don't reveal info we + // shouldn't. + if (you.hp <= 0) { - // [ds] The highscore entry may be constructed while the player - // is alive (for notes), so make sure we don't reveal info we - // shouldn't. - if (you.hp <= 0) - { #if HISCORE_WEAPON_DETAIL - set_ident_flags( mitm[monster->inv[MSLOT_WEAPON]], - ISFLAG_IDENT_MASK ); + set_ident_flags( mitm[monster->inv[MSLOT_WEAPON]], + ISFLAG_IDENT_MASK ); #else - // changing this to ignore the pluses to keep it short - unset_ident_flags( mitm[monster->inv[MSLOT_WEAPON]], - ISFLAG_IDENT_MASK ); + // changing this to ignore the pluses to keep it short + unset_ident_flags( mitm[monster->inv[MSLOT_WEAPON]], + ISFLAG_IDENT_MASK ); - set_ident_flags( mitm[monster->inv[MSLOT_WEAPON]], - ISFLAG_KNOW_TYPE ); + set_ident_flags( mitm[monster->inv[MSLOT_WEAPON]], + ISFLAG_KNOW_TYPE ); - // clear "runed" description text to make shorter yet - set_equip_desc( mitm[monster->inv[MSLOT_WEAPON]], 0 ); + // clear "runed" description text to make shorter yet + set_equip_desc( mitm[monster->inv[MSLOT_WEAPON]], 0 ); #endif - } - - // Setting this is redundant for dancing weapons, however - // we do care about the above indentification. -- bwr - if (monster->type != MONS_DANCING_WEAPON) - auxkilldata = mitm[monster->inv[MSLOT_WEAPON]].name(DESC_NOCAP_A); } - const bool death = you.hp <= 0; + // Setting this is redundant for dancing weapons, however + // we do care about the above indentification. -- bwr + if (monster->type != MONS_DANCING_WEAPON) + auxkilldata = mitm[monster->inv[MSLOT_WEAPON]].name(DESC_NOCAP_A); + } - death_source_name = monster->name(DESC_NOCAP_A, death); - if (monster->has_base_name()) - death_source_name += - ", " + monster->base_name(DESC_NOCAP_A, death); + const bool death = you.hp <= 0; - if (monster->has_ench(ENCH_SHAPESHIFTER)) - { - death_source_name += " (shapeshifter)"; - } - else if (monster->has_ench(ENCH_GLOWING_SHAPESHIFTER)) - { - death_source_name += " (glowing shapeshifter)"; - } - } + death_source_name = monster->name(DESC_NOCAP_A, death); + if (monster->has_base_name()) + death_source_name += + ", " + monster->base_name(DESC_NOCAP_A, death); + + if (monster->has_ench(ENCH_SHAPESHIFTER)) + death_source_name += " (shapeshifter)"; + else if (monster->has_ench(ENCH_GLOWING_SHAPESHIFTER)) + death_source_name += " (glowing shapeshifter)"; } else { - death_source = death_source; mon_num = 0; death_source_name[0] = 0; } @@ -867,7 +859,7 @@ void scorefile_entry::reset() best_skill = 0; best_skill_lvl = 0; death_type = KILLED_BY_SOMETHING; - death_source = 0; + death_source = NON_MONSTER; mon_num = 0; death_source_name[0] = 0; auxkilldata[0] = 0; @@ -1136,7 +1128,7 @@ std::string scorefile_entry::death_source_desc() const return (""); // XXX no longer handles mons_num correctly! FIXME - return (!death_source_name.empty()? + return (!death_source_name.empty() ? death_source_name : mons_type_name(death_source, DESC_NOCAP_A)); } diff --git a/crawl-ref/source/hiscores.h b/crawl-ref/source/hiscores.h index 86926e24fa..7016f55f4a 100644 --- a/crawl-ref/source/hiscores.h +++ b/crawl-ref/source/hiscores.h @@ -95,7 +95,7 @@ public: char best_skill; // best skill # char best_skill_lvl; // best skill level int death_type; - int death_source; // 0 or monster TYPE + int death_source; // NON_MONSTER or monster type int mon_num; // sigh... std::string death_source_name; // overrides death_source std::string auxkilldata; // weapon wielded, spell cast, etc diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 26ae1fd3a4..aa9a7c04fd 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1301,7 +1301,7 @@ void curare_hits_player(int agent, int degree) if (hurted) { mpr("You feel difficulty breathing."); - ouch( hurted, agent, KILLED_BY_CURARE, "curare-induced apnoea" ); + ouch(hurted, agent, KILLED_BY_CURARE, "curare-induced apnoea"); } potion_effect(POT_SLOWING, 2 + random2(4 + degree)); } @@ -1488,8 +1488,8 @@ void up_stairs(dungeon_feature_type force_stair, { mpr("In your confused state, you trip and fall back down the stairs."); - ouch( roll_dice( 3 + you.burden_state, 5 ), 0, - KILLED_BY_FALLING_DOWN_STAIRS ); + ouch(roll_dice(3 + you.burden_state, 5), NON_MONSTER, + KILLED_BY_FALLING_DOWN_STAIRS); you.turn_is_over = true; return; @@ -1540,11 +1540,11 @@ void up_stairs(dungeon_feature_type force_stair, if (is_valid_item( you.inv[i] ) && you.inv[i].base_type == OBJ_ORBS) { - ouch(INSTANT_DEATH, 0, KILLED_BY_WINNING); + ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_WINNING); } } - ouch(INSTANT_DEATH, 0, KILLED_BY_LEAVING); + ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_LEAVING); } you.prev_targ = MHITNOT; @@ -1936,8 +1936,8 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, // Nastier than when climbing stairs, but you'll aways get to // your destination. -- bwr - ouch( roll_dice( 6 + you.burden_state, 10 ), 0, - KILLED_BY_FALLING_DOWN_STAIRS ); + ouch(roll_dice(6 + you.burden_state, 10), NON_MONSTER, + KILLED_BY_FALLING_DOWN_STAIRS); } if (shaft) diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 307029b90c..c387d3a1c3 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -1759,7 +1759,7 @@ bool mutate(mutation_type which_mutation, bool failMsg, lose_stat(STAT_RANDOM, 1, false, "mutating"); else { - ouch(3, 0, KILLED_BY_ROTTING); + ouch(3, NON_MONSTER, KILLED_BY_ROTTING); rot_hp(roll_dice(1, 3)); } diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 145ee6d316..1556b49e95 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -271,7 +271,7 @@ void splash_with_acid( char acid_strength ) if (post_res_dam < dam) canned_msg(MSG_YOU_RESIST); - ouch( post_res_dam, 0, KILLED_BY_ACID ); + ouch(post_res_dam, NON_MONSTER, KILLED_BY_ACID); } } } // end splash_with_acid() @@ -286,7 +286,7 @@ void weapon_acid( char acid_strength ) if (hand_thing == -1) { msg::stream << "Your " << your_hand(true) << " burn!" << std::endl; - ouch( roll_dice( 1, acid_strength ), 0, KILLED_BY_ACID ); + ouch(roll_dice(1, acid_strength), NON_MONSTER, KILLED_BY_ACID); } else if (x_chance_in_y(acid_strength + 1, 20)) item_corrode( hand_thing ); @@ -621,7 +621,7 @@ void lose_level() // must die straightaway. if (you.experience_level == 1) { - ouch(INSTANT_DEATH, 0, KILLED_BY_DRAINING); + ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_DRAINING); // Return in case death was canceled via wizard mode return; } @@ -634,7 +634,7 @@ void lose_level() // Constant value to avoid grape jelly trick... see level_change() for // where these HPs and MPs are given back. -- bwr - ouch( 4, 0, KILLED_BY_DRAINING ); + ouch(4, NON_MONSTER, KILLED_BY_DRAINING); dec_max_hp(4); dec_mp(1); @@ -667,7 +667,7 @@ void drain_exp(bool announce_full) if (you.experience == 0) { - ouch(INSTANT_DEATH, 0, KILLED_BY_DRAINING); + ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_DRAINING); // Return in case death was escaped via wizard mode. return; } @@ -736,7 +736,7 @@ static void _xom_checks_damage(kill_method_type death_type, return; } else if (death_type != KILLED_BY_MONSTER && death_type != KILLED_BY_BEAM - || death_source < 0 || death_source >= MAX_MONSTERS) + || invalid_monster_index(death_source)) { return; } @@ -790,9 +790,9 @@ static void _xom_checks_damage(kill_method_type death_type, xom_is_stimulated(amusementvalue); } -// death_source should be set to zero for non-monsters. {dlb} -void ouch( int dam, int death_source, kill_method_type death_type, - const char *aux, bool see_source ) +// death_source should be set to NON_MONSTER for non-monsters. {dlb} +void ouch(int dam, int death_source, kill_method_type death_type, + const char *aux, bool see_source) { ait_hp_loss hpl(dam, death_type); interrupt_activity( AI_HP_LOSS, &hpl ); @@ -806,7 +806,7 @@ void ouch( int dam, int death_source, kill_method_type death_type, return; } - if (dam > -9000) // that is, a "death" caused by hp loss {dlb} + if (dam != INSTANT_DEATH) // that is, a "death" caused by hp loss {dlb} { if (dam >= you.hp && god_protects_from_harm(you.religion)) { @@ -850,7 +850,7 @@ void ouch( int dam, int death_source, kill_method_type death_type, if (you.religion == GOD_YREDELEMNUL && you.duration[DUR_PRAYER] - && death_source != 0 && !invalid_monster_index(death_source)) + && !invalid_monster_index(death_source)) { yred_mirror_injury(&menv[death_source], dam); } diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 664fc387ff..6b1f1788ca 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -4548,9 +4548,9 @@ void modify_stat(stat_type which_stat, char amount, bool suppress_msg, if (amount < 0 && *ptr_stat < 1) { if (cause == NULL) - ouch(INSTANT_DEATH, 0, kill_type); + ouch(INSTANT_DEATH, NON_MONSTER, kill_type); else - ouch(INSTANT_DEATH, 0, kill_type, cause, see_source); + ouch(INSTANT_DEATH, NON_MONSTER, kill_type, cause, see_source); } if (ptr_stat == &you.strength) @@ -4636,7 +4636,7 @@ void dec_hp(int hp_loss, bool fatal, const char *aux) // fatal, somebody else is doing the bookkeeping, and we don't want to mess // with that. if (!fatal && aux) - ouch(hp_loss, -1, KILLED_BY_SOMETHING, aux); + ouch(hp_loss, NON_MONSTER, KILLED_BY_SOMETHING, aux); else you.hp -= hp_loss; @@ -6498,14 +6498,14 @@ int player::hurt(const actor *agent, int amount, beam_type flavour) const monsters *mon = dynamic_cast<const monsters*>(agent); if (agent->atype() == ACT_MONSTER) { - ouch(amount, monster_index( mon ), + ouch(amount, monster_index(mon), KILLED_BY_MONSTER, "", player_monster_visible(mon)); } else { // Should never happen! ASSERT(false); - ouch(amount, 0, KILLED_BY_SOMETHING); + ouch(amount, NON_MONSTER, KILLED_BY_SOMETHING); } return (amount); } diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 7e4de96d0b..c1d6e5dca9 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -5662,7 +5662,7 @@ void god_smites_you(god_type god, const char *message, divine_hurt += random2( you.experience_level ); simple_god_message( " smites you!", god ); - ouch( divine_hurt, 0, death_type, aux.c_str() ); + ouch(divine_hurt, NON_MONSTER, death_type, aux.c_str()); dec_penance( god, 1 ); } } diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 7b28f4b04c..5202345a3f 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -644,7 +644,7 @@ void cast_refrigeration(int pow) if (hurted > 0) { mpr("You feel very cold."); - ouch( hurted, 0, KILLED_BY_FREEZING ); + ouch(hurted, NON_MONSTER, KILLED_BY_FREEZING); // Note: this used to be 12!... and it was also applied even if // the player didn't take damage from the cold, so we're being diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 002554c889..7ee3913b65 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -327,8 +327,8 @@ void cast_shatter(int pow) mpr("cast_shatter(): unknown transformation in spells4.cc"); } - if (damage) - ouch(damage, 0, KILLED_BY_TARGETTING); + if (damage > 0) + ouch(damage, NON_MONSTER, KILLED_BY_TARGETTING); int rad = 3 + (you.skills[SK_EARTH_MAGIC] / 5); @@ -748,7 +748,7 @@ void cast_ignite_poison(int pow) mpr("The poison in your system burns!"); } - ouch( damage, 0, KILLED_BY_TARGETTING ); + ouch(damage, NON_MONSTER, KILLED_BY_TARGETTING); if (you.duration[DUR_POISONING] > 0) { @@ -799,7 +799,7 @@ static int _discharge_monsters( coord_def where, int pow, int garbage ) damage = check_your_resists( damage, BEAM_ELECTRICITY ); if ( player_is_airborne() ) damage /= 2; - ouch( damage, 0, KILLED_BY_WILD_MAGIC ); + ouch(damage, NON_MONSTER, KILLED_BY_WILD_MAGIC); } else if (mon == NON_MONSTER) return (0); @@ -1144,7 +1144,7 @@ static int _passwall(coord_def where, int pow, int garbage) { if (howdeep > range || non_rock_barriers) { - ouch(1 + you.hp, 0, KILLED_BY_PETRIFICATION); + ouch(1 + you.hp, NON_MONSTER, KILLED_BY_PETRIFICATION); //jmf: not return; if wizard, successful transport is option } } diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index c72b4cffe2..adb8493576 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -3870,7 +3870,7 @@ void MiscastEffect::_fire(int severity) mon_msg_seen = "@The_monster@ is blasted with fire."; mon_msg_unseen = "A flame briefly burns in thin air."; - _ouch(5 + random2avg(29, 2), BEAM_FIRE ); + _ouch(5 + random2avg(29, 2), BEAM_FIRE); target->expose_to_element(BEAM_FIRE, 5); break; diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index 532538f469..67a2fa84b6 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -608,13 +608,13 @@ bool fall_into_a_pool( const coord_def& entry, bool allow_shift, if (resist <= 0) { mpr( "The lava burns you to a cinder!" ); - ouch( INSTANT_DEATH, 0, KILLED_BY_LAVA ); + ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_LAVA); } else { // should boost # of bangs per damage in the future {dlb} mpr( "The lava burns you!" ); - ouch( (10 + roll_dice(2,50)) / resist, 0, KILLED_BY_LAVA ); + ouch((10 + roll_dice(2, 50)) / resist, NON_MONSTER, KILLED_BY_LAVA); } expose_player_to_element( BEAM_LAVA, 14 ); @@ -668,9 +668,9 @@ bool fall_into_a_pool( const coord_def& entry, bool allow_shift, mpr("You drown..."); if (terrain == DNGN_LAVA) - ouch( INSTANT_DEATH, 0, KILLED_BY_LAVA ); + ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_LAVA); else if (terrain == DNGN_DEEP_WATER) - ouch( INSTANT_DEATH, 0, KILLED_BY_WATER ); + ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_WATER); return (false); } diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index fae7a411ec..16aaa0ab87 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -260,7 +260,10 @@ static void dart_trap(bool trap_known, int trapped, bolt &pbolt, bool poison) damage_taken -= random2( player_AC() + 1 ); if (damage_taken > 0) - ouch( damage_taken, 0, KILLED_BY_TRAP, pbolt.name.c_str() ); + { + ouch(damage_taken, NON_MONSTER, KILLED_BY_TRAP, + pbolt.name.c_str()); + } } else { @@ -429,7 +432,7 @@ void handle_traps(trap_type trt, int i, bool trap_known) mpr("A huge blade swings out and slices into you!"); int damage = (you.your_level * 2) + random2avg(29, 2) - random2(1 + player_AC()); - ouch( damage, 0, KILLED_BY_TRAP, " blade" ); + ouch(damage, NON_MONSTER, KILLED_BY_TRAP, " blade"); bleed_onto_floor(you.pos(), -1, damage, true); } break; |