Added C Interface for BattleParty.
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:
22
CInterface/Battling/BattleParty.cpp
Normal file
22
CInterface/Battling/BattleParty.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#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(); }
|
||||
Reference in New Issue
Block a user