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

Method Check

engine/Poseidon/Network/NetworkMisc.cpp:517–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515 }
516 if (index < 0)
517 {
518 index = base::Add();
519 Set(index).player = player;
520 }
521 if (value)
522 {
523 Set(index).value.Realloc(valueSize);
524 Set(index).value.Resize(valueSize);
525 memcpy(Set(index).value.Data(), value, valueSize);
526 }
527 else
528 {
529 Set(index).value.Realloc(0);
530 Set(index).value.Resize(0);
531 }
532 return index;
533}
534
535bool Voting::Check(const AutoArray<PlayerIdentity>& identities) const
536{
537 int sum = 0;
538 int n = identities.Size();
539
540 for (int j = 0; j < Size(); j++)
541 {
542 int player = Get(j).player;
543 for (int i = 0; i < n; i++)
544 {
545 if (identities[i].dpnid == player)
546 {
547 sum++;
548 break;
549 }
550 }
551 }
552 if (Poseidon::VoteThresholdMet(sum, n, _threshold))
553 {
554 return true;
555 }
556 if (!_selection)
557 {
558 return false;

Callers 2

AddMethod · 0.45
OnPlayerDestroyMethod · 0.45

Calls 10

VoteThresholdMetFunction · 0.85
GetValueFunction · 0.85
VoteSelectionCompleteFunction · 0.85
SetClass · 0.85
ApplyVotingMethod · 0.80
GetIDMethod · 0.80
GetFunction · 0.50
SizeMethod · 0.45
GetIdentitiesMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected