Welcome to Metin2Resources

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

[C++] Cube renewal memory leak fix

JIGSAW

Be the best, Ignore the rest.
Staff member
Administrator
Premium
Joined
Jul 14, 2025
Messages
134
Reaction score
1,098
Points
93
Discord
jigsaw86
Replace
Code:
            LPITEM item = ITEM_MANAGER::instance().CreateItem(materialInfo.reward.vnum, materialInfo.reward.count);
            if (item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)){
                pack.date_cube_renewal.item_reward_stackable = true;
            }else{
                pack.date_cube_renewal.item_reward_stackable = false;
            }

With

Code:
            auto item = ITEM_MANAGER::instance().GetTable(materialInfo.reward.vnum);
            if (!item)
            {
                sys_err("%s: unknown material vnum (reward vnum %u) (category %s)", ch->GetName(), materialInfo.reward.vnum, materialInfo.category.c_str());
                continue;
            }
            pack.date_cube_renewal.item_reward_stackable = IS_SET(item->dwFlags, ITEM_FLAG_STACKABLE) && !IS_SET(item->dwAntiFlags, ITEM_ANTIFLAG_STACK);

What does it do?

- Previously, an item was created just to check if it was stackable and it remained in memory.
 
636Threads
3,982Messages
1,277Members
AecusLatest member
Back
Top