diff --git a/res/core/messages.xml b/res/core/messages.xml
index 0c1ea60d9..4159969ee 100644
--- a/res/core/messages.xml
+++ b/res/core/messages.xml
@@ -6783,6 +6783,14 @@
"$unit($unit) in $region($region): '$order($command)' - ${error}."
"$unit($unit) in $region($region): '$order($command)' - ${error}."
+
+
+
+
+
+ "$unit($unit) benutzt $resource($potion,1)."
+ "$unit($unit) uses $resource($potion,1)."
+
@@ -6974,14 +6982,6 @@
"$unit($unit) verdient am Handel in $region($region) Steuern in Höhe von $int($amount) Silber."
"$unit($unit) collected $int($amount) silver trade tax in $region($region)."
-
-
-
-
-
- "$unit($unit) benutzt $resource($potion,1)."
- "$unit($unit) uses $resource($potion,1)."
-
diff --git a/scripts/tests/e2/items.lua b/scripts/tests/e2/items.lua
index cefffd967..ce7b76b40 100644
--- a/scripts/tests/e2/items.lua
+++ b/scripts/tests/e2/items.lua
@@ -38,7 +38,7 @@ function test_nestwarmth_insect()
turn_process()
assert_equal(flags+64, u.flags) -- UFL_WARMTH
assert_equal(1, u:get_item("nestwarmth"))
- assert_equal(1, f:count_msg_type('usepotion'))
+ assert_equal(1, f:count_msg_type('use_item'))
turn_end()
end
diff --git a/scripts/tests/items.lua b/scripts/tests/items.lua
index bb910bc70..9f1df3323 100644
--- a/scripts/tests/items.lua
+++ b/scripts/tests/items.lua
@@ -135,6 +135,7 @@ function test_use_healing_potion()
turn_process()
assert_equal(530, u.hp)
assert_equal(0, u:get_item("p14"))
+ assert_equal(1, f:count_msg_type('use_item'))
turn_end()
end
@@ -188,7 +189,7 @@ function test_use_ointment()
process_orders()
assert_equal(530, u.hp)
assert_equal(0, u:get_item("ointment"))
- assert_equal(1, f:count_msg_type('usepotion'))
+ assert_equal(1, f:count_msg_type('use_item'))
end
function test_use_domore()
@@ -200,7 +201,7 @@ function test_use_domore()
process_orders()
assert_equal(10, u:effect("p3"))
assert_equal(0, u:get_item("p3"))
- assert_equal(1, f:count_msg_type('usepotion'))
+ assert_equal(1, f:count_msg_type('use_item'))
u:clear_orders()
u:set_skill('weaponsmithing', 3)
u:add_item("iron", 2)
@@ -221,7 +222,7 @@ function test_bloodpotion_demon()
process_orders()
assert_equal(100, u:effect('peasantblood'))
assert_equal(0, u:get_item("peasantblood"))
- assert_equal(1, f:count_msg_type('usepotion'))
+ assert_equal(1, f:count_msg_type('use_item'))
assert_equal("demon", u.race)
end
@@ -235,6 +236,6 @@ function test_bloodpotion_other()
process_orders()
assert_equal(0, u:effect('peasantblood'))
assert_equal(0, u:get_item("peasantblood"))
- assert_equal(1, f:count_msg_type('usepotion'))
+ assert_equal(1, f:count_msg_type('use_item'))
assert_equal("smurf", u.race)
end
diff --git a/src/alchemy.c b/src/alchemy.c
index b6a86057e..2973c3748 100644
--- a/src/alchemy.c
+++ b/src/alchemy.c
@@ -202,27 +202,28 @@ int use_potion(unit * u, const item_type * itype, int amount, struct order *ord)
{
region *r = u->region;
- ADDMSG(&u->faction->msgs, msg_message("usepotion",
- "unit potion", u, itype->rtype));
-
if (itype == oldpotiontype[P_PEOPLE]) {
- return potion_luck(u, r, &at_peasantluck, amount);
+ amount = potion_luck(u, r, &at_peasantluck, amount);
}
else if (itype == oldpotiontype[P_HORSE]) {
- return potion_luck(u, r, &at_horseluck, amount);
+ amount = potion_luck(u, r, &at_horseluck, amount);
}
else if (itype == oldpotiontype[P_HEAL]) {
- return potion_healing(u, amount);
+ amount = potion_healing(u, amount);
}
else if (itype == oldpotiontype[P_OINTMENT]) {
- return potion_ointment(u, amount);
+ amount = potion_ointment(u, amount);
}
else if (itype == oldpotiontype[P_MACHT]) {
- return potion_power(u, amount);
+ amount = potion_power(u, amount);
}
else {
change_effect(u, itype, 10 * amount);
}
+ if (amount > 0) {
+ ADDMSG(&u->faction->msgs, msg_message("use_item",
+ "unit amount item", u, amount, itype->rtype));
+ }
return amount;
}
diff --git a/src/items.c b/src/items.c
index 18c2d7b0f..9376fe1c5 100644
--- a/src/items.c
+++ b/src/items.c
@@ -304,8 +304,8 @@ struct order *ord)
use_pooled(u, itype->rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK,
amount);
- ADDMSG(&u->faction->msgs, msg_message("usepotion",
- "unit potion", u, itype->rtype));
+ ADDMSG(&u->faction->msgs, msg_message("use_item",
+ "unit amount item", u, amount, itype->rtype));
return 0;
}
@@ -369,8 +369,8 @@ static int use_warmthpotion(unit *u, const item_type *itype,
}
use_pooled(u, itype->rtype, GET_DEFAULT, amount);
- ADDMSG(&u->faction->msgs, msg_message("usepotion",
- "unit potion", u, itype->rtype));
+ ADDMSG(&u->faction->msgs, msg_message("use_item",
+ "unit amount item", u, amount, itype->rtype));
return 0;
}