mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 21:56:36 +00:00
Sorta hacky work around for doing nukeitem in item quests. Added lua bitop library. Made excluding io/os optional
This commit is contained in:
+19
-5
@@ -30,6 +30,7 @@
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
std::list<ItemInst*> dirty_inst;
|
||||
int32 NextItemInstSerialNumber = 1;
|
||||
|
||||
static inline int32 GetNextItemInstSerialNumber() {
|
||||
@@ -110,7 +111,6 @@ ItemInstQueue::~ItemInstQueue() {
|
||||
Inventory::~Inventory() {
|
||||
std::map<int16, ItemInst*>::iterator cur,end;
|
||||
|
||||
|
||||
cur = m_worn.begin();
|
||||
end = m_worn.end();
|
||||
for(; cur != end; cur++) {
|
||||
@@ -1116,7 +1116,7 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity)
|
||||
(!item_to_delete->IsStackable() &&
|
||||
((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable()))) {
|
||||
// Item can now be destroyed
|
||||
safe_delete(item_to_delete);
|
||||
Inventory::MarkDirty(item_to_delete);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1126,8 +1126,7 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity)
|
||||
return false;
|
||||
}
|
||||
|
||||
safe_delete(item_to_delete);
|
||||
|
||||
Inventory::MarkDirty(item_to_delete);
|
||||
return true;
|
||||
|
||||
}
|
||||
@@ -1418,7 +1417,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst)
|
||||
|
||||
if (result == SLOT_INVALID) {
|
||||
LogFile->write(EQEMuLog::Error, "Inventory::_PutItem: Invalid slot_id specified (%i)", slot_id);
|
||||
safe_delete(inst); // Slot not found, clean up
|
||||
Inventory::MarkDirty(inst); // Slot not found, clean up
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -1933,3 +1932,18 @@ bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const
|
||||
}
|
||||
return (IsRace && IsClass);
|
||||
}
|
||||
|
||||
void Inventory::CleanDirty() {
|
||||
auto iter = dirty_inst.begin();
|
||||
while(iter != dirty_inst.end()) {
|
||||
delete (*iter);
|
||||
++iter;
|
||||
}
|
||||
dirty_inst.clear();
|
||||
}
|
||||
|
||||
void Inventory::MarkDirty(ItemInst *inst) {
|
||||
if(inst) {
|
||||
dirty_inst.push_back(inst);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +136,9 @@ public:
|
||||
|
||||
~Inventory();
|
||||
|
||||
static void CleanDirty();
|
||||
static void MarkDirty(ItemInst *inst);
|
||||
|
||||
// Retrieve a writeable item at specified slot
|
||||
ItemInst* GetItem(int16 slot_id) const;
|
||||
ItemInst* GetItem(int16 slot_id, uint8 bagidx) const;
|
||||
|
||||
Reference in New Issue
Block a user