summaryrefslogtreecommitdiff
path: root/src/dna.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dna.cpp')
-rw-r--r--src/dna.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/dna.cpp b/src/dna.cpp
index 8cef6e0..ac2d500 100644
--- a/src/dna.cpp
+++ b/src/dna.cpp
@@ -14,6 +14,10 @@ DNA::DNA(std::string s)
speed = CREATURE_SPEED;
mutationPercent = CREATURE_MUTATION_PERCENT;
mutationChance = CREATURE_MUTATION_CHANCE;
+ appearance.sides = CREATURE_SIDES;
+ appearance.red = 0;
+ appearance.green = 1;
+ appearance.blue = 1;
}
else if(s == "resource"){
type = RESOURCE_TYPE;
@@ -27,6 +31,10 @@ DNA::DNA(std::string s)
speed = 0;
mutationPercent = 0;
mutationChance = 0;
+ appearance.sides = RESOURCE_SIDES;
+ appearance.red = 0;
+ appearance.green = 1;
+ appearance.blue = 0;
}
}
@@ -44,6 +52,10 @@ DNA DNA::combine(DNA D)
N.speed = (speed + D.speed)/2;
N.mutationPercent = (mutationPercent + D.mutationPercent)/2;
N.mutationChance = (mutationChance + D.mutationChance)/2;
+ N.appearance.sides = CREATURE_SIDES;
+ N.appearance.red = 0;
+ N.appearance.green = 1;
+ N.appearance.blue = 1;
if(roll(mutationChance)){
float pn;