LPITEM CHARACTER::GetItem(TItemPos Cell) const
{
if (!m_PlayerSlots)
return nullptr;
if (!IsValidItemPosition(Cell))
return NULL;
WORD wCell = Cell.cell;
BYTE window_type = Cell.window_type;
switch (window_type)
{
case INVENTORY:
case EQUIPMENT:
if (wCell >= INVENTORY_AND_EQUIP_SLOT_MAX)
{
sys_err("CHARACTER::GetInventoryItem: invalid item cell %d", wCell);
return NULL;
}
return m_PlayerSlots->pItems[wCell];
case DRAGON_SOUL_INVENTORY:
if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid DS item cell %d", wCell);
return NULL;
}
return m_PlayerSlots->pDSItems[wCell];
#ifdef ENABLE_SPECIAL_STORAGE
case UPGRADE_INVENTORY:
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid SSU item cell %d", wCell);
return nullptr;
}
return m_PlayerSlots->pSSUItems[wCell];
case BOOK_INVENTORY:
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid SSB item cell %d", wCell);
return nullptr;
}
return m_PlayerSlots->pSSBItems[wCell];
case STONE_INVENTORY:
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid SSS item cell %d", wCell);
return nullptr;
}
return m_PlayerSlots->pSSSItems[wCell];
case CHEST_INVENTORY:
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid SSC item cell %d", wCell);
return nullptr;
}
return m_PlayerSlots->pSSCItems[wCell];
#endif