summaryrefslogtreecommitdiff
path: root/src/creature.cpp
diff options
context:
space:
mode:
authortom <tombarrett@siu.edu>2017-02-12 07:57:21 -0600
committertom <tombarrett@siu.edu>2017-02-12 07:57:21 -0600
commit1da46794f74ebd8f445fcd70cbe0420eadb648e4 (patch)
treefee655a50188e50b7c63d6b855bc671e0a1b0128 /src/creature.cpp
parent358ea01c03d787377ef88945706f350befd5b7a9 (diff)
-removed grouping
Diffstat (limited to 'src/creature.cpp')
-rw-r--r--src/creature.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/creature.cpp b/src/creature.cpp
index 7a86af9..0b7a438 100644
--- a/src/creature.cpp
+++ b/src/creature.cpp
@@ -14,8 +14,11 @@ Creature::Creature(Window M, SDL_Rect R, Dna D)
type = CREATURE_TYPE;
health = mine.maxHealth/2;
gender = rand() % 2;
+ age = 0;
+ pregnancyTime = 0;
able = true;
pregnancyReady = false;
+ pregnate = false;
}
void Creature::Behavior()
@@ -56,7 +59,8 @@ void Creature::Priority()
void Creature::setTarget()
{
- for(std::list <Entity*>::iterator it = N.begin(); it!=N.end(); it++){
+ std::random_shuffle(N.begin(),N.end());
+ for(std::vector <Entity*>::iterator it = N.begin(); it!=N.end(); it++){
if( (*it)->getType() == RESOURCE_TYPE && hungry){
target = *it;
hasTarget = true;
@@ -80,12 +84,11 @@ void Creature::setTarget()
void Creature::checkTarget()
{
- for(std::list <Entity*>::iterator it = N.begin(); it!=N.end(); it++)
+ for(std::vector <Entity*>::iterator it = N.begin(); it!=N.end(); it++)
if( target == *it )
return;
hasTarget = false;
- return;
}