Initial support for ordering choices and getting them ready for execution.
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:
18
src/Battling/Flow/TurnOrdering.cpp
Normal file
18
src/Battling/Flow/TurnOrdering.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user