From c1f2b8f2d299d22be4ad3f2f176b6e106eeff6dc Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Fri, 18 May 2012 13:52:06 +0200 Subject: Lua: Move school_book[] to C --- lib/core/s_aux.lua | 65 ------------------------------------------------------ 1 file changed, 65 deletions(-) (limited to 'lib/core') diff --git a/lib/core/s_aux.lua b/lib/core/s_aux.lua index 6cdcbd82..20cf4964 100644 --- a/lib/core/s_aux.lua +++ b/lib/core/s_aux.lua @@ -81,7 +81,6 @@ __spell_spell = {} __spell_info = {} __spell_desc = {} __spell_school = {} -school_book = {} -- Find a spell by name function find_spell(name) @@ -262,44 +261,6 @@ function spell_school_name(s) return sch_str end --- Print the book and the spells -function print_book(book, spl, obj) - local x, y, index, sch, size, s - - x = 0 - y = 2 - size = 0 - - -- Hack if the book is 255 it is a random book - if book == 255 then - school_book[book] = {spl} - end - - -- Parse all spells - for index, s in school_book[book] do - local color = TERM_L_DARK - local lvl, na = get_level_school(s, 50, -50) - local xx, sch_str - - if is_ok_spell(s, obj) then - if get_mana(s) > get_power(s) then color = TERM_ORANGE - else color = TERM_L_GREEN end - end - - sch_str = spell_school_name(s) - - if na then - c_prt(color, format("%c) %-20s%-16s %3s %4s %3d%s %s", size + strbyte("a"), spell(s).name, sch_str, na, get_mana(s), spell_chance(s), "%", __spell_info[s]()), y, x) - else - c_prt(color, format("%c) %-20s%-16s %3d %4s %3d%s %s", size + strbyte("a"), spell(s).name, sch_str, lvl, get_mana(s), spell_chance(s), "%", __spell_info[s]()), y, x) - end - y = y + 1 - size = size + 1 - end - prt(format(" %-20s%-16s Level Cost Fail Info", "Name", "School"), 1, x) - return y -end - -- Output the desc when sued as a device function print_device_desc(s) local index, desc @@ -309,32 +270,6 @@ function print_device_desc(s) end end -function book_spells_num(book) - local size, index, sch - - size = 0 - - -- Hack if the book is 255 it is a random book - if book == 255 then - return 1 - end - - -- Parse all spells - for index, s in school_book[book] do - size = size + 1 - end - return size -end - -function spell_in_book(book, spell) - local i, s - - for i, s in school_book[book] do - if s == spell then return TRUE end - end - return FALSE -end - function check_affect(s, name, default) local s_ptr = __tmp_spells[s] local a -- cgit v1.2.3