summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortom <tom@ground-control>2016-05-02 16:29:28 -0500
committertom <tom@ground-control>2016-05-02 16:29:28 -0500
commiteac63735fb84ba3b59b5fc887d959e1492ef246d (patch)
treef5feb17bb2cf4e909b349c154a74a396e3b7fa97
parent084d556f831832c1ca15d1e7cd52944815d9beea (diff)
spring cleaning
-rw-r--r--inc/creature.hpp4
-rw-r--r--src/creature.cpp9
-rw-r--r--src/entity.cpp2
-rw-r--r--src/list.cpp6
4 files changed, 5 insertions, 16 deletions
diff --git a/inc/creature.hpp b/inc/creature.hpp
index 875b498..f3bd723 100644
--- a/inc/creature.hpp
+++ b/inc/creature.hpp
@@ -12,10 +12,10 @@ class Creature: public Entity
int Behavior();
bool Action();
void Priority();
- Location getLocation();
void giveR(vector<Resource*> n){nR=n;};
void giveC(vector<Creature*> n){nC=n;};
-
+
+ Location getLocation(){return L;};
double Distance(Location A, Location B){return sqrt(pow(A.x-B.x,2)+pow(A.y-B.y,2));};
int getHealth(){return health;};
bool doesItHaveTarget(){return hasTarget;};
diff --git a/src/creature.cpp b/src/creature.cpp
index 01882a3..9404ba2 100644
--- a/src/creature.cpp
+++ b/src/creature.cpp
@@ -157,12 +157,3 @@ bool Creature::Action()
return false;
}
-
-Location Creature::getLocation()
-{
- //returns location object of the specific creature
- //Location L(xPosition, yPosition, 1);
- return L;
-}
-
-
diff --git a/src/entity.cpp b/src/entity.cpp
index 909dd15..4f60851 100644
--- a/src/entity.cpp
+++ b/src/entity.cpp
@@ -6,7 +6,7 @@ void Entity::Place()
SDL_RenderCopyEx(renderer,texture,NULL,&rect,degrees,NULL,SDL_FLIP_NONE);
}
-SDL_Texture* Entity::loadTexture(std::string path, Window main)
+SDL_Texture* Entity::loadTexture(string path, Window main)
{
SDL_Surface* surface = IMG_Load(path.c_str());
SDL_SetColorKey(surface, SDL_TRUE, SDL_MapRGB(surface->format, 255, 255, 255));
diff --git a/src/list.cpp b/src/list.cpp
index 464ac48..e2724f3 100644
--- a/src/list.cpp
+++ b/src/list.cpp
@@ -1,6 +1,6 @@
#include "list.hpp"
-List::List(Window m) //Constructor
+List::List(Window m)
{
int i;
@@ -20,12 +20,10 @@ List::List(Window m) //Constructor
}
void List::Place()
-{
- //places each creature on window
+{
for(vector<Creature>::iterator it = C.begin(); it!=C.end(); it++)
it->Place();
-
for(vector<Resource>::iterator it = R.begin(); it!=R.end(); it++){
if(it->getAmount()<=0)
R.erase(it--);