diff options
Diffstat (limited to 'src/list.cpp')
-rw-r--r-- | src/list.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/list.cpp b/src/list.cpp index c3246c9..2612d3e 100644 --- a/src/list.cpp +++ b/src/list.cpp @@ -19,10 +19,20 @@ List::List(Window m) void List::Behavior() { - int i; + int i, j; + std::vector<Location> Z; + for(i = 0; i < C.size(); i++) { C[i].Behavior(); + for(j = 0; j < L.size(); j++) + if(200>(Distance(C[i].getLocation(),L[j]))) + { + Z.push_back(L[j]); + } + + C[i].giveKnown(Z); + Z.clear(); } } @@ -31,7 +41,7 @@ void List::Place() int i; for(i = 0;i < L.size(); i++) - if(L.getType()==1) + if(L[i].t==1) L.erase(L.begin()+i); for(i = 0; i < C.size(); i++) @@ -45,3 +55,10 @@ void List::Place() R[i].Place(); } } + +double List::Distance(Location A, Location B) +{ + double z = sqrt(pow(A.x-B.x,2)+pow(A.y-B.y,2)); + //std::cout << z << "\n"; + return z; +} |