[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
This commit is contained in:
Alex King 2024-12-12 17:39:38 -05:00 committed by GitHub
parent 3b779ef301
commit e258aaa068
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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<int16>::max()) {
hdr.stacksize = std::numeric_limits<uint32>::max();
} else {
hdr.stacksize = inst->GetCharges();
}
}
hdr.unknown004 = 0;
structs::InventorySlot_Struct slot_id{};