From 1da46794f74ebd8f445fcd70cbe0420eadb648e4 Mon Sep 17 00:00:00 2001 From: tom Date: Sun, 12 Feb 2017 07:57:21 -0600 Subject: -removed grouping --- src/creature.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/creature.cpp') 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 ::iterator it = N.begin(); it!=N.end(); it++){ + std::random_shuffle(N.begin(),N.end()); + for(std::vector ::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 ::iterator it = N.begin(); it!=N.end(); it++) + for(std::vector ::iterator it = N.begin(); it!=N.end(); it++) if( target == *it ) return; hasTarget = false; - return; } -- cgit v1.2.3