diff options
author | blackcustard <peterwicksstringfield@gmail.com> | 2013-06-01 17:25:59 -0500 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2013-06-09 19:21:27 -0400 |
commit | 5d961268d2138bd511a266b787977c805a2292f8 (patch) | |
tree | 5504f66d5e9018c3dbef0042096467a2cc2f96e7 /crawl-ref/source/shout.cc | |
parent | bec542cbd48f95602bc3aa00a2abc86c6990fa4b (diff) | |
download | crawl-ref-5d961268d2138bd511a266b787977c805a2292f8.tar.gz crawl-ref-5d961268d2138bd511a266b787977c805a2292f8.zip |
Fix a crash related to LRD, noise, and permarock.
Some spells (e.g. dig and Lee's Rapid Deconstruction (LRD)) can be used
on the very edge of the level (permarock/open sea/lava sea). This is by
design. LRD can use permarock to make explosions, but cannot destroy it.
The bolt class wanted these spells to cause noise, and it was attempting
to center the noise on the border tile, which is technically
out-of-bounds. Because the noise code did not check for out of bounds
positions, the bolt class was successful.
When the resulting noise disturbed a monster, the out-of-bounds sound's
out-of-bounds location would be passed to behaviour_event through its
src_pos argument, triggering this assertion:
"ASSERT(in_bounds(src_pos) || src_pos.origin());".
Changes:
1. Added an assertion in noisy in sound.cc to ensure that all sounds
are in-bounds.
2. Made these spells only generate noises in-bounds. If a noise needs
to be generated out-of-bounds, it will instead be generated nearby, but
in-bounds.
Maybe this messes things up by changing who can hear the sound in certain
situations?
Diffstat (limited to 'crawl-ref/source/shout.cc')
-rw-r--r-- | crawl-ref/source/shout.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crawl-ref/source/shout.cc b/crawl-ref/source/shout.cc index f15c1ebaa1..dbac64d836 100644 --- a/crawl-ref/source/shout.cc +++ b/crawl-ref/source/shout.cc @@ -466,6 +466,8 @@ bool noisy(int original_loudness, const coord_def& where, const char *msg, int who, bool mermaid, bool message_if_unseen, bool fake_noise) { + ASSERT(in_bounds(where)); + if (original_loudness <= 0) return false; |