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

Method ProcessGetIn2

engine/Poseidon/AI/AIUnitImpl.cpp:507–707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507bool AIUnit::ProcessGetIn2(Transport* veh, UIActionType pos)
508{
509 if (!veh)
510 {
511 return false;
512 }
513
514 // fixed - do not continue with get in if unit is dead
515 if (GetPerson()->IsDammageDestroyed())
516 {
517 return false;
518 }
519
520 AI_ERROR(veh->IsLocal()); // warning: BUG
521 AIGroup* grp = GetGroup();
522 AI_ERROR(grp);
523 AICenter* center = grp->GetCenter();
524 AI_ERROR(center);
525
526 // avoid get in enemy vehicle
527 if (AvoidBeInWith(center, veh->Commander()))
528 {
529 if (_vehicleAssigned == veh)
530 {
531 UnassignVehicle();
532 grp->UnassignVehicle(veh);
533 }
534 return false;
535 }
536 if (AvoidBeInWith(center, veh->Driver()))
537 {
538 if (_vehicleAssigned == veh)
539 {
540 UnassignVehicle();
541 grp->UnassignVehicle(veh);
542 }
543 return false;
544 }
545 if (AvoidBeInWith(center, veh->Gunner()))
546 {
547 if (_vehicleAssigned == veh)
548 {
549 UnassignVehicle();
550 grp->UnassignVehicle(veh);
551 }
552 return false;
553 }
554 for (int i = 0; i < veh->GetManCargo().Size(); i++)
555 {
556 Person* man = veh->GetManCargo()[i];
557 if (AvoidBeInWith(center, man))
558 {
559 if (_vehicleAssigned == veh)
560 {
561 UnassignVehicle();
562 grp->UnassignVehicle(veh);
563 }
564 return false;

Callers 1

ProcessMoveFunctionMethod · 0.80

Calls 15

GetGroupFunction · 0.85
AvoidBeInWithFunction · 0.85
JoinSubgroupsFunction · 0.85
ValidateCameraFunction · 0.85
GunnerGetInFunction · 0.85
DriverMethod · 0.80
GunnerMethod · 0.80
GetInFinishedMethod · 0.80
GetInDriverMethod · 0.80
UpdateStopTimeoutMethod · 0.80
IsUnitMethod · 0.80

Tested by

no test coverage detected