From 483615c458927d5b90b913af484a87a19547b0d0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 13 Jun 2012 23:28:56 -0700 Subject: [PATCH] bindings for LEAVE command --- scripts/tests/bindings.lua | 1 + scripts/tests/orders.lua | 11 +++++++++++ src/bindings/bind_process.c | 4 ++++ src/bindings/bind_process.h | 1 + src/bindings/process.pkg | 1 + 5 files changed, 18 insertions(+) diff --git a/scripts/tests/bindings.lua b/scripts/tests/bindings.lua index a6f8434a5..a686b063f 100755 --- a/scripts/tests/bindings.lua +++ b/scripts/tests/bindings.lua @@ -30,6 +30,7 @@ function test_process() assert_equal("function", _G.type(eressea.process.study)) assert_equal("function", _G.type(eressea.process.movement)) assert_equal("function", _G.type(eressea.process.use)) + assert_equal("function", _G.type(eressea.process.leave)) end function test_settings() diff --git a/scripts/tests/orders.lua b/scripts/tests/orders.lua index 84c02309a..c2439fdb2 100755 --- a/scripts/tests/orders.lua +++ b/scripts/tests/orders.lua @@ -137,8 +137,19 @@ end function test_process_move() r2 = _G.region.create(1, 0, 'plain') u:add_order('NACH O') + assert_not_equal(r2, u.region) eressea.process.update_long_order() eressea.process.movement() assert_equal(r2, u.region) end +function test_process_leave() + r2 = _G.region.create(1, 0, 'plain') + b = _G.building.create(r, "castle") + u.building = b + assert_equal(b, u.building) + u:add_order('VERLASSEN') + eressea.process.leave() + assert_not_equal(b, u.building) +end + diff --git a/src/bindings/bind_process.c b/src/bindings/bind_process.c index 6e739ec8d..a3de48c29 100755 --- a/src/bindings/bind_process.c +++ b/src/bindings/bind_process.c @@ -146,3 +146,7 @@ void process_movement(void) { void process_use(void) { process_cmd(K_USE, use_cmd); } + +void process_leave(void) { + process_cmd(K_LEAVE, leave_cmd); +} diff --git a/src/bindings/bind_process.h b/src/bindings/bind_process.h index 009a79325..b2363c6d0 100755 --- a/src/bindings/bind_process.h +++ b/src/bindings/bind_process.h @@ -21,6 +21,7 @@ void process_quit(void); void process_study(void); void process_movement(void); void process_use(void); +void process_leave(void); #ifdef __cplusplus } diff --git a/src/bindings/process.pkg b/src/bindings/process.pkg index ef123716c..ed0d57520 100755 --- a/src/bindings/process.pkg +++ b/src/bindings/process.pkg @@ -18,5 +18,6 @@ module eressea { void process_study @ study(void); /* LEARN/TEACH */ void process_movement @ movement(void); /* MOVE/FOLLOW/ROUTE */ void process_use @ use(void); /* USE */ + void process_leave @ leave(void); /* LEAVE */ } }