Added ExperienceLibrary C Interface.

This commit is contained in:
Deukhoofd 2020-03-04 18:53:32 +01:00
parent 679133ef4f
commit 569a12ec82
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 21 additions and 4 deletions

View File

@ -6,16 +6,20 @@ export const DamageLibrary* CreatureLib_DamageLibrary_Construct() { return new D
export void CreatureLib_DamageLibrary_Destruct(const DamageLibrary* p) { delete p; }
export uint32_t GetDamage(const DamageLibrary* p, ExecutingAttack* attack, Creature* target, uint8_t hitIndex) {
export uint32_t CreatureLib_DamageLibrary_GetDamage(const DamageLibrary* p, ExecutingAttack* attack, Creature* target,
uint8_t hitIndex) {
return p->GetDamage(attack, target, hitIndex);
}
export uint8_t GetBasePower(const DamageLibrary* p, ExecutingAttack* attack, Creature* target, uint8_t hitIndex) {
export uint8_t CreatureLib_DamageLibrary_GetBasePower(const DamageLibrary* p, ExecutingAttack* attack, Creature* target,
uint8_t hitIndex) {
return p->GetBasePower(attack, target, hitIndex);
}
export float GetStatModifier(const DamageLibrary* p, ExecutingAttack* attack, Creature* target, uint8_t hitIndex) {
export float CreatureLib_DamageLibrary_GetStatModifier(const DamageLibrary* p, ExecutingAttack* attack,
Creature* target, uint8_t hitIndex) {
return p->GetStatModifier(attack, target, hitIndex);
}
export float GetDamageModifier(const DamageLibrary* p, ExecutingAttack* attack, Creature* target, uint8_t hitIndex) {
export float CreatureLib_DamageLibrary_GetDamageModifier(const DamageLibrary* p, ExecutingAttack* attack,
Creature* target, uint8_t hitIndex) {
return p->GetDamageModifier(attack, target, hitIndex);
}

View File

@ -0,0 +1,13 @@
#include "../../src/Battling/Library/ExperienceLibrary.hpp"
#define export extern "C"
using namespace CreatureLib::Battling;
export const ExperienceLibrary* CreatureLib_ExperienceLibrary_Construct() { return new ExperienceLibrary(); }
export void CreatureLib_ExperienceLibrary_Destruct(const ExperienceLibrary* p) { delete p; }
export void CreatureLib_ExperienceLibrary_HandleExperienceGain(const ExperienceLibrary* p, Creature* faintedMon,
Creature* opponents[], size_t opponentsCount) {
auto set = std::unordered_set<Creature*>(opponents, opponents + opponentsCount);
p->HandleExperienceGain(faintedMon, set);
}