summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fineff.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-05-29 11:17:37 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-05-29 13:25:34 +0200
commit17597ac35bb9753363a5bcb839b87c47ca043a1f (patch)
treec55b296105fe72e22af11934ecff86d313b1de5b /crawl-ref/source/fineff.cc
parentc57e53905dafb5f2203084e1d274a3aabaf454fb (diff)
downloadcrawl-ref-17597ac35bb9753363a5bcb839b87c47ca043a1f.tar.gz
crawl-ref-17597ac35bb9753363a5bcb839b87c47ca043a1f.zip
Don't move a trampler into tramplee's space until after the given attack.
This fixes crashes if either was moved off-level. It does _not_ fix a random monster with the same mindex continuing wuth the next attack on the level you dropped to -- combat code is sprinkled with attacked/defender->alive() which happily uses a stale pointer which, while currently always pointing to an actor struct (you or menv[x]), may refer to another monster which can happen to be alive and in range. Also, for some reason attacker following doesn't obey traps. This is more fixable than it used to be, though.
Diffstat (limited to 'crawl-ref/source/fineff.cc')
-rw-r--r--crawl-ref/source/fineff.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/crawl-ref/source/fineff.cc b/crawl-ref/source/fineff.cc
index 0ee75b3884..76f2f92c37 100644
--- a/crawl-ref/source/fineff.cc
+++ b/crawl-ref/source/fineff.cc
@@ -5,6 +5,7 @@
**/
#include "AppHdr.h"
+#include "coord.h"
#include "effects.h"
#include "env.h"
#include "fineff.h"
@@ -101,6 +102,16 @@ void fire_final_effects()
attacker->hurt(defender, fe.x);
}
break;
+ case FINEFF_TRAMPLE_FOLLOW:
+ if (!attacker
+ || attacker->pos() == fe.pos
+ || !adjacent(attacker->pos(), fe.pos)
+ || !attacker->is_habitable(fe.pos))
+ {
+ continue;
+ }
+ attacker->move_to_pos(fe.pos);
+ break;
}
}
env.final_effects.clear();