diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-12-11 08:09:30 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-12-11 08:09:30 +0100 |
commit | 9f6f4a36d87c1334437debd9f48f3de27a747dce (patch) | |
tree | 5c87f54baaceff98cdff2465b0c0b30591512025 /src/cmd5.cc | |
parent | 18e52d9a037ebb751312d6a2632383135321763f (diff) |
Move print_book() to cmd5.cc and make it static
Diffstat (limited to 'src/cmd5.cc')
-rw-r--r-- | src/cmd5.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/cmd5.cc b/src/cmd5.cc index e12d62c5..2603b9a8 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; |