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

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
2020-08-14 15:18:00 +02:00
parent 939fee3f50
commit cb4765e0cc
12 changed files with 150 additions and 19 deletions

View File

@@ -7,7 +7,7 @@
#include "../../Library/Exceptions/CreatureException.hpp"
#include "Events/EventData.hpp"
template <class T> concept Event = std::is_base_of<CreatureLib::Battling::EventData, T>::value;
template <class T> concept EventDataType = std::is_base_of<CreatureLib::Battling::EventData, T>::value;
namespace CreatureLib::Battling {
/// The Event Hook class allows users to write consumers for the battle events, for example to write User Interfaces
@@ -41,7 +41,7 @@ namespace CreatureLib::Battling {
size_t GetPosition() const noexcept { return _offset; }
size_t GetCapacity() const noexcept { return _capacity; }
template <Event T, class... parameters> void Trigger(parameters... args) {
template <EventDataType T, class... parameters> void Trigger(parameters... args) {
if (_listeners.size() == 0)
return;

View File

@@ -1,5 +1,6 @@
#ifndef CREATURELIB_ATTACKUSEEVENT_HPP
#define CREATURELIB_ATTACKUSEEVENT_HPP
#include "../../Models/ExecutingAttack.hpp"
#include "EventData.hpp"
namespace CreatureLib::Battling {

View File

@@ -2,14 +2,9 @@
#define CREATURELIB_EVENTDATA_HPP
#include <Arbutils/Memory/BorrowedPtr.hpp>
#include "../../Models/CreatureIndex.hpp"
#include "../../Models/DamageSource.hpp"
#include "../EventDataKind.hpp"
namespace CreatureLib::Battling {
// Predeclare some classes.
class Creature;
class EventData {
public:
virtual ~EventData() = default;

View File

@@ -1,5 +1,6 @@
#ifndef CREATURELIB_SWITCHEVENT_HPP
#define CREATURELIB_SWITCHEVENT_HPP
#include "../../Models/CreatureIndex.hpp"
#include "EventData.hpp"
namespace CreatureLib::Battling {