Merge pull request #5 from Valorith/copilot/fix-ff2b6de1-c436-4d71-b9f4-dfeb78b9fa7f

Enhance SummonItemIntoInventory to support stacking of items
This commit is contained in:
Vayle 2025-10-04 14:45:33 -04:00 committed by GitHub
commit 4600b05bea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 19 deletions

View File

@ -842,6 +842,11 @@ ENDIF (UNIX)
IF (EQEMU_BUILD_PCH) IF (EQEMU_BUILD_PCH)
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/std-pch.h) TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/std-pch.h)
# Avoid PCH/__OPTIMIZE__ mismatch when compiling certain patch sources with -O0
# These files are compiled with -O0 on UNIX (see COMPILE_FLAGS above), which
# disables the __OPTIMIZE__ predefined macro. Disabling PCH for them prevents
# Clang from erroring due to macro state differences between the PCH and TU.
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
ENDIF () ENDIF ()
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

View File

@ -4607,26 +4607,32 @@ void Client::SummonItemIntoInventory(
return; return;
} }
const bool is_arrow = inst->GetItem()->ItemType == EQ::item::ItemTypeArrow; // Try stacking first if the item is stackable, then fall back to finding a free slot
const int16 slot_id = m_inv.FindFreeSlot( if (!PutItemInInventoryWithStacking(inst)) {
inst->IsClassBag(), // PutItemInInventoryWithStacking failed, fall back to original behavior
true, const bool is_arrow = inst->GetItem()->ItemType == EQ::item::ItemTypeArrow;
inst->GetItem()->Size, const int16 slot_id = m_inv.FindFreeSlot(
is_arrow inst->IsClassBag(),
); true,
inst->GetItem()->Size,
is_arrow
);
SummonItem( SummonItem(
item_id, item_id,
charges, charges,
aug1, aug1,
aug2, aug2,
aug3, aug3,
aug4, aug4,
aug5, aug5,
aug6, aug6,
is_attuned, is_attuned,
slot_id slot_id
); );
}
safe_delete(inst);
} }
bool Client::HasItemOnCorpse(uint32 item_id) bool Client::HasItemOnCorpse(uint32 item_id)