52 bool operator()(const
Item *const item)
const
54 return (item !=
nullptr) && item->mId >= 0 && item->mQuantity > 0;
62 mInventoryListeners(),
76 for (
unsigned i = 0; i <
mSize; i++)
97 for (
unsigned i = 0; i <
mSize; i++)
100 if ((item !=
nullptr) && item->
mId == itemId)
118 const uint8_t refine,
145 const uint8_t refine,
161 if ((item1 ==
nullptr) &&
id > 0)
178 else if (
id > 0 && (item1 !=
nullptr))
180 item1->
setId(
id, color);
188 else if (item1 !=
nullptr)
195 const int *
const cards,
196 const int size)
const
206 if (item1 !=
nullptr)
220 if (item1 !=
nullptr)
234 if (item1 !=
nullptr)
240 for (
unsigned i = 0; i <
mSize; i++)
246 for (
unsigned i = 0; i <
mSize; i++)
249 if ((item !=
nullptr) && item->
mId ==
id)
256 if (
mItems[index] ==
nullptr)
271 const int id = item->
mId;
272 for (
unsigned i = 0; i <
mSize; i++)
275 if ((item1 !=
nullptr) && item1->
mId ==
id)
286 std::not1(SlotUsed()));
293 for (
int i =
mSize - 1; i >= 0; i--)
295 if (SlotUsed()(
mItems[i]))
315 (*i)->slotsChanged(
this);
325 int partialIndex = -1;
327 for (
unsigned i = 0; i <
mSize; i++)
336 if (spritePath == path)
340 if (spritePathShort == path)
345 if (partialIndex != -1)
346 return mItems[partialIndex];
361 return N_(
"Inventory");
366 return N_(
"Storage");
400 if (
mSize == newSize)
403 for (
unsigned i = 0; i <
mSize; i++)
414 for (
unsigned i = 0; i <
mSize; i++)
417 if ((item !=
nullptr) && item->
mTag == tag)
426 for (
unsigned i = 0; i <
mSize; i++)
429 if (item !=
nullptr &&
447 if (
mItems[index] !=
nullptr)
478 if (item2 !=
nullptr)
488 if ((item ==
nullptr) || item->
mQuantity < amount)
506 const int index = (*it).first;
507 if (index < 0 || index >= sz)
520 const int index = item->
getTag();
550 if (item1 !=
nullptr)
552 if (item2 !=
nullptr)
std::map< int, int >::const_iterator IntMapCIter
#define reportAlways(...)
void virtualRemove(Item *const item, const int amount)
void setCards(const int index, const int *const cards, const int size) const
int findIndexByTag(const int tag) const
void removeItemAt(const int index)
Item * getItem(const int index) const
Inventory(const InventoryTypeT type, const int size)
void setTag(const int index, const int tag)
virtual bool addVirtualItem(const Item *const item, int index, const int amount)
void distributeSlotsChangedEvent()
const Item * findItemBySprite(std::string spritePath, const GenderT gender, const BeingTypeId race) const
Item * findItemByTag(const int tag) const
bool contains(const Item *const item) const
void setOptions(const int index, const ItemOptionsList *const options)
void moveItem(const int index1, const int index2)
Item * findItem(const int itemId, const ItemColor color) const
int getLastUsedSlot() const
std::string getName() const
int addItem(const int id, const ItemTypeT type, const int quantity, const uint8_t refine, const ItemColor color, const Identified identified, const Damaged damaged, const Favorite favorite, const Equipm equipment, const Equipped equipped)
InventoryListenerList mInventoryListeners
virtual void setItem(const int index, const int id, const ItemTypeT type, const int quantity, const uint8_t refine, const ItemColor color, const Identified identified, const Damaged damaged, const Favorite favorite, const Equipm equipment, const Equipped equipped)
void removeInventoyListener(InventoryListener *const listener)
void resize(const unsigned int newSize)
void virtualRestore(const Item *const item, const int amount)
void removeItem(const int id)
void addInventoyListener(InventoryListener *const listener)
const std::string & getSprite(const GenderT gender, const BeingTypeId race) const
void setQuantity(const int quantity)
void setIdentified(const Identified b)
void setInvIndex(const int index)
void setRefine(const uint8_t refine)
Favorite getFavorite() const
void setDamaged(const Damaged b)
void setId(const int id, const ItemColor color)
void setTag(const int tag)
ItemColor getColor() const
Identified getIdentified() const
ItemTypeT getType() const
Damaged getDamaged() const
void setEquipment(const Equipm equipment)
void setOptions(const ItemOptionsList *const options)
void setCards(const int *const cards, const int size)
void setFavorite(const Favorite b)
const ItemInfo & getInfo() const
const bool Equipped_false
#define FOR_EACH(type, iter, array)
Net::InventoryHandler * inventoryHandler
InventoryType ::T InventoryTypeT
const ItemColor ItemColor_one
const ItemColor ItemColor_zero
#define A_DEFAULT_COPY(func)
bool isItemProtected(const int id)
std::string removeSpriteIndex(std::string str)
std::string extractNameFromSprite(std::string str)