summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dactions.h
diff options
context:
space:
mode:
authorblackcustard <peterwicksstringfield@gmail.com>2013-07-30 14:11:30 -0500
committerNeil Moore <neil@s-z.org>2013-07-30 16:36:15 -0400
commited92a994f664c3d06841dd45e2479d5c037e3316 (patch)
tree408791ee412f79361cc0d5f94aea0e248e473dff /crawl-ref/source/dactions.h
parentc67cb32cf693618954cf9a0211d99e07e5ed05b4 (diff)
downloadcrawl-ref-ed92a994f664c3d06841dd45e2479d5c037e3316.tar.gz
crawl-ref-ed92a994f664c3d06841dd45e2479d5c037e3316.zip
Fix a Kirke crash by deporkalating transiting hogs correctly.
Normally, monsters are stored in a list (env.mons or menv for short). There is a grid (env.mgrid or mgrd for short) which maps the position (x, y) of the monster to its index in the list. Transiting monsters, however, exist outside both the monster list and the monster grid. They are stored separately, and they do not really have positions. The deporkalation code inside dactions.cc was not transiting-monster aware. It would call monster::move_to_pos on transiting hogs, just as on non-transiting hogs. When it did so, it would write their index inside the monster list into the monster grid. Of course, since these hogs were not in the monster list in the first place, this "index" was bogus. Within a few turns one of several unrelated parts Crawl would try to investigate the monster grid and trip over the bogus entry, triggering this assertion in monster_at inside mon-util.cc: ASSERT(mindex <= MAX_MONSTERS); Changes: 1. Make the deporkalation code transiting-monster aware. Do not call monster::move_to_pos on transiting monsters. (Fixes the crash.) 2. Add some informative comments. 3. Make an implicit type conversion from monster to follower explicit.
Diffstat (limited to 'crawl-ref/source/dactions.h')
-rw-r--r--crawl-ref/source/dactions.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/crawl-ref/source/dactions.h b/crawl-ref/source/dactions.h
index df9e804a55..fe50ba3dbe 100644
--- a/crawl-ref/source/dactions.h
+++ b/crawl-ref/source/dactions.h
@@ -9,6 +9,7 @@ void update_da_counters(LevelInfo *lev);
unsigned int query_da_counter(daction_type c);
bool mons_matches_daction(const monster* mon, daction_type act);
-void apply_daction_to_mons(monster* mons, daction_type act, bool local);
+void apply_daction_to_mons(monster* mons, daction_type act, bool local,
+ bool in_transit);
#endif