Adds support for History data, allowing us to store specific interesting occurrences in the data flow, and recall them later.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <memory>
|
||||
#include "../EventHooks/EventHook.hpp"
|
||||
#include "../Flow/ChoiceQueue.hpp"
|
||||
#include "../History/HistoryHolder.hpp"
|
||||
#include "../Library/BattleLibrary.hpp"
|
||||
#include "../TurnChoices/BaseTurnChoice.hpp"
|
||||
#include "BattleParty.hpp"
|
||||
@@ -28,6 +29,8 @@ namespace CreatureLib::Battling {
|
||||
bool _hasEnded = false;
|
||||
BattleResult _battleResult = BattleResult::Empty();
|
||||
EventHook _eventHook;
|
||||
HistoryHolder _historyHolder;
|
||||
|
||||
uint32_t _currentTurn = 0;
|
||||
|
||||
ScriptSet _volatile;
|
||||
@@ -95,14 +98,20 @@ namespace CreatureLib::Battling {
|
||||
void RemoveVolatileScript(Script* script);
|
||||
bool HasVolatileScript(const ArbUt::BasicStringView& name) const { return _volatile.Has(name); }
|
||||
bool HasVolatileScript(uint32_t keyHash) const { return _volatile.Has(keyHash); }
|
||||
|
||||
void DisplayText(const ArbUt::StringView& text);
|
||||
|
||||
void RegisterEventListener(EventHook::EventHookFunc listener) { this->_eventHook.RegisterListener(listener); }
|
||||
template <EventDataType T, class... parameters> void TriggerEventListener(parameters... args) {
|
||||
this->_eventHook.Trigger<T>(args...);
|
||||
}
|
||||
EventHook& GetEventHook() noexcept { return _eventHook; }
|
||||
const EventHook& GetEventHook() const noexcept { return _eventHook; }
|
||||
|
||||
void DisplayText(const ArbUt::StringView& text);
|
||||
void RegisterEventListener(EventHook::EventHookFunc listener) { this->_eventHook.RegisterListener(listener); }
|
||||
template <Event T, class... parameters> void TriggerEventListener(parameters... args) {
|
||||
this->_eventHook.Trigger<T>(args...);
|
||||
template <HistoryElementType T, class... parameters> void RegisterHistoryElement(parameters... args) {
|
||||
this->_historyHolder.Register<T>(args...);
|
||||
}
|
||||
const HistoryHolder& GetHistory() const noexcept { return _historyHolder; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user