Change nickname to string from string_view.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-07-19 12:15:14 +02:00
parent 75810b9d0c
commit be82abeece
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
3 changed files with 5 additions and 5 deletions

View File

@ -12,7 +12,7 @@ export uint8_t CreatureLib_Creature_Construct(Creature*& out, const BattleLibrar
Try(auto attacksVec = std::vector<LearnedAttack*>(attacks, attacks + (attacksNum * sizeof(LearnedAttack*))); Try(auto attacksVec = std::vector<LearnedAttack*>(attacks, attacks + (attacksNum * sizeof(LearnedAttack*)));
out = new Creature(library, ArbUt::BorrowedPtr<const CreatureLib::Library::CreatureSpecies>(species), variant, out = new Creature(library, ArbUt::BorrowedPtr<const CreatureLib::Library::CreatureSpecies>(species), variant,
level, experience, uid, gender, coloring, level, experience, uid, gender, coloring,
ArbUt::BorrowedPtr<const CreatureLib::Library::Item>(heldItem), nickname, ArbUt::BorrowedPtr<const CreatureLib::Library::Item>(heldItem), std::string(nickname),
CreatureLib::Library::TalentIndex(secretTalent, talent), attacksVec, allowedExperienceGain);) CreatureLib::Library::TalentIndex(secretTalent, talent), attacksVec, allowedExperienceGain);)
}; };

View File

@ -10,7 +10,7 @@ Battling::Creature::Creature(ArbUt::BorrowedPtr<const BattleLibrary> library,
const ArbUt::BorrowedPtr<const Library::CreatureSpecies>& species, const ArbUt::BorrowedPtr<const Library::CreatureSpecies>& species,
const ArbUt::BorrowedPtr<const Library::SpeciesVariant>& variant, uint8_t level, const ArbUt::BorrowedPtr<const Library::SpeciesVariant>& variant, uint8_t level,
uint32_t experience, uint32_t uid, Library::Gender gender, uint8_t coloring, uint32_t experience, uint32_t uid, Library::Gender gender, uint8_t coloring,
const ArbUt::BorrowedPtr<const Library::Item> heldItem, const std::string_view& nickname, const ArbUt::BorrowedPtr<const Library::Item> heldItem, const std::string& nickname,
const Library::TalentIndex& talent, const std::vector<LearnedAttack*>& attacks, const Library::TalentIndex& talent, const std::vector<LearnedAttack*>& attacks,
bool allowedExperienceGain) bool allowedExperienceGain)
: _library(library), _species(species), _variant(variant), _level(level), _experience(experience), : _library(library), _species(species), _variant(variant), _level(level), _experience(experience),

View File

@ -45,7 +45,7 @@ namespace CreatureLib::Battling {
ArbUt::BorrowedPtr<BattleSide> _side = nullptr; ArbUt::BorrowedPtr<BattleSide> _side = nullptr;
bool _onBattleField = false; bool _onBattleField = false;
std::string_view _nickname = ""; std::string _nickname = "";
CreatureLib::Library::TalentIndex _talentIndex; CreatureLib::Library::TalentIndex _talentIndex;
std::unique_ptr<Script> _activeTalent = nullptr; std::unique_ptr<Script> _activeTalent = nullptr;
@ -69,7 +69,7 @@ namespace CreatureLib::Battling {
const ArbUt::BorrowedPtr<const Library::CreatureSpecies>& species, const ArbUt::BorrowedPtr<const Library::CreatureSpecies>& species,
const ArbUt::BorrowedPtr<const Library::SpeciesVariant>& variant, uint8_t level, uint32_t experience, const ArbUt::BorrowedPtr<const Library::SpeciesVariant>& variant, uint8_t level, uint32_t experience,
uint32_t uid, Library::Gender gender, uint8_t coloring, uint32_t uid, Library::Gender gender, uint8_t coloring,
const ArbUt::BorrowedPtr<const Library::Item> heldItem, const std::string_view& nickname, const ArbUt::BorrowedPtr<const Library::Item> heldItem, const std::string& nickname,
const Library::TalentIndex& talent, const std::vector<LearnedAttack*>& attacks, const Library::TalentIndex& talent, const std::vector<LearnedAttack*>& attacks,
bool allowedExperienceGain = true); bool allowedExperienceGain = true);
@ -108,7 +108,7 @@ namespace CreatureLib::Battling {
inline void SetOnBattleField(bool value) { _onBattleField = value; } inline void SetOnBattleField(bool value) { _onBattleField = value; }
inline bool IsOnBattleField() const { return _onBattleField; } inline bool IsOnBattleField() const { return _onBattleField; }
inline const std::string_view& GetNickname() const noexcept { return _nickname; } inline std::string_view GetNickname() const noexcept { return _nickname; }
const ArbUt::StringView& GetActiveTalent() const; const ArbUt::StringView& GetActiveTalent() const;
[[nodiscard]] bool IsFainted() const noexcept; [[nodiscard]] bool IsFainted() const noexcept;