summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Barrett <tombarrett@cornell.engr.siu.edu>2015-05-06 14:03:33 -0500
committerTom Barrett <tombarrett@cornell.engr.siu.edu>2015-05-06 14:03:33 -0500
commite91f0c208605f27d2ba9e2a9c584c92212ab0088 (patch)
treeb352e62e57c9375fc38bfab17e36a459200c2f65
parenta67acef63379f9fd9f5bd983b70a81c50c544eda (diff)
made list vector not get infinitly big
-rw-r--r--inc/location.hpp4
-rw-r--r--src/creature.cpp10
-rw-r--r--src/list.cpp5
3 files changed, 11 insertions, 8 deletions
diff --git a/inc/location.hpp b/inc/location.hpp
index c4428f5..2042734 100644
--- a/inc/location.hpp
+++ b/inc/location.hpp
@@ -7,9 +7,9 @@ class Location
Location(){x=y=t=0;};
Location(int x, int y, int z){};
int getType(){return t;};
-
+
private:
- int x;
+ int x;
int y;
int t;
};
diff --git a/src/creature.cpp b/src/creature.cpp
index 2e5e1ab..9d50291 100644
--- a/src/creature.cpp
+++ b/src/creature.cpp
@@ -20,13 +20,13 @@ Creature::Creature(Window m, std::string s)
void Creature::Behavior()
{
hp--;
- //Detection
+ //Detection
- //Priorities
+ //Priorities
- //Action
- this->Action();
+ //Action
+ this->Action();
}
void Creature::Action()
@@ -76,8 +76,6 @@ void Creature::Action()
}
}
-
-
/*
else
{
diff --git a/src/list.cpp b/src/list.cpp
index b8a809c..c3246c9 100644
--- a/src/list.cpp
+++ b/src/list.cpp
@@ -29,6 +29,11 @@ void List::Behavior()
void List::Place()
{
int i;
+
+ for(i = 0;i < L.size(); i++)
+ if(L.getType()==1)
+ L.erase(L.begin()+i);
+
for(i = 0; i < C.size(); i++)
{
C[i].Place();