summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Kozlov <zaba@thorium.homeunix.org>2009-11-05 22:03:07 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-11-05 22:03:07 +1000
commit504bcf4bd3bc5297ca3c508193d7590bae6c1836 (patch)
treef80a50efbea21577b6db8e5dabfd36aa876b090d
parentfc0e79dabbc83e24ac32461ab67cdd1cef765e91 (diff)
downloadcrawl-ref-504bcf4bd3bc5297ca3c508193d7590bae6c1836.tar.gz
crawl-ref-504bcf4bd3bc5297ca3c508193d7590bae6c1836.zip
Combine player_knows_spell, player_has_spell into player::has_spell.
Signed-off-by: Jude Brown <bookofjude@users.sourceforge.net>
-rw-r--r--crawl-ref/source/acr.cc2
-rw-r--r--crawl-ref/source/ghost.cc14
-rw-r--r--crawl-ref/source/item_use.cc8
-rw-r--r--crawl-ref/source/itemname.cc2
-rw-r--r--crawl-ref/source/player.cc14
-rw-r--r--crawl-ref/source/player.h4
-rw-r--r--crawl-ref/source/spl-book.cc4
-rw-r--r--crawl-ref/source/spl-util.cc4
-rw-r--r--crawl-ref/source/tilereg.cc10
9 files changed, 22 insertions, 40 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index d9f2050c73..7b7a6a5c89 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -2408,7 +2408,7 @@ static void _decrement_durations()
const int chance =
10 + player_mutation_level(MUT_BERSERK) * 25
+ (wearing_amulet(AMU_RAGE) ? 10 : 0)
- + (player_has_spell(SPELL_BERSERKER_RAGE) ? 5 : 0);
+ + (you.has_spell(SPELL_BERSERKER_RAGE) ? 5 : 0);
// Note the beauty of Trog! They get an extra save that's at
// the very least 20% and goes up to 100%.
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index e52eb599ad..a3dad82575 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -683,7 +683,7 @@ static spell_type search_first_list(int ignore_spell)
if (search_order_conj[i] == ignore_spell)
continue;
- if (player_has_spell(search_order_conj[i]))
+ if (you.has_spell(search_order_conj[i]))
return (search_order_conj[i]);
}
@@ -701,7 +701,7 @@ static spell_type search_second_list(int ignore_spell)
if (search_order_third[i] == ignore_spell)
continue;
- if (player_has_spell(search_order_third[i]))
+ if (you.has_spell(search_order_third[i]))
return (search_order_third[i]);
}
@@ -719,7 +719,7 @@ static spell_type search_third_list(int ignore_spell)
if (search_order_misc[i] == ignore_spell)
continue;
- if (player_has_spell(search_order_misc[i]))
+ if (you.has_spell(search_order_misc[i]))
return (search_order_misc[i]);
}
@@ -746,17 +746,17 @@ void ghost_demon::add_spells()
if (spells[4] == SPELL_NO_SPELL)
spells[4] = search_first_list(spells[3]);
- if (player_has_spell(SPELL_DIG))
+ if (you.has_spell(SPELL_DIG))
spells[4] = SPELL_DIG;
// Look for Blink or Teleport Self for the emergency slot.
- if (player_has_spell(SPELL_CONTROLLED_BLINK)
- || player_has_spell(SPELL_BLINK))
+ if (you.has_spell(SPELL_CONTROLLED_BLINK)
+ || you.has_spell(SPELL_BLINK))
{
spells[5] = SPELL_CONTROLLED_BLINK;
}
- if (player_has_spell(SPELL_TELEPORT_SELF))
+ if (you.has_spell(SPELL_TELEPORT_SELF))
spells[5] = SPELL_TELEPORT_SELF;
for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i)
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 50119d4f55..2bab2ccfce 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -196,10 +196,10 @@ static bool _valid_weapon_swap(const item_def &item)
if (item.base_type == OBJ_MISSILES)
{
if (item.sub_type == MI_STONE)
- return (player_knows_spell(SPELL_SANDBLAST));
+ return (you.has_spell(SPELL_SANDBLAST));
if (item.sub_type == MI_ARROW)
- return (player_knows_spell(SPELL_STICKS_TO_SNAKES));
+ return (you.has_spell(SPELL_STICKS_TO_SNAKES));
return (false);
}
@@ -208,11 +208,11 @@ static bool _valid_weapon_swap(const item_def &item)
if (item.base_type == OBJ_CORPSES)
{
return (item.sub_type == CORPSE_SKELETON
- && player_knows_spell(SPELL_BONE_SHARDS));
+ && you.has_spell(SPELL_BONE_SHARDS));
}
// Sublimation of Blood.
- if (!player_knows_spell(SPELL_SUBLIMATION_OF_BLOOD))
+ if (!you.has_spell(SPELL_SUBLIMATION_OF_BLOOD))
return (false);
if (item.base_type == OBJ_FOOD)
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 008baf629b..1d8f48920a 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -2600,7 +2600,7 @@ bool is_useless_item(const item_def &item, bool temp)
case OBJ_POTIONS:
{
// No potion is useless if it can be used for Evaporate.
- if (player_knows_spell(SPELL_EVAPORATE))
+ if (you.has_spell(SPELL_EVAPORATE))
return (false);
// Apart from Evaporate, mummies can't use potions.
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 8dc89b70b7..14354ae205 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1286,15 +1286,6 @@ int player_spell_levels(void)
return (sl);
}
-bool player_knows_spell(int spell)
-{
- for (int i = 0; i < 25; i++)
- if (you.spells[i] == spell)
- return (true);
-
- return (false);
-}
-
bool player_can_smell()
{
return (you.species != SP_MUMMY);
@@ -4243,11 +4234,6 @@ bool player_is_airborne(void)
return you.airborne();
}
-bool player_has_spell( spell_type spell )
-{
- return you.has_spell(spell);
-}
-
static int _species_exp_mod(species_type species)
{
if (player_genus(GENPC_DRACONIAN, species))
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index fe8940f033..1228ed8002 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -630,8 +630,6 @@ int player_speed(void);
int player_spell_levels(void);
-bool player_knows_spell(int spell);
-
int player_sust_abil(bool calc_unid = true);
void jiyva_stat_action();
@@ -737,8 +735,6 @@ void dec_disease_player();
bool rot_player(int amount);
-bool player_has_spell(spell_type spell);
-
item_def *player_slot_item(equipment_type eq);
bool player_weapon_wielded();
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 0b095e471d..baa38eb5e5 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1393,7 +1393,7 @@ static bool _get_mem_list(spell_list &mem_spells,
{
const spell_type spell = i->first;
- if (spell == current_spell || player_knows_spell(spell))
+ if (spell == current_spell || you.has_spell(spell))
num_known++;
else if (you_cannot_memorise(spell))
num_race++;
@@ -1720,7 +1720,7 @@ static bool _learn_spell_checks(spell_type specspell)
return (false);
}
- if (player_knows_spell(specspell))
+ if (you.has_spell(specspell))
{
mpr("You already know that spell!");
return (false);
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index df0e76626e..ef780a4f88 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -409,12 +409,12 @@ int spell_levels_required( spell_type which_spell )
int levels = spell_difficulty( which_spell );
if (which_spell == SPELL_DELAYED_FIREBALL
- && player_has_spell( SPELL_FIREBALL ))
+ && you.has_spell(SPELL_FIREBALL))
{
levels -= spell_difficulty( SPELL_FIREBALL );
}
else if (which_spell == SPELL_FIREBALL
- && player_has_spell( SPELL_DELAYED_FIREBALL ))
+ && you.has_spell(SPELL_DELAYED_FIREBALL))
{
levels = 0;
}
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 903187da19..cff4edb5ae 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -2247,9 +2247,9 @@ bool InventoryRegion::update_tip_text(std::string& tip)
if (wielded)
tip += "\n[Ctrl-L-Click] Unwield (w-)";
else if (item.sub_type == MI_STONE
- && player_knows_spell(SPELL_SANDBLAST)
+ && you.has_spell(SPELL_SANDBLAST)
|| item.sub_type == MI_ARROW
- && player_knows_spell(SPELL_STICKS_TO_SNAKES))
+ && you.has_spell(SPELL_STICKS_TO_SNAKES))
{
// For Sandblast and Sticks to Snakes,
// respectively.
@@ -2284,7 +2284,7 @@ bool InventoryRegion::update_tip_text(std::string& tip)
tip += "\n[Ctrl-L-Click] Unwield (w-)";
else if (item_type_known(item)
&& is_blood_potion(item)
- && player_knows_spell(SPELL_SUBLIMATION_OF_BLOOD))
+ && you.has_spell(SPELL_SUBLIMATION_OF_BLOOD))
{
tip += "\n[Ctrl-L-Click] Wield (w)";
}
@@ -2295,7 +2295,7 @@ bool InventoryRegion::update_tip_text(std::string& tip)
if (wielded)
tip += "\n[Ctrl-L-Click] Unwield (w-)";
else if (item.sub_type == FOOD_CHUNK
- && player_knows_spell(
+ && you.has_spell(
SPELL_SUBLIMATION_OF_BLOOD))
{
tip += "\n[Ctrl-L-Click] Wield (w)";
@@ -2324,7 +2324,7 @@ bool InventoryRegion::update_tip_text(std::string& tip)
{
if (wielded)
tip += "\n[Ctrl-L-Click] Unwield";
- else if (player_knows_spell(SPELL_BONE_SHARDS))
+ else if (you.has_spell(SPELL_BONE_SHARDS))
tip += "\n[Ctrl-L-Click] Wield (w)";
}