CreatureLib/CInterface/Battling/BattleParty.cpp

23 lines
1.0 KiB
C++
Raw Normal View History

2020-03-08 14:19:19 +00:00
#include "../../src/Battling/Models/BattleParty.hpp"
#define export extern "C"
using namespace CreatureLib::Battling;
// Note that creatureIndices should be twice the size of numberOfIndices, and have index of side, index of creature on
// side, one after the other.
export BattleParty* CreatureLib_BattleParty_Construct(CreatureParty* p, uint8_t creatureIndices[],
size_t numberOfIndices) {
std::vector<CreatureIndex> indices(numberOfIndices);
for (size_t i = 0; i < numberOfIndices; i++) {
indices[i] = CreatureIndex(creatureIndices[i * 2], creatureIndices[i * 2 + 1]);
}
return new BattleParty(p, indices);
}
export void CreatureLib_BattleParty_Destruct(const BattleParty* p) { delete p; }
export bool CreatureLib_BattleParty_IsResponsibleForIndex(const BattleParty* p, uint8_t side, uint8_t creature) {
return p->IsResponsibleForIndex(side, creature);
}
export bool CreatureLib_BattleParty_HasCreaturesNotInField(const BattleParty* p) { return p->HasCreaturesNotInField(); }