diff --git a/src/magic.cpp b/src/magic.cpp index b07b5dd4591e5..36fbe3876022a 100644 --- a/src/magic.cpp +++ b/src/magic.cpp @@ -977,6 +977,11 @@ bool known_magic::knows_spell( const spell_id &sp ) const return spellbook.count( sp ) == 1; } +bool known_magic::knows_spell() const +{ + return !spellbook.empty(); +} + void known_magic::learn_spell( const std::string &sp, player &p, bool force ) { learn_spell( spell_id( sp ), p, force ); diff --git a/src/magic.h b/src/magic.h index c4ac1bd4ed008..01d9add7c9122 100644 --- a/src/magic.h +++ b/src/magic.h @@ -340,6 +340,8 @@ class known_magic bool can_learn_spell( const player &p, const spell_id &sp ) const; bool knows_spell( const std::string &sp ) const; bool knows_spell( const spell_id &sp ) const; + // does the player know a spell? + bool knows_spell() const; // spells known by player std::vector spells() const; // gets the spell associated with the spell_id to be edited diff --git a/src/panels.cpp b/src/panels.cpp index 0b792e4ee8711..6afac346404f2 100644 --- a/src/panels.cpp +++ b/src/panels.cpp @@ -1741,7 +1741,7 @@ static void draw_mana( const player &u, const catacurses::window &w ) static bool spell_panel() { - return !spell_type::get_all().empty(); + return g->u.magic.knows_spell(); } bool default_render()