summaryrefslogtreecommitdiffstats
path: root/src/scripting
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-11 02:54:10 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-11 02:54:10 +0200
commit9527d079307454178fea3b2958e301875cecc15a (patch)
tree333ed71036813c9cdec4c8e1de1e058b86275bca /src/scripting
parent0820d6632b0ce5887c49d16929ac7903aa185fe4 (diff)
parent8766149dc12d197205b1632ec6e9fc663de05990 (diff)
downloadmanaserv-9527d079307454178fea3b2958e301875cecc15a.tar.gz
manaserv-9527d079307454178fea3b2958e301875cecc15a.tar.xz
manaserv-9527d079307454178fea3b2958e301875cecc15a.zip
Merge branch 'master' of git://gitorious.org/~bertram/mana/manaserv-equipment-fix into equipment-fix
Conflicts: src/common/manaserv_protocol.h
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 47bf335..2ea2187 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -366,7 +366,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)) ||
@@ -404,12 +404,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