MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / VerifyPath

Method VerifyPath

engine/Poseidon/AI/AIUnit.cpp:1678–1706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1676 LOG_DEBUG(AI, "pos {:.2f},{:.2f},{:.2f}", pos[0], pos[1], pos[2]);
1677 LOG_DEBUG(AI, "from {:.2f},{:.2f},{:.2f}", from[0], from[1], from[2]);
1678 }
1679 map.CreateMap(GetVehicle(), xMin, zMin, xMax, zMax);
1680 bool retVal = map.IsSimplePath(this, xs, zs, xe, ze);
1681
1682 GetVehicle()->PerformLock();
1683 return retVal;
1684}
1685
1686bool AIUnit::VerifyPath()
1687{
1688 // do not verify fresh path
1689 if (_path.GetSearchTime() > Glob.time - 0.5)
1690 {
1691 // assume fresh path is always valid
1692 return true;
1693 }
1694
1695 EntityAI* veh = GetVehicle();
1696 if (_path.GetOnRoad())
1697 {
1698 veh->PerformUnlock();
1699 int index = _path.GetOperIndex();
1700 for (int i = index; i < _path.GetMaxIndex(); i++)
1701 {
1702 if (GRoadNet->IsLocked(_path[i]._pos, 0.1))
1703 {
1704 return false;
1705 }
1706 }
1707 veh->PerformLock();
1708 }
1709 else

Callers

nothing calls this directly

Calls 7

GetSearchTimeMethod · 0.80
GetOnRoadMethod · 0.80
PerformUnlockMethod · 0.80
GetOperIndexMethod · 0.80
GetMaxIndexMethod · 0.80
PerformLockMethod · 0.80
IsLockedMethod · 0.45

Tested by

no test coverage detected