Add ConstString to several other places where context isn't changed much during runtime.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "../../Core/StatisticSet.hpp"
|
||||
#include "CreatureMoves.hpp"
|
||||
#include "LearnableAttacks.hpp"
|
||||
using ConstString = Arbutils::CaseInsensitiveConstString;
|
||||
|
||||
namespace CreatureLib::Library {
|
||||
/*!
|
||||
@@ -14,7 +15,7 @@ namespace CreatureLib::Library {
|
||||
*/
|
||||
class SpeciesVariant {
|
||||
protected:
|
||||
std::string _name;
|
||||
ConstString _name;
|
||||
float _height;
|
||||
float _weight;
|
||||
uint32_t _baseExperience;
|
||||
@@ -22,19 +23,19 @@ namespace CreatureLib::Library {
|
||||
private:
|
||||
std::vector<uint8_t> _types;
|
||||
const Core::StatisticSet<uint16_t> _baseStatistics;
|
||||
std::vector<std::string> _talents;
|
||||
std::vector<std::string> _secretTalents;
|
||||
std::vector<ConstString> _talents;
|
||||
std::vector<ConstString> _secretTalents;
|
||||
const LearnableAttacks* _attacks;
|
||||
|
||||
public:
|
||||
SpeciesVariant(std::string name, float height, float weight, uint32_t baseExperience,
|
||||
SpeciesVariant(ConstString name, float height, float weight, uint32_t baseExperience,
|
||||
std::vector<uint8_t> types, Core::StatisticSet<uint16_t> baseStats,
|
||||
std::vector<std::string> talents, std::vector<std::string> secretTalents,
|
||||
std::vector<ConstString> talents, std::vector<ConstString> secretTalents,
|
||||
const LearnableAttacks* attacks);
|
||||
|
||||
virtual ~SpeciesVariant();
|
||||
|
||||
inline const std::string& GetName() const { return _name; }
|
||||
inline const ConstString& GetName() const { return _name; }
|
||||
inline float GetHeight() const { return _height; }
|
||||
inline float GetWeight() const { return _weight; }
|
||||
inline uint32_t GetBaseExperience() const { return _baseExperience; }
|
||||
@@ -43,12 +44,12 @@ namespace CreatureLib::Library {
|
||||
[[nodiscard]] uint8_t GetType(size_t index) const;
|
||||
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const;
|
||||
[[nodiscard]] uint32_t GetStatistic(Core::Statistic stat) const;
|
||||
[[nodiscard]] const std::string& GetTalent(int32_t index) const;
|
||||
[[nodiscard]] const ConstString& GetTalent(int32_t index) const;
|
||||
[[nodiscard]] const LearnableAttacks* GetLearnableAttacks() const;
|
||||
[[nodiscard]] int8_t GetTalentIndex(const std::string& talent) const;
|
||||
[[nodiscard]] int8_t GetRandomTalent(Arbutils::Random* rand) const;
|
||||
[[nodiscard]] inline const std::vector<std::string>& GetTalents() const { return _talents; }
|
||||
[[nodiscard]] inline const std::vector<std::string>& GetSecretTalents() const { return _secretTalents; }
|
||||
[[nodiscard]] inline const std::vector<ConstString>& GetTalents() const { return _talents; }
|
||||
[[nodiscard]] inline const std::vector<ConstString>& GetSecretTalents() const { return _secretTalents; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user