summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2011-02-22 18:27:20 +0100
committerBardur Arantsson <bardur@scientician.net>2012-03-29 19:59:22 +0200
commitbdce1032586236e5a0cfae9ff4f29f8f3efe2bd8 (patch)
treee79f77397c752622b0b03c76c0422b3cefe91863
parentb28f125f75e32b80f43ad2871da55bf76a217ecb (diff)
Remove unused execute_magic() and get_magic_power_lua()
-rw-r--r--lib/core/powers.lua26
-rw-r--r--lib/mods/theme/core/powers.lua26
-rw-r--r--src/externs.h1
-rw-r--r--src/lua_bind.c5
-rw-r--r--src/spells.pkg35
5 files changed, 0 insertions, 93 deletions
diff --git a/lib/core/powers.lua b/lib/core/powers.lua
index 839a921d..dfd5f44b 100644
--- a/lib/core/powers.lua
+++ b/lib/core/powers.lua
@@ -70,32 +70,6 @@ function __get_magic_info(power)
return __current_magic_power_info[power]()
end
-function execute_magic(m)
- local sn, ret
-
- -- Ask for a spell
- __current_magic_power_info = m.info
- ret, sn = select_magic_power(0, m.spells, m.max, "__get_magic_info", m.get_current_level(), m.stat)
- if (ret == FALSE) then return end
-
- -- Verify mana needs
- if (get_magic_power(m.spells, sn).mana_cost > player.csp) then msg_print("Not enough mana!") return end
-
- -- Verify failure(second parameter is optional)
- if m.fail then
- __current_magic_power_fail = m.fail_fct
- if (magic_power_sucess(get_magic_power(m.spells, sn), m.stat, "__current_magic_power_fail") == FALSE) then return end
- else
- if (magic_power_sucess(get_magic_power(m.spells, sn), m.stat) == FALSE) then return end
- end
-
- -- Actually cast the spells
- m.spell[sn]()
-
- -- use up some mana
- increase_mana(-get_magic_power(m.spells, sn).mana_cost)
-end
-
-- Get the level of a power
function get_level_power(s, max, min)
if not max then max = 50 end
diff --git a/lib/mods/theme/core/powers.lua b/lib/mods/theme/core/powers.lua
index 839a921d..dfd5f44b 100644
--- a/lib/mods/theme/core/powers.lua
+++ b/lib/mods/theme/core/powers.lua
@@ -70,32 +70,6 @@ function __get_magic_info(power)
return __current_magic_power_info[power]()
end
-function execute_magic(m)
- local sn, ret
-
- -- Ask for a spell
- __current_magic_power_info = m.info
- ret, sn = select_magic_power(0, m.spells, m.max, "__get_magic_info", m.get_current_level(), m.stat)
- if (ret == FALSE) then return end
-
- -- Verify mana needs
- if (get_magic_power(m.spells, sn).mana_cost > player.csp) then msg_print("Not enough mana!") return end
-
- -- Verify failure(second parameter is optional)
- if m.fail then
- __current_magic_power_fail = m.fail_fct
- if (magic_power_sucess(get_magic_power(m.spells, sn), m.stat, "__current_magic_power_fail") == FALSE) then return end
- else
- if (magic_power_sucess(get_magic_power(m.spells, sn), m.stat) == FALSE) then return end
- end
-
- -- Actually cast the spells
- m.spell[sn]()
-
- -- use up some mana
- increase_mana(-get_magic_power(m.spells, sn).mana_cost)
-end
-
-- Get the level of a power
function get_level_power(s, max, min)
if not max then max = 50 end
diff --git a/src/externs.h b/src/externs.h
index 98e5368c..f3f565ac 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -1776,7 +1776,6 @@ extern bool_ select_module(void);
extern magic_power *grab_magic_power(magic_power *m_ptr, int num);
extern bool_ get_magic_power(int *sn, magic_power *powers, int max_powers, void (*power_info)(char *p, int power), int plev, int cast_stat);
extern magic_power *new_magic_power(int num);
-extern bool_ get_magic_power_lua(int *sn, magic_power *powers, int max_powers, char *info_fct, int plev, int cast_stat);
extern bool_ lua_spell_success(magic_power *spell, int stat, char *oups_fct);
extern object_type *new_object(void);
diff --git a/src/lua_bind.c b/src/lua_bind.c
index ccbaa921..04c0f7d9 100644
--- a/src/lua_bind.c
+++ b/src/lua_bind.c
@@ -40,11 +40,6 @@ static void magic_power_info_lua(char *p, int power)
strcpy(p, lua_tostring(L, -1));
lua_settop(L, oldtop);
}
-bool_ get_magic_power_lua(int *sn, magic_power *powers, int max_powers, char *info_fct, int plev, int cast_stat)
-{
- magic_power_info_lua_fct = info_fct;
- return (get_magic_power(sn, powers, max_powers, magic_power_info_lua, plev, cast_stat));
-}
bool_ lua_spell_success(magic_power *spell, int stat, char *oups_fct)
{
diff --git a/src/spells.pkg b/src/spells.pkg
index d1f50566..9ea21079 100644
--- a/src/spells.pkg
+++ b/src/spells.pkg
@@ -2162,41 +2162,6 @@ extern magic_power *new_magic_power(int num);
*/
extern magic_power *grab_magic_power @ get_magic_power(magic_power *m_ptr, int num);
-/** @fn select_magic_power(int *sn, magic_power *powers, int max_powers, char *info_fct, int plev, int cast_stat);
- * @dgonly
- * @brief Select a magic power from array of powers.\n
- * @param *sn Number
- * @brief Power (spell) number
- * @param *powers magic_power \n powers is the array of magic powers.
- * @brief Powers
- * @param max_powers Number \n max_powers is the maximum number of magic
- * powers.
- * @brief Maximum powers
- * @param *info_fct String \n info_fct is the name of a function which will
- * return power info.
- * @brief Name of power info function
- * @param plev Number \n plev is the player's level of magic skill.
- * @brief Player magic level
- * @param cast_stat Number \n cast_stat is the required casting statistic
- * (INT or WIS).
- * @brief Casting statistic
- * @return *sn Number \n sn is the index of the power in the array of magic
- * powers.
- * @return Boolean \n TRUE if power was selected, otherwise FALSE.
- * @note
- * Allow user to choose a magic power.\n\n
- * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
- * If the user hits escape, returns FALSE, and set '*sn' to -1\n
- * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n\n
- * The "prompt" should be "cast", "recite", or "study".
- * The "known" should be TRUE for cast/pray, FALSE for study\n\n
- * Note: do not call this function directly.\n
- * Please use execute_magic() in powers.lua instead.\n
- * By order of DG.
- * @note (see files lua_bind.c, cmd7.c)
- */
-extern bool get_magic_power_lua @ select_magic_power(int *sn, magic_power *powers, int max_powers, char *info_fct, int plev, int cast_stat);
-
/** @fn magic_power_sucess(magic_power *spell, int stat, char *oups_fct=NULL);
* @dgonly
* @brief Determine if using a magic power succeeds.\n