Remove GetProperty macro, as it wasn't that intuitive, and caused issues later.
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:
@@ -3,3 +3,7 @@
|
||||
bool CreatureLib::Library::Item::HasFlag(const std::string& flag) const {
|
||||
return this->_flags.find(flag) != this->_flags.end();
|
||||
}
|
||||
CreatureLib::Library::Item::Item(std::string name, CreatureLib::Library::ItemCategory category,
|
||||
CreatureLib::Library::BattleItemCategory battleCategory, int32_t price,
|
||||
std::unordered_set<std::string> flags)
|
||||
: _name(name), _category(category), _battleCategory(battleCategory), _price(price), _flags(flags) {}
|
||||
|
||||
@@ -3,24 +3,27 @@
|
||||
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include "../../GenericTemplates.hpp"
|
||||
#include "BattleItemCategory.hpp"
|
||||
#include "ItemCategory.hpp"
|
||||
|
||||
namespace CreatureLib::Library {
|
||||
class Item {
|
||||
GetProperty(std::string, Name);
|
||||
GetProperty(ItemCategory, Category);
|
||||
GetProperty(BattleItemCategory, BattleCategory);
|
||||
GetProperty(int32_t, Price);
|
||||
|
||||
private:
|
||||
protected:
|
||||
std::string _name;
|
||||
ItemCategory _category;
|
||||
BattleItemCategory _battleCategory;
|
||||
int32_t _price;
|
||||
std::unordered_set<std::string> _flags;
|
||||
|
||||
public:
|
||||
Item(std::string name, ItemCategory category, BattleItemCategory battleCategory, int32_t price,
|
||||
std::unordered_set<std::string> flags);
|
||||
|
||||
inline const std::string GetName() const { return _name; }
|
||||
inline ItemCategory GetCategory() const { return _category; }
|
||||
inline BattleItemCategory GetBattleCategory() const { return _battleCategory; }
|
||||
inline const int32_t GetPrice() const { return _price; }
|
||||
|
||||
bool HasFlag(const std::string& flag) const;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user