Initial support for ordering choices and getting them ready for execution.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-10-31 12:02:23 +01:00
parent af611070c5
commit 972af35ecf
11 changed files with 157 additions and 4 deletions

View File

@@ -0,0 +1,18 @@
#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);
}