C Interface for new event hooks.
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
5aa04a4b15
commit
665227a033
|
@ -2,7 +2,7 @@
|
||||||
#include "../Core.hpp"
|
#include "../Core.hpp"
|
||||||
using namespace CreatureLib::Battling;
|
using namespace CreatureLib::Battling;
|
||||||
|
|
||||||
export void CreatureLib_EventData_Destruct(const EventData* p) { delete p; }
|
DESTRUCTOR(EventData);
|
||||||
|
|
||||||
SIMPLE_GET_FUNC(EventData, GetKind, EventDataKind);
|
SIMPLE_GET_FUNC(EventData, GetKind, EventDataKind);
|
||||||
|
|
||||||
|
@ -10,15 +10,29 @@ BORROWED_GET_FUNC(DamageEvent, GetCreature, Creature*);
|
||||||
SIMPLE_GET_FUNC(DamageEvent, GetDamageSource, DamageSource);
|
SIMPLE_GET_FUNC(DamageEvent, GetDamageSource, DamageSource);
|
||||||
SIMPLE_GET_FUNC(DamageEvent, GetOriginalHealth, uint32_t);
|
SIMPLE_GET_FUNC(DamageEvent, GetOriginalHealth, uint32_t);
|
||||||
SIMPLE_GET_FUNC(DamageEvent, GetNewHealth, uint32_t);
|
SIMPLE_GET_FUNC(DamageEvent, GetNewHealth, uint32_t);
|
||||||
export void CreatureLib_DamageEvent_Destruct(const DamageEvent* p) { delete p; }
|
DESTRUCTOR(DamageEvent);
|
||||||
|
|
||||||
BORROWED_GET_FUNC(HealEvent, GetCreature, Creature*);
|
BORROWED_GET_FUNC(HealEvent, GetCreature, Creature*);
|
||||||
SIMPLE_GET_FUNC(HealEvent, GetOriginalHealth, uint32_t);
|
SIMPLE_GET_FUNC(HealEvent, GetOriginalHealth, uint32_t);
|
||||||
SIMPLE_GET_FUNC(HealEvent, GetNewHealth, uint32_t);
|
SIMPLE_GET_FUNC(HealEvent, GetNewHealth, uint32_t);
|
||||||
export void CreatureLib_HealEvent_Destruct(const HealEvent* p) { delete p; }
|
DESTRUCTOR(HealEvent);
|
||||||
|
|
||||||
BORROWED_GET_FUNC(FaintEvent, GetCreature, Creature*);
|
BORROWED_GET_FUNC(FaintEvent, GetCreature, Creature*);
|
||||||
export void CreatureLib_FaintEvent_Destruct(const FaintEvent* p) { delete p; }
|
DESTRUCTOR(FaintEvent);
|
||||||
|
|
||||||
|
BORROWED_GET_FUNC(SwitchEvent, GetNewCreature, Creature*);
|
||||||
|
export uint8_t CreatureLib_SwitchEvent_GetSide(const SwitchEvent* p) { return p->GetIndex().GetSideIndex(); }
|
||||||
|
export uint8_t CreatureLib_SwitchEvent_GetIndex(const SwitchEvent* p) { return p->GetIndex().GetCreatureIndex(); }
|
||||||
|
DESTRUCTOR(SwitchEvent);
|
||||||
|
|
||||||
|
DESTRUCTOR(TurnStartEvent);
|
||||||
|
|
||||||
|
DESTRUCTOR(TurnEndEvent);
|
||||||
|
|
||||||
|
BORROWED_GET_FUNC(ExperienceGainEvent, GetCreature, Creature*);
|
||||||
|
SIMPLE_GET_FUNC(ExperienceGainEvent, GetPreviousExperience, uint32_t);
|
||||||
|
SIMPLE_GET_FUNC(ExperienceGainEvent, GetNewExperience, uint32_t);
|
||||||
|
DESTRUCTOR(ExperienceGainEvent);
|
||||||
|
|
||||||
export const char* CreatureLib_DisplayTextEvent_GetText(const DisplayTextEvent* p) { return p->GetText().c_str(); }
|
export const char* CreatureLib_DisplayTextEvent_GetText(const DisplayTextEvent* p) { return p->GetText().c_str(); }
|
||||||
export void CreatureLib_DisplayTextEvent_Destruct(const DisplayTextEvent* p) { delete p; }
|
export void CreatureLib_DisplayTextEvent_Destruct(const DisplayTextEvent* p) { delete p; }
|
||||||
|
|
|
@ -37,5 +37,7 @@ public:
|
||||||
export returnType CreatureLib_##type##_##name(const type* p) { return p->name().GetRaw(); }
|
export returnType CreatureLib_##type##_##name(const type* p) { return p->name().GetRaw(); }
|
||||||
#define SMART_GET_FUNC(type, name, returnType) \
|
#define SMART_GET_FUNC(type, name, returnType) \
|
||||||
export returnType CreatureLib_##type##_##name(const type* p) { return p->name().get(); }
|
export returnType CreatureLib_##type##_##name(const type* p) { return p->name().get(); }
|
||||||
|
#define DESTRUCTOR(type) \
|
||||||
|
export void CreatureLib_##type##_Destruct(const type* p) { delete p; }
|
||||||
|
|
||||||
#endif // CREATURELIB_CORE_HPP
|
#endif // CREATURELIB_CORE_HPP
|
||||||
|
|
Loading…
Reference in New Issue