From 30dd8efe8d71648bea7604ebee5afc4d55b25a6b Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Fri, 4 Mar 2016 08:42:00 -0500 Subject: You can buy sausages from meme --- include/entities.h | 45 ++++++++++++++------------------------------- include/inventory.h | 2 +- include/ui.h | 2 +- 3 files changed, 16 insertions(+), 33 deletions(-) (limited to 'include') diff --git a/include/entities.h b/include/entities.h index 0714650..b39923b 100644 --- a/include/entities.h +++ b/include/entities.h @@ -52,38 +52,20 @@ enum BUILD_SUB{ STALL_TRADER = 71 }; -class BuySell{ +class Trade{ public: - int member; - // 0 = Buy/Sell - // 1 = Trade - union{ - struct{ - std::string item; - std::string itemt; - }trade; - struct{ - int type; - // 0 = buy - // 1 = sell - std::string item; - int price; - }cost; - }; - BuySell(int typ, std::string itm, int prc){ - this->cost.type = typ; - this->cost.item = itm; - this->cost.price = prc; - this->member = 0; - } - BuySell(std::string itm, std::string itmt){ - this->trade.item = itm; - this->trade.itemt = itmt; - this->member = 1; + std::string item[2]; + int quantity[2]; + Trade(int qo, const char* o, int qt, const char* t){ + item[0] = o; + item[1] = t; + + quantity[0] = qo; + quantity[1] = qt; + + std::cout << "Trading: " << quantity[0] << " " << item[0] << " for " << quantity[1] << " " << item[1] << std::endl; } - ~BuySell(){} - BuySell(const BuySell&){} - BuySell(){} + Trade(){} }; class World; @@ -233,7 +215,8 @@ public: class Merchant : public NPC{ public: - std::vectorbsinv; + std::vectortrade; + void interact(); Merchant(); diff --git a/include/inventory.h b/include/inventory.h index cf6e480..69cf073 100644 --- a/include/inventory.h +++ b/include/inventory.h @@ -62,7 +62,7 @@ void initInventorySprites(void); void destroyInventory(void); const char *getItemTexturePath(std::string name); -Texturec *getItemTexture(std::string name); +GLuint getItemTexture(std::string name); float getItemWidth(std::string name); float getItemHeight(std::string name); diff --git a/include/ui.h b/include/ui.h index 667a581..ed9fb94 100644 --- a/include/ui.h +++ b/include/ui.h @@ -146,7 +146,7 @@ namespace ui { */ void dialogBox(const char *name,const char *opt,bool passive,const char *text,...); - void merchantBox(const char *name, std::vector *items, const char *opt,bool passive,const char *text,...); + void merchantBox(const char *name,Trade trade,const char *opt,bool passive,const char *text,...); void merchantBox(); void waitForDialog(void); -- cgit v1.2.3