summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-04 13:14:08 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-04 13:14:08 +0000
commit59b053efd22ccd197d042ed5731b117e4846599b (patch)
treeea7803c17c786ba173a4c938f999ea3815919188 /crawl-ref/source/player.cc
parentf5e55fd944784181102ecdf93c6eca2da4e509b2 (diff)
downloadcrawl-ref-59b053efd22ccd197d042ed5731b117e4846599b.tar.gz
crawl-ref-59b053efd22ccd197d042ed5731b117e4846599b.zip
Apply the first part of the labyrinth tweaks:
* labyrinths are bordered by (undiggable) metal walls * teleporting inside a labyrinth will always send you away from the centre (as the crow flies: you'll end somewhere in the stone or rock area) Also make sure melded equipment cannot corrode. (I'm still undecided about whether curses should affect melded items.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7383 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 54028f48dd..a75fc6aeb9 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -588,6 +588,14 @@ bool player_has_feet()
return (true);
}
+bool player_wearing_slot(int eq)
+{
+ if (you.equip[eq] == -1)
+ return (false);
+
+ return (you_tran_can_wear(you.inv[you.equip[eq]]));
+}
+
bool you_tran_can_wear(const item_def &item)
{
switch (item.base_type)
@@ -1992,7 +2000,7 @@ int player_AC(void)
if (i == EQ_SHIELD)
continue;
- if (you.equip[i] == -1 || !you_tran_can_wear(you.equip[i]))
+ if (!player_wearing_slot(i))
continue;
const item_def& item = you.inv[you.equip[i]];
@@ -4443,11 +4451,11 @@ int scan_randarts(randart_prop_type which_property, bool calc_unid)
for (i = EQ_WEAPON; i < NUM_EQUIP; i++)
{
- const int eq = you.equip[i];
-
- if (eq == -1 || !you_tran_can_wear(eq))
+ if (!player_wearing_slot(i))
continue;
+ const int eq = you.equip[i];
+
// Only weapons give their effects when in our hands.
if (i == EQ_WEAPON && you.inv[ eq ].base_type != OBJ_WEAPONS)
continue;