Remove tie breaking by randomness. This caused issues with sorting.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
97fa37ea7d
commit
1709617e10
|
@ -7,10 +7,8 @@ using namespace CreatureLib;
|
|||
using namespace Battling;
|
||||
|
||||
class ChoiceCompare {
|
||||
Arbutils::Random& _rand;
|
||||
|
||||
public:
|
||||
explicit ChoiceCompare(Arbutils::Random& rand) : _rand(rand) {}
|
||||
explicit ChoiceCompare() {}
|
||||
bool operator()(const BaseTurnChoice* a, const BaseTurnChoice* b) {
|
||||
auto aKind = a->GetKind();
|
||||
auto bKind = b->GetKind();
|
||||
|
@ -27,11 +25,10 @@ public:
|
|||
if (aSpeed != bSpeed)
|
||||
return aSpeed > bSpeed;
|
||||
|
||||
auto randomValue = _rand.Get(2);
|
||||
return randomValue == 0;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void TurnOrdering::OrderChoices(std::vector<BaseTurnChoice*>& vec, Arbutils::Random& rand) {
|
||||
std::sort(vec.begin(), vec.end(), ChoiceCompare(rand));
|
||||
std::sort(vec.begin(), vec.end(), ChoiceCompare());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue