summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-01 19:42:19 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-01 19:42:19 +0000
commit3156b39e958b466c424a27e888861e029ddb0602 (patch)
treec7fc0722864bad6adf523bbfb0af0ce9d90951ea /crawl-ref/source/beam.cc
parent99beaf9eb5a1ef9ee360732140f89dae8e44d57c (diff)
downloadcrawl-ref-3156b39e958b466c424a27e888861e029ddb0602.tar.gz
crawl-ref-3156b39e958b466c424a27e888861e029ddb0602.zip
Yet Another Code Cleanup, this time concentrating on libx11.cc and
view.cc. (Yes, this is semi-random.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4032 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc35
1 files changed, 22 insertions, 13 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index a9d8abf02c..abb0189e8f 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1381,7 +1381,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
oldValue = set_buffering(false);
#endif
- while(!beamTerminate)
+ while (!beamTerminate)
{
tx = ray.x();
ty = ray.y();
@@ -1415,8 +1415,11 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
rangeRemaining -= affect(pbolt, tx, ty);
do
+ {
ray.regress();
+ }
while (grid_is_solid(grd(ray.pos())));
+
tx = ray.x();
ty = ray.y();
break; // breaks from line tracing
@@ -1425,14 +1428,19 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
did_bounce = true;
// bounce
- do {
+ do
+ {
do
+ {
ray.regress();
+ }
while (grid_is_solid(grd(ray.pos())));
+
ray.advance_and_bounce();
--rangeRemaining;
- } while ( rangeRemaining > 0 &&
- grid_is_solid(grd[ray.x()][ray.y()]) );
+ }
+ while ( rangeRemaining > 0
+ && grid_is_solid(grd[ray.x()][ray.y()]) );
if (rangeRemaining < 1)
break;
@@ -4771,7 +4779,7 @@ void explosion( bolt &beam, bool hole_in_the_middle,
_explosion_cell(beam, 0, 0, drawing);
// do the rest of it
- for(int rad = 1; rad <= r; rad ++)
+ for (int rad = 1; rad <= r; rad ++)
{
// do sides
for (int ay = 1 - rad; ay <= rad - 1; ay += 1)
@@ -4809,9 +4817,11 @@ void explosion( bolt &beam, bool hole_in_the_middle,
bool seen_anything = false;
for ( int i = -9; i <= 9; ++i )
for ( int j = -9; j <= 9; ++j )
- if ( explode_map[i+9][j+9] &&
- see_grid(beam.target_x + i, beam.target_y + j) )
+ if ( explode_map[i+9][j+9]
+ && see_grid(beam.target_x + i, beam.target_y + j) )
+ {
seen_anything = true;
+ }
// ---------------- end boom --------------------------
@@ -4904,18 +4914,17 @@ static void _explosion_map( bolt &beam, int x, int y,
// special case: explosion originates from rock/statue
// (e.g. Lee's rapid deconstruction) - in this case, ignore
// solid cells at the center of the explosion.
- if (dngn_feat <= DNGN_MAXWALL)
+ if (dngn_feat <= DNGN_MAXWALL
+ && (x != 0 || y != 0) && !_affects_wall(beam, dngn_feat))
{
- if (!(x==0 && y==0) && !_affects_wall(beam, dngn_feat))
- return;
+ return;
}
// hmm, I think we're ok
explode_map[x+9][y+9] = true;
- // now recurse in every direction except the one we
- // came from
- for(int i=0; i<4; i++)
+ // now recurse in every direction except the one we came from
+ for (int i = 0; i < 4; i++)
{
if (i+1 != dir)
{