CreatureLib/CInterface/Battling/LearnedAttack.cpp

30 lines
1.7 KiB
C++
Raw Normal View History

2020-04-04 11:36:13 +00:00
#include "../../src/Battling/Models/LearnedAttack.hpp"
#include "../Core.hpp"
using namespace CreatureLib::Battling;
2020-05-24 18:57:22 +00:00
export uint8_t CreatureLib_LearnedAttack_Construct(LearnedAttack*& out, const CreatureLib::Library::AttackData* attack,
2020-04-04 11:36:13 +00:00
uint8_t maxUses, AttackLearnMethod learnMethod) {
2020-05-26 16:31:06 +00:00
Try(out = new LearnedAttack(ArbUt::BorrowedPtr<const CreatureLib::Library::AttackData>(attack), maxUses,
learnMethod);)
2020-04-04 11:36:13 +00:00
}
export void CreatureLib_LearnedAttack_Destruct(LearnedAttack* p) { delete p; }
#define SIMPLE_GET_FUNC(type, name, returnType) \
export returnType CreatureLib_##type##_##name(const type* p) { return p->name(); }
2020-05-24 18:57:22 +00:00
#define SIMPLE_GET_FUNC_SMART_PTR(type, name, returnType) \
export returnType CreatureLib_##type##_##name(const type* p) { return p->name().operator->(); }
SIMPLE_GET_FUNC_SMART_PTR(LearnedAttack, GetAttack, const CreatureLib::Library::AttackData*);
2020-04-04 11:36:13 +00:00
SIMPLE_GET_FUNC(LearnedAttack, GetMaxUses, uint8_t);
SIMPLE_GET_FUNC(LearnedAttack, GetRemainingUses, uint8_t);
SIMPLE_GET_FUNC(LearnedAttack, GetLearnMethod, AttackLearnMethod);
export bool CreatureLib_LearnedAttack_TryUse(LearnedAttack* p, uint8_t uses) { return p->TryUse(uses); }
export void CreatureLib_LearnedAttack_DecreaseUses(LearnedAttack* p, uint8_t uses) { p->DecreaseUses(uses); }
export void CreatureLib_LearnedAttack_RestoreUses(LearnedAttack* p, uint8_t uses) { p->RestoreUses(uses); }
export void CreatureLib_LearnedAttack_RestoreAllUses(LearnedAttack* p) { p->RestoreAllUses(); }
2020-05-24 18:57:22 +00:00
#undef SIMPLE_GET_FUNC
#undef SIMPLE_GET_FUNC_SMART_PTR