mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
[bugfix] Don't set iType on empty item slots.
This confuses ItemManager::findFreeSlot().
This commit is contained in:
parent
579aa9d31d
commit
5747c24479
@ -130,7 +130,7 @@ void CNLoginServer::handlePacket(CNSocket* sock, CNPacketData* data) {
|
||||
for (int i = 5; i < AEQUIP_COUNT; i++) {
|
||||
// empty equips
|
||||
charInfo.aEquip[i].iID = 0;
|
||||
charInfo.aEquip[i].iType = i;
|
||||
charInfo.aEquip[i].iType = 0;
|
||||
charInfo.aEquip[i].iOpt = 0;
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ Player Database::DbToPlayer(DbPlayer player) {
|
||||
for (int i = 4; i < AEQUIP_COUNT; i++) {
|
||||
// empty equips
|
||||
result.Equip[i].iID = 0;
|
||||
result.Equip[i].iType = i;
|
||||
result.Equip[i].iType = 0;
|
||||
result.Equip[i].iOpt = 0;
|
||||
}
|
||||
for (int i = 0; i < AINVEN_COUNT; i++) {
|
||||
|
@ -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
|
||||
|
@ -141,7 +141,7 @@ void MissionManager::quitMission(CNSocket* sock, CNPacketData* data) {
|
||||
|
||||
/*
|
||||
* It's ok to do this only server-side, because the server decides which
|
||||
* slot latter items will be placed in.
|
||||
* slot later items will be placed in.
|
||||
*/
|
||||
for (int j = 0; j < AQINVEN_COUNT; j++)
|
||||
if (plr->QInven[j].iID == task["m_iSUItem"][i] || plr->QInven[j].iID == task["m_iCSUItem"][i])
|
||||
|
@ -44,7 +44,7 @@ void NPCManager::npcVendorBuy(CNSocket* sock, CNPacketData* data) {
|
||||
|
||||
if (slot != req->iInvenSlotNum) {
|
||||
// possible item stacking?
|
||||
std::cout << "[WARN] Client and server disagree on bought item slot" << std::endl;
|
||||
std::cout << "[WARN] Client and server disagree on bought item slot (" << req->iInvenSlotNum << " vs " << slot << ")" << std::endl;
|
||||
}
|
||||
|
||||
INITSTRUCT(sP_FE2CL_REP_PC_VENDOR_ITEM_BUY_SUCC, resp);
|
||||
|
Loading…
Reference in New Issue
Block a user