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

Method Clear

engine/Poseidon/AI/AICenter.cpp:393–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391const int maxMPTableRows = 10;
392
393void AIStatsMission::Clear()
394{
395 _events.Clear();
396 _tableMP.Clear();
397 _reportHeader.Clear();
398 _reportEvents.Clear();
399 _reportFooter.Clear();
400 _lives = -1;
401 _start = Glob.time;
402 _reportWritten = false;
403
404// caution: GNetworkManager must be initialized
405#if 1
406 const AutoArray<PlayerIdentity>* identities = GetNetworkManager().GetIdentities();
407 if (identities)
408 {
409 int n = identities->Size();
410 if (n > 0)
411 {
412 _tableMP.Resize(n);
413 for (int i = 0; i < n; i++)
414 {
415 _tableMP[i].player = identities->Get(i).name;
416 _tableMP[i].order = i + 1;
417 int dpnid = identities->Get(i).dpnid;
418 for (int j = 0; j < GetNetworkManager().NPlayerRoles(); j++)
419 {
420 const PlayerRole* info = GetNetworkManager().GetPlayerRole(j);
421 if (info && info->player == dpnid)
422 {
423 _tableMP[i].side = info->side;
424 break;
425 }
426 }
427 }
428 // ensure local player statistics are visible
429 int index = -1;
430 for (int i = 0; i < _tableMP.Size(); i++)
431 {
432 if (_tableMP[i].player == GetLocalPlayerName())
433 {
434 index = i;
435 break;
436 }
437 }
438 if (index >= maxMPTableRows)
439 {
440 swap(_tableMP[index], _tableMP[maxMPTableRows - 1]);
441 }
442 }
443 }
444#endif
445}
446
447void AIStatsMission::AddEvent(AIStatsEventType type, Vector3Par position, RString message,
448 const VehicleType* killedType, RString killedName, bool killedPlayer,

Callers

nothing calls this directly

Calls 8

GetLocalPlayerNameFunction · 0.85
swapFunction · 0.85
GetIdentitiesMethod · 0.45
SizeMethod · 0.45
ResizeMethod · 0.45
GetMethod · 0.45
NPlayerRolesMethod · 0.45
GetPlayerRoleMethod · 0.45

Tested by

no test coverage detected