Adds C Interface.

This commit is contained in:
2021-04-23 10:09:50 +02:00
parent 5898688a65
commit a5d49d7aa4
6 changed files with 81 additions and 3 deletions

View File

@@ -5,6 +5,7 @@
#include <CreatureLib/Battling/TurnChoices/SwitchTurnChoice.hpp>
#include <PkmnLib/Battling/Pokemon/LearnedMove.hpp>
#include <algorithm>
#include <angelscript.h>
#include <future>
#include <thread>
#include "../cmake-build-release/PkmnLib/src/pkmnlib/src/Battling/Pokemon/PokemonParty.hpp"
@@ -92,7 +93,7 @@ namespace PkmnLibAI {
}));
}
std::vector<std::tuple<u8, float>> results(threadPool.size());
for (int i = 0; i < threadPool.size(); ++i) {
for (size_t i = 0; i < threadPool.size(); ++i) {
results[i] = threadPool[i].get();
}
return results;
@@ -111,7 +112,7 @@ namespace PkmnLibAI {
scoredMoves.emplace_back(moveIndex, scored);
}
auto& party = battle->GetParties()[side->GetSideIndex()]->GetParty()->GetParty();
for (int i = 0; i < party.Count(); ++i) {
for (size_t i = 0; i < party.Count(); ++i) {
auto mon = party[i];
if (!mon.HasValue()) {
continue;

View File

@@ -15,6 +15,7 @@ namespace PkmnLibAI {
virtual std::string GetName() const noexcept = 0;
protected:
CreatureLib::Battling::CreatureIndex GetOppositeIndex(PkmnLib::Battling::Pokemon* user) {
auto side = user->GetBattleSide().GetValue();
if (side->GetSideIndex() == 0) {