20 const std::vector<std::shared_ptr<Item>>&
getItems()
const;
28 bool addItem(std::shared_ptr<Item> item);
68 std::vector<std::shared_ptr<Item>>
itemsM = {};
Base pure virtual Entity class. Different types of enities inherit this.
Definition: Entity.hpp:17
Represents the items that an entity can carry.
Definition: Inventory.hpp:12
Entity * ownerM
Definition: Inventory.hpp:64
std::shared_ptr< Item > removeItem(int itemId)
Removes item from the inventory.
Definition: Inventory.cpp:16
void useItem(int itemId)
Uses an item in the inventory.
Definition: Inventory.cpp:45
friend std::ostream & operator<<(std::ostream &os, const Inventory &inv)
Prints the contents of the inventory to ostream.
Definition: Inventory.cpp:61
const int inventorySizeM
Definition: Inventory.hpp:66
bool addItem(std::shared_ptr< Item > item)
Adds item to the inventory.
Definition: Inventory.cpp:6
std::vector< std::shared_ptr< Item > > itemsM
Definition: Inventory.hpp:68
void removeAllItems()
Removes all items from the inventory.
Definition: Inventory.cpp:30
Inventory(Entity *owner)
Definition: Inventory.cpp:4
bool isFull() const
Checks if inventory is full.
Definition: Inventory.cpp:35
const std::vector< std::shared_ptr< Item > > & getItems() const
Returns the items that the inventory contains.
Definition: Inventory.cpp:40