summaryrefslogtreecommitdiff
path: root/src/scripting
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2011-01-30 21:29:21 -0700
committerJared Adams <jaxad0127@gmail.com>2011-01-30 21:29:21 -0700
commit19d140fb6989ada459b0a71ec3bf5647ff93bec2 (patch)
tree680340ea0e645c90a89d972bbfc4801007a31644 /src/scripting
parent6a3e510e4b40fcb1554cdd57e7ddc49edd89fa3f (diff)
downloadmanaserv-19d140fb6989ada459b0a71ec3bf5647ff93bec2.tar.gz
manaserv-19d140fb6989ada459b0a71ec3bf5647ff93bec2.tar.bz2
manaserv-19d140fb6989ada459b0a71ec3bf5647ff93bec2.tar.xz
manaserv-19d140fb6989ada459b0a71ec3bf5647ff93bec2.zip
Revert "Fixed the money handling."
This reverts commit b2209cbe93aa12dcd4e4e3b9a7cd8b13ed5713e9. Money should be handled through attributes, not magic numbers.
Diffstat (limited to 'src/scripting')
-rw-r--r--src/scripting/lua.cpp29
1 files changed, 4 insertions, 25 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 57146cb9..3a615412 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -370,14 +370,8 @@ static int chr_inv_change(lua_State *s)
int id = lua_tointeger(s, i * 2 + 2);
int nb = lua_tointeger(s, i * 2 + 3);
- if (id == 0) // Id 0 = Change money amount.
- {
- double money = q->getModifiedAttribute(ATTR_MONEY);
- money += nb;
- q->setAttribute(ATTR_MONEY, money);
- lua_pushboolean(s, 1);
- return 1;
- }
+ if (id == 0)
+ LOG_WARN("chr_inv_change: id 0! Currency is now handled through attributes!");
else if (nb < 0)
{
nb = inv.remove(id, -nb);
@@ -427,23 +421,8 @@ static int chr_inv_count(lua_State *s)
Inventory inv(q);
for (int i = 2; i <= nb_items + 1; ++i)
{
- int id = luaL_checkint(s, i);
-
- // Id 0 = Money - get it through attributes
- if (id == 0)
- {
- int money = (int) q->getAttribute(ATTR_MONEY);
-
- if (money < 0)
- money = 0;
- lua_pushinteger(s, money);
- }
- else
- {
- // Otherwise, return the normal count result
- int nb = inv.count(id);
- lua_pushinteger(s, nb);
- }
+ int nb = inv.count(luaL_checkint(s, i));
+ lua_pushinteger(s, nb);
}
return nb_items;
}