2020-08-14 13:18:00 +00:00
|
|
|
#ifndef CREATURELIB_HISTORYELEMENT_HPP
|
|
|
|
#define CREATURELIB_HISTORYELEMENT_HPP
|
|
|
|
|
|
|
|
#include "../HistoryElementKind.hpp"
|
2020-09-25 11:05:15 +00:00
|
|
|
|
2020-08-14 13:18:00 +00:00
|
|
|
namespace CreatureLib::Battling {
|
|
|
|
class HistoryElement {
|
|
|
|
friend class HistoryHolder;
|
2021-04-11 13:20:50 +00:00
|
|
|
u8* _previousOffset = nullptr;
|
2020-08-14 13:18:00 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void Clear() {
|
2021-04-11 13:20:50 +00:00
|
|
|
if (_previousOffset != nullptr) {
|
|
|
|
GetPrevious()->Clear();
|
2020-08-14 13:18:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual HistoryElementKind GetKind() const noexcept = 0;
|
2021-04-11 13:20:50 +00:00
|
|
|
ArbUt::BorrowedPtr<const HistoryElement> GetPrevious() const noexcept {
|
|
|
|
return reinterpret_cast<HistoryElement*>((u8*)this - _previousOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
ArbUt::BorrowedPtr<HistoryElement> GetPrevious() noexcept {
|
|
|
|
return reinterpret_cast<HistoryElement*>((u8*)this - _previousOffset);
|
|
|
|
}
|
2020-08-14 13:18:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // CREATURELIB_HISTORYELEMENT_HPP
|