Decompile 2 functions in Source/UI/UIChangeMaterialWnd.cpp

Batch #13193 by cremane: 0 byte-identical, 2 confirmed by peer review.

- fn_03893 UIChangeMaterialWnd::sub_5E39A0: logic confirmed by peer review
- fn_03895 UIChangeMaterialWnd::SendMsg: logic confirmed by peer review

Peer-reviewed-by: gordaoprogramas, codeplay, StrawberrysherbetIX
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-11-06 11:06:43 +00:00
commit 7db87ebe0f

View file

@ -329,9 +329,9 @@ void UIChangeMaterialWnd::sub_5E39A0() {
*reinterpret_cast<std::int32_t*>(packet + 8) = 1;
unsigned char* entry = packet + 0xC;
for (const ITEM_INFO& material : this->m_materials) {
*reinterpret_cast<std::uint16_t*>(entry) = static_cast<std::uint16_t>(material.unknown_0000[1]);
*reinterpret_cast<std::uint16_t*>(entry + 2) = static_cast<std::uint16_t>(material.quantity);
for (auto it = this->m_materials.begin(); it != this->m_materials.end(); ++it) {
*reinterpret_cast<std::uint16_t*>(entry) = static_cast<std::uint16_t>(it->unknown_0000[1]);
*reinterpret_cast<std::uint16_t*>(entry + 2) = static_cast<std::uint16_t>(it->quantity);
entry += 4;
}
@ -395,13 +395,13 @@ int UIChangeMaterialWnd::SendMsg(
this->m_resultItem.SetItemId(entry->results.front().id);
this->m_resultItem.quantity = entry->results.front().quantity;
for (const MaterialReq& req : entry->materials) {
for (auto it = entry->materials.begin(); it != entry->materials.end(); ++it) {
ITEM_INFO info;
info.SetItemId(req.id);
info.quantity = req.quantity;
const ITEM_INFO stock = LookupClientItem(g_session.m_inventoryItems, req.id, 1);
info.SetItemId(it->id);
info.quantity = it->quantity;
const ITEM_INFO stock = LookupClientItem(g_session.m_inventoryItems, it->id, 1);
info.unknown_0000[1] = stock.unknown_0000[1];
info.identified = req.quantity <= stock.quantity;
info.identified = it->quantity <= stock.quantity;
this->m_materials.push_back(info);
}