diff options
author | Simon Edwardsson <simon@crossnet.se> | 2004-10-02 15:50:55 +0000 |
---|---|---|
committer | Simon Edwardsson <simon@crossnet.se> | 2004-10-02 15:50:55 +0000 |
commit | 91fbf564fe4a28a93122d6a8a6a1df9d119dce91 (patch) | |
tree | e1c8025714fb70c40f4e2e63117e1a86246f8b17 /src/gui | |
parent | 572f377ea2eca51469e06109503e9f4bcb198166 (diff) | |
download | mana-client-91fbf564fe4a28a93122d6a8a6a1df9d119dce91.tar.gz mana-client-91fbf564fe4a28a93122d6a8a6a1df9d119dce91.tar.bz2 mana-client-91fbf564fe4a28a93122d6a8a6a1df9d119dce91.tar.xz mana-client-91fbf564fe4a28a93122d6a8a6a1df9d119dce91.zip |
Sell in shops does now works, and you can choose amount :) (hope I don't break anything)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/inventory.h | 1 | ||||
-rw-r--r-- | src/gui/shop.cpp | 28 | ||||
-rw-r--r-- | src/gui/shop.h | 10 |
3 files changed, 38 insertions, 1 deletions
diff --git a/src/gui/inventory.h b/src/gui/inventory.h index ee16d56b..0a8fd600 100644 --- a/src/gui/inventory.h +++ b/src/gui/inventory.h @@ -60,6 +60,7 @@ class TmwInventory { int change_quantity(int index, int quantity); // change number of a item int increase_quantity(int index, int quantity); // increase quantity of a item int use_item(int index, int id); + int quantityForIndex(int index) { return items[index].quantity; } //END API itemHolder items[INVENTORY_SIZE]; // this is the holder of items diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 3065f8ea..487465b6 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -26,6 +26,7 @@ #include "shop.h" int n_items; +char* selectedItem = "You got 4"; ITEM_SHOP *shop = NULL; char *item_db[] = { @@ -75,7 +76,9 @@ void add_sell_item(short index, int price) { else sprintf(item_shop->name, "Unknown item %i gp", price); item_shop->price = price; + item_shop->index = index; item_shop->id = id; + item_shop->quantity = inventory.items[index].quantity; item_shop->next = NULL; if(shop==NULL) shop = item_shop; @@ -107,3 +110,28 @@ short get_item_id(int index) { } return item_shop->id; } + +int get_item_quantity(int index) { + int iterator = 0; + ITEM_SHOP *item_shop = shop; + while(iterator<index) { + item_shop = item_shop->next; + iterator++; + } + return item_shop->quantity; +} +int get_item_index(int index) { + int iterator = 0; + ITEM_SHOP *item_shop = shop; + while(iterator<index) { + item_shop = item_shop->next; + iterator++; + } + return item_shop->index; +} + +void changeQ(void *dp3, int d2) +{ +sprintf(itemCurrenyQ,"%i",d2); +printf("%s\n",itemCurrenyQ); +}
\ No newline at end of file diff --git a/src/gui/shop.h b/src/gui/shop.h index 5aa8548a..8c3869d0 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.h @@ -30,20 +30,28 @@ #include <stdio.h> #include "../graphic/graphic.h" +#include "inventory.h" + struct ITEM_SHOP { char name[30]; int price; short id; + int index; + int quantity; ITEM_SHOP *next; }; extern int n_items; +extern char* selectedItem; +extern char itemCurrenyQ[10]; char *shop_list(int index, int *list_size); void add_buy_item(short id, int price); void add_sell_item(short index, int price); +void changeQ(void *dp3, int d2); void close_shop(); short get_item_id(int index); - +int get_item_quantity(int index); +int get_item_index(int index); #endif |