From e2fb36d5da705278fb84246400945f430794d5e7 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 28 Apr 2016 11:45:52 -0400 Subject: CAT --- include/common.hpp | 2 +- include/entities.hpp | 1 + include/mob.hpp | 13 +++++++++++++ include/world.hpp | 6 ++++-- 4 files changed, 19 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/common.hpp b/include/common.hpp index 1f7b9fc..c30f861 100644 --- a/include/common.hpp +++ b/include/common.hpp @@ -165,7 +165,7 @@ extern std::mutex mtx; * */ -#define HLINES(n) (game::HLINE * n) +#define HLINES(n) (static_cast(game::HLINE * n)) /** * A 'wrapper' for libc's srand(), as we hope to eventually have our own random number diff --git a/include/entities.hpp b/include/entities.hpp index 567380a..8620206 100644 --- a/include/entities.hpp +++ b/include/entities.hpp @@ -281,6 +281,7 @@ public: class Player : public Entity{ public: + Entity *ride; QuestHandler qh; Player(); diff --git a/include/mob.hpp b/include/mob.hpp index 9f006b9..48be456 100644 --- a/include/mob.hpp +++ b/include/mob.hpp @@ -17,13 +17,17 @@ class Mob : public Entity { protected: unsigned int actCounter; unsigned int actCounterInitial; + bool ridable; public: + Entity *rider; bool aggressive; std::string heyid; + Mob(void); ~Mob(void); void wander(void); + void ride(Entity *e); virtual void act(void) =0; virtual bool bindTex(void) =0; virtual void createFromXML(const XMLElement *e) =0; @@ -53,6 +57,15 @@ public: void createFromXML(const XMLElement *e); }; +class Cat : public Mob { +public: + Cat(void); + + void act(void); + bool bindTex(void); + void createFromXML(const XMLElement *e); +}; + class Rabbit : public Mob { public: Rabbit(void); diff --git a/include/world.hpp b/include/world.hpp index b99e9ab..9566184 100644 --- a/include/world.hpp +++ b/include/world.hpp @@ -182,6 +182,8 @@ public: // gets the nearest interactable entity to the given one Entity *getNearInteractable(Entity &e); + Mob *getNearMob(Entity &e); + // gets the coordinates of the `index`th structure vec2 getStructurePos(int index); @@ -213,8 +215,8 @@ public: std::string getToRight(void) const; // attempts to enter the left/right adjacent world, returning either that world or this - World *goWorldLeft(Player *p); - World *goWorldRight(Player *p); + std::pair goWorldLeft(Player *p); + std::pair goWorldRight(Player *p); // attempts to move an NPC to the left adjacent world, returning true on success bool goWorldLeft(NPC *e); -- cgit v1.2.3