From 121c65d7ea846cd777ded93f5e1ec7f6246fdb45 Mon Sep 17 00:00:00 2001 From: Gent Date: Mon, 9 Nov 2020 21:29:28 -0500 Subject: [PATCH] Fix not being able to attach weapons to emails --- src/BuddyManager.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/BuddyManager.cpp b/src/BuddyManager.cpp index 35c9b28..3b20c11 100644 --- a/src/BuddyManager.cpp +++ b/src/BuddyManager.cpp @@ -654,13 +654,12 @@ void BuddyManager::emailSend(CNSocket* sock, CNPacketData* data) { for (int i = 0; i < 4; i++) { sEmailItemInfoFromCL attachment = pkt->aItem[i]; resp.aItem[i] = attachment; - if (attachment.ItemInven.iID > 0 && attachment.ItemInven.iType > 0) { - if (attachment.iSlotNum < 0 || attachment.iSlotNum >= AINVEN_COUNT) - continue; // sanity check - attachments.push_back(attachment.ItemInven); - // delete item - plr->Inven[attachment.iSlotNum] = { 0, 0, 0, 0 }; - } + if (attachment.iSlotNum < 0 || attachment.iSlotNum >= AINVEN_COUNT + || attachment.ItemInven.iID <= 0 || attachment.ItemInven.iType < 0) + continue; // sanity check + attachments.push_back(attachment.ItemInven); + // delete item + plr->Inven[attachment.iSlotNum] = { 0, 0, 0, 0 }; } int cost = pkt->iCash + 50 + 20 * attachments.size(); // attached taros + postage