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;
|
using namespace Battling;
|
||||||
|
|
||||||
class ChoiceCompare {
|
class ChoiceCompare {
|
||||||
Arbutils::Random& _rand;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ChoiceCompare(Arbutils::Random& rand) : _rand(rand) {}
|
explicit ChoiceCompare() {}
|
||||||
bool operator()(const BaseTurnChoice* a, const BaseTurnChoice* b) {
|
bool operator()(const BaseTurnChoice* a, const BaseTurnChoice* b) {
|
||||||
auto aKind = a->GetKind();
|
auto aKind = a->GetKind();
|
||||||
auto bKind = b->GetKind();
|
auto bKind = b->GetKind();
|
||||||
|
@ -27,11 +25,10 @@ public:
|
||||||
if (aSpeed != bSpeed)
|
if (aSpeed != bSpeed)
|
||||||
return aSpeed > bSpeed;
|
return aSpeed > bSpeed;
|
||||||
|
|
||||||
auto randomValue = _rand.Get(2);
|
return true;
|
||||||
return randomValue == 0;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void TurnOrdering::OrderChoices(std::vector<BaseTurnChoice*>& vec, Arbutils::Random& rand) {
|
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