Used ClangFormat style guide I'm happy with.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
#include "TurnOrdering.hpp"
|
||||
#include "../TurnChoices/AttackTurnChoice.hpp"
|
||||
#include "../Models/Battle.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include "../Models/Battle.hpp"
|
||||
#include "../TurnChoices/AttackTurnChoice.hpp"
|
||||
|
||||
using namespace CreatureLib;
|
||||
using namespace Battling;
|
||||
|
||||
bool ___ChoiceOrderFunc(const BaseTurnChoice* a, const BaseTurnChoice* b, Core::Random& rand){
|
||||
bool ___ChoiceOrderFunc(const BaseTurnChoice* a, const BaseTurnChoice* b, Core::Random& rand) {
|
||||
auto aKind = a->GetKind();
|
||||
auto bKind = b->GetKind();
|
||||
if (aKind != bKind)
|
||||
return aKind > bKind;
|
||||
if (aKind == TurnChoiceKind::Attack){
|
||||
if (aKind == TurnChoiceKind::Attack) {
|
||||
auto aPriority = dynamic_cast<const AttackTurnChoice*>(a)->GetPriority();
|
||||
auto bPriority = dynamic_cast<const AttackTurnChoice*>(b)->GetPriority();
|
||||
if (aPriority != bPriority)
|
||||
@@ -27,9 +26,9 @@ bool ___ChoiceOrderFunc(const BaseTurnChoice* a, const BaseTurnChoice* b, Core::
|
||||
return randomValue == 0;
|
||||
}
|
||||
|
||||
void TurnOrdering::OrderChoices(std::vector<BaseTurnChoice *> &vec, Core::Random& rand) {
|
||||
auto comp = [&](const BaseTurnChoice * a,const BaseTurnChoice * b)-> bool {
|
||||
return ___ChoiceOrderFunc(a,b,rand);
|
||||
void TurnOrdering::OrderChoices(std::vector<BaseTurnChoice*>& vec, Core::Random& rand) {
|
||||
auto comp = [&](const BaseTurnChoice* a, const BaseTurnChoice* b) -> bool {
|
||||
return ___ChoiceOrderFunc(a, b, rand);
|
||||
};
|
||||
std::sort(vec.begin(), vec.end(), comp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user