[bugfix] Don't set iType on empty item slots.

This confuses ItemManager::findFreeSlot().
This commit is contained in:
2020-09-12 02:25:45 +02:00
parent 579aa9d31d
commit 5747c24479
5 changed files with 5 additions and 8 deletions

View File

@@ -720,12 +720,9 @@ void ItemManager::chestOpenHandler(CNSocket *sock, CNPacketData *data) {
// TODO: use this in cleaned up ItemManager
int ItemManager::findFreeSlot(Player *plr) {
int i;
sItemBase free;
memset((void*)&free, 0, sizeof(sItemBase));
for (i = 0; i < AINVEN_COUNT; i++)
if (memcmp((void*)&plr->Inven[i], (void*)&free, sizeof(sItemBase)) == 0)
if (plr->Inven[i].iType == 0 && plr->Inven[i].iID == 0 && plr->Inven[i].iOpt == 0)
return i;
// not found