From e258aaa068beadb9782eb933ead5768a2449d93e Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:39:38 -0500 Subject: [PATCH] [Bug Fix] Allow Items in ROF2 to Stack to 32,767 (#4556) * [Bug Fix] Allow Items in ROF2 to Stack to 32,767 * Update rof2.cpp --- common/patches/rof2.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 0406225ba..38106fd2a 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -6365,9 +6365,18 @@ namespace RoF2 //sprintf(hdr.unknown000, "06e0002Y1W00"); strn0cpy(hdr.unknown000, fmt::format("{:016}\0", inst->GetSerialNumber()).c_str(),sizeof(hdr.unknown000)); - hdr.stacksize = - item->ID == PARCEL_MONEY_ITEM_ID ? inst->GetPrice() : (inst->IsStackable() ? ((inst->GetCharges() > 1000) - ? 0xFFFFFFFF : inst->GetCharges()) : 1); + hdr.stacksize = 1; + + if (item->ID == PARCEL_MONEY_ITEM_ID) { + hdr.stacksize = inst->GetPrice(); + } else if (inst->IsStackable()) { + if (inst->GetCharges() > std::numeric_limits::max()) { + hdr.stacksize = std::numeric_limits::max(); + } else { + hdr.stacksize = inst->GetCharges(); + } + } + hdr.unknown004 = 0; structs::InventorySlot_Struct slot_id{};