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

Method Process

engine/Poseidon/UI/InGame/InGameUIActions.cpp:305–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303bool CheckSupply(EntityAI* vehicle, EntityAI* parent, SupportCheckF check, float limit, bool now);
304
305void UIAction::Process(AIUnit* unit) const
306{
307 if (!unit || unit->GetLifeState() != AIUnit::LSAlive)
308 {
309 return;
310 }
311
312 EntityAI* veh = target;
313 switch (type)
314 {
315 case ATGetInCommander:
316 case ATGetInDriver:
317 case ATGetInGunner:
318 case ATGetInCargo:
319 {
320 if (!unit->IsFreeSoldier())
321 {
322 return;
323 }
324 Transport* trans = dyn_cast<Transport>(veh);
325 if (!trans)
326 {
327 return;
328 }
329 if (unit->IsPlayer() && trans->GetLock() == LSLocked)
330 {
331 return;
332 }
333 AIGroup* grp = unit->GetGroup();
334 PoseidonAssert(grp);
335 AICenter* center = grp->GetCenter();
336 PoseidonAssert(center);
337 // avoid get in enemy vehicle
338 if (trans->Commander() && center->IsEnemy(trans->Commander()->GetTargetSide()))
339 {
340 return;
341 }
342 if (trans->Driver() && center->IsEnemy(trans->Driver()->GetTargetSide()))
343 {
344 return;
345 }
346 if (trans->Gunner() && center->IsEnemy(trans->Gunner()->GetTargetSide()))
347 {
348 return;
349 }
350 for (int i = 0; i < trans->GetManCargo().Size(); i++)
351 {
352 Person* man = trans->GetManCargo()[i];
353 if (!man)
354 {
355 continue;
356 }
357 if (center->IsEnemy(man->GetTargetSide()))
358 {
359 return;
360 }
361 }
362 switch (type)

Callers 1

OnHTMLLinkMethod · 0.45

Calls 15

MoveToGetInPosFunction · 0.85
CreateGetInActionContextFunction · 0.85
CheckSupplyFunction · 0.85
UpdateWeaponsInBriefingFunction · 0.85
NewVehicleFunction · 0.85
GetLifeStateMethod · 0.80
IsFreeSoldierMethod · 0.80
IsPlayerMethod · 0.80
GetLockMethod · 0.80
IsEnemyMethod · 0.80
DriverMethod · 0.80
GunnerMethod · 0.80

Tested by

no test coverage detected