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

Method FindTarget

engine/Poseidon/UI/InGame/InGameUI.cpp:1726–1854  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1724 }
1725
1726 { // assign vehicle
1727 Transport* veh = dyn_cast<Transport, EntityAI>(command._target);
1728 PoseidonAssert(veh);
1729 bool canAsDriver = veh->GetType()->HasDriver();
1730 bool canAsCommander = veh->GetType()->HasCommander();
1731 bool canAsGunner = veh->GetType()->HasGunner();
1732 AIUnit* driver = veh->GetDriverAssigned();
1733 if (driver)
1734 {
1735 if (veh->QIsDriverIn())
1736 {
1737 canAsDriver = false;
1738 }
1739 else if (driver->GetGroup() && driver->GetGroup()->CommandSent(driver, Command::GetIn))
1740 {
1741 canAsDriver = false;
1742 }
1743 }
1744 if (canAsCommander)
1745 {
1746 AIUnit* commander = veh->GetCommanderAssigned();
1747 if (commander)
1748 {
1749 if (veh->QIsCommanderIn())
1750 {
1751 canAsCommander = false;
1752 }
1753 else if (commander->GetGroup() && commander->GetGroup()->CommandSent(commander, Command::GetIn))
1754 {
1755 canAsCommander = false;
1756 }
1757 }
1758 }
1759 if (canAsGunner)
1760 {
1761 AIUnit* gunner = veh->GetGunnerAssigned();
1762 if (gunner)
1763 {
1764 if (veh->QIsGunnerIn())
1765 {
1766 canAsGunner = false;
1767 }
1768 else if (gunner->GetGroup() && gunner->GetGroup()->CommandSent(gunner, Command::GetIn))
1769 {
1770 canAsGunner = false;
1771 }
1772 }
1773 }
1774 for (int i = 0; i < MAX_UNITS_PER_GROUP; i++)
1775 {
1776 AIUnit* unit = GetSelectedUnit(i);
1777 if (!unit)
1778 {
1779 continue;
1780 }
1781 if (canAsDriver)
1782 {
1783 if (veh->GetGroupAssigned() != grp)

Callers 1

CheckCursorTargetMethod · 0.45

Calls 15

ValidateWeaponFunction · 0.85
AngleDifferenceFunction · 0.85
SelectedWeaponMethod · 0.80
IsFreeSoldierMethod · 0.80
GetIRTargetMethod · 0.80
CanLockMethod · 0.80
CalcVisibilityMethod · 0.80
IsEnemyMethod · 0.80
GetWeaponDirectionMethod · 0.45
CommanderUnitMethod · 0.45
IsGunnerMethod · 0.45
AimingPositionMethod · 0.45

Tested by

no test coverage detected