CreatureLib/src/Battling/Flow/TurnOrdering.cpp

19 lines
502 B
C++
Raw Normal View History

#include "TurnOrdering.hpp"
#include <algorithm>
using namespace CreatureLib::Battling;
bool ___ChoiceOrderFunc(const BaseTurnChoice* a, const BaseTurnChoice* b){
auto aKind = a->GetKind();
auto bKind = b->GetKind();
if (aKind != bKind)
return aKind > bKind;
//FIXME: choices need to be ordered when they're the same type
throw 1;
}
void TurnOrdering::OrderChoices(std::vector<const BaseTurnChoice *> &vec) {
std::sort(vec.begin(), vec.end(), ___ChoiceOrderFunc);
}