mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2026-01-06 13:10:55 +00:00
[Client] Catch and ignore attempts to add invalid items to containers
This commit is contained in:
parent
5dbdc92a1c
commit
14a8dae86c
1 changed files with 19 additions and 12 deletions
|
|
@ -226,23 +226,30 @@ void ObjectList::editContainers(MWWorld::CellStore* cellStore)
|
|||
|
||||
if (action == BaseObjectList::SET || action == BaseObjectList::ADD)
|
||||
{
|
||||
// Create a ManualRef to be able to set item charge
|
||||
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), containerItem.refId, 1);
|
||||
MWWorld::Ptr newPtr = ref.getPtr();
|
||||
try
|
||||
{
|
||||
// Create a ManualRef to be able to set item charge
|
||||
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), containerItem.refId, 1);
|
||||
MWWorld::Ptr newPtr = ref.getPtr();
|
||||
|
||||
if (containerItem.count > 1)
|
||||
newPtr.getRefData().setCount(containerItem.count);
|
||||
if (containerItem.count > 1)
|
||||
newPtr.getRefData().setCount(containerItem.count);
|
||||
|
||||
if (containerItem.charge > -1)
|
||||
newPtr.getCellRef().setCharge(containerItem.charge);
|
||||
if (containerItem.charge > -1)
|
||||
newPtr.getCellRef().setCharge(containerItem.charge);
|
||||
|
||||
if (containerItem.enchantmentCharge > -1)
|
||||
newPtr.getCellRef().setEnchantmentCharge(containerItem.enchantmentCharge);
|
||||
if (containerItem.enchantmentCharge > -1)
|
||||
newPtr.getCellRef().setEnchantmentCharge(containerItem.enchantmentCharge);
|
||||
|
||||
if (!containerItem.soul.empty())
|
||||
newPtr.getCellRef().setSoul(containerItem.soul);
|
||||
if (!containerItem.soul.empty())
|
||||
newPtr.getCellRef().setSoul(containerItem.soul);
|
||||
|
||||
containerStore.add(newPtr, containerItem.count, ownerPtr);
|
||||
containerStore.add(newPtr, containerItem.count, ownerPtr);
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
LOG_APPEND(TimedLog::LOG_ERROR, "-- Ignored invalid container item %s", containerItem.refId.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
else if (action == BaseObjectList::REMOVE && containerItem.actionCount > 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue