OpenEnroth 52af553
|
#include <Inventory.h>
Public Member Functions | |
ChestInventory (Sizei size) | |
ChestInventory () | |
int | size () const |
int | capacity () const |
Sizei | gridSize () const |
Recti | gridRect () const |
auto | entries (this auto &&self) |
auto | items (this auto &&self) |
auto | items (this auto &&self, ItemId itemId) |
InventoryEntry | entry (Pointi position) |
InventoryConstEntry | entry (Pointi position) const |
InventoryEntry | entry (ItemSlot slot) |
InventoryConstEntry | entry (ItemSlot slot) const |
InventoryEntry | entry (int index) |
InventoryConstEntry | entry (int index) const |
bool | canAdd (Pointi position, Sizei size) const |
bool | canAdd (Pointi position, const Item &item) const |
bool | canAdd (Sizei size) const |
bool | canAdd (const Item &item) const |
InventoryEntry | add (Pointi position, const Item &item) |
InventoryEntry | add (const Item &item) |
InventoryEntry | tryAdd (Pointi position, const Item &item) |
InventoryEntry | tryAdd (const Item &item) |
bool | canStash () const |
InventoryEntry | stash (const Item &item) |
InventoryEntry | tryStash (const Item &item) |
Item | take (InventoryEntry entry) |
std::optional< Pointi > | findSpace (Sizei size) const |
std::optional< Pointi > | findSpace (const Item &item) const |
InventoryEntry | find (ItemId itemId) |
InventoryConstEntry | find (ItemId itemId) const |
void | clear () |
Friends | |
class | Inventory |
void | snapshot (const ChestInventory &src, Chest_MM7 *dst) |
void | reconstruct (const Chest_MM7 &src, ChestInventory *dst, ContextTag< int > chestId) |
Additional Inherited Members | |
![]() | |
Inventory (Sizei gridSize, int capacity) | |
Inventory () | |
int | size () const |
int | capacity () const |
Sizei | gridSize () const |
Recti | gridRect () const |
auto | entries (this auto &&self) |
auto | items (this auto &&self) |
auto | items (this auto &&self, ItemId itemId) |
InventoryEntry | entry (Pointi position) |
InventoryConstEntry | entry (Pointi position) const |
InventoryEntry | entry (ItemSlot slot) |
InventoryConstEntry | entry (ItemSlot slot) const |
InventoryEntry | entry (int index) |
InventoryConstEntry | entry (int index) const |
bool | canAdd (Pointi position, Sizei size) const |
bool | canAdd (Pointi position, const Item &item) const |
bool | canAdd (Sizei size) const |
bool | canAdd (const Item &item) const |
InventoryEntry | add (Pointi position, const Item &item) |
InventoryEntry | add (const Item &item) |
InventoryEntry | tryAdd (Pointi position, const Item &item) |
InventoryEntry | tryAdd (const Item &item) |
bool | canEquip (ItemSlot slot) const |
InventoryEntry | equip (ItemSlot slot, const Item &item) |
InventoryEntry | tryEquip (ItemSlot slot, const Item &item) |
bool | canStash () const |
InventoryEntry | stash (const Item &item) |
InventoryEntry | tryStash (const Item &item) |
Item | take (InventoryEntry entry) |
std::optional< Pointi > | findSpace (Sizei size) const |
std::optional< Pointi > | findSpace (const Item &item) const |
InventoryEntry | find (ItemId itemId) |
InventoryConstEntry | find (ItemId itemId) const |
void | clear () |
![]() | |
static constexpr std::size_t | MAX_ITEMS = 140 |
Thin facade that exposes only the chest‑appropriate subset of Inventory
interface.
|
inlineexplicit |
|
inline |
InventoryEntry Inventory::add | ( | const Item & | item | ) |
InventoryEntry Inventory::add | ( | Pointi | position, |
const Item & | item | ||
) |
|
inline |
bool Inventory::canAdd | ( | Sizei | size | ) | const |
bool Inventory::canStash | ( | ) | const |
|
inline |
void Inventory::clear | ( | ) |
|
inline |
self | *this . |
InventoryEntry
or InventoryConstEntry
objects for items in this inventory. Returned entries are never invalid. InventoryEntry Inventory::entry | ( | int | index | ) |
index | Entry index to look up an item. |
index
, or an invalid entry if index
is out of bounds or if there is no item at index
.
|
inline |
InventoryEntry Inventory::entry | ( | ItemSlot | slot | ) |
slot | Equipment slot to look up an item. |
slot
, or an invalid entry if that slot is empty.
|
inline |
InventoryEntry Inventory::entry | ( | Pointi | position | ) |
position | Grid position to look up an item. |
position
is out of bounds or if the grid at position
is empty.
|
inline |
InventoryEntry Inventory::find | ( | ItemId | itemId | ) |
|
inline |
|
inline |
inventory.gridRect().contains(pos)
.
|
inline |
self | *this . |
Item
objects for items in this inventory. Returned items are never ITEM_NULL
.
|
inline |
|
inline |
InventoryEntry Inventory::stash | ( | const Item & | item | ) |
Item Inventory::take | ( | InventoryEntry | entry | ) |
InventoryEntry Inventory::tryAdd | ( | const Item & | item | ) |
InventoryEntry Inventory::tryAdd | ( | Pointi | position, |
const Item & | item | ||
) |
InventoryEntry Inventory::tryStash | ( | const Item & | item | ) |
|
friend |
|
friend |
|
friend |