diff options
author | Tom <spalf0@gmail.com> | 2015-08-01 12:56:55 -0500 |
---|---|---|
committer | Tom <spalf0@gmail.com> | 2015-08-01 12:56:55 -0500 |
commit | 1ddb996ac4a4fc78e5484acdadac2df95006b632 (patch) | |
tree | 853b1e65b6c8c08533c91ae08acf7b699cce2538 /src/list.cpp | |
parent | 6b967f3bd7a3e7203b57bd9e4edb0db82bc9ed1c (diff) |
pushing before format
Diffstat (limited to 'src/list.cpp')
-rw-r--r-- | src/list.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/list.cpp b/src/list.cpp index 93d2312..379a113 100644 --- a/src/list.cpp +++ b/src/list.cpp @@ -4,7 +4,7 @@ List::List(Window m) //Constructor { int i; - for(i=0;i<25;i++) + for(i=0;i<3;i++) { Creature X(m,"img/Cbasic.png"); C.push_back(X); @@ -25,6 +25,14 @@ void List::Place() for(vector<Creature>::iterator it = C.begin(); it!=C.end(); it++) it->Place(); + /* + if(R.size()<15) + { + Resource Y(m,"img/Rbasic.png"); + R.push_back(Y); + } + */ + //places all resources for(int j = 0; j<R.size(); j++) { @@ -44,12 +52,24 @@ void List::Behavior() vector<Resource*> N; for(int j = 0; j < R.size(); j++) - if(250>Distance(C[i].getLocation(),R[j].getLocation())) + if(C[i].getBestSense()>Distance(C[i].getLocation(),R[j].getLocation())) N.push_back(&R[j]); - - C[i].give(N); + + C[i].giveR(N); N.clear(); + vector<Creature*> M; + for(int j = 0; j < C.size(); j++) + { + if(j==i) + continue; + else if(C[i].getBestSense()>Distance(C[i].getLocation(),C[j].getLocation())) + M.push_back(&C[j]); + } + + C[i].giveC(M); + M.clear(); + // This kills the creature if(C[i].getHealth()<=0) { |