C Interface for History.
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
cb4765e0cc
commit
73f48eab7a
|
@ -78,3 +78,4 @@ export bool CreatureLib_Battle_HasVolatileScript(Battle* p, const char* key) {
|
|||
export uint8_t CreatureLib_Battle_RegisterEventListener(Battle* p, void (*func)(const EventData*)) {
|
||||
Try(p->RegisterEventListener(func);)
|
||||
}
|
||||
export const HistoryHolder* CreatureLib_Battle_GetHistory(Battle* p) { return &p->GetHistory(); }
|
|
@ -0,0 +1,20 @@
|
|||
#include "../../src/Battling/History/HistoryElements/AttackUseHistory.hpp"
|
||||
#include "../../src/Battling/History/HistoryHolder.hpp"
|
||||
#include "../Core.hpp"
|
||||
using namespace CreatureLib::Battling;
|
||||
|
||||
export const HistoryElement* CreatureLib_HistoryHandler_GetTopElement(const HistoryHolder* p) {
|
||||
return p->GetTopElement().GetRaw();
|
||||
}
|
||||
export const HistoryElement* CreatureLib_HistoryHandler_GetLastUsedAttack(const HistoryHolder* p) {
|
||||
return p->GetLastUsedAttack().GetRaw();
|
||||
}
|
||||
|
||||
export HistoryElementKind CreatureLib_HistoryElement_GetKind(const HistoryElement* p) { return p->GetKind(); }
|
||||
export const HistoryElement* CreatureLib_HistoryElement_GetPrevious(const HistoryElement* p) {
|
||||
return p->GetPrevious().GetRaw();
|
||||
}
|
||||
|
||||
export const ExecutingAttack* CreatureLib_AttackUseHistory_GetAttack(const AttackUseHistory* p) {
|
||||
return p->GetAttack().GetRaw();
|
||||
}
|
|
@ -17,7 +17,7 @@ namespace CreatureLib::Battling {
|
|||
AttackUseHistory(const ExecutingAttack* attack) : _attack(attack) {}
|
||||
|
||||
HistoryElementKind GetKind() const noexcept override { return HistoryElementKind::AttackUse; }
|
||||
ArbUt::BorrowedPtr<const ExecutingAttack> GetAttack() { return _attack; }
|
||||
ArbUt::BorrowedPtr<const ExecutingAttack> GetAttack() const noexcept { return _attack; }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue