| 970 | }; |
| 971 | |
| 972 | static void findCoverCallback(SceneObject *obj, void *key) |
| 973 | { |
| 974 | CoverPoint *p = dynamic_cast<CoverPoint*>(obj); |
| 975 | if(!p || p->isOccupied()) |
| 976 | return; |
| 977 | CoverSearch *s = static_cast<CoverSearch*>(key); |
| 978 | Point3F dir = s->from - p->getPosition(); |
| 979 | dir.normalizeSafe(); |
| 980 | // Score first based on angle of cover point to enemy. |
| 981 | F32 score = mDot(p->getNormal(), dir); |
| 982 | // Score also based on distance from seeker. |
| 983 | score -= (p->getPosition() - s->loc).len() / s->dist; |
| 984 | // Finally, consider cover size. |
| 985 | score += (p->getSize() + 1) / CoverPoint::NumSizes; |
| 986 | score *= p->getQuality(); |
| 987 | if(score > s->best) |
| 988 | { |
| 989 | s->best = score; |
| 990 | s->point = p; |
| 991 | } |
| 992 | } |
| 993 | |
| 994 | bool AIPlayer::findCover(const Point3F &from, F32 radius) |
| 995 | { |
nothing calls this directly
no test coverage detected