|
Rehti MMORPG
1.0.0
Rehti MMORPG is a free and open source MMORPG game.
|
Represents the items that an entity can carry. More...
#include <Inventory.hpp>

Public Member Functions | |
| Inventory (Entity *owner) | |
| const std::vector< std::shared_ptr< Item > > & | getItems () const |
| Returns the items that the inventory contains. More... | |
| bool | addItem (std::shared_ptr< Item > item) |
| Adds item to the inventory. More... | |
| std::shared_ptr< Item > | removeItem (int itemId) |
| Removes item from the inventory. More... | |
| void | removeAllItems () |
| Removes all items from the inventory. More... | |
| void | useItem (int itemId) |
| Uses an item in the inventory. More... | |
| bool | isFull () const |
| Checks if inventory is full. More... | |
Private Attributes | |
| Entity * | ownerM |
| const int | inventorySizeM = 28 |
| std::vector< std::shared_ptr< Item > > | itemsM = {} |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Inventory &inv) |
| Prints the contents of the inventory to ostream. More... | |
Represents the items that an entity can carry.
| Inventory::Inventory | ( | Entity * | owner | ) |
| bool Inventory::addItem | ( | std::shared_ptr< Item > | item | ) |
Adds item to the inventory.
| item | shared pointer to Item |

| const std::vector< std::shared_ptr< Item > > & Inventory::getItems | ( | ) | const |
Returns the items that the inventory contains.

| bool Inventory::isFull | ( | ) | const |
Checks if inventory is full.

| void Inventory::removeAllItems | ( | ) |
Removes all items from the inventory.
| std::shared_ptr< Item > Inventory::removeItem | ( | int | itemId | ) |
Removes item from the inventory.
| itemId | instance id of item to be removed |

| void Inventory::useItem | ( | int | itemId | ) |
Uses an item in the inventory.
| itemId | instance id of item to be used |
|
friend |
Prints the contents of the inventory to ostream.
| os | ostream where to print |
| inv | inventory to be printed |
|
private |
|
private |
|
private |