summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/acr.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-27 12:46:08 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-27 12:46:08 +0000
commita86d2a52392ed50ba63ed9712c05f3574e45d695 (patch)
tree119721aaeb398f83686f783efcbf92ba5f3cd5f9 /crawl-ref/source/acr.cc
parent612b5c431864991b19105694131ba1314012e631 (diff)
downloadcrawl-ref-a86d2a52392ed50ba63ed9712c05f3574e45d695.tar.gz
crawl-ref-a86d2a52392ed50ba63ed9712c05f3574e45d695.zip
Fix 1974137: Stat-lowering transformations resulting in death by stat
loss. Now take to-be-removed equipment in account and don't transform in the removed equipment or the stat loss or both in combination would decrease one of your stats to (below) 0. For the vampire bat transformation, this check only happens after the ability failure check, so this could be improved. In any case, it's better than dying. Also, fix wrongly treating armour as worn when checking for stat loss by wearing. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5294 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/acr.cc')
-rw-r--r--crawl-ref/source/acr.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 119e0adf5c..5b364affc1 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -3467,14 +3467,12 @@ static keycode_type _get_next_keycode()
return (keyin);
}
-/*
- * Check squares adjacent to player for given feature and return how
- * many there are. If there's only one, return the dx and dy.
- */
+// Check squares adjacent to player for given feature and return how
+// many there are. If there's only one, return the dx and dy.
static int _check_adjacent(dungeon_feature_type feat, int &dx, int &dy)
{
int num = 0;
- int _dx, _dy;
+ int _dx = 0, _dy = 0;
for (int x = -1; x <= 1; x++)
for (int y = -1; y <= 1; y++)
@@ -3494,11 +3492,9 @@ static int _check_adjacent(dungeon_feature_type feat, int &dx, int &dy)
return num;
}
-/*
- Opens doors and handles some aspects of untrapping. If either move_x or
- move_y are non-zero, the pair carries a specific direction for the door
- to be opened (eg if you type ctrl - dir).
- */
+// Opens doors and handles some aspects of untrapping. If either move_x or
+// move_y are non-zero, the pair carries a specific direction for the door
+// to be opened (eg if you type ctrl - dir).
static void _open_door(int move_x, int move_y, bool check_confused)
{
struct dist door_move;