Make HistoryHolder a pointer instead of value.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
ff67ab9e00
commit
51897e42da
|
@ -84,7 +84,7 @@ export bool CreatureLib_Battle_HasVolatileScript(Battle* p, const char* key) {
|
||||||
export uint8_t CreatureLib_Battle_RegisterEventListener(Battle* p, void (*func)(const EventData*)) {
|
export uint8_t CreatureLib_Battle_RegisterEventListener(Battle* p, void (*func)(const EventData*)) {
|
||||||
Try(p->RegisterEventListener(func);)
|
Try(p->RegisterEventListener(func);)
|
||||||
}
|
}
|
||||||
export const HistoryHolder* CreatureLib_Battle_GetHistory(Battle* p) { return &p->GetHistory(); }
|
export const HistoryHolder* CreatureLib_Battle_GetHistory(Battle* p) { return p->GetHistory(); }
|
||||||
|
|
||||||
export uint8_t CreatureLib_Battle_EndBattle(Battle* p) { Try(p->EndBattle()) }
|
export uint8_t CreatureLib_Battle_EndBattle(Battle* p) { Try(p->EndBattle()) }
|
||||||
export uint8_t CreatureLib_Battle_ClearBattle(Battle* p) { Try(p->ClearBattle()) }
|
export uint8_t CreatureLib_Battle_ClearBattle(Battle* p) { Try(p->ClearBattle()) }
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace CreatureLib::Battling {
|
||||||
bool _hasEnded = false;
|
bool _hasEnded = false;
|
||||||
BattleResult _battleResult = BattleResult::Empty();
|
BattleResult _battleResult = BattleResult::Empty();
|
||||||
EventHook _eventHook;
|
EventHook _eventHook;
|
||||||
HistoryHolder _historyHolder;
|
HistoryHolder* _historyHolder = new HistoryHolder();
|
||||||
|
|
||||||
uint32_t _currentTurn = 0;
|
uint32_t _currentTurn = 0;
|
||||||
|
|
||||||
|
@ -112,10 +112,10 @@ namespace CreatureLib::Battling {
|
||||||
const EventHook& GetEventHook() const noexcept { return _eventHook; }
|
const EventHook& GetEventHook() const noexcept { return _eventHook; }
|
||||||
|
|
||||||
template <HistoryElementType T, class... parameters> void RegisterHistoryElement(parameters... args) {
|
template <HistoryElementType T, class... parameters> void RegisterHistoryElement(parameters... args) {
|
||||||
try_creature(this->_historyHolder.Register<T>(this->GetCurrentTurn(), args...);
|
try_creature(this->_historyHolder->Register<T>(this->GetCurrentTurn(), args...);
|
||||||
, "Exception occurred during history element registration.");
|
, "Exception occurred during history element registration.");
|
||||||
}
|
}
|
||||||
const HistoryHolder& GetHistory() const noexcept { return _historyHolder; }
|
const HistoryHolder* GetHistory() const noexcept { return _historyHolder; }
|
||||||
|
|
||||||
long GetLastTurnTimeMicroseconds() const noexcept { return _lastTurnTime; }
|
long GetLastTurnTimeMicroseconds() const noexcept { return _lastTurnTime; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue