diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/list.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/list.cpp b/src/list.cpp index ca69a4d..30b0eb1 100644 --- a/src/list.cpp +++ b/src/list.cpp @@ -41,9 +41,7 @@ void List::Behavior() it->Behavior(); if(it->getPregnancyReady()){ - DNA d = it->getChildsDNA(); - Rectangle tmp = it->getRectangle(); - Creature X(tmp,d); + Creature X(it->getRectangle(),it->getChildsDNA()); creatures.push_back(X); it->hadPregnancy(); } @@ -74,12 +72,16 @@ void List::Place() } } -std::vector<Entity*> List::getNear(Creature nC) +std::vector<Entity*> List::getNear(Creature c) { - std::vector<Entity*> N; - N = tree.retrieve(N, nC.getGFXD()); + std::vector<Entity*> near; + near = tree.retrieve(near, c.getGFXD()); - return N; + for(std::vector<Entity*>::iterator it = near.begin(); it!= near.end(); it++) + if(c.getBestSense() < Distance(c.getRectangle(),(*it)->getRectangle())) + near.erase(it--); + + return near; } std::vector<GraphicsData> List::drawQuadTree(){ |