summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-16 12:48:57 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-16 12:48:57 +0000
commit263a61728d25f53837389fcf1c333eebd78c535b (patch)
treeb497ab51dc2d6edc75f55da134b684c53148cb57 /crawl-ref/source/monstuff.cc
parent0b23da9f3754bcbd9ca3561f4c9c8d77cd6c598b (diff)
downloadcrawl-ref-263a61728d25f53837389fcf1c333eebd78c535b.tar.gz
crawl-ref-263a61728d25f53837389fcf1c333eebd78c535b.zip
Use up some of a monster's energy if it does nothing because there's nowhere
for it move. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9099 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 17253a1ca0..66fafc2233 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -6966,6 +6966,8 @@ static void _handle_monster_move(monsters *monster)
if (!monster->alive())
break;
+ const coord_def old_pos = monster->pos();
+
#if DEBUG_MONS_SCAN
if (!monster_was_floating
&& mgrd(monster->pos()) != monster->mindex())
@@ -7327,6 +7329,10 @@ static void _handle_monster_move(monsters *monster)
if (mons_cannot_move(monster) || !_monster_move(monster))
monster->speed_increment -= non_move_energy;
+ else if (monster->pos() == old_pos)
+ // There was nowhere the monster could move to, so it did
+ // nothing.
+ monster->speed_increment -= non_move_energy;
}
update_beholders(monster);
@@ -7338,7 +7344,6 @@ static void _handle_monster_move(monsters *monster)
_handle_behaviour(monster);
ASSERT(in_bounds(monster->target) || monster->target.origin());
}
-
}
if (monster->type != -1 && monster->hit_points < 1)