Mana
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Item Class Reference

Represents one or more instances of a certain item type. More...

#include <item.h>

Inheritance diagram for Item:
ShopItem

Public Member Functions

 Item (int id=-1, int quantity=0, bool equipped=false)
 
virtual ~Item ()=default
 
void setId (int id)
 Sets the item id, identifying the item type.
 
int getId () const
 Returns the item id.
 
ImagegetImage () const
 Returns the item image.
 
void setQuantity (int quantity)
 Sets the number of items.
 
void increaseQuantity (int amount)
 Increases the number of items by the given amount.
 
int getQuantity () const
 Returns the number of items.
 
void setEquipped (bool equipped)
 Sets whether this item is equipped.
 
bool isEquipped () const
 Returns whether this item is equipped.
 
bool isEquippable () const
 Returns whether this item is equippable.
 
void setInvIndex (int index)
 Sets the inventory index of this item.
 
int getInvIndex () const
 Returns the inventory index of this item.
 
void doEvent (Event::Type eventType)
 
void doEvent (Event::Type eventType, int amount)
 
const ItemInfogetInfo () const
 Returns information about this item type.
 

Protected Attributes

int mId
 Item type id.
 
ResourceRef< ImagemImage
 Item image.
 
int mQuantity
 Number of items.
 
bool mEquipped
 Item is equipped.
 
int mInvIndex
 Inventory index.
 

Detailed Description

Represents one or more instances of a certain item type.

Definition at line 34 of file item.h.

Constructor & Destructor Documentation

◆ Item()

Item::Item ( int  id = -1,
int  quantity = 0,
bool  equipped = false 
)

Definition at line 31 of file item.cpp.

◆ ~Item()

virtual Item::~Item ( )
virtualdefault

Member Function Documentation

◆ doEvent() [1/2]

void Item::doEvent ( Event::Type  eventType)

Definition at line 54 of file item.cpp.

◆ doEvent() [2/2]

void Item::doEvent ( Event::Type  eventType,
int  amount 
)

Definition at line 61 of file item.cpp.

◆ getId()

int Item::getId ( ) const
inline

Returns the item id.

Definition at line 49 of file item.h.

◆ getImage()

Image * Item::getImage ( ) const
inline

Returns the item image.

Definition at line 54 of file item.h.

◆ getInfo()

const ItemInfo & Item::getInfo ( ) const
inline

Returns information about this item type.

Definition at line 103 of file item.h.

◆ getInvIndex()

int Item::getInvIndex ( ) const
inline

Returns the inventory index of this item.

Definition at line 94 of file item.h.

◆ getQuantity()

int Item::getQuantity ( ) const
inline

Returns the number of items.

Definition at line 69 of file item.h.

◆ increaseQuantity()

void Item::increaseQuantity ( int  amount)
inline

Increases the number of items by the given amount.

Definition at line 64 of file item.h.

◆ isEquippable()

bool Item::isEquippable ( ) const

Returns whether this item is equippable.

Definition at line 69 of file item.cpp.

◆ isEquipped()

bool Item::isEquipped ( ) const
inline

Returns whether this item is equipped.

Definition at line 79 of file item.h.

◆ setEquipped()

void Item::setEquipped ( bool  equipped)
inline

Sets whether this item is equipped.

Definition at line 74 of file item.h.

◆ setId()

void Item::setId ( int  id)

Sets the item id, identifying the item type.

Definition at line 38 of file item.cpp.

◆ setInvIndex()

void Item::setInvIndex ( int  index)
inline

Sets the inventory index of this item.

Definition at line 89 of file item.h.

◆ setQuantity()

void Item::setQuantity ( int  quantity)
inline

Sets the number of items.

Definition at line 59 of file item.h.

Member Data Documentation

◆ mEquipped

bool Item::mEquipped
protected

Item is equipped.

Definition at line 109 of file item.h.

◆ mId

int Item::mId
protected

Item type id.

Definition at line 106 of file item.h.

◆ mImage

ResourceRef<Image> Item::mImage
protected

Item image.

Definition at line 107 of file item.h.

◆ mInvIndex

int Item::mInvIndex
protected

Inventory index.

Definition at line 110 of file item.h.

◆ mQuantity

int Item::mQuantity
protected

Number of items.

Definition at line 108 of file item.h.


The documentation for this class was generated from the following files: