summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fineff.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-04-10 13:08:27 +0200
committerAdam Borowski <kilobyte@angband.pl>2011-04-10 13:08:27 +0200
commit4fdebf294f1b5c0d5160a6988eab00dec647fcef (patch)
treef80e481f1640455e0c9075be29f28a1c77840276 /crawl-ref/source/fineff.cc
parentd6169c4135d6ea623cf018cac5314fd36018627d (diff)
downloadcrawl-ref-4fdebf294f1b5c0d5160a6988eab00dec647fcef.tar.gz
crawl-ref-4fdebf294f1b5c0d5160a6988eab00dec647fcef.zip
Use mid not mindex for delayed "final" effects.
Since these are very short lived, this shouldn't happen outside of some very far-fetched scenarios: something would have to kill a monster with a final effect and spawn a new one.
Diffstat (limited to 'crawl-ref/source/fineff.cc')
-rw-r--r--crawl-ref/source/fineff.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/crawl-ref/source/fineff.cc b/crawl-ref/source/fineff.cc
index 239e029053..adf246d393 100644
--- a/crawl-ref/source/fineff.cc
+++ b/crawl-ref/source/fineff.cc
@@ -21,13 +21,13 @@ void add_final_effect(final_effect_flavour flavour,
{
final_effect fe;
- fe.att = NON_MONSTER;
- fe.def = NON_MONSTER;
+ fe.att = 0;
+ fe.def = 0;
if (attacker)
- fe.att = attacker->mindex();
+ fe.att = attacker->mid;
if (defender)
- fe.def = defender->mindex();
+ fe.def = defender->mid;
fe.flavour = flavour;
fe.pos = pos;
@@ -66,12 +66,8 @@ void fire_final_effects()
// immediately replacing it; this is not supposed to happen save for
// zombifying (and then it's the same monster), but if this changes,
// we'd need an identifier or such.
- actor *attacker = (fe.att == NON_MONSTER) ? 0 :
- (fe.att == MHITYOU) ? (actor*)&you :
- &menv[fe.att];
- actor *defender = (fe.def == NON_MONSTER) ? 0 :
- (fe.def == MHITYOU) ? (actor*)&you :
- &menv[fe.def];
+ actor *attacker = actor_by_mid(fe.att);
+ actor *defender = actor_by_mid(fe.def);
switch (fe.flavour)
{