While reviewing the DestroyItem logic, I noticed a potential inconsistency in the ownership validation check.
Inside ITEM_MANAGER::DestroyItem(), the code performs the following lookup:
if (CHARACTER_MANAGER::instance().Find(item->GetOwner()->GetPlayerID()) != nullptr)
However, Find() operates on the character VID map (m_map_pkChrByVID), while GetPlayerID() returns Player ID. This introduces a mismatch between the lookup key and the expected identifier type.
As a result, this check will almost always fail and return nullptr, meaning the condition is effectively not reliable for validating the character existence through this path.
From what I understand, this safety check was intended as a defensive check rather than part of the normal item lifecycle. In the standard execution flow, items owned by a character should already have been detached via RemoveFromCharacter() before reaching M2_DESTROY_ITEM, while items on the ground naturally have no owner and do not require this validation.
The concern arises in edge cases where the destruction flow is triggered while the item is still logically attached to a character. In such scenarios, this validation does not correctly reflect the real ownership state due to the PID/VID mismatch.
Fix Change Find() to FindByPID()
In item_manager.cpp, find:
if (CHARACTER_MANAGER::instance().Find(item->GetOwner()->GetPlayerID()) != nullptr)
Replace it with:
if (CHARACTER_MANAGER::instance().FindByPID(item->GetOwner()->GetPlayerID()) != nullptr)
special thanks to @ Abel(Tiger) and @ Gurgarath For taking the time to clarify this behavior.