From 65ba0f127e5a57bfe448d963179cd57e09ffca0e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 02:32:52 +0000 Subject: [PATCH 2/8] Remove duplicate cpc.quantity assignment in parcels.cpp Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com> --- zone/parcels.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/parcels.cpp b/zone/parcels.cpp index 12281aa67..75d2f4b36 100644 --- a/zone/parcels.cpp +++ b/zone/parcels.cpp @@ -453,7 +453,6 @@ void Client::DoParcelSend(const Parcel_Struct *parcel_in) cpc.quantity = item->GetCharges() >= 0 ? item->GetCharges() : 1; cpc.evolve_amount = item->GetEvolveCurrentAmount(); - cpc.quantity = item->GetCharges() >= 0 ? item->GetCharges() : 1; all_entries.push_back(cpc); } CharacterParcelsContainersRepository::InsertMany(database, all_entries); From c652a07c0549529560247db581b35843b7b6008c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 02:35:15 +0000 Subject: [PATCH 5/8] Fix non-const lvalue reference binding in inventory_snapshots_repository.h Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com> --- common/repositories/inventory_snapshots_repository.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/repositories/inventory_snapshots_repository.h b/common/repositories/inventory_snapshots_repository.h index 88671cdd7..674e8bb1b 100644 --- a/common/repositories/inventory_snapshots_repository.h +++ b/common/repositories/inventory_snapshots_repository.h @@ -81,7 +81,7 @@ public: return -1; } - auto &row = results.begin(); + auto row = results.begin(); const int64 count = Strings::ToBigInt(row[0]); if (count > std::numeric_limits::max()) { From 0ac96258812d2552beececff5bc8e117872455c8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 02:37:13 +0000 Subject: [PATCH 7/8] Fix PutItemInInventoryWithStacking: complete stack-fill pass before using empty slots Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com> --- zone/inventory.cpp | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 9ea858570..aa7c5e9ef 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -4700,16 +4700,14 @@ bool Client::PutItemInInventoryWithStacking(EQ::ItemInstance *inst) int32 quantity; }; - std::vector queue; - auto quantity = inst->GetCharges(); + std::vector queue; + std::vector empty_bag_slots; + auto quantity = inst->GetCharges(); for (int i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++) { auto inv_inst = GetInv().GetItem(i); if (!inv_inst) { - LogError("Found a slot {} in general inventory", i); - inst->SetCharges(quantity); - PutItemInInventory(i, *inst, true); - return true; + continue; } int16 base_slot_id = EQ::InventoryProfile::CalcSlotId(i, EQ::invbag::SLOT_BEGIN); @@ -4722,10 +4720,8 @@ bool Client::PutItemInInventoryWithStacking(EQ::ItemInstance *inst) auto bag_inst = GetInv().GetItem(base_slot_id + bag_slot); if (!bag_inst && inv_inst->GetItem()->BagSize >= inst->GetItem()->Size) { - LogError("Found a parent {} base_slot_id {} bag_slot {} in bag", i, base_slot_id, bag_slot); - inst->SetCharges(quantity); - PutItemInInventory(base_slot_id + bag_slot, *inst, true); - return true; + empty_bag_slots.push_back(base_slot_id + bag_slot); + continue; } if (bag_inst && bag_inst->IsStackable() && bag_inst->GetID() == inst->GetID()) { @@ -4736,12 +4732,6 @@ bool Client::PutItemInInventoryWithStacking(EQ::ItemInstance *inst) temp tmp = {temp_slot, quantity}; queue.push_back(tmp); quantity = 0; - LogError( - "Found an item parent {} base_slot_id {} bag_slot {} in bag with ENOUGH space", - i, - base_slot_id, - bag_slot - ); break; } @@ -4749,12 +4739,6 @@ bool Client::PutItemInInventoryWithStacking(EQ::ItemInstance *inst) temp tmp = {temp_slot, stack_size - bag_inst_quantity}; queue.push_back(tmp); quantity -= stack_size - bag_inst_quantity; - LogError( - "Found an item parent {} base_slot_id {} bag_slot {} in bag with SOME space", - i, - base_slot_id, - bag_slot - ); } } } @@ -4770,25 +4754,29 @@ bool Client::PutItemInInventoryWithStacking(EQ::ItemInstance *inst) } bag_inst->SetCharges(i.quantity + bag_inst->GetCharges()); PutItemInInventory(i.slot_id, *bag_inst, true); - LogError("Write out data. Item {} quantity {} slot {}", bag_inst->GetItem()->Name, i.quantity, i.slot_id); } database.TransactionCommit(); } if (quantity == 0) { - LogError("Quantity was zero. All items placed in inventory."); return true; } inst->SetCharges(quantity); + for (auto slot_id : empty_bag_slots) { + if (PutItemInInventory(slot_id, *inst, true)) { + return true; + } + } + if (free_id != INVALID_INDEX && !EQ::ValueWithin(free_id, EQ::invslot::EQUIPMENT_BEGIN, EQ::invslot::EQUIPMENT_END) && PutItemInInventory(free_id, *inst, true)) { return true; } - LogError("Could not find enough room"); + LogError("Could not find enough room for item {} (quantity {}) for character {}", inst->GetItem()->Name, quantity, CharacterID()); return false; } From 882a2627ab2ea33aaec6b6d0121daee587a2169b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 02:39:19 +0000 Subject: [PATCH 8/8] Pass unordered_set by const ref in Strings::Implode to avoid unnecessary copy Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com> --- common/strings.cpp | 6 +++--- common/strings.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/strings.cpp b/common/strings.cpp index 29bef8993..a4ea9f3da 100644 --- a/common/strings.cpp +++ b/common/strings.cpp @@ -961,14 +961,14 @@ bool Strings::IsValidJson(const std::string &json) return result; } -std::string Strings::Implode(const std::string& glue, std::unordered_set src) +std::string Strings::Implode(const std::string& glue, const std::unordered_set& src) { if (src.empty()) { return {}; } - std::ostringstream output; - std::unordered_set::iterator src_iter; + std::ostringstream output; + std::unordered_set::const_iterator src_iter; for (src_iter = src.begin(); src_iter != src.end(); src_iter++) { output << *src_iter << glue; diff --git a/common/strings.h b/common/strings.h index ab2e71011..ef7d93440 100644 --- a/common/strings.h +++ b/common/strings.h @@ -77,7 +77,7 @@ public: static std::string Escape(const std::string &s); static std::string GetBetween(const std::string &s, std::string start_delim, std::string stop_delim); static std::string Implode(const std::string& glue, std::vector src); - static std::string Implode(const std::string& glue, std::unordered_set src); + static std::string Implode(const std::string& glue, const std::unordered_set& src); static std::string Join(const std::vector &ar, const std::string &delim); static std::string Join(const std::vector &ar, const std::string &delim); static std::string MillisecondsToTime(int duration);