| 1040 | } |
| 1041 | |
| 1042 | NavMesh *AIPlayer::findNavMesh() const |
| 1043 | { |
| 1044 | // Search for NavMeshes that contain us entirely with the smallest possible |
| 1045 | // volume. |
| 1046 | NavMesh *mesh = NULL; |
| 1047 | SimSet *set = NavMesh::getServerSet(); |
| 1048 | for(U32 i = 0; i < set->size(); i++) |
| 1049 | { |
| 1050 | NavMesh *m = static_cast<NavMesh*>(set->at(i)); |
| 1051 | if(m->getWorldBox().isContained(getWorldBox())) |
| 1052 | { |
| 1053 | // Check that mesh size is appropriate. |
| 1054 | if(mMount.object) // Should use isMounted() but it's not const. Grr. |
| 1055 | { |
| 1056 | if(!m->mVehicles) |
| 1057 | continue; |
| 1058 | } |
| 1059 | else |
| 1060 | { |
| 1061 | if((getNavSize() == Small && !m->mSmallCharacters) || |
| 1062 | (getNavSize() == Regular && !m->mRegularCharacters) || |
| 1063 | (getNavSize() == Large && !m->mLargeCharacters)) |
| 1064 | continue; |
| 1065 | } |
| 1066 | if(!mesh || m->getWorldBox().getVolume() < mesh->getWorldBox().getVolume()) |
| 1067 | mesh = m; |
| 1068 | } |
| 1069 | } |
| 1070 | return mesh; |
| 1071 | } |
| 1072 | |
| 1073 | DefineEngineMethod(AIPlayer, findNavMesh, S32, (),, |
| 1074 | "@brief Get the NavMesh object this AIPlayer is currently using.\n\n" |
nothing calls this directly
no test coverage detected