Adds C Interface for Talent + TalentLibrary
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-11-27 10:37:12 +01:00
parent 9cb2a27007
commit 1c51edb2b9
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,17 @@
#include "../../src/Library/CreatureData/Talent.hpp"
#include "../Core.hpp"
using namespace CreatureLib::Library;
export Talent* CreatureLib_Talent_Construct(const char* name, const char* effect, EffectParameter* effectParameters[],
size_t effectParameterCount) {
ArbUt::List<EffectParameter*> effectParameterList(effectParameterCount);
for (size_t i = 0; i < effectParameterCount; i++) {
effectParameterList.Append(effectParameters[i]);
}
return new Talent(ArbUt::StringView(name), ArbUt::StringView(effect), effectParameterList);
}
export void CreatureLib_Talent_Destruct(const Talent* p) { delete p; }
export const char* CreatureLib_Talent_GetName(const Talent* talent) { return talent->GetName().c_str(); }
export const char* CreatureLib_Talent_GetEffect(const Talent* talent) { return talent->GetEffect().c_str(); }

View File

@ -0,0 +1,13 @@
#include "../../src/Library/TalentLibrary.hpp"
#include "../Core.hpp"
#include "BaseLibrary.cpp"
using namespace CreatureLib::Library;
export uint8_t CreatureLib_TalentLibrary_Construct(TalentLibrary*& library, size_t initialCapacity = 32) {
Try(library = new TalentLibrary(initialCapacity);)
};
export void CreatureLib_TalentLibrary_Destruct(const TalentLibrary* p) { delete p; }
BASELIBRARY(CreatureLib_TalentLibrary, TalentLibrary, Talent);