/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
| 3065 | // |
| 3066 | //////////////////////////////////////////////////////////////////////////////////////// |
| 3067 | bool NAV::SafePathExists(const CVec3& startVec, const CVec3& stopVec, const CVec3& danger, float dangerDistSq) |
| 3068 | { |
| 3069 | mUser.ClearActor(); |
| 3070 | |
| 3071 | |
| 3072 | // If Either Start Or End Is Invalid, We Can't Do Any Pathing |
| 3073 | //------------------------------------------------------------ |
| 3074 | NAV::TNodeHandle target = GetNearestNode(stopVec.v, 0, 0, 0, true); |
| 3075 | if (target==WAYPOINT_NONE) |
| 3076 | { |
| 3077 | return false; |
| 3078 | } |
| 3079 | |
| 3080 | NAV::TNodeHandle start = GetNearestNode(startVec.v, 0, target, 0, true); |
| 3081 | if (start==WAYPOINT_NONE) |
| 3082 | { |
| 3083 | return false; |
| 3084 | } |
| 3085 | |
| 3086 | // Convert Edges To Points |
| 3087 | //------------------------ |
| 3088 | if (start<0) |
| 3089 | { |
| 3090 | start = mGraph.get_edge(abs(start)).mNodeA; |
| 3091 | } |
| 3092 | if (target<0) |
| 3093 | { |
| 3094 | target = mGraph.get_edge(abs(target)).mNodeA; |
| 3095 | } |
| 3096 | if (start==target) |
| 3097 | { |
| 3098 | return true; |
| 3099 | } |
| 3100 | |
| 3101 | |
| 3102 | // First Step: Find The Actor And Make Sure He Has A Path User Struct |
| 3103 | //-------------------------------------------------------------------- |
| 3104 | SPathUser& puser = mPathUserMaster; |
| 3105 | puser.mLastUseTime = level.time; |
| 3106 | |
| 3107 | |
| 3108 | // Now, Check To See If He Already Has Found A Path To This Target |
| 3109 | //----------------------------------------------------------------- |
| 3110 | if (puser.mEnd==target && level.time<puser.mLastAStarTime) |
| 3111 | { |
| 3112 | return puser.mSuccess; |
| 3113 | } |
| 3114 | |
| 3115 | |
| 3116 | |
| 3117 | // Setup The Search |
| 3118 | //------------------ |
| 3119 | mSearch.mStart = start; |
| 3120 | mSearch.mEnd = target; |
| 3121 | puser.mEnd = target; |
| 3122 | |
| 3123 | |
| 3124 | // First Check The Region |
nothing calls this directly
no test coverage detected