From d02857ebb9ff71b5946dfb1f0624472e8d6dcadd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 17 Jun 2012 12:51:48 -0700 Subject: [PATCH] binding COMBATSPELL to Lua --- scripts/tests/bindings.lua | 1 + src/bindings/bind_process.c | 4 ++++ src/bindings/bind_process.h | 1 + src/bindings/process.pkg | 1 + src/gamecode/laws.c | 2 +- src/gamecode/laws.h | 1 + 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/tests/bindings.lua b/scripts/tests/bindings.lua index 8f8209b13..8715e501a 100755 --- a/scripts/tests/bindings.lua +++ b/scripts/tests/bindings.lua @@ -36,6 +36,7 @@ function test_process() assert_equal("function", _G.type(eressea.process.promote)) assert_equal("function", _G.type(eressea.process.renumber)) assert_equal("function", _G.type(eressea.process.restack)) + assert_equal("function", _G.type(eressea.process.set_spells)) end function test_settings() diff --git a/src/bindings/bind_process.c b/src/bindings/bind_process.c index 5e657fca4..eb7a72052 100755 --- a/src/bindings/bind_process.c +++ b/src/bindings/bind_process.c @@ -190,6 +190,10 @@ void process_restack(void) { restack_units(); } +void process_setspells(void) { + process_cmd(K_COMBATSPELL, combatspell_cmd, 0); +} + void process_maintenance(void) { region * r; for (r=regions; r; r=r->next) { diff --git a/src/bindings/bind_process.h b/src/bindings/bind_process.h index 8762ba510..804414795 100755 --- a/src/bindings/bind_process.h +++ b/src/bindings/bind_process.h @@ -28,6 +28,7 @@ void process_maintenance(void); void process_promote(void); void process_renumber(void); void process_restack(void); +void process_setspells(void); #ifdef __cplusplus } diff --git a/src/bindings/process.pkg b/src/bindings/process.pkg index 146eb43c0..7504773fa 100755 --- a/src/bindings/process.pkg +++ b/src/bindings/process.pkg @@ -25,5 +25,6 @@ module eressea { void process_promote @ promote(void); /* PROMOTE */ void process_renumber @ renumber(void); /* RENUMBER */ void process_restack @ restack(void); /* SORT */ + void process_setspells @ set_spells(void); /* COMBATSPELL */ } } diff --git a/src/gamecode/laws.c b/src/gamecode/laws.c index 57756a569..6d0c50ad2 100755 --- a/src/gamecode/laws.c +++ b/src/gamecode/laws.c @@ -2838,7 +2838,7 @@ int status_cmd(unit * u, struct order *ord) return 0; } -static int combatspell_cmd(unit * u, struct order *ord) +int combatspell_cmd(unit * u, struct order *ord) { const char *s; int level = 0; diff --git a/src/gamecode/laws.h b/src/gamecode/laws.h index 35e94875c..5a6664764 100755 --- a/src/gamecode/laws.h +++ b/src/gamecode/laws.h @@ -75,6 +75,7 @@ extern "C" { extern int pay_cmd(struct unit *u, struct order *ord); extern int promotion_cmd(struct unit *u, struct order *ord); extern int renumber_cmd(struct unit *u, struct order *ord); + extern int combatspell_cmd(struct unit *u, struct order *ord); #ifdef __cplusplus }