summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-25 19:36:08 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-25 19:36:08 +0000
commitf080c133494f6430dd9078c438c90f9939e01b85 (patch)
treebf17e8c9e9de7034400abb76c00c1adf2fffd838 /crawl-ref/source/effects.cc
parentc1e8bba8affbfe9bfd20eebb1fdc6c9c858b9c0a (diff)
downloadcrawl-ref-f080c133494f6430dd9078c438c90f9939e01b85.tar.gz
crawl-ref-f080c133494f6430dd9078c438c90f9939e01b85.zip
Fixed tile compile. (I was being a bit overzealous in my cleanup.)
Fix 1922815: blood potion assert. Implement 1828037: prompt before entering harmful clouds And tidy up fountain handling, dried non-magic fountains may now also start flowing again. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3878 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc72
1 files changed, 41 insertions, 31 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 257e58e237..a0962fd34f 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2844,6 +2844,35 @@ void update_level( double elapsedTime )
delete_cloud( i );
}
+static void _maybe_restart_fountain_flow(const int x, const int y, int tries)
+{
+ while (0 < tries--)
+ {
+ if (!one_chance_in(100))
+ continue;
+
+ if (grd[x][y] > DNGN_SPARKLING_FOUNTAIN)
+ grd[x][y] = static_cast<dungeon_feature_type>(grd[x][y] - 1);
+ else // grid == DNGN_DRY_FOUNTAIN_I
+ grd[x][y] = DNGN_BLUE_FOUNTAIN;
+
+ // clean bloody floor
+ if (is_bloodcovered(x,y))
+ env.map[x][y].property = FPROP_NONE;
+
+ // chance of cleaning adjacent squares
+ for (int i = -1; i <= 1; i++)
+ for (int j =-1; j <= 1; j++)
+ {
+ if (is_bloodcovered(x+i,y+j)
+ && one_chance_in(5))
+ {
+ env.map[x+i][y+j].property = FPROP_NONE;
+ }
+ }
+ }
+}
+
//---------------------------------------------------------------
//
// update_corpses
@@ -2892,7 +2921,12 @@ void update_corpses(double elapsedTime)
}
else
{
- ASSERT(rot_time < 256);
+ // potions of blood have a longer rot time
+ if (it.base_type == OBJ_POTIONS)
+ ASSERT(rot_time < 1500);
+ else
+ ASSERT(rot_time < 256);
+
it.special -= rot_time;
}
}
@@ -2904,39 +2938,15 @@ void update_corpses(double elapsedTime)
// dry fountains may start flowing again
if (fountain_checks > 0)
{
- for (cx=0; cx<GXM; cx++)
- {
- for (cy=0; cy<GYM; cy++)
+ for (cx = 0; cx < GXM; cx++)
+ for (cy = 0; cy < GYM; cy++)
{
- if (grd[cx][cy] > DNGN_SPARKLING_FOUNTAIN
- && grd[cx][cy] < DNGN_PERMADRY_FOUNTAIN)
+ if (grd[cx][cy] == DNGN_DRY_FOUNTAIN_I
+ || grd[cx][cy] > DNGN_SPARKLING_FOUNTAIN
+ && grd[cx][cy] < DNGN_PERMADRY_FOUNTAIN)
{
- for (int i=0; i<fountain_checks; i++)
- {
- if (one_chance_in(100))
- {
- if (grd[cx][cy] > DNGN_SPARKLING_FOUNTAIN)
- grd[cx][cy] =
- static_cast<dungeon_feature_type>(
- grd[cx][cy] - 1);
-
- // clean bloody floor
- if (is_bloodcovered(cx,cy))
- env.map[cx][cy].property = FPROP_NONE;
- // chance of cleaning adjacent squares
- for (int k=-1; k<=1; k++)
- {
- for (int l=-1; l<=1; l++)
- if (is_bloodcovered(cx+k,cy+l)
- && one_chance_in(5))
- {
- env.map[cx+k][cy+l].property = FPROP_NONE;
- }
- }
- }
- }
+ _maybe_restart_fountain_flow(cx, cy, fountain_checks);
}
}
- }
}
}