| 932 | } |
| 933 | |
| 934 | void AIPlayer::repath() |
| 935 | { |
| 936 | // Ineffectual if we don't have a path, or are using someone else's. |
| 937 | if(mPathData.path.isNull() || !mPathData.owned) |
| 938 | return; |
| 939 | |
| 940 | // If we're following, get their position. |
| 941 | if(!mFollowData.object.isNull()) |
| 942 | mPathData.path->mTo = mFollowData.object->getPosition(); |
| 943 | // Update from position and replan. |
| 944 | mPathData.path->mFrom = getPosition(); |
| 945 | mPathData.path->plan(); |
| 946 | // Move to first node (skip start pos). |
| 947 | moveToNode(1); |
| 948 | } |
| 949 | |
| 950 | DefineEngineMethod(AIPlayer, repath, void, (),, |
| 951 | "@brief Tells the AI to re-plan its path. Does nothing if the character " |
no test coverage detected