(RoF+) Added a work-around for the cursor buffer issue.

This commit is contained in:
Trevius 2014-12-22 20:51:56 -06:00
parent b072f5873d
commit ed257b0ef3
5 changed files with 32 additions and 17 deletions

View File

@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 12/22/2014 == == 12/22/2014 ==
Trevius: (RoF2) Fixed Tracking. Trevius: (RoF2) Fixed Tracking.
Trevius: (RoF+) Added a work-around for the cursor buffer issue.
== 12/21/2014 == == 12/21/2014 ==
Trevius: (RoF2) Fixed Extended Targets Window by correcting opcodes. Trevius: (RoF2) Fixed Extended Targets Window by correcting opcodes.

View File

@ -89,6 +89,17 @@ ItemInst* ItemInstQueue::pop()
return inst; 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 // Look at item at front of queue
ItemInst* ItemInstQueue::peek_front() const ItemInst* ItemInstQueue::peek_front() const
{ {
@ -259,9 +270,9 @@ int16 Inventory::PushCursor(const ItemInst& inst)
return MainCursor; return MainCursor;
} }
ItemInst* Inventory::PopCursor() ItemInst* Inventory::GetCursorItem()
{ {
return m_cursor.pop(); return m_cursor.peek_front();
} }
// Swap items in inventory // Swap items in inventory

View File

@ -93,6 +93,7 @@ public:
void push(ItemInst* inst); void push(ItemInst* inst);
void push_front(ItemInst* inst); void push_front(ItemInst* inst);
ItemInst* pop(); ItemInst* pop();
ItemInst* pop_back();
ItemInst* peek_front() const; ItemInst* peek_front() const;
inline int size() { return static_cast<int>(m_list.size()); } inline int size() { return static_cast<int>(m_list.size()); }
@ -151,8 +152,9 @@ public:
// Add item to cursor queue // Add item to cursor queue
int16 PushCursor(const ItemInst& inst); 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 // Swap items in inventory
bool SwapItem(int16 slot_a, int16 slot_b); bool SwapItem(int16 slot_a, int16 slot_b);

View File

@ -804,7 +804,7 @@ public:
int32 GetAugmentIDAt(int16 slot_id, uint8 augslot); int32 GetAugmentIDAt(int16 slot_id, uint8 augslot);
bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false);
bool PushItemOnCursor(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); void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true);
bool SwapItem(MoveItem_Struct* move_in); bool SwapItem(MoveItem_Struct* move_in);
void SwapItemResync(MoveItem_Struct* move_slots); void SwapItemResync(MoveItem_Struct* move_slots);

View File

@ -617,6 +617,7 @@ void Client::DropItem(int16 slot_id)
// Save client inventory change to database // Save client inventory change to database
if (slot_id == MainCursor) { if (slot_id == MainCursor) {
SendCursorBuffer();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(CharacterID(), s, e); database.SaveCursor(CharacterID(), s, e);
} else { } else {
@ -678,19 +679,19 @@ int32 Client::GetAugmentIDAt(int16 slot_id, uint8 augslot) {
return INVALID_ID; return INVALID_ID;
} }
void Client::SummonCursorBuffer() { void Client::SendCursorBuffer() {
// Temporary work-around for the RoF+ Client Buffer // Temporary work-around for the RoF+ Client Buffer
// Instead of letting the client move items around in cursor buffer, // Instead of dealing with client moving items in cursor buffer,
// we can just delete an item from the buffer and summon it to the cursor. // we can just send the next item in the cursor buffer to the cursor.
if (GetClientVersion() >= EQClientRoF) if (GetClientVersion() >= EQClientRoF)
{ {
if (!GetInv().CursorEmpty()) if (!GetInv().CursorEmpty())
{ {
const ItemInst* inst = GetInv().PopCursor(); const ItemInst* inst = GetInv().GetCursorItem();
SummonItem(inst->GetID(), inst->GetCharges(), inst->GetAugmentItemID(0), if (inst)
inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), {
inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), MainCursor, SendItemPacket(MainCursor, inst, ItemPacketSummonItem);
inst->GetOrnamentationIcon(), inst->GetOrnamentationIDFile(), inst->GetOrnamentHeroModel()); }
} }
} }
} }
@ -1332,7 +1333,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
} }
DeleteItemInInventory(move_in->from_slot); DeleteItemInInventory(move_in->from_slot);
SummonCursorBuffer(); SendCursorBuffer();
return true; // Item destroyed by client return true; // Item destroyed by client
} }
@ -1543,7 +1544,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
{ {
if (dstitemid == 0) if (dstitemid == 0)
{ {
SummonCursorBuffer(); SendCursorBuffer();
} }
std::list<ItemInst*>::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end(); std::list<ItemInst*>::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end();
database.SaveCursor(character_id, s, e); 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); trade->AddEntity(dst_slot_id, move_in->number_in_stack);
if (dstitemid == 0) if (dstitemid == 0)
{ {
SummonCursorBuffer(); SendCursorBuffer();
} }
return true; 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 not swapping another item to cursor and stacking items were depleted
if (dstitemid == 0 || all_to_stack == true) if (dstitemid == 0 || all_to_stack == true)
{ {
SummonCursorBuffer(); SendCursorBuffer();
} }
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(character_id, s, e); database.SaveCursor(character_id, s, e);