minor refactoring

This commit is contained in:
2020-09-28 13:11:13 -05:00
parent 4079806436
commit 884b844d65
10 changed files with 172 additions and 23 deletions

View File

@@ -198,6 +198,9 @@ void ItemManager::itemUseHandler(CNSocket* sock, CNPacketData* data) {
sP_CL2FE_REQ_ITEM_USE* request = (sP_CL2FE_REQ_ITEM_USE*)data->buf;
Player* player = PlayerManager::getPlayer(sock);
if (player == nullptr)
return;
//gumball can only be used from inventory, so we ignore eIL
sItemBase gumball = player->Inven[request->iSlotNum];
sNano nano = player->Nanos[player->equippedNanos[request->iNanoSlot]];
@@ -769,6 +772,9 @@ void ItemManager::chestOpenHandler(CNSocket *sock, CNPacketData *data) {
sP_CL2FE_REQ_ITEM_CHEST_OPEN *pkt = (sP_CL2FE_REQ_ITEM_CHEST_OPEN *)data->buf;
Player *plr = PlayerManager::getPlayer(sock);
if (plr == nullptr)
return;
// item giving packet
const size_t resplen = sizeof(sP_FE2CL_REP_REWARD_ITEM) + sizeof(sItemReward);
assert(resplen < CN_PACKET_BUFFER_SIZE - 8);