Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- long GetNearestPlayerNumberToCoords(word playerNum, float x, float y){
- float aDistance = 2500000000;
- float aTemp = 0;
- long lLowest = 0;
- __try {
- for(unsigned int i = 1;i < maxAgent;i++){
- if(Agents[i] == NULL){continue;}
- if(Agents[i]->PlayerNumber != playerNum){continue;}
- if(Agents[i]->HP == 0){continue;}
- aTemp = (pow((Agents[i]->Y - y), 2) + pow((Agents[i]->X - x), 2));
- if(aDistance > aTemp){
- lLowest = i;
- aDistance = aTemp;
- }
- }
- }
- __except(1) {
- return false;
- }
- return lLowest;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement