summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-06-11 20:43:12 +0200
committerBardur Arantsson <bardur@scientician.net>2012-06-19 18:36:20 +0200
commitf71485a5448f1e978101f9033f34875a96c88880 (patch)
treea8907bb003d49659b1dbbe53c981a2aa93366552 /src
parentb9894d348db43cacb2807c325fb48d8d46e84985 (diff)
Lua: Move increase_mana() to C
Diffstat (limited to 'src')
-rw-r--r--src/lua_bind.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lua_bind.c b/src/lua_bind.c
index 4ae8ed80..0f41f9dc 100644
--- a/src/lua_bind.c
+++ b/src/lua_bind.c
@@ -483,9 +483,17 @@ int get_lua_list_size(cptr list_var)
void increase_mana(int delta)
{
- char buf[256];
- sprintf(buf, "increase_mana(%d)", delta);
- exec_lua(buf);
+ p_ptr->csp += delta;
+ p_ptr->redraw |= PR_MANA;
+
+ if (p_ptr->csp < 0)
+ {
+ p_ptr->csp = 0;
+ }
+ if (p_ptr->csp > p_ptr->msp)
+ {
+ p_ptr->csp = p_ptr->msp;
+ }
}
timer_type *TIMER_AGGRAVATE_EVIL = 0;