Overhaul memory model to new Arbutils memory.
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
2020-12-12 12:22:48 +01:00
parent 1dc3aafd33
commit 5c39694f19
33 changed files with 279 additions and 211 deletions

View File

@@ -24,8 +24,8 @@ namespace CreatureLib::Battling {
ArbUt::BorrowedPtr<const Library::CreatureSpecies> _species;
ArbUt::BorrowedPtr<const Library::SpeciesVariant> _variant;
ArbUt::BorrowedPtr<const Library::CreatureSpecies> _displaySpecies = nullptr;
ArbUt::BorrowedPtr<const Library::SpeciesVariant> _displayVariant = nullptr;
ArbUt::OptionalBorrowedPtr<const Library::CreatureSpecies> _displaySpecies = nullptr;
ArbUt::OptionalBorrowedPtr<const Library::SpeciesVariant> _displayVariant = nullptr;
level_int_t _level;
uint32_t _experience;
@@ -39,8 +39,8 @@ namespace CreatureLib::Battling {
Library::StatisticSet<uint32_t> _flatStats;
Library::StatisticSet<uint32_t> _boostedStats;
ArbUt::BorrowedPtr<Battle> _battle = nullptr;
ArbUt::BorrowedPtr<BattleSide> _side = nullptr;
ArbUt::OptionalBorrowedPtr<Battle> _battle = nullptr;
ArbUt::OptionalBorrowedPtr<BattleSide> _side = nullptr;
bool _onBattleField = false;
std::string _nickname = "";
@@ -104,9 +104,9 @@ namespace CreatureLib::Battling {
inline uint32_t GetCurrentHealth() const noexcept { return _currentHealth; }
void SetBattleData(ArbUt::BorrowedPtr<Battle> battle, ArbUt::BorrowedPtr<BattleSide> side);
const ArbUt::BorrowedPtr<Battle>& GetBattle() const;
const ArbUt::BorrowedPtr<BattleSide>& GetBattleSide() const;
void SetBattleData(const ArbUt::BorrowedPtr<Battle>& battle, const ArbUt::BorrowedPtr<BattleSide>& side);
const ArbUt::OptionalBorrowedPtr<Battle>& GetBattle() const;
const ArbUt::OptionalBorrowedPtr<BattleSide>& GetBattleSide() const;
inline void SetOnBattleField(bool value) { _onBattleField = value; }
inline bool IsOnBattleField() const { return _onBattleField; }
@@ -149,14 +149,14 @@ namespace CreatureLib::Battling {
return false;
}
ArbUt::BorrowedPtr<const Library::CreatureSpecies> GetDisplaySpecies() const noexcept;
ArbUt::BorrowedPtr<const Library::SpeciesVariant> GetDisplayVariant() const noexcept;
ArbUt::OptionalBorrowedPtr<const Library::CreatureSpecies> GetDisplaySpecies() const noexcept;
ArbUt::OptionalBorrowedPtr<const Library::SpeciesVariant> GetDisplayVariant() const noexcept;
void SetDisplaySpecies(const ArbUt::BorrowedPtr<const Library::CreatureSpecies>& species) noexcept {
_displaySpecies = species;
_displaySpecies = species.GetRaw();
}
void SetDisplayVariant(ArbUt::BorrowedPtr<const Library::SpeciesVariant> variant) noexcept {
_displayVariant = variant;
_displayVariant = variant.GetRaw();
};
inline bool AllowedExperienceGain() const noexcept { return _allowedExperienceGain; }