From 4bb5b05443c36bc6e0a164bc7e324a5486be45ff Mon Sep 17 00:00:00 2001 From: tom Date: Mon, 2 May 2016 18:15:26 -0500 Subject: commiting before refractoring type out of location and into entity --- inc/creature.hpp | 4 +++- inc/entity.hpp | 3 ++- inc/resource.hpp | 3 ++- src/resource.cpp | 6 ------ src/timer.cpp | 6 ++---- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/inc/creature.hpp b/inc/creature.hpp index f3bd723..ffff888 100644 --- a/inc/creature.hpp +++ b/inc/creature.hpp @@ -31,12 +31,14 @@ class Creature: public Entity int health; int maxHealth; int hunger; - int speed = 2; + int speed = 1; bool able; int bestSense = 100; vector nR; //vector containing resources near the creature vector nC; //vector containing creatures near the creature + vector N; + int n; }; diff --git a/inc/entity.hpp b/inc/entity.hpp index 3555c62..ee42858 100644 --- a/inc/entity.hpp +++ b/inc/entity.hpp @@ -14,7 +14,8 @@ class Entity Location L; int height, width; //Dimensions of image on window int degrees = 0; - SDL_Texture* texture; + int type = 0; + SDL_Texture* texture; SDL_Renderer* renderer; }; diff --git a/inc/resource.hpp b/inc/resource.hpp index 5c45f96..968c208 100644 --- a/inc/resource.hpp +++ b/inc/resource.hpp @@ -9,8 +9,9 @@ class Resource: public Entity public: Resource(Window m, std::string s); Resource(Window m, std::string s, Location z); - Location getLocation(); void eat(); + + Location getLocation(){return L;}; int getAmount(){return amount;}; private: diff --git a/src/resource.cpp b/src/resource.cpp index 9583f14..8b00e0a 100644 --- a/src/resource.cpp +++ b/src/resource.cpp @@ -24,12 +24,6 @@ Resource::Resource(Window m, std::string s, Location z) amount = 100; } -Location Resource::getLocation() -{ - //Location L(xPosition,yPosition,2); - return L; -} - void Resource::eat() { amount-=10; diff --git a/src/timer.cpp b/src/timer.cpp index b59bec8..3a0b55e 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -31,8 +31,7 @@ void Timer::Pause() void Timer::unPause() { - if (paused) - { + if (paused){ paused = false; startTicks = SDL_GetTicks() - pausedTicks; pausedTicks = 0; @@ -41,8 +40,7 @@ void Timer::unPause() int Timer::getTicks() { - if(started) - { + if(started){ if (paused) return pausedTicks; else -- cgit v1.2.3