From 4df411931dd63f22258be76911e0648c3cdc3936 Mon Sep 17 00:00:00 2001
From: drumsetmonkey <abelleisle@roadrunner.com>
Date: Fri, 26 Feb 2016 08:28:48 -0500
Subject: Merchants kinda work...

---
 include/common.h   |  3 +++
 include/entities.h | 30 ++++++++++++++++++++++++++----
 include/ui.h       |  7 ++++---
 include/world.h    |  8 ++++++++
 4 files changed, 41 insertions(+), 7 deletions(-)

(limited to 'include')

diff --git a/include/common.h b/include/common.h
index a99e352..cbfc507 100644
--- a/include/common.h
+++ b/include/common.h
@@ -18,6 +18,7 @@
 #include <thread>
 #include <mutex>
 #include <future>
+#include <threadpool.h>
 
 #define GLEW_STATIC
 #include <GL/glew.h>
@@ -113,6 +114,8 @@ extern unsigned int SCREEN_WIDTH;
 extern unsigned int SCREEN_HEIGHT;
 
 extern bool FULLSCREEN;
+extern bool uiLoop;
+extern std::mutex mtx;
 
 /**
  * Define the length of a single HLINE.
diff --git a/include/entities.h b/include/entities.h
index 926eeae..6c8e658 100644
--- a/include/entities.h
+++ b/include/entities.h
@@ -22,13 +22,13 @@ enum _TYPE {
 	STRUCTURET,
 	PLAYERT,
 	NPCT,
+	MERCHT,
 	MOBT
 };
 
 enum GENDER{
 	MALE,
-	FEMALE,
-	TRANSBULLSHIT
+	FEMALE
 };
 
 enum MOB_SUB {
@@ -47,7 +47,9 @@ enum BUILD_SUB{
 	HOUSE4 = 4,
 	FOUNTAIN = 5,
 	LAMP_POST = 6,
-	FIRE_PIT = 7
+	FIRE_PIT = 7,
+	STALL_MARKET = 70,
+	STALL_TRADER = 71
 };
 
 class World;
@@ -191,10 +193,30 @@ public:
 	
 	void addAIFunc(int (*func)(NPC *),bool preload);
 	void clearAIFunc(void);
-	void interact();
+	virtual void interact();
 	void wander(int);
 };
 
+class Merchant : public NPC{
+public:
+	union BSINV{
+		struct EQUAL{
+			std::string item1;
+			std::string item2;
+		};
+
+		struct COST{
+			std::string item;
+			int price;
+		};
+	};
+	std::vector<BSINV>bsinv;
+	void interact();
+
+	Merchant();
+	~Merchant();
+};
+
 class Structures : public Entity{
 public:
 	BUILD_SUB bsubtype;
diff --git a/include/ui.h b/include/ui.h
index 6a81ff8..0499570 100644
--- a/include/ui.h
+++ b/include/ui.h
@@ -108,9 +108,9 @@ namespace ui {
 	extern bool posFlag;
 	
 	extern unsigned char dialogOptChosen;
-	extern bool dialogBoxExists;
-	extern bool dialogImportant;
-	extern bool dialogPassive;
+	extern bool 		 dialogBoxExists;
+	extern bool 		 dialogImportant;
+	extern bool 		 dialogPassive;
 
 	extern unsigned int textWrapLimit;
 
@@ -148,6 +148,7 @@ namespace ui {
 	*/
 	
 	void dialogBox(const char *name,const char *opt,bool passive,const char *text,...);
+	void merchantBox(const char *name,const char *opt,bool passive,const char *text,...);
 	void waitForDialog(void);
 	
 	/*
diff --git a/include/world.h b/include/world.h
index f9e952e..7338097 100644
--- a/include/world.h
+++ b/include/world.h
@@ -101,6 +101,8 @@ struct Village{
 	}
 };
 
+extern Player *player;
+
 /**
  * The world class. This class does everything a world should do.
  */
@@ -215,6 +217,10 @@ public:
 	
 	char *setToRight(const char *file);
 
+	void callUpdate(){
+		this->update(player,deltaTime);
+	}
+
 
 	/**
 	 * A vector of pointers to every NPC, Structure, Mob, and Object in this
@@ -228,6 +234,7 @@ public:
 	 */
 
 	std::vector<NPC			*>	npc;
+	std::vector<Merchant    *>  merchant;
 	
 	/**
 	 * A vector of all Structures in this world.
@@ -310,6 +317,7 @@ public:
 	 */
 	
 	void addNPC(float x,float y);
+	void addMerchant(float x, float y);
 	
 	/**
 	 * Adds an object to the world with the specified item id and coordinates.
-- 
cgit v1.2.3