From f2a54d7ab10bd5bef162023c0659d6922b5bfa04 Mon Sep 17 00:00:00 2001 From: Vsevolod Kozlov Date: Sat, 7 Nov 2009 11:30:34 +0300 Subject: Replace player_shield with player::shield. Signed-off-by: Jude Brown --- crawl-ref/source/acr.cc | 2 +- crawl-ref/source/item_use.cc | 12 ++++++------ crawl-ref/source/itemprop.cc | 2 +- crawl-ref/source/player.cc | 7 +------ crawl-ref/source/player.h | 1 - crawl-ref/source/spl-book.cc | 2 +- 6 files changed, 10 insertions(+), 16 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 44499a0114..bbc0993942 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -725,7 +725,7 @@ static bool _recharge_rod( item_def &rod, bool wielded ) if (!wielded) rate /= 5; // Shields hamper recharging for wielded rods. - else if (player_shield()) + else if (you.shield()) rate /= 2; if (rod.plus / ROD_CHARGE_MULT != (rod.plus + rate) / ROD_CHARGE_MULT) diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 22027b1137..8b9b0ec052 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -394,7 +394,7 @@ static void warn_rod_shield_interference(const item_def &) { mprf(MSGCH_WARN, "Your %s %sreduces the effectiveness of your rod.", - shield_base_name(player_shield()), + shield_base_name(you.shield()), leak_degree); } } @@ -402,7 +402,7 @@ static void warn_rod_shield_interference(const item_def &) static void warn_launcher_shield_slowdown(const item_def &launcher) { const int slowspeed = - launcher_final_speed(launcher, player_shield()) * player_speed() / 100; + launcher_final_speed(launcher, you.shield()) * player_speed() / 100; const int normspeed = launcher_final_speed(launcher, NULL) * player_speed() / 100; @@ -416,7 +416,7 @@ static void warn_launcher_shield_slowdown(const item_def &launcher) { mprf(MSGCH_WARN, "Your %s %sslows your rate of fire.", - shield_base_name(player_shield()), + shield_base_name(you.shield()), slow_degree); } } @@ -425,7 +425,7 @@ static void warn_launcher_shield_slowdown(const item_def &launcher) // Warn if your shield is greatly impacting the effectiveness of your weapon? void warn_shield_penalties() { - if (!player_shield()) + if (!you.shield()) return; // Warnings are limited to rods, bows, and quarterstaves at the moment. @@ -441,7 +441,7 @@ void warn_shield_penalties() && weapon_skill(*weapon) == SK_STAVES) { mprf(MSGCH_WARN, "Your %s severely limits your weapon's effectiveness.", - shield_base_name(player_shield())); + shield_base_name(you.shield())); } } @@ -2484,7 +2484,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, shoot_skill = you.skills[launcher_skill]; effSkill = shoot_skill; - const int speed = launcher_final_speed(launcher, player_shield()); + const int speed = launcher_final_speed(launcher, you.shield()); #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Final launcher speed: %d", speed); #endif diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index c48a641ff1..c220166ba9 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -2854,7 +2854,7 @@ bool is_shield(const item_def &item) bool is_shield_incompatible(const item_def &weapon, const item_def *shield) { // If there's no shield, there's no problem. - if (!shield && !(shield = player_shield())) + if (!shield && !(shield = you.shield())) return (false); hands_reqd_type hand = hands_reqd(weapon, you.body_size()); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 7734fd26d7..cf5193c2b0 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -2506,12 +2506,6 @@ int player_mag_abil(bool is_weighted) return ((is_weighted) ? ((ma * you.intel) / 10) : ma); } -// Returns the shield the player is wearing, or NULL if none. -item_def *player_shield() -{ - return (you.shield()); -} - int player_shield_class(void) //jmf: changes for new spell { int base_shield = 0; @@ -5976,6 +5970,7 @@ bool player::could_wield(const item_def &item, bool ignore_brand, return (true); } +// Returns the shield the player is wearing, or NULL if none. item_def *player::shield() { if (!you_tran_can_wear(EQ_SHIELD)) diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index dd77859abf..6b8068fb0e 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -743,7 +743,6 @@ void dec_disease_player(); bool player_weapon_wielded(); item_def *player_weapon(); -item_def *player_shield(); // Determines if the given grid is dangerous for the player to enter. bool is_feat_dangerous(dungeon_feature_type feat); diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index c04554d56a..fcac1faa6a 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -1888,7 +1888,7 @@ int count_staff_spells(const item_def &item, bool need_id) // Returns a measure of the rod spell power disrupted by a worn shield. int rod_shield_leakage() { - const item_def *shield = player_shield(); + const item_def *shield = you.shield(); int leakage = 100; if (shield) -- cgit v1.2.3-54-g00ecf