diff --git a/res/core/common/items.xml b/res/core/common/items.xml
index c903a6b78..8745b6e59 100644
--- a/res/core/common/items.xml
+++ b/res/core/common/items.xml
@@ -62,9 +62,7 @@
- -
-
-
+
diff --git a/scripts/tests/e2/e2features.lua b/scripts/tests/e2/e2features.lua
index c88dfdf22..5af956980 100644
--- a/scripts/tests/e2/e2features.lua
+++ b/scripts/tests/e2/e2features.lua
@@ -230,12 +230,24 @@ function test_no_uruk()
assert_equal(f1.race, "orc")
end
+function test_meow()
+ local r = region.create(0, 0, "plain")
+ local f = faction.create("noreply@eressea.de", "human", "de")
+ local u = unit.create(f, r, 1)
+ u:add_item("aoc", 1)
+ u:clear_orders()
+ u:add_order("BENUTZEN 1 Katzenamulett")
+ process_orders()
+ assert_equal(1, u:get_item("aoc"))
+ assert_equal(1, r:count_msg_type('meow'))
+end
+
function test_ointment()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
local hp = u.hp
- u.hp = 0
+ u.hp = 1
u:add_item("ointment", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Wundsalbe")
diff --git a/src/bind_region.c b/src/bind_region.c
index 9e4e2f778..05c0e3842 100644
--- a/src/bind_region.c
+++ b/src/bind_region.c
@@ -29,6 +29,7 @@ without prior permission by the authors of Eressea.
#include
#include
#include
+#include
#include
#include
#include
@@ -46,6 +47,23 @@ without prior permission by the authors of Eressea.
#include
#include
+static int tolua_region_count_msg_type(lua_State *L) {
+ region *self = (region *)tolua_tousertype(L, 1, 0);
+ const char *str = tolua_tostring(L, 2, 0);
+ int n = 0;
+ if (self->msgs) {
+ mlist * ml = self->msgs->begin;
+ while (ml) {
+ if (strcmp(str, ml->msg->type->name) == 0) {
+ ++n;
+ }
+ ml = ml->next;
+ }
+ }
+ lua_pushinteger(L, n);
+ return 1;
+}
+
int tolua_regionlist_next(lua_State * L)
{
region **region_ptr = (region **)lua_touserdata(L, lua_upvalueindex(1));
@@ -671,6 +689,8 @@ void tolua_region_open(lua_State * L)
tolua_function(L, TOLUA_CAST "destroy", tolua_region_destroy);
tolua_function(L, TOLUA_CAST "__tostring", tolua_region_tostring);
+ tolua_function(L, TOLUA_CAST "count_msg_type", tolua_region_count_msg_type);
+
/* flags */
tolua_variable(L, TOLUA_CAST "blocked", tolua_region_get_blocked, tolua_region_set_blocked);
diff --git a/src/kernel/item.c b/src/kernel/item.c
index 1fa006c73..e0f8f64cc 100644
--- a/src/kernel/item.c
+++ b/src/kernel/item.c
@@ -1289,7 +1289,7 @@ void register_resources(void)
register_item_use(use_potion_delayed, "use_p2");
register_item_use(use_tacticcrystal, "use_tacticcrystal");
- register_item_use(use_birthdayamulet, "use_birthdayamulet");
+ register_item_use(use_birthdayamulet, "use_aoc");
register_item_use(use_warmthpotion, "use_nestwarmth");
register_item_use(use_bloodpotion, "use_peasantblood");
register_item_use(use_healingpotion, "use_ointment");
diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c
index c4ce845a5..69e9c22d0 100644
--- a/src/kernel/xmlreader.c
+++ b/src/kernel/xmlreader.c
@@ -855,6 +855,7 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
struct order *))fun;
}
else if (strcmp((const char *)propValue, "use") == 0) {
+ log_error("%s has a use function", rtype->_name);
itype->flags |= ITF_CANUSE;
itype->use =
(int(*)(struct unit *, const struct item_type *, int,