From c86eef1db053a51748cf75a8318604b1d14b5be5 Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Wed, 15 Mar 2017 14:43:08 -0500 Subject: -string comparison is for losers --- src/dna.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/dna.cpp') diff --git a/src/dna.cpp b/src/dna.cpp index dd1d606..1c70f46 100644 --- a/src/dna.cpp +++ b/src/dna.cpp @@ -1,8 +1,8 @@ #include "dna.hpp" -DNA::DNA(std::string s) +DNA::DNA(int type) { - if(s == "herbavore"){ + if(type == HERBAVORE_TYPE){ type = HERBAVORE_TYPE; eatType = PLANT_TYPE; maxHealth = CREATURE_MAX_HEALTH; @@ -20,7 +20,7 @@ DNA::DNA(std::string s) appearance.green = 1; appearance.blue = 1; } - else if(s == "carnivore"){ + else if(type == CARNIVORE_TYPE){ type = CARNIVORE_TYPE; eatType = HERBAVORE_TYPE; maxHealth = CREATURE_MAX_HEALTH; @@ -38,7 +38,7 @@ DNA::DNA(std::string s) appearance.green = 0; appearance.blue = 1; } - else if(s == "plant"){ + else if(type == PLANT_TYPE){ type = PLANT_TYPE; maxHealth = PLANT_MAX_HEALTH; growAmount = PLANT_GROW_AMOUNT; @@ -46,7 +46,7 @@ DNA::DNA(std::string s) appearance.green = 1; appearance.blue = 0; } - else if(s == "corpse"){ + else if(type == CORPSE_TYPE){ type = CORPSE_TYPE; maxHealth = CORPSE_MAX_HEALTH; growAmount = CORPSE_DECAY_AMOUNT; -- cgit v1.2.3