#ifndef CREATURELIB_HISTORYELEMENT_HPP #define CREATURELIB_HISTORYELEMENT_HPP #include "../HistoryElementKind.hpp" namespace CreatureLib::Battling { class HistoryElement { friend class HistoryHolder; u8* _previousOffset = nullptr; protected: virtual void Clear() { if (_previousOffset != nullptr) { GetPrevious()->Clear(); } } public: virtual HistoryElementKind GetKind() const noexcept = 0; ArbUt::BorrowedPtr GetPrevious() const noexcept { return reinterpret_cast((u8*)this - _previousOffset); } ArbUt::BorrowedPtr GetPrevious() noexcept { return reinterpret_cast((u8*)this - _previousOffset); } }; } #endif // CREATURELIB_HISTORYELEMENT_HPP