Some EquipmentItem locking fixes
This commit is contained in:
parent
c0f002209f
commit
60f1130466
2 changed files with 12 additions and 5 deletions
|
@ -3556,9 +3556,12 @@ bool EquipmentItemList::AddItem(int8 slot, Item* item){
|
|||
Item* curItem = GetItem(slot);
|
||||
|
||||
if (curItem) // existing item in slot
|
||||
{
|
||||
MEquipmentItems.unlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
SetItem(slot, item);
|
||||
SetItem(slot, item, true);
|
||||
if (item->details.unique_id == 0) {
|
||||
GetItem(slot)->details.unique_id = MasterItemList::NextUniqueID();
|
||||
if (item->IsBag())
|
||||
|
@ -3581,13 +3584,17 @@ int8 EquipmentItemList::GetNumberOfItems(){
|
|||
return ret;
|
||||
}
|
||||
|
||||
void EquipmentItemList::SetItem(int8 slot_id, Item* item){
|
||||
MEquipmentItems.lock();
|
||||
void EquipmentItemList::SetItem(int8 slot_id, Item* item, bool locked){
|
||||
if(!locked)
|
||||
MEquipmentItems.lock();
|
||||
|
||||
item->details.inv_slot_id = 0;
|
||||
item->details.slot_id = slot_id;
|
||||
item->details.index = slot_id;
|
||||
items[slot_id] = item;
|
||||
MEquipmentItems.unlock();
|
||||
|
||||
if(!locked)
|
||||
MEquipmentItems.unlock();
|
||||
}
|
||||
|
||||
vector<Item*>* EquipmentItemList::GetAllEquippedItems(){
|
||||
|
|
|
@ -1031,7 +1031,7 @@ public:
|
|||
int8 GetNumberOfItems();
|
||||
Item* GetItemFromUniqueID(int32 item_id);
|
||||
Item* GetItemFromItemID(int32 item_id);
|
||||
void SetItem(int8 slot_id, Item* item);
|
||||
void SetItem(int8 slot_id, Item* item, bool locked = false);
|
||||
void RemoveItem(int8 slot, bool delete_item = false);
|
||||
Item* GetItem(int8 slot_id);
|
||||
bool AddItem(int8 slot, Item* item);
|
||||
|
|
Loading…
Add table
Reference in a new issue