(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
+13 -2
View File
@@ -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
+4 -2
View File
@@ -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<int>(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);