| 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 | |
| 535 | bool 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; |
no test coverage detected