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

Method OnStrategicPathNotFound

engine/Poseidon/AI/AIUnitImpl.cpp:1512–1546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1510void AIUnit::OnStrategicPathNotFound(bool update)
1511{
1512 _waitWithPlan = Glob.time + 10.0F;
1513
1514 if (update)
1515 {
1516#if LOG_POSITION_PROBL
1517 LOG_DEBUG(AI, "Did not found path in update.");
1518#endif
1519 _completedTime = Glob.clock.GetTimeInYear() + OneDay; // set conditions for timeout
1520 }
1521 else
1522 {
1523 switch (_planningMode)
1524 {
1525 case LeaderPlanned:
1526 if (++_attemptPlan >= 3)
1527 {
1528 GetSubgroup()->FailCommand();
1529 }
1530 else
1531 {
1532 GetSubgroup()->SendAnswer(AI::SubgroupDestinationUnreacheable);
1533 }
1534 break;
1535 case FormationPlanned:
1536 case VehiclePlanned:
1537 // nothing to do
1538 break;
1539 default:
1540 Fail("Unexpected mode");
1541 break;
1542 }
1543 }
1544}
1545
1546void AIUnit::SetWantedPosition(Vector3Par pos, PlanningMode mode, bool forceReplan)
1547{
1548#if DIAG_PLANNING
1549 LOG_DEBUG(AI, "{:.3f}, {}: SetWantedPosition to {:.0f}, {:.0f}, mode {} {}", Glob.time.toFloat(),

Callers

nothing calls this directly

Calls 3

GetTimeInYearMethod · 0.80
FailCommandMethod · 0.80
SendAnswerMethod · 0.45

Tested by

no test coverage detected