From 263a61728d25f53837389fcf1c333eebd78c535b Mon Sep 17 00:00:00 2001 From: zelgadis Date: Mon, 16 Feb 2009 12:48:57 +0000 Subject: 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 --- crawl-ref/source/monstuff.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/monstuff.cc') 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) -- cgit v1.2.3-54-g00ecf