diff options
author | Matthew Cline <zelgadis@sourceforge.net> | 2009-11-08 23:23:32 -0800 |
---|---|---|
committer | Matthew Cline <zelgadis@sourceforge.net> | 2009-11-08 23:25:20 -0800 |
commit | 6521776b1fc7b68f7cb025397797cd8cad5a32e0 (patch) | |
tree | d648ee1c1a06be0b2e0022616a2aa0f8f86833ac /crawl-ref/source/beam.cc | |
parent | b3f20c3f817c2b820ae95f3d6c2dbc4379872060 (diff) | |
download | crawl-ref-6521776b1fc7b68f7cb025397797cd8cad5a32e0.tar.gz crawl-ref-6521776b1fc7b68f7cb025397797cd8cad5a32e0.zip |
Bug 2852602: wall stopped beam gets two chances
If a wall stopped an item beam, and there was an actor right in front of
the wall, then the beam would try to hit the actor with the item, even
if the beam had already missed.
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r-- | crawl-ref/source/beam.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index cd8d484634..2650e495b6 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -1882,7 +1882,8 @@ coord_def bolt::pos() const return ray.pos(); } -void bolt::hit_wall() +// Returns true if the beam ended due to hitting the wall. +bool bolt::hit_wall() { const dungeon_feature_type feat = grd(pos()); ASSERT( feat_is_solid(feat) ); @@ -1917,7 +1918,7 @@ void bolt::hit_wall() { beam_cancelled = true; finish_beam(); - return; + return (false); } // Well, we warned them. @@ -1954,7 +1955,11 @@ void bolt::hit_wall() target = ray.pos(); } finish_beam(); + + return (true); } + + return (false); } void bolt::affect_cell(bool avoid_self) @@ -1988,7 +1993,10 @@ void bolt::affect_cell(bool avoid_self) // Note that this can change the ray position and the solidity // of the wall. - hit_wall(); + if (hit_wall()) + // Beam ended due to hitting wall, so don't hit the player + // or monster with the regressed beam. + return; } const bool still_wall = (was_solid && old_pos == pos()); |