diff options
author | tom <tom@ground-control> | 2016-05-02 18:23:19 -0500 |
---|---|---|
committer | tom <tom@ground-control> | 2016-05-02 18:23:19 -0500 |
commit | 0346965968fb5da1a52ed8f896a922c63ce180f6 (patch) | |
tree | 917da10ed0e0e86a76abe4f3634cb6cf5b8a4fc6 /src | |
parent | 4bb5b05443c36bc6e0a164bc7e324a5486be45ff (diff) |
done refractoring type
Diffstat (limited to 'src')
-rw-r--r-- | src/creature.cpp | 12 | ||||
-rw-r--r-- | src/resource.cpp | 4 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/creature.cpp b/src/creature.cpp index 9404ba2..f2b85e5 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -10,7 +10,8 @@ Creature::Creature(Window m, std::string s) L.y=yTarget=rand()%800; L.x=xTarget=rand()%1200; - + type = 1; + hasTarget = false; wandering = false; able = true; @@ -23,16 +24,13 @@ int Creature::Behavior() this->Priority(); - if(this->Action()) - { - if(nR.size()) - { + if(this->Action()){ + if(nR.size()){ nR[n]->eat(); if(health<maxHealth) health+=10; } } - return 0; } @@ -82,7 +80,7 @@ void Creature::Priority() } else { - Location L(xTarget,yTarget,1); + Location L(xTarget,yTarget); if(Distance(this->getLocation(),L)<5) wandering = false; hasTarget = false; diff --git a/src/resource.cpp b/src/resource.cpp index 8b00e0a..08929bc 100644 --- a/src/resource.cpp +++ b/src/resource.cpp @@ -7,7 +7,7 @@ Resource::Resource(Window m, std::string s) L.y = rand()%800; L.x = rand()%1200; - L.type = 2; + type = 2; amount = 100; } @@ -19,7 +19,7 @@ Resource::Resource(Window m, std::string s, Location z) L.y = z.y; L.x = z.x; - L.type = 2; + type = 2; amount = 100; } |