summaryrefslogtreecommitdiff
path: root/src/creature.cpp
diff options
context:
space:
mode:
authortom <tombarrett@siu.edu>2017-02-12 08:42:55 -0600
committertom <tombarrett@siu.edu>2017-02-12 08:42:55 -0600
commit60bc5dcb19a983e8ae335ba89f860c59473303fb (patch)
tree6f232f9db0d71678ce593a765b88f4934976ed83 /src/creature.cpp
parent1da46794f74ebd8f445fcd70cbe0420eadb648e4 (diff)
-added DNA combining, currently it just takes the average of the mother and father
-there maybe a random segfault, further investigation is needed
Diffstat (limited to 'src/creature.cpp')
-rw-r--r--src/creature.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/creature.cpp b/src/creature.cpp
index 0b7a438..1cd0a52 100644
--- a/src/creature.cpp
+++ b/src/creature.cpp
@@ -107,7 +107,7 @@ void Creature::Action()
hasTarget = false;
}
else if( Distance(rect,target->getRect()) < mine.reach && target->getType() == CREATURE_TYPE && target->getGender() != gender ){
- target->impregnate();
+ target->impregnate(mine);
hasTarget = false;
}
else
@@ -157,10 +157,11 @@ void Creature::Move(SDL_Rect R)
}
}
-void Creature::impregnate()
+void Creature::impregnate(Dna D)
{
if(!pregnate){
pregnate = true;
pregnancyTime = 0;
+ childs = mine.combine(D);
}
}