added inventory & active object
This commit is contained in:
1 parent
e1b491be73
commit
b3fda88784
16 files changed
+793
-98
No files matched your search
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace ZL {
|
||||
|
||||
struct Item {
|
||||
std::string id;
|
||||
std::string name;
|
||||
std::string description;
|
||||
std::string icon;
|
||||
|
||||
Item() = default;
|
||||
Item(const std::string& _id, const std::string& _name, const std::string& _desc, const std::string& _icon)
|
||||
: id(_id), name(_name), description(_desc), icon(_icon) {
|
||||
}
|
||||
};
|
||||
|
||||
class Inventory {
|
||||
private:
|
||||
std::vector<Item> items;
|
||||
|
||||
public:
|
||||
void addItem(const Item& item);
|
||||
void removeItem(const std::string& itemId);
|
||||
const std::vector<Item>& getItems() const { return items; }
|
||||
bool hasItem(const std::string& itemId) const;
|
||||
void clear() { items.clear(); }
|
||||
size_t getCount() const { return items.size(); }
|
||||
};
|
||||
|
||||
} // namespace ZL
|
||||
Reference in new issue
Block a user