| 306 | } |
| 307 | |
| 308 | void CheckPlayerNearby() |
| 309 | { |
| 310 | int distance, newDdistance, rotations; |
| 311 | |
| 312 | if (pcursmonst != -1) |
| 313 | return; |
| 314 | |
| 315 | int spl = plr[myplr]._pRSpell; |
| 316 | if (FriendlyMode && spl != SPL_RESURRECT && spl != SPL_HEALOTHER) |
| 317 | return; |
| 318 | |
| 319 | for (int i = 0; i < MAX_PLRS; i++) { |
| 320 | if (i == myplr) |
| 321 | continue; |
| 322 | const int mx = plr[i].WorldX; |
| 323 | const int my = plr[i].WorldY; |
| 324 | if (dPlayer[mx][my] == 0 |
| 325 | || !(dFlags[mx][my] & BFLAG_LIT) |
| 326 | || (plr[i]._pHitPoints == 0 && spl != SPL_RESURRECT)) |
| 327 | continue; |
| 328 | |
| 329 | if (plr[myplr]._pwtype == WT_RANGED || HasRangedSpell() || spl == SPL_HEALOTHER) { |
| 330 | newDdistance = GetDistanceRanged(mx, my); |
| 331 | } else { |
| 332 | newDdistance = GetDistance(mx, my, distance); |
| 333 | if (newDdistance == 0) |
| 334 | continue; |
| 335 | } |
| 336 | |
| 337 | if (pcursplr != -1 && distance < newDdistance) |
| 338 | continue; |
| 339 | const int newRotations = GetRotaryDistance(mx, my); |
| 340 | if (pcursplr != -1 && distance == newDdistance && rotations < newRotations) |
| 341 | continue; |
| 342 | |
| 343 | distance = newDdistance; |
| 344 | rotations = newRotations; |
| 345 | pcursplr = i; |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | void FindActor() |
| 350 | { |
no test coverage detected