mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Merge pull request #2363 from akortunov/herbalism
Additional herbalism-related tweaks
This commit is contained in:
commit
a737935748
3 changed files with 11 additions and 5 deletions
|
@ -89,6 +89,10 @@ namespace MWClass
|
||||||
ptr.get<ESM::Container>();
|
ptr.get<ESM::Container>();
|
||||||
if (ref->mBase->mFlags & ESM::Container::Respawn)
|
if (ref->mBase->mFlags & ESM::Container::Respawn)
|
||||||
{
|
{
|
||||||
|
// Container was not touched, there is no need to modify its content.
|
||||||
|
if (ptr.getRefData().getCustomData() == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
|
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
|
||||||
ptr.getRefData().setCustomData(nullptr);
|
ptr.getRefData().setCustomData(nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1990,9 +1990,7 @@ namespace MWRender
|
||||||
mObjectRoot->accept(visitor);
|
mObjectRoot->accept(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ptr.getTypeName() == typeid(ESM::Container).name() &&
|
if (ptr.getRefData().getCustomData() != nullptr && canBeHarvested())
|
||||||
SceneUtil::hasUserDescription(mObjectRoot, Constants::HerbalismLabel) &&
|
|
||||||
ptr.getRefData().getCustomData() != nullptr)
|
|
||||||
{
|
{
|
||||||
const MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr);
|
const MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr);
|
||||||
if (!store.hasVisibleItems())
|
if (!store.hasVisibleItems())
|
||||||
|
|
|
@ -3335,9 +3335,13 @@ namespace MWWorld
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Consider references inside containers as well (except if we are looking for a Creature, they cannot be in containers)
|
// Consider references inside containers as well (except if we are looking for a Creature, they cannot be in containers)
|
||||||
if (mType != World::Detect_Creature &&
|
bool isContainer = ptr.getClass().getTypeName() == typeid(ESM::Container).name();
|
||||||
(ptr.getClass().isActor() || ptr.getClass().getTypeName() == typeid(ESM::Container).name()))
|
if (mType != World::Detect_Creature && (ptr.getClass().isActor() || isContainer))
|
||||||
{
|
{
|
||||||
|
// but ignore containers without resolved content
|
||||||
|
if (isContainer && ptr.getRefData().getCustomData() == nullptr)
|
||||||
|
return true;
|
||||||
|
|
||||||
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr);
|
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr);
|
||||||
{
|
{
|
||||||
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
||||||
|
|
Loading…
Reference in a new issue