summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-12-11 08:09:30 +0100
committerBardur Arantsson <bardur@scientician.net>2015-12-11 08:09:30 +0100
commit9f6f4a36d87c1334437debd9f48f3de27a747dce (patch)
tree5c87f54baaceff98cdff2465b0c0b30591512025
parent18e52d9a037ebb751312d6a2632383135321763f (diff)
Move print_book() to cmd5.cc and make it static
-rw-r--r--src/cmd5.cc36
-rw-r--r--src/spells4.cc33
-rw-r--r--src/spells4.hpp1
3 files changed, 36 insertions, 34 deletions
diff --git a/src/cmd5.cc b/src/cmd5.cc
index e12d62c..2603b9a 100644
--- a/src/cmd5.cc
+++ b/src/cmd5.cc
@@ -22,6 +22,7 @@
#include "player_race.hpp"
#include "player_race_mod.hpp"
#include "player_type.hpp"
+#include "school_book.hpp"
#include "skills.hpp"
#include "spell_type.hpp"
#include "spells1.hpp"
@@ -111,6 +112,41 @@ bool_ is_magestaff()
}
+static int print_book(s16b sval, s32b spell_idx, object_type *obj)
+{
+ int y = 2;
+ int i;
+
+ random_book_setup(sval, spell_idx);
+
+ school_book *school_book = school_books_at(sval);
+
+ /* Parse all spells */
+ i = 0;
+ for (auto spell_idx : school_book->spell_idxs)
+ {
+ byte color = TERM_L_DARK;
+ bool_ is_ok;
+ char label[8];
+
+ is_ok = is_ok_spell(spell_idx, obj->pval);
+ if (is_ok)
+ {
+ color = (get_mana(spell_idx) > get_power(spell_idx)) ? TERM_ORANGE : TERM_L_GREEN;
+ }
+
+ sprintf(label, "%c) ", 'a' + i);
+
+ y = print_spell(label, color, y, spell_idx);
+ i++;
+ }
+
+ prt(format(" %-20s%-16s Level Cost Fail Info", "Name", "School"), 1, 0);
+ return y;
+}
+
+
+
static void browse_school_spell(int book, int spell_idx, object_type *o_ptr)
{
int i;
diff --git a/src/spells4.cc b/src/spells4.cc
index 3c877bf..b4f924c 100644
--- a/src/spells4.cc
+++ b/src/spells4.cc
@@ -447,39 +447,6 @@ int print_spell(cptr label_, byte color, int y, s32b s)
return y + 1;
}
-int print_book(s16b sval, s32b spell_idx, object_type *obj)
-{
- int y = 2;
- int i;
-
- random_book_setup(sval, spell_idx);
-
- school_book *school_book = school_books_at(sval);
-
- /* Parse all spells */
- i = 0;
- for (auto spell_idx : school_book->spell_idxs)
- {
- byte color = TERM_L_DARK;
- bool_ is_ok;
- char label[8];
-
- is_ok = is_ok_spell(spell_idx, obj->pval);
- if (is_ok)
- {
- color = (get_mana(spell_idx) > get_power(spell_idx)) ? TERM_ORANGE : TERM_L_GREEN;
- }
-
- sprintf(label, "%c) ", 'a' + i);
-
- y = print_spell(label, color, y, spell_idx);
- i++;
- }
-
- prt(format(" %-20s%-16s Level Cost Fail Info", "Name", "School"), 1, 0);
- return y;
-}
-
void lua_cast_school_spell(s32b s, bool_ no_cost)
{
bool_ use = FALSE;
diff --git a/src/spells4.hpp b/src/spells4.hpp
index 99203ef..02cdc3c 100644
--- a/src/spells4.hpp
+++ b/src/spells4.hpp
@@ -36,7 +36,6 @@ school_book *school_books_at(int sval);
void school_book_add_spell(school_book *school_book, s32b spell_idx);
void random_book_setup(s16b sval, s32b spell_idx);
int print_spell(cptr label, byte color, int y, s32b s);
-int print_book(s16b sval, s32b spell_idx, object_type *obj);
int school_book_length(int sval);
int spell_x(int sval, int spell_idx, int i);
bool_ school_book_contains_spell(int sval, s32b spell_idx);