diff options
author | Simon Edwardsson <simon@crossnet.se> | 2004-10-02 17:59:31 +0000 |
---|---|---|
committer | Simon Edwardsson <simon@crossnet.se> | 2004-10-02 17:59:31 +0000 |
commit | 1c496b3ccdd7bfde947aeb59eaf7aa429ccf5818 (patch) | |
tree | 0a04df96d91978ee925fbea80081dfcf4fa9f8aa | |
parent | bbaf3dff1287cba348b047998a632fc000114c3d (diff) | |
download | mana-1c496b3ccdd7bfde947aeb59eaf7aa429ccf5818.tar.gz mana-1c496b3ccdd7bfde947aeb59eaf7aa429ccf5818.tar.bz2 mana-1c496b3ccdd7bfde947aeb59eaf7aa429ccf5818.tar.xz mana-1c496b3ccdd7bfde947aeb59eaf7aa429ccf5818.zip |
Fix the invetory items decrease thing.
-rw-r--r-- | src/game.cpp | 6 | ||||
-rw-r--r-- | src/gui/inventory.cpp | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/game.cpp b/src/game.cpp index ab50a863..5aca7bad 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -687,12 +687,18 @@ void do_parse() { case 0x00a0: inventory.add_item(RFIFOW(2), RFIFOW(6), RFIFOW(4)); break; + // Remove item to inventory after you sold it + case 0x00af: + printf("sell %i\n",-RFIFOW(4)); + inventory.change_quantity(RFIFOW(2),-RFIFOW(4)); + break; case 0x0119: sprintf(pkt_nfo, "%i %i %i %i", RFIFOL(2), RFIFOW(6), RFIFOW(8), RFIFOW(10)); //alert(pkt_nfo,"","","","",0,0); break; // Manage non implemented packets default: + // use when debug packets :) printf("%x\n",id); //alert(pkt_nfo,"","","","",0,0); break; } diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp index 2bf7474a..09bf56f2 100644 --- a/src/gui/inventory.cpp +++ b/src/gui/inventory.cpp @@ -89,7 +89,7 @@ int TmwInventory::remove_item(int id) { /** Change quantity of an item */ int TmwInventory::change_quantity(int index, int quantity) { - items[index].quantity = quantity; + items[index].quantity += quantity; return 0; } |