summaryrefslogtreecommitdiff
path: root/src/scripting
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-25 23:35:25 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-25 23:35:25 +0200
commitec99e999a918f6680d38704d9408933090d0386a (patch)
tree89e2361ccc9da7d88c10cc0967e9898d9cdab0a6 /src/scripting
parentf2368c9887e8b97b76e459a5088ed52bb5ee4512 (diff)
parenta4d0b4d6e0360f09b1f01ec59f548cdb297ebd4c (diff)
downloadmanaserv-ec99e999a918f6680d38704d9408933090d0386a.tar.gz
manaserv-ec99e999a918f6680d38704d9408933090d0386a.tar.bz2
manaserv-ec99e999a918f6680d38704d9408933090d0386a.tar.xz
manaserv-ec99e999a918f6680d38704d9408933090d0386a.zip
Merge branch 'equipment-fix' of github.com:Bertram25/manaserv
Diffstat (limited to 'src/scripting')
-rw-r--r--src/scripting/lua.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 546f4a66..91cf7635 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -370,7 +370,7 @@ static int chr_inv_change(lua_State *s)
return 0;
}
int nb_items = (lua_gettop(s) - 1) / 2;
- Inventory inv(q, true);
+ Inventory inv(q);
for (int i = 0; i < nb_items; ++i)
{
if (!(lua_isnumber(s, i * 2 + 2) || lua_isstring(s, i * 2 + 2)) ||
@@ -408,12 +408,13 @@ static int chr_inv_change(lua_State *s)
id = ic->getDatabaseID();
if (nb < 0)
{
+ // Removing too much item is a success as for the scripter's
+ // point of view. We log it anyway.
nb = inv.remove(id, -nb);
if (nb)
{
- inv.cancel();
- lua_pushboolean(s, 0);
- return 1;
+ LOG_WARN("mana.chr_inv_change() removed more items than owned: "
+ << "character: " << q->getName() << " item id: " << id);
}
}
else