From 4d77bc8053e1fda66f1e3f805f0a2cb74fba6201 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sat, 9 Jun 2012 17:59:12 +0200 Subject: Lua: Remove Lua help code --- lib/core/help.lua | 141 ------------------------------------------- lib/core/init.lua | 3 - lib/mods/theme/core/help.lua | 141 ------------------------------------------- lib/mods/theme/core/init.lua | 3 - lib/mods/theme/scpt/help.lua | 7 --- lib/mods/theme/scpt/init.lua | 3 - lib/scpt/help.lua | 7 --- lib/scpt/init.lua | 3 - 8 files changed, 308 deletions(-) delete mode 100644 lib/core/help.lua delete mode 100644 lib/mods/theme/core/help.lua delete mode 100644 lib/mods/theme/scpt/help.lua delete mode 100644 lib/scpt/help.lua (limited to 'lib') diff --git a/lib/core/help.lua b/lib/core/help.lua deleted file mode 100644 index a581fe63..00000000 --- a/lib/core/help.lua +++ /dev/null @@ -1,141 +0,0 @@ --- Ingame contextual help - --- We use our own hook list as to not overburn the hook proccessor --- with many hooks that would slow down things --- It would be very meaningless if the option is not even on -__ingame_hooks = {} - -__ingame_help_max = 0 - -function ingame_help(t, ...) - -- This function can also be used to call the callbacks - if type(t) == "string" then - local f = getglobal("__ingame_help_fct_"..t) - call(f, arg) - return - end - - assert(t.desc or t.fct, "no ingame help desc/fct") - assert(t.hook or t.callback, "no ingame help hook/callback") - if t.hook then assert(t.event, "no ingame hepl event needed by hook") end - - -- Set it to only trigger once - setglobal("__ingame_help_activated_"..__ingame_help_max, FALSE) - -- Save/load it - add_loadsave("__ingame_help_activated_"..__ingame_help_max, FALSE) - - if t.hook then - -- If the hok list didnt exist yet, add it - if not __ingame_hooks[t.hook] then - -- Set it to empty, we'll fill it later - __ingame_hooks[t.hook] = {} - -- Add the global hook - add_hooks - { - [t.hook] = function (...) - if option_ingame_help ~= TRUE then return end - local k, e - for k, e in __ingame_hooks[%t.hook] do - if k ~= "n" then - call(e, arg) - end - end - end - } - end - if t.desc then - tinsert(__ingame_hooks[t.hook], - function (...) - local tbl = %t - if getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE then - if call(tbl.event, arg) == TRUE then - local k, e - for k, e in tbl.desc do - msg_print(TERM_YELLOW, e) - end - setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE) - end - end - end - ) - elseif t.fct then - tinsert(__ingame_hooks[t.hook], - function (...) - local tbl = %t - if getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE then - if call(tbl.event, arg) == TRUE then - if tbl.fct() == TRUE then - setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE) - end - end - end - end - ) - end - else - local no_test = FALSE - if t.no_test == TRUE then no_test = TRUE end - if t.desc then - setglobal - ( - "__ingame_help_fct_"..(t.callback), - function (...) - local tbl = %t - if ((option_ingame_help == TRUE) or (%no_test == TRUE)) and (getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE) then - local k, e - for k, e in tbl.desc do - msg_print(TERM_YELLOW, e) - end - setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE) - end - end - ) - elseif t.fct then - setglobal - ( - "__ingame_help_fct_"..(t.callback), - function (...) - local tbl = %t - if ((option_ingame_help == TRUE) or (%no_test == TRUE)) and (getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE) then - if call(tbl.fct, arg) == TRUE then - setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE) - end - end - end - ) - end - end - - __ingame_help_max = __ingame_help_max + 1 -end - --- Clean up the ingame help seen at birth -add_hooks -{ - [HOOK_BIRTH_OBJECTS] = function() - local i - for i = 0, __ingame_help_max - 1 do - setglobal("__ingame_help_activated_"..i, FALSE) - end - end -} - -function ingame_clean() - local i - for i = 0, __ingame_help_max - 1 do - setglobal("__ingame_help_activated_"..i, FALSE) - end -end - --- helper function, brings up a doc -function ingame_help_doc(name, anchor) - -- Save screen - screen_save(); - - -- Peruse the help file - if not anchor then anchor = 0 end - show_file(name, 0, -anchor, 0) - - -- Load screen - screen_load() -end diff --git a/lib/core/init.lua b/lib/core/init.lua index c87f9a20..5abc1571 100644 --- a/lib/core/init.lua +++ b/lib/core/init.lua @@ -17,9 +17,6 @@ tome_dofile_anywhere(ANGBAND_DIR_CORE, "monsters.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "building.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "dungeon.lua") --- Load the ingame contextual help -tome_dofile_anywhere(ANGBAND_DIR_CORE, "help.lua") - -------------------------------------------------------------- -------------------------------------------------------------- -------------------------------------------------------------- diff --git a/lib/mods/theme/core/help.lua b/lib/mods/theme/core/help.lua deleted file mode 100644 index a581fe63..00000000 --- a/lib/mods/theme/core/help.lua +++ /dev/null @@ -1,141 +0,0 @@ --- Ingame contextual help - --- We use our own hook list as to not overburn the hook proccessor --- with many hooks that would slow down things --- It would be very meaningless if the option is not even on -__ingame_hooks = {} - -__ingame_help_max = 0 - -function ingame_help(t, ...) - -- This function can also be used to call the callbacks - if type(t) == "string" then - local f = getglobal("__ingame_help_fct_"..t) - call(f, arg) - return - end - - assert(t.desc or t.fct, "no ingame help desc/fct") - assert(t.hook or t.callback, "no ingame help hook/callback") - if t.hook then assert(t.event, "no ingame hepl event needed by hook") end - - -- Set it to only trigger once - setglobal("__ingame_help_activated_"..__ingame_help_max, FALSE) - -- Save/load it - add_loadsave("__ingame_help_activated_"..__ingame_help_max, FALSE) - - if t.hook then - -- If the hok list didnt exist yet, add it - if not __ingame_hooks[t.hook] then - -- Set it to empty, we'll fill it later - __ingame_hooks[t.hook] = {} - -- Add the global hook - add_hooks - { - [t.hook] = function (...) - if option_ingame_help ~= TRUE then return end - local k, e - for k, e in __ingame_hooks[%t.hook] do - if k ~= "n" then - call(e, arg) - end - end - end - } - end - if t.desc then - tinsert(__ingame_hooks[t.hook], - function (...) - local tbl = %t - if getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE then - if call(tbl.event, arg) == TRUE then - local k, e - for k, e in tbl.desc do - msg_print(TERM_YELLOW, e) - end - setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE) - end - end - end - ) - elseif t.fct then - tinsert(__ingame_hooks[t.hook], - function (...) - local tbl = %t - if getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE then - if call(tbl.event, arg) == TRUE then - if tbl.fct() == TRUE then - setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE) - end - end - end - end - ) - end - else - local no_test = FALSE - if t.no_test == TRUE then no_test = TRUE end - if t.desc then - setglobal - ( - "__ingame_help_fct_"..(t.callback), - function (...) - local tbl = %t - if ((option_ingame_help == TRUE) or (%no_test == TRUE)) and (getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE) then - local k, e - for k, e in tbl.desc do - msg_print(TERM_YELLOW, e) - end - setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE) - end - end - ) - elseif t.fct then - setglobal - ( - "__ingame_help_fct_"..(t.callback), - function (...) - local tbl = %t - if ((option_ingame_help == TRUE) or (%no_test == TRUE)) and (getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE) then - if call(tbl.fct, arg) == TRUE then - setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE) - end - end - end - ) - end - end - - __ingame_help_max = __ingame_help_max + 1 -end - --- Clean up the ingame help seen at birth -add_hooks -{ - [HOOK_BIRTH_OBJECTS] = function() - local i - for i = 0, __ingame_help_max - 1 do - setglobal("__ingame_help_activated_"..i, FALSE) - end - end -} - -function ingame_clean() - local i - for i = 0, __ingame_help_max - 1 do - setglobal("__ingame_help_activated_"..i, FALSE) - end -end - --- helper function, brings up a doc -function ingame_help_doc(name, anchor) - -- Save screen - screen_save(); - - -- Peruse the help file - if not anchor then anchor = 0 end - show_file(name, 0, -anchor, 0) - - -- Load screen - screen_load() -end diff --git a/lib/mods/theme/core/init.lua b/lib/mods/theme/core/init.lua index c87f9a20..5abc1571 100644 --- a/lib/mods/theme/core/init.lua +++ b/lib/mods/theme/core/init.lua @@ -17,9 +17,6 @@ tome_dofile_anywhere(ANGBAND_DIR_CORE, "monsters.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "building.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "dungeon.lua") --- Load the ingame contextual help -tome_dofile_anywhere(ANGBAND_DIR_CORE, "help.lua") - -------------------------------------------------------------- -------------------------------------------------------------- -------------------------------------------------------------- diff --git a/lib/mods/theme/scpt/help.lua b/lib/mods/theme/scpt/help.lua deleted file mode 100644 index e17d1723..00000000 --- a/lib/mods/theme/scpt/help.lua +++ /dev/null @@ -1,7 +0,0 @@ --- Ingame contextual help - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------Here comes the definition of help----------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- diff --git a/lib/mods/theme/scpt/init.lua b/lib/mods/theme/scpt/init.lua index 64b1c6a5..85099e19 100644 --- a/lib/mods/theme/scpt/init.lua +++ b/lib/mods/theme/scpt/init.lua @@ -5,9 +5,6 @@ -- Load the class specific stuff tome_dofile("player.lua") --- Load the ingame contextual help -tome_dofile("help.lua") - -- Add the mkey activations tome_dofile("mkeys.lua") diff --git a/lib/scpt/help.lua b/lib/scpt/help.lua deleted file mode 100644 index e17d1723..00000000 --- a/lib/scpt/help.lua +++ /dev/null @@ -1,7 +0,0 @@ --- Ingame contextual help - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------Here comes the definition of help----------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- diff --git a/lib/scpt/init.lua b/lib/scpt/init.lua index 079d064d..3be0887c 100644 --- a/lib/scpt/init.lua +++ b/lib/scpt/init.lua @@ -5,9 +5,6 @@ -- Load the class specific stuff tome_dofile("player.lua") --- Load the ingame contextual help -tome_dofile("help.lua") - -- Add the mkey activations tome_dofile("mkeys.lua") -- cgit v1.2.3