diff options
author | tom <tom@ground-control> | 2015-05-07 12:35:15 -0500 |
---|---|---|
committer | tom <tom@ground-control> | 2015-05-07 12:35:15 -0500 |
commit | ffcee12acf3fe3f972f322c18b3203212682205d (patch) | |
tree | ac300fa0808b8f6218669e3f14b1d0b784bc7055 /src/list.cpp | |
parent | e91f0c208605f27d2ba9e2a9c584c92212ab0088 (diff) |
woo! detection is implemented albeit shitty
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; +} |