summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-20 20:02:08 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-20 20:02:08 +0000
commit9d0d35643d521ebd9972311d823abd9969170214 (patch)
tree8a44c829e4fda12c798befeac9c5e7a787556d7f /crawl-ref/source/monstuff.cc
parent0737272c9fd3edab36625972e378537b2689d2ad (diff)
downloadcrawl-ref-9d0d35643d521ebd9972311d823abd9969170214.tar.gz
crawl-ref-9d0d35643d521ebd9972311d823abd9969170214.zip
Add another sanity check cleanup.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3761 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 2ab379d8c9..d804b70484 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -396,8 +396,9 @@ static void give_monster_experience( monsters *victim,
int killer_index, int experience,
bool victim_was_born_friendly )
{
- if (killer_index < 0 || killer_index >= MAX_MONSTERS)
+ if (invalid_monster_index(killer_index))
return;
+
monsters *mons = &menv[killer_index];
if (!mons->alive())
return;
@@ -416,11 +417,11 @@ static void give_adjusted_experience(monsters *monster, killer_type killer,
{
const int experience = exper_value(monster);
- const bool created_friendly =
+ const bool created_friendly =
testbits(monster->flags, MF_CREATED_FRIENDLY);
const bool was_neutral = testbits(monster->flags, MF_WAS_NEUTRAL);
const bool no_xp = monster->has_ench(ENCH_ABJ);
-
+
if (created_friendly || was_neutral || no_xp)
; // No experience if monster was created friendly or summoned.
else if (YOU_KILL(killer))
@@ -2757,7 +2758,7 @@ static bool handle_special_ability(monsters *monster, bolt & beem)
if (!mons_player_visible( monster ))
break;
-
+
if (is_sanctuary(you.x_pos, you.y_pos)
|| is_sanctuary(monster->x, monster->y))
{
@@ -5069,7 +5070,7 @@ static bool monster_swaps_places( monsters *mon, int mx, int my )
if (!mx && !my)
return (false);
- int targmon = mgrd[mon->x + mx][mon->y + my];
+ int targmon = mgrd[mon->x + mx][mon->y + my];
if (targmon == MHITNOT || targmon == MHITYOU)
return (false);
@@ -5082,7 +5083,7 @@ static bool monster_swaps_places( monsters *mon, int mx, int my )
if (one_chance_in(2))
{
#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
+ mprf(MSGCH_DIAGNOSTICS,
"Alerting monster %s at (%d,%d)",
m2->name(DESC_PLAIN).c_str(), m2->x, m2->y);
#endif
@@ -5568,7 +5569,7 @@ bool mon_can_move_to_pos(const monsters *monster, const int count_x,
{
if (targ_x == monster->x && targ_y == monster->y)
return true;
-
+
return false; // blocks square
}