summaryrefslogtreecommitdiff
path: root/src/list.cpp
diff options
context:
space:
mode:
authormajortom6 <tombarrett@siu.edu>2017-03-05 13:13:44 -0600
committerTom Barrett <tombarrett@siu.edu>2017-03-07 13:23:42 -0600
commit8f5a73f1daba39c8b0175036cf688f8ce1399a8f (patch)
tree1bd365c1eb41d1b6f19ccac747919b2b762b72c0 /src/list.cpp
parentdfda3f2a5e555d3173359134f4994bcd12d129f8 (diff)
-added carnivores
-removed creature type constant and replaced it with herbavore/carnivore type -replaced resource type with plant type -added eatType to dna (whatever the organism goes for hunger)
Diffstat (limited to 'src/list.cpp')
-rw-r--r--src/list.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/list.cpp b/src/list.cpp
index d4b9529..9d32b21 100644
--- a/src/list.cpp
+++ b/src/list.cpp
@@ -3,15 +3,21 @@
List::List()
{
int i;
- DNA d = DNA("creature");
+ DNA d = DNA("herbavore");
Rectangle tmp;
- for(i=0;i<CREATURES;i++){
+ for(i=0;i<HERBAVORES;i++){
Organism X(tmp,d);
creatures.push_back(X);
}
- d = DNA("resource");
- for(i=0;i<RESOURCES;i++){
+ d = DNA("carnivore");
+ for(i=0;i<CARNIVORES;i++){
+ Organism X(tmp, d);
+ creatures.push_back(X);
+ }
+
+ d = DNA("plant");
+ for(i=0;i<PLANTS;i++){
Organism X(tmp, d);
resources.push_back(X);
}
@@ -24,7 +30,7 @@ void List::Remove()
{
for(std::list<Organism>::iterator it = creatures.begin(); it!= creatures.end(); it++)
if(it->getHealth()<=0){
- DNA d = DNA("resource");
+ DNA d = DNA("plant");
Organism X(it->getRectangle(), d);
resources.push_back(X);
creatures.erase(it--);
@@ -58,8 +64,8 @@ void List::Place()
tree.clear();
Rectangle tmp;
- DNA d = DNA("resource");
- while(resources.size() < MINIMUM_RESOURCES){
+ DNA d = DNA("plant");
+ while(resources.size() < MINIMUM_PLANTS){
Organism X(tmp, d);
resources.push_back(X);
}