summaryrefslogtreecommitdiff
path: root/src/gui/shop.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2004-10-02 10:40:58 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2004-10-02 10:40:58 +0000
commitace84beb9ef458b49d2c502c13f70c1aa6cc5da3 (patch)
tree7c034cb33f3c2c317a3acb98f44adc34b53d5df5 /src/gui/shop.cpp
parentcc2cf7a80788b725b5ce4ba616969172c62e9f8b (diff)
downloadmana-ace84beb9ef458b49d2c502c13f70c1aa6cc5da3.tar.gz
mana-ace84beb9ef458b49d2c502c13f70c1aa6cc5da3.tar.bz2
mana-ace84beb9ef458b49d2c502c13f70c1aa6cc5da3.tar.xz
mana-ace84beb9ef458b49d2c502c13f70c1aa6cc5da3.zip
*** empty log message ***
Diffstat (limited to 'src/gui/shop.cpp')
-rw-r--r--src/gui/shop.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp
index 530df8f4..3065f8ea 100644
--- a/src/gui/shop.cpp
+++ b/src/gui/shop.cpp
@@ -25,8 +25,6 @@
#include "shop.h"
-#include <allegro.h>
-
int n_items;
ITEM_SHOP *shop = NULL;
@@ -50,7 +48,27 @@ char *shop_list(int index, int *list_size) {
}
}
-void add_item(short id, int price) {
+void add_buy_item(short id, int price) {
+ ITEM_SHOP *item_shop = (ITEM_SHOP *)malloc(sizeof(ITEM_SHOP));
+ if(id-501>=0 && id-501<=2)
+ sprintf(item_shop->name, "%s %i gp", item_db[id-501], price);
+ else
+ sprintf(item_shop->name, "Unknown item %i gp", price);
+ item_shop->price = price;
+ item_shop->id = id;
+ item_shop->next = NULL;
+ if(shop==NULL)
+ shop = item_shop;
+ else {
+ ITEM_SHOP *temp = shop;
+ while(temp->next)
+ temp = temp->next;
+ temp->next = item_shop;
+ }
+}
+
+void add_sell_item(short index, int price) {
+ int id = inventory.items[index].id;
ITEM_SHOP *item_shop = (ITEM_SHOP *)malloc(sizeof(ITEM_SHOP));
if(id-501>=0 && id-501<=2)
sprintf(item_shop->name, "%s %i gp", item_db[id-501], price);