diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-05-18 15:41:45 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-05-24 16:46:35 +0200 |
commit | 0b4fe745accdb743bc998e42282efb08c5b4ccd1 (patch) | |
tree | c7949a1b11a9535655b94eee4ed43105b37de535 /src/spells4.c | |
parent | f7e4d1b4d9da8c42f02f79c0328477dd787fecd2 (diff) |
Lua: Move handling of spell descriptions to C
Diffstat (limited to 'src/spells4.c')
-rw-r--r-- | src/spells4.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/spells4.c b/src/spells4.c index aa62d827..40cca814 100644 --- a/src/spells4.c +++ b/src/spells4.c @@ -63,24 +63,17 @@ s32b get_power(s32b s) /* Output the describtion when it is used as a spell */ void print_spell_desc(int s, int y) { - int i; + string_list *sl; + struct sglib_string_list_iterator it; - for (i=0; ; i++) + for (sl = sglib_string_list_it_init(&it, school_spells[s].description); + sl != NULL; + sl = sglib_string_list_it_next(&it)) { - char buf[128]; - cptr desc = NULL; - - sprintf(buf, "return __spell_desc[%d][%d]", s, i+1); - desc = string_exec_lua(buf); - if (!desc) - { - break; - } - - c_prt(TERM_L_BLUE, desc, y, 0); + c_prt(TERM_L_BLUE, sl->s, y, 0); y++; } - + if (uses_piety_to_cast(s)) { c_prt(TERM_L_WHITE, "It uses piety to cast.", y, 0); @@ -603,3 +596,10 @@ void lua_cast_school_spell(s32b s, bool_ no_cost) p_ptr->redraw |= PR_MANA; p_ptr->window |= PW_PLAYER; } + +void spell_description_add_line(s32b spell_idx, cptr line) +{ + string_list *e = malloc(sizeof(string_list)); + string_list_init(e, line); + sglib_string_list_add(&school_spells[spell_idx].description, e); +} |