diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-04-07 14:50:36 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-04-07 15:28:27 +0200 |
commit | a01f15e08da3b2e0e326b2a94100e17962136741 (patch) | |
tree | fa07a987e816cc752f909b689e2118f6c963c3b3 /src/xtra2.c | |
parent | 41b6617e992d3fedda4c0a93ddd0fa4ad834a2ae (diff) |
Lua: Refactor all the corruption code into C
Diffstat (limited to 'src/xtra2.c')
-rw-r--r-- | src/xtra2.c | 65 |
1 files changed, 4 insertions, 61 deletions
diff --git a/src/xtra2.c b/src/xtra2.c index 1a6ec3a0..a3ae9881 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -12,6 +12,7 @@ */ #include "angband.h" +#include <assert.h> /* * Invoke The Rush @@ -5147,7 +5148,7 @@ void gain_level_reward(int chosen_reward) { msg_format("%^s rewards you with a corruption!", chaos_patrons[p_ptr->chaos_patron]); - (void)gain_random_corruption(0); + gain_random_corruption(); return; } @@ -5600,19 +5601,6 @@ bool_ tgt_pt(int *x, int *y) return success; } - -bool_ gain_random_corruption(int choose_mut) -{ - exec_lua("gain_corruption()"); - return (FALSE); -} - -bool_ lose_corruption(int choose_mut) -{ - exec_lua("lose_corruption()"); - return (FALSE); -} - bool_ get_hack_dir(int *dp) { int dir; @@ -5710,51 +5698,6 @@ bool_ get_hack_dir(int *dp) } /* - * Do we have at least one corruption? - */ -bool_ got_corruptions() -{ - int i, max; - - max = exec_lua("return __corruptions_max"); - - for (i = 0; i < max; i++) - { - if (exec_lua(format("if test_depend_corrupt(%d) == TRUE then return TRUE else return FALSE end", i))) - { - return TRUE; - } - } - return FALSE; -} - -/* - * Dump the corruption list - */ -void dump_corruptions(FILE *fff, bool_ color) -{ - int i, max; - - if (!fff) return; - - max = exec_lua("return __corruptions_max"); - - for (i = 0; i < max; i++) - { - if (exec_lua(format("if test_depend_corrupt(%d) == TRUE then return TRUE else return FALSE end", i))) - { - int c = exec_lua(format("return __corruptions[%d].color", i)); - - if (color) - fprintf(fff, "#####%c%s:\n", conv_color[c], string_exec_lua(format("return __corruptions[%d].name", i))); - else - fprintf(fff, "%s:\n", string_exec_lua(format("return __corruptions[%d].name", i))); - fprintf(fff, "%s\n", string_exec_lua(format("return __corruptions[%d].desc", i))); - } - } -} - -/* * Set "p_ptr->grace", notice observable changes */ void set_grace(s32b v) @@ -6048,11 +5991,11 @@ void corrupt_corrupted(void) { if (magik(45)) { - lose_corruption(0); + lose_corruption(); } else { - gain_random_corruption(0); + gain_random_corruption(); } /* We are done. */ |