From 6ef98743b002c48fb3bf720fb07936e34926b313 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Tue, 8 May 2012 18:59:59 +0200 Subject: Lua: Move "Meta" spell functions to C --- lib/mods/theme/core/util.lua | 7 ------- 1 file changed, 7 deletions(-) (limited to 'lib/mods/theme/core/util.lua') diff --git a/lib/mods/theme/core/util.lua b/lib/mods/theme/core/util.lua index eea13014..048b0d0f 100644 --- a/lib/mods/theme/core/util.lua +++ b/lib/mods/theme/core/util.lua @@ -93,13 +93,6 @@ function new_timer(t) return timer end --- saves all timer values -function save_timer(name) - add_loadsave(name..".enabled", FALSE) - add_loadsave(name..".delay", 1) - add_loadsave(name..".countdown", 1) -end - -- displays a scrolling list function display_list(y, x, h, w, title, list, begin, sel, sel_color) -- cgit v1.2.3 From a5b78e910344f4277c110941145e9412a03039ef Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Wed, 9 May 2012 22:35:12 +0200 Subject: Lua: Move Theme's "aggravate_evil" timer to C --- lib/mods/theme/core/util.lua | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'lib/mods/theme/core/util.lua') diff --git a/lib/mods/theme/core/util.lua b/lib/mods/theme/core/util.lua index 048b0d0f..7729ac35 100644 --- a/lib/mods/theme/core/util.lua +++ b/lib/mods/theme/core/util.lua @@ -71,28 +71,6 @@ function msg_print(c, m) end end --- better timer add function -__timers_callback_max = 0 - -function new_timer(t) - assert(t.delay > 0, "no timer delay") - assert(t.enabled, "no timer enabled state") - assert(t.callback, "no timer callback") - - local timer - if type(t.callback) == "function" then - setglobal("__timers_callback_"..__timers_callback_max, t.callback) - timer = %new_timer("__timers_callback_"..__timers_callback_max, t.delay) - __timers_callback_max = __timers_callback_max + 1 - else - timer = %new_timer(t.callback, t.delay) - end - - timer.enabled = t.enabled - - return timer -end - -- displays a scrolling list function display_list(y, x, h, w, title, list, begin, sel, sel_color) -- cgit v1.2.3 From 8f7682e6fbd636e3172290f0adc9e8b45c5dd0a2 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sat, 9 Jun 2012 09:55:18 +0200 Subject: Lua: Move "gained two melee skills" help to C --- lib/mods/theme/core/util.lua | 9 --------- 1 file changed, 9 deletions(-) (limited to 'lib/mods/theme/core/util.lua') diff --git a/lib/mods/theme/core/util.lua b/lib/mods/theme/core/util.lua index 7729ac35..2d437d61 100644 --- a/lib/mods/theme/core/util.lua +++ b/lib/mods/theme/core/util.lua @@ -118,12 +118,3 @@ end function msg_format(...) msg_print(call(format, arg)) end - --- A way to check if the game is now running(as opposed to initialization/character gen) -game = {} -add_hooks -{ - [HOOK_GAME_START] = function () - game.started = TRUE - end -} -- cgit v1.2.3 From fe752bb67a2a43c49c3f1b6d25eb646b1f7d9847 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Mon, 11 Jun 2012 20:16:03 +0200 Subject: Lua: Remove dead "patches" code --- lib/mods/theme/core/util.lua | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'lib/mods/theme/core/util.lua') diff --git a/lib/mods/theme/core/util.lua b/lib/mods/theme/core/util.lua index 2d437d61..185c0982 100644 --- a/lib/mods/theme/core/util.lua +++ b/lib/mods/theme/core/util.lua @@ -20,32 +20,6 @@ end set_safe_globals() --- Patch modules -__patch_modules = {} - -function patch_version(name, version) - assert(not __patch_modules[name], "Patch " .. name .. " already loaded!!!") - __patch_modules[name] = version -end - -function patchs_list() - local k, e, first - first = FALSE - for k, e in __patch_modules do - if first == FALSE then print_hook("\n\n [Patch modules]\n") first = TRUE end - print_hook("\n "..k.." version "..e) - end - if first == TRUE then print_hook("\n") end -end - -function patchs_display() - local k, e - for k, e in __patch_modules do - msg_print("Patch: "..k.." version "..e) - end -end - - -- Better hook interface __hooks_list_callback = {} __hooks_list_callback_max = 0 -- cgit v1.2.3 From 243116ee1e4a8414f759837412b3087ac3f8321b Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Mon, 11 Jun 2012 20:51:36 +0200 Subject: Lua: Remove dead code from 'util.lua' --- lib/mods/theme/core/util.lua | 57 -------------------------------------------- 1 file changed, 57 deletions(-) (limited to 'lib/mods/theme/core/util.lua') diff --git a/lib/mods/theme/core/util.lua b/lib/mods/theme/core/util.lua index 185c0982..c3387401 100644 --- a/lib/mods/theme/core/util.lua +++ b/lib/mods/theme/core/util.lua @@ -20,21 +20,6 @@ end set_safe_globals() --- Better hook interface -__hooks_list_callback = {} -__hooks_list_callback_max = 0 - -function add_hooks(h_table, name_prefix) - local k, e - - if not name_prefix then name_prefix = "" end - for k, e in h_table do - add_hook_script(k, "__"..name_prefix.."__hooks_list_callback"..__hooks_list_callback_max, "__"..name_prefix.."__hooks_list_callback"..__hooks_list_callback_max) - setglobal("__"..name_prefix.."__hooks_list_callback"..__hooks_list_callback_max, e) - __hooks_list_callback_max = __hooks_list_callback_max + 1 - end -end - -- Wrapper for the real msg_print and cmsg_print -- it understands if we want color or not function msg_print(c, m) @@ -46,49 +31,7 @@ function msg_print(c, m) end --- displays a scrolling list -function display_list(y, x, h, w, title, list, begin, sel, sel_color) - local l = create_list(getn(list)) - - for i = 1, getn(list) do - add_to_list(l, i - 1, list[i]) - end - - %display_list(y, x, h, w, title, l, getn(list), begin - 1, sel - 1, sel_color) - - delete_list(l, getn(list)) -end - --- Easier access to special gene stuff -function set_monster_generation(monster, state) - if type(monster) == "string" then - m_allow_special[test_monster_name(monster) + 1] = state - else - m_allow_special[monster + 1] = state - end -end -function set_object_generation(obj, state) - if type(obj) == "string" then - m_allow_special[test_item_name(obj) + 1] = state - else - m_allow_special[obj + 1] = state - end -end -function set_artifact_generation(obj, state) - m_allow_special[obj + 1] = state -end - -- Strings -function strcap(str) - if strlen(str) > 1 then - return strupper(strsub(str, 1, 1))..strsub(str, 2) - elseif strlen(str) == 1 then - return strupper(str) - else - return str - end -end - function msg_format(...) msg_print(call(format, arg)) end -- cgit v1.2.3 From 64e064330c5c595d0b8553028e0c5ca95c5e5392 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Tue, 19 Jun 2012 18:32:22 +0200 Subject: Lua: Remove Lua --- lib/mods/theme/core/util.lua | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 lib/mods/theme/core/util.lua (limited to 'lib/mods/theme/core/util.lua') diff --git a/lib/mods/theme/core/util.lua b/lib/mods/theme/core/util.lua deleted file mode 100644 index c3387401..00000000 --- a/lib/mods/theme/core/util.lua +++ /dev/null @@ -1,37 +0,0 @@ --- various stuff to make scripters life easier - --- Beware of the scary undefined globals -function safe_getglobal(x) - local v = rawget(globals(), x) - - if v then - return v - else - error("undefined global variable '"..x.."'") - end -end - -function set_safe_globals() - settagmethod(tag(nil), "getglobal", safe_getglobal) -end -function unset_safe_globals() - settagmethod(tag(nil), "getglobal", nil) -end - -set_safe_globals() - --- Wrapper for the real msg_print and cmsg_print --- it understands if we want color or not -function msg_print(c, m) - if type(c) == "number" then - cmsg_print(c, m) - else - call(%msg_print, { c }) - end -end - - --- Strings -function msg_format(...) - msg_print(call(format, arg)) -end -- cgit v1.2.3