diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-06-11 20:51:36 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-06-19 18:36:20 +0200 |
commit | 243116ee1e4a8414f759837412b3087ac3f8321b (patch) | |
tree | a4a32fc997632a751f06b6b2a3b2023408e26641 | |
parent | 4dfd1e9255f421093ecf444fff7c76a9434d8fe1 (diff) |
Lua: Remove dead code from 'util.lua'
-rw-r--r-- | lib/core/util.lua | 57 | ||||
-rw-r--r-- | lib/mods/theme/core/util.lua | 57 | ||||
-rw-r--r-- | src/externs.h | 1 | ||||
-rw-r--r-- | src/lua_bind.c | 31 | ||||
-rw-r--r-- | src/util.pkg | 78 |
5 files changed, 0 insertions, 224 deletions
diff --git a/lib/core/util.lua b/lib/core/util.lua index 185c0982..c3387401 100644 --- a/lib/core/util.lua +++ b/lib/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 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 diff --git a/src/externs.h b/src/externs.h index d4d7d140..46a4cf2b 100644 --- a/src/externs.h +++ b/src/externs.h @@ -2417,7 +2417,6 @@ extern char lua_msg_box(cptr title); extern list_type *lua_create_list(int size); extern void lua_delete_list(list_type *, int size); extern void lua_add_to_list(list_type *, int idx, cptr str); -extern void lua_display_list(int y, int x, int h, int w, cptr title, list_type *list, int max, int begin, int sel, byte sel_color); extern void increase_mana(int delta); diff --git a/src/lua_bind.c b/src/lua_bind.c index 0f41f9dc..5a3806d8 100644 --- a/src/lua_bind.c +++ b/src/lua_bind.c @@ -434,37 +434,6 @@ char lua_msg_box(cptr title) return msg_box(title, hgt / 2, wid / 2); } -list_type *lua_create_list(int size) -{ - list_type *l; - cptr *list; - - MAKE(l, list_type); - C_MAKE(list, size, cptr); - l->list = list; - return l; -} - -void lua_delete_list(list_type *l, int size) -{ - int i; - - for (i = 0; i < size; i++) - string_free(l->list[i]); - C_FREE(l->list, size, cptr); - FREE(l, list_type); -} - -void lua_add_to_list(list_type *l, int idx, cptr str) -{ - l->list[idx] = string_make(str); -} - -void lua_display_list(int y, int x, int h, int w, cptr title, list_type* list, int max, int begin, int sel, byte sel_color) -{ - display_list(y, x, h, w, title, list->list, max, begin, sel, sel_color); -} - int get_lua_int(cptr name) diff --git a/src/util.pkg b/src/util.pkg index 1412e66b..196aabda 100644 --- a/src/util.pkg +++ b/src/util.pkg @@ -2229,84 +2229,6 @@ extern cptr game_module; */ extern int get_keymap_dir(char ch); -/* - * Lists - */ -/** @struct list_type - */ -struct list_type -{ -}; - -/** @fn create_list(int size); - * @dgonly - * @brief Create an empty list big enough to store "size" strings.\n - * @param size Number \n the number of strings the list will hold. - * @brief List size - * @return list_type \n The empty list. - * @note (see file lua_bind.c) - */ -extern list_type *lua_create_list@create_list(int size); - -/** @fn delete_list(list_type *, int size); - * @dgonly - * @brief Delete the list of strings.\n - * @param * list_type \n the list of strings. - * @brief List - * @param size Number \n the number of strings the list holds. - * @brief List size - * @note - * All the strings in the list are deleted first, then the list is deleted. - * @note (see file lua_bind.c) - */ -extern void lua_delete_list@delete_list(list_type *, int size); - -/** @fn add_to_list(list_type *, int idx, cptr str); - * @dgonly - * @brief Add string "str" to list in position "idx".\n - * @param * list_type \n the list of strings. - * @brief List - * @param idx Number \n the index of the list where the string will be added. - * @brief Index - * @param str String \n the string to be added. - * @brief String - * @note - * Too bad if there was something in that position already. - * You have been warned. - * @note (see file lua_bind.c) - */ -extern void lua_add_to_list@add_to_list(list_type *, int idx, cptr str); - -/** @fn display_list(int y, int x, int h, int w, cptr title, list_type *list, int max, int begin, int sel, byte sel_color); - * @dgonly - * @brief Display a scrollable boxed list with a selected item.\n - * @param y Number \n the y-coordinate of the top-left corner of the box. - * @brief Top-left y-coordinate - * @param x Number \n the x-coordinate of the top-left corner of the box. - * @brief Top-left x-coordinate - * @param h Number \n the height of the box. - * @brief Height - * @param w Number \n the width of the box. - * @brief Width - * @param title String \n the title for the list box. - * @brief Title - * @param *list list_type \n the list of strings to be displayed. - * @brief List - * @param max Number \n the maximum number of strings to display. - * @brief Maximum displayed strings - * @param begin Number \n the index of the first string to display. - * @brief Start index - * @param sel Number \n the index of the selected string. - * @brief Selected index - * @param sel_color Number \n the colour of the selected string. - * @brief Selected colour - * @note - * The title of the list is displayed in TERM_L_BLUE and the unselected strings - * are displayed in TERM_WHITE. - * @note (see file util.c) - */ -extern void lua_display_list@display_list(int y, int x, int h, int w, cptr title, list_type *list, int max, int begin, int sel, byte sel_color); - extern errr file_character(cptr name, bool full); extern void calc_bonuses(bool silent); |