Make item name ConstString.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-02-27 18:30:30 +01:00
parent 412e0a4d63
commit 469fcfe280
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 6 additions and 5 deletions

View File

@ -3,7 +3,8 @@
bool CreatureLib::Library::Item::HasFlag(const Arbutils::CaseInsensitiveConstString& flag) const {
return this->_flags.find(flag) != this->_flags.end();
}
CreatureLib::Library::Item::Item(std::string name, CreatureLib::Library::ItemCategory category,
CreatureLib::Library::Item::Item(const Arbutils::CaseInsensitiveConstString& name,
CreatureLib::Library::ItemCategory category,
CreatureLib::Library::BattleItemCategory battleCategory, int32_t price,
std::unordered_set<Arbutils::CaseInsensitiveConstString> flags)
: _name(name), _category(category), _battleCategory(battleCategory), _price(price), _flags(flags) {}

View File

@ -10,17 +10,17 @@
namespace CreatureLib::Library {
class Item {
protected:
std::string _name;
Arbutils::CaseInsensitiveConstString _name;
ItemCategory _category;
BattleItemCategory _battleCategory;
int32_t _price;
std::unordered_set<Arbutils::CaseInsensitiveConstString> _flags;
public:
Item(std::string name, ItemCategory category, BattleItemCategory battleCategory, int32_t price,
std::unordered_set<Arbutils::CaseInsensitiveConstString> flags);
Item(const Arbutils::CaseInsensitiveConstString& name, ItemCategory category, BattleItemCategory battleCategory,
int32_t price, std::unordered_set<Arbutils::CaseInsensitiveConstString> flags);
inline const std::string& GetName() const { return _name; }
inline const Arbutils::CaseInsensitiveConstString& GetName() const { return _name; }
inline ItemCategory GetCategory() const { return _category; }
inline BattleItemCategory GetBattleCategory() const { return _battleCategory; }
inline const int32_t GetPrice() const { return _price; }