diff --git a/changelog.txt b/changelog.txt index ec9d830c6..d7ce432cb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/22/2014 == Trevius: (RoF2) Fixed Tracking. +Trevius: (RoF+) Added a work-around for the cursor buffer issue. == 12/21/2014 == Trevius: (RoF2) Fixed Extended Targets Window by correcting opcodes. diff --git a/common/item.cpp b/common/item.cpp index d066f74cb..583cfdcb4 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -89,6 +89,17 @@ ItemInst* ItemInstQueue::pop() return inst; } +// Remove item from back of queue +ItemInst* ItemInstQueue::pop_back() +{ + if (m_list.size() == 0) + return nullptr; + + ItemInst* inst = m_list.back(); + m_list.pop_back(); + return inst; +} + // Look at item at front of queue ItemInst* ItemInstQueue::peek_front() const { @@ -259,9 +270,9 @@ int16 Inventory::PushCursor(const ItemInst& inst) return MainCursor; } -ItemInst* Inventory::PopCursor() +ItemInst* Inventory::GetCursorItem() { - return m_cursor.pop(); + return m_cursor.peek_front(); } // Swap items in inventory diff --git a/common/item.h b/common/item.h index 93ac21788..03182e4dd 100644 --- a/common/item.h +++ b/common/item.h @@ -93,6 +93,7 @@ public: void push(ItemInst* inst); void push_front(ItemInst* inst); ItemInst* pop(); + ItemInst* pop_back(); ItemInst* peek_front() const; inline int size() { return static_cast(m_list.size()); } @@ -151,8 +152,9 @@ public: // Add item to cursor queue int16 PushCursor(const ItemInst& inst); - // Remove item from cursor queue - ItemInst* PopCursor(); + + // Get cursor item in front of queue + ItemInst* GetCursorItem(); // Swap items in inventory bool SwapItem(int16 slot_a, int16 slot_b); diff --git a/zone/client.h b/zone/client.h index ac668f32a..b9a2c6d30 100644 --- a/zone/client.h +++ b/zone/client.h @@ -804,7 +804,7 @@ public: int32 GetAugmentIDAt(int16 slot_id, uint8 augslot); bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); bool PushItemOnCursor(const ItemInst& inst, bool client_update = false); - void SummonCursorBuffer(); + void SendCursorBuffer(); void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true); bool SwapItem(MoveItem_Struct* move_in); void SwapItemResync(MoveItem_Struct* move_slots); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index c0ef3d6cb..3afb2806b 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -617,6 +617,7 @@ void Client::DropItem(int16 slot_id) // Save client inventory change to database if (slot_id == MainCursor) { + SendCursorBuffer(); std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); database.SaveCursor(CharacterID(), s, e); } else { @@ -678,19 +679,19 @@ int32 Client::GetAugmentIDAt(int16 slot_id, uint8 augslot) { return INVALID_ID; } -void Client::SummonCursorBuffer() { +void Client::SendCursorBuffer() { // Temporary work-around for the RoF+ Client Buffer - // Instead of letting the client move items around in cursor buffer, - // we can just delete an item from the buffer and summon it to the cursor. + // Instead of dealing with client moving items in cursor buffer, + // we can just send the next item in the cursor buffer to the cursor. if (GetClientVersion() >= EQClientRoF) { if (!GetInv().CursorEmpty()) { - const ItemInst* inst = GetInv().PopCursor(); - SummonItem(inst->GetID(), inst->GetCharges(), inst->GetAugmentItemID(0), - inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), - inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), MainCursor, - inst->GetOrnamentationIcon(), inst->GetOrnamentationIDFile(), inst->GetOrnamentHeroModel()); + const ItemInst* inst = GetInv().GetCursorItem(); + if (inst) + { + SendItemPacket(MainCursor, inst, ItemPacketSummonItem); + } } } } @@ -1332,7 +1333,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } DeleteItemInInventory(move_in->from_slot); - SummonCursorBuffer(); + SendCursorBuffer(); return true; // Item destroyed by client } @@ -1543,7 +1544,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { { if (dstitemid == 0) { - SummonCursorBuffer(); + SendCursorBuffer(); } std::list::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end(); database.SaveCursor(character_id, s, e); @@ -1580,7 +1581,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { trade->AddEntity(dst_slot_id, move_in->number_in_stack); if (dstitemid == 0) { - SummonCursorBuffer(); + SendCursorBuffer(); } return true; @@ -1702,7 +1703,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // If not swapping another item to cursor and stacking items were depleted if (dstitemid == 0 || all_to_stack == true) { - SummonCursorBuffer(); + SendCursorBuffer(); } std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); database.SaveCursor(character_id, s, e);