summaryrefslogtreecommitdiff
path: root/src/gui/shop.cpp
diff options
context:
space:
mode:
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);