From 0eaec3460042bac94f3ef0e5538f0aa17da41b1a Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 29 Feb 2008 22:53:57 +0000 Subject: Tidy up Xom effects a bit in that berserk and vitrification will only give a message if they actually happen. Also, add some more flavour messages for vitrification. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3494 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/effects.cc | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'crawl-ref/source/effects.cc') diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index d70a41fc14..08f8fdd1cd 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -1982,24 +1982,37 @@ bool forget_inventory(bool quiet) return (items_forgotten > 0); } -void vitrify_area(int radius) +// returns true if there was a visible change +bool vitrify_area(int radius) { + if (radius < 2) + return (false); + const int radius2 = radius * radius; + // this hinges on clear wall types having the same order as non-clear ones + const int clear_plus = DNGN_CLEAR_ROCK_WALL - DNGN_ROCK_WALL; + bool something_happened = false; for ( int x = X_BOUND_1; x <= X_BOUND_2; ++x ) { for ( int y = Y_BOUND_1; y <= Y_BOUND_2; ++y ) { if ( distance(x,y,you.x_pos,you.y_pos) < radius2 ) { - if ( grd[x][y] == DNGN_ROCK_WALL ) - grd[x][y] = DNGN_CLEAR_ROCK_WALL; - else if ( grd[x][y] == DNGN_STONE_WALL ) - grd[x][y] = DNGN_CLEAR_STONE_WALL; - else if ( grd[x][y] == DNGN_PERMAROCK_WALL ) - grd[x][y] = DNGN_CLEAR_PERMAROCK_WALL; + dungeon_feature_type grid = grd[x][y]; + + if (grid == DNGN_ROCK_WALL + || grid == DNGN_STONE_WALL + || grid == DNGN_PERMAROCK_WALL ) + { + grd[x][y] + = static_cast(grid + clear_plus); + something_happened = true; + } } } } + + return (something_happened); } /////////////////////////////////////////////////////////////////////// -- cgit v1.2.3-54-g00ecf