From 5ccc3347038709ba87f5b04d19d800aca459158e Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sat, 9 Jun 2012 16:54:02 +0200 Subject: Lua: Move "class" help to C --- lib/mods/theme/scpt/help.lua | 48 ---------------------------------- lib/scpt/help.lua | 36 ------------------------- src/birth.c | 10 +++++-- src/externs.h | 1 + src/help.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 71 insertions(+), 86 deletions(-) diff --git a/lib/mods/theme/scpt/help.lua b/lib/mods/theme/scpt/help.lua index 4f9c1521..7046e846 100644 --- a/lib/mods/theme/scpt/help.lua +++ b/lib/mods/theme/scpt/help.lua @@ -24,54 +24,6 @@ ingame_help -- list of files for classes, { filename, anchor } local t = { - ["class"] = - { - ["Archer"] = { "c_archer.txt", 0 }, - ["Ascetic"] = { "c_ascet.txt", 0 }, - ["Assassin"] = { "c_assass.txt", 0 }, - ["Axemaster"] = { "c_axemas.txt", 0 }, - ["Bard"] = { "c_bard.txt", 0 }, - ["Clairvoyant"] = {"c_clairv.txt", 0}, - ["Dark-Priest"] = { "c_pr_drk.txt", 0 }, - ["Demonologist"] = { "c_demono.txt", 0 }, - ["Druid"] = { "c_druid.txt", 0 }, - ["Geomancer"] = { "c_geoman.txt", 0 }, - ["Haftedmaster"] = { "c_hafted.txt", 0 }, - ["Loremaster"] = { "c_lorema.txt", 0 }, - ["Mage"] = { "c_mage.txt", 0 }, - ["Mercenary"] = { "c_mercen.txt", 0 }, - ["Mimic"] = { "c_mimic.txt", 0 }, - ["Mindcrafter"] = { "c_mindcr.txt", 0 }, - ["Monk"] = { "c_monk.txt", 0 }, - ["Necromancer"] = { "c_necro.txt", 0 }, - ["Pacifist"] = { "c_pacif.txt", 0 }, - ["Paladin"] = { "c_palad.txt", 0 }, - ["Peace-mage"] = { "c_peacemag.txt", 0 }, - ["Polearmmaster"] = { "c_polear.txt", 0 }, - ["Possessor"] = { "c_posses.txt", 0 }, - ["Priest"] = { "c_priest.txt", 0 }, - ["Priest(Eru)"] = { "c_pr_eru.txt", 0 }, - ["Priest(Mandos)"] = { "c_pr_mand.txt", 0 }, - ["Priest(Manwe)"] = { "c_pr_man.txt", 0 }, - ["Priest(Ulmo)"] = { "c_pr_ulmo.txt", 0 }, - ["Priest(Varda)"] = { "c_pr_varda.txt", 0 }, - ["Ranger"] = { "c_ranger.txt", 0 }, - ["Rogue"] = { "c_rogue.txt", 0 }, - ["Runecrafter"] = { "c_runecr.txt", 0 }, - ["Sniper"] = {"c_sniper.txt", 0 }, - ["Sorceror"] = { "c_sorcer.txt", 0 }, - ["Stonewright"] = { "c_stonewr.txt", 0 }, - ["Summoner"] = { "c_summon.txt", 0 }, - ["Swordmaster"] = { "c_swordm.txt", 0 }, - ["Symbiant"] = { "c_symbia.txt", 0 }, - ["Thaumaturgist"] = { "c_thaum.txt", 0 }, - ["Trapper"] = { "c_trapper.txt", 0 }, - ["Unbeliever"] = { "c_unbel.txt", 0 }, - ["Wainrider"] = { "c_wainrid.txt", 0 }, - ["War-mage"] = { "c_warmage.txt", 0 }, - ["Warper"] = { "c_warper.txt", 0 }, - ["Warrior"] = { "c_warrio.txt", 0 }, - }, ["god"] = { ["Aule the Smith"] = { "g_aule.txt", 0 }, diff --git a/lib/scpt/help.lua b/lib/scpt/help.lua index daff0ed6..9e94606f 100644 --- a/lib/scpt/help.lua +++ b/lib/scpt/help.lua @@ -24,42 +24,6 @@ ingame_help -- list of files for classes, { filename, anchor } local t = { - ["class"] = - { - ["Alchemist"] = { "c_alchem.txt", 0 }, - ["Archer"] = { "c_archer.txt", 0 }, - ["Assassin"] = { "c_assass.txt", 0 }, - ["Axemaster"] = { "c_axemas.txt", 0 }, - ["Bard"] = { "c_bard.txt", 0 }, - ["Dark-Priest"] = { "c_pr_drk.txt", 0 }, - ["Demonologist"] = { "c_demono.txt", 0 }, - ["Druid"] = { "c_druid.txt", 0 }, - ["Geomancer"] = { "c_geoman.txt", 0 }, - ["Haftedmaster"] = { "c_hafted.txt", 0 }, - ["Loremaster"] = { "c_lorema.txt", 0 }, - ["Mage"] = { "c_mage.txt", 0 }, - ["Mimic"] = { "c_mimic.txt", 0 }, - ["Mindcrafter"] = { "c_mindcr.txt", 0 }, - ["Monk"] = { "c_monk.txt", 0 }, - ["Necromancer"] = { "c_necro.txt", 0 }, - ["Paladin"] = { "c_palad.txt", 0 }, - ["Polearmmaster"] = { "c_polear.txt", 0 }, - ["Possessor"] = { "c_posses.txt", 0 }, - ["Priest"] = { "c_priest.txt", 0 }, - ["Priest(Eru)"] = { "c_pr_eru.txt", 0 }, - ["Priest(Manwe)"] = { "c_pr_man.txt", 0 }, - ["Ranger"] = { "c_ranger.txt", 0 }, - ["Rogue"] = { "c_rogue.txt", 0 }, - ["Runecrafter"] = { "c_runecr.txt", 0 }, - ["Sorceror"] = { "c_sorcer.txt", 0 }, - ["Summoner"] = { "c_summon.txt", 0 }, - ["Swordmaster"] = { "c_swordm.txt", 0 }, - ["Symbiant"] = { "c_symbia.txt", 0 }, - ["Thaumaturgist"] = { "c_thaum.txt", 0 }, - ["Unbeliever"] = { "c_unbel.txt", 0 }, - ["Warper"] = { "c_warper.txt", 0 }, - ["Warrior"] = { "c_warrio.txt", 0 }, - }, ["god"] = { ["Eru Iluvatar"] = { "g_eru.txt", 0 }, diff --git a/src/birth.c b/src/birth.c index 595a8dfa..58debca0 100644 --- a/src/birth.c +++ b/src/birth.c @@ -2196,7 +2196,10 @@ static bool_ player_birth_aux_ask() } k = (islower(c) ? A2I(c) : (D2I(c) + 26)); if ((k >= 0) && (k < n)) break; - if (c == '?') exec_lua(format("ingame_help('select_context', 'class', '%s')", class_info[class_types[sel]].title + c_name)); + if (c == '?') + { + help_class(class_info[class_types[sel]].title + c_name); + } else if (c == '=') { screen_save(); @@ -2275,7 +2278,10 @@ static bool_ player_birth_aux_ask() } k = (islower(c) ? A2I(c) : (D2I(c) + 26)); if ((k >= 0) && (k < n)) break; - if (c == '?') exec_lua(format("ingame_help('select_context', 'class', '%s')", class_info[p_ptr->pclass].spec[sel].title + c_name)); + if (c == '?') + { + help_class(class_info[p_ptr->pclass].spec[sel].title + c_name); + } else if (c == '=') { screen_save(); diff --git a/src/externs.h b/src/externs.h index 6be9776b..3ea6d2d6 100644 --- a/src/externs.h +++ b/src/externs.h @@ -620,6 +620,7 @@ extern void initialize_bookable_spells(); extern void init_hooks_help(); extern void help_race(cptr race); extern void help_subrace(cptr subrace); +extern void help_class(cptr klass); /* birth.c */ extern void print_desc_aux(cptr txt, int y, int x); diff --git a/src/help.c b/src/help.c index b924017d..4d894044 100644 --- a/src/help.c +++ b/src/help.c @@ -141,6 +141,63 @@ context_help_type subrace_table[] = { NULL, NULL, 0 }, }; +/** + * Class help files + */ +context_help_type class_table[] = +{ + /* ToME */ + { "Alchemist", "c_alchem.txt", 0 }, + { "Archer", "c_archer.txt", 0 }, + { "Assassin", "c_assass.txt", 0 }, + { "Axemaster", "c_axemas.txt", 0 }, + { "Bard", "c_bard.txt", 0 }, + { "Dark-Priest", "c_pr_drk.txt", 0 }, + { "Demonologist", "c_demono.txt", 0 }, + { "Druid", "c_druid.txt", 0 }, + { "Geomancer", "c_geoman.txt", 0 }, + { "Haftedmaster", "c_hafted.txt", 0 }, + { "Loremaster", "c_lorema.txt", 0 }, + { "Mage", "c_mage.txt", 0 }, + { "Mimic", "c_mimic.txt", 0 }, + { "Mindcrafter", "c_mindcr.txt", 0 }, + { "Monk", "c_monk.txt", 0 }, + { "Necromancer", "c_necro.txt", 0 }, + { "Paladin", "c_palad.txt", 0 }, + { "Polearmmaster", "c_polear.txt", 0 }, + { "Possessor", "c_posses.txt", 0 }, + { "Priest", "c_priest.txt", 0 }, + { "Priest(Eru)", "c_pr_eru.txt", 0 }, + { "Priest(Manwe)", "c_pr_man.txt", 0 }, + { "Ranger", "c_ranger.txt", 0 }, + { "Rogue", "c_rogue.txt", 0 }, + { "Runecrafter", "c_runecr.txt", 0 }, + { "Sorceror", "c_sorcer.txt", 0 }, + { "Summoner", "c_summon.txt", 0 }, + { "Swordmaster", "c_swordm.txt", 0 }, + { "Symbiant", "c_symbia.txt", 0 }, + { "Thaumaturgist", "c_thaum.txt", 0 }, + { "Unbeliever", "c_unbel.txt", 0 }, + { "Warper", "c_warper.txt", 0 }, + { "Warrior", "c_warrio.txt", 0 }, + /* Theme */ + { "Ascetic", "c_ascet.txt", 0 }, + { "Clairvoyant", "c_clairv.txt", 0 }, + { "Mercenary", "c_mercen.txt", 0 }, + { "Pacifist", "c_pacif.txt", 0 }, + { "Peace-mage", "c_peacemag.txt", 0 }, + { "Priest(Mandos)", "c_pr_mand.txt", 0 }, + { "Priest(Ulmo)", "c_pr_ulmo.txt", 0 }, + { "Priest(Varda)", "c_pr_varda.txt", 0 }, + { "Sniper", "c_sniper.txt", 0 }, + { "Stonewright", "c_stonewr.txt", 0 }, + { "Trapper", "c_trapper.txt", 0 }, + { "Wainrider", "c_wainrid.txt", 0 }, + { "War-mage", "c_warmage.txt", 0 }, + /* End of list */ + { NULL, NULL, 0 }, +}; + /** * Trigger functions */ @@ -546,3 +603,8 @@ void help_subrace(cptr subrace) { show_context_help(find_context_help(subrace_table, subrace)); } + +void help_class(cptr klass) +{ + show_context_help(find_context_help(class_table, klass)); +} -- cgit v1.2.3