| 505 | } |
| 506 | |
| 507 | bool 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; |
no test coverage detected