1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 12:32:36 +00:00
OpenMW/apps/openmw/mwworld/refdata.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

316 lines
7.6 KiB
C++
Raw Normal View History

#include "refdata.hpp"
#include <components/esm3/objectstate.hpp>
2023-07-25 02:17:18 +02:00
#include <components/esm4/loadachr.hpp>
#include <components/esm4/loadrefr.hpp>
Store RefData::mBaseNode as osg::ref_ptr Direct leak of 16197408 byte(s) in 56241 object(s) allocated from: #0 0x5572356d4d42 in operator new(unsigned long) (/home/elsid/dev/openmw/build/clang/asan/openmw+0xae0d42) #1 0x557236938196 in (anonymous namespace)::addObject(MWWorld::Ptr const&, MWWorld::World const&, std::__1::vector<ESM::RefNum, std::__1::allocator<ESM::RefNum> > const&, MWPhysics::PhysicsSystem&, MWRender::RenderingManager&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:119:42 #2 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7::operator()(MWWorld::Ptr const&) const /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:62 #3 0x55723692e51b in void (anonymous namespace)::InsertVisitor::insert<MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7>(MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7&&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:230:21 #4 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:23 #5 0x55723692d451 in MWWorld::Scene::loadCell(MWWorld::CellStore*, Loading::Listener*, bool, osg::Vec3f const&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:449:9 #6 0x5572369299f5 in MWWorld::Scene::changeCellGrid(osg::Vec3f const&, int, int, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:612:17 #7 0x557236928521 in MWWorld::Scene::update(float) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:315:13 #8 0x5572368d4c98 in MWWorld::World::update(float, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1833:22 #9 0x557236ebbb72 in OMW::Engine::frame(float) /home/elsid/dev/openmw/apps/openmw/engine.cpp:418:25 #10 0x557236ed250a in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:1102:14 #11 0x557236eb621a in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:228:17 #12 0x55723774d622 in wrapApplication(int (*)(int, char**), int, char**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) /home/elsid/dev/openmw/components/debug/debugging.cpp:328:19 #13 0x557236eb651f in main /home/elsid/dev/openmw/apps/openmw/main.cpp:240:12 #14 0x7fbf58a3f2cf (/usr/lib/libc.so.6+0x232cf) (BuildId: e637217a46491314667a7a37b2155cb07afc1a40) Direct leak of 396288 byte(s) in 1376 object(s) allocated from: #0 0x5572356d4d42 in operator new(unsigned long) (/home/elsid/dev/openmw/build/clang/asan/openmw+0xae0d42) #1 0x557236938196 in (anonymous namespace)::addObject(MWWorld::Ptr const&, MWWorld::World const&, std::__1::vector<ESM::RefNum, std::__1::allocator<ESM::RefNum> > const&, MWPhysics::PhysicsSystem&, MWRender::RenderingManager&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:119:42 #2 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7::operator()(MWWorld::Ptr const&) const /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:62 #3 0x55723692e51b in void (anonymous namespace)::InsertVisitor::insert<MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7>(MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7&&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:230:21 #4 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:23 #5 0x55723692d451 in MWWorld::Scene::loadCell(MWWorld::CellStore*, Loading::Listener*, bool, osg::Vec3f const&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:449:9 #6 0x5572369299f5 in MWWorld::Scene::changeCellGrid(osg::Vec3f const&, int, int, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:612:17 #7 0x557236936eb2 in MWWorld::Scene::changeToExteriorCell(ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:888:9 #8 0x55723689a5ac in MWWorld::World::changeToExteriorCell(ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1003:22 #9 0x5572368c249d in MWWorld::World::changeToCell(ESM::CellId const&, ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1014:13 #10 0x557236e9bbce in MWState::StateManager::loadGame(MWState::Character const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/statemanagerimp.cpp:545:52 #11 0x557236e998db in MWState::StateManager::loadGame(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/statemanagerimp.cpp:377:17 #12 0x557236ed18fb in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:1066:24 #13 0x557236eb621a in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:228:17 #14 0x55723774d622 in wrapApplication(int (*)(int, char**), int, char**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) /home/elsid/dev/openmw/components/debug/debugging.cpp:328:19 #15 0x557236eb651f in main /home/elsid/dev/openmw/apps/openmw/main.cpp:240:12 #16 0x7fbf58a3f2cf (/usr/lib/libc.so.6+0x232cf) (BuildId: e637217a46491314667a7a37b2155cb07afc1a40)
2022-07-08 18:58:23 +02:00
#include <components/sceneutil/positionattitudetransform.hpp>
#include "customdata.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
2020-12-18 23:21:10 +01:00
#include "../mwlua/localscripts.hpp"
namespace
{
enum RefDataFlags
{
Flag_SuppressActivate = 1, // If set, activation will be suppressed and redirected to the OnActivate flag, which
// can then be handled by a script.
2017-01-14 00:10:43 +01:00
Flag_OnActivate = 2,
Flag_ActivationBuffered = 4
};
}
namespace MWWorld
{
2021-04-23 02:49:12 +02:00
void RefData::setLuaScripts(std::shared_ptr<MWLua::LocalScripts>&& scripts)
2020-12-18 23:21:10 +01:00
{
mChanged = true;
mLuaScripts = std::move(scripts);
}
void RefData::copy(const RefData& refData)
{
mBaseNode = refData.mBaseNode;
mLocals = refData.mLocals;
mEnabled = refData.mEnabled;
mPosition = refData.mPosition;
mChanged = refData.mChanged;
2015-12-12 22:37:23 +01:00
mDeletedByContentFile = refData.mDeletedByContentFile;
mFlags = refData.mFlags;
mPhysicsPostponed = refData.mPhysicsPostponed;
mAnimationState = refData.mAnimationState;
2020-11-13 11:39:47 +04:00
mCustomData = refData.mCustomData ? refData.mCustomData->clone() : nullptr;
2020-12-18 23:21:10 +01:00
mLuaScripts = refData.mLuaScripts;
}
void RefData::cleanup()
{
2020-11-13 11:39:47 +04:00
mBaseNode = nullptr;
mCustomData = nullptr;
2020-12-18 23:21:10 +01:00
mLuaScripts = nullptr;
}
RefData::RefData()
2021-10-05 12:02:49 +00:00
: mBaseNode(nullptr)
, mCustomData(nullptr)
, mFlags(0)
2021-10-05 12:02:49 +00:00
, mDeletedByContentFile(false)
, mEnabled(true)
, mPhysicsPostponed(false)
, mChanged(false)
{
for (int i = 0; i < 3; ++i)
{
mPosition.pos[i] = 0;
mPosition.rot[i] = 0;
}
}
RefData::RefData(const ESM::CellRef& cellRef)
: mBaseNode(nullptr)
, mPosition(cellRef.mPos)
, mCustomData(nullptr)
, mFlags(0) // Loading from ESM/ESP files -> assume unchanged
, mDeletedByContentFile(false)
, mEnabled(true)
, mPhysicsPostponed(false)
, mChanged(false)
2013-04-16 21:17:19 +02:00
{
}
RefData::RefData(const ESM4::Reference& ref)
: mBaseNode(nullptr)
, mPosition(ref.mPos)
, mCustomData(nullptr)
, mFlags(0)
, mDeletedByContentFile(ref.mFlags & ESM4::Rec_Deleted)
, mEnabled(!(ref.mFlags & ESM4::Rec_Disabled))
, mPhysicsPostponed(false)
, mChanged(false)
{
}
2023-07-25 02:17:18 +02:00
RefData::RefData(const ESM4::ActorCharacter& ref)
: mBaseNode(nullptr)
, mPosition(ref.mPos)
, mCustomData(nullptr)
, mFlags(0)
2023-07-25 02:17:18 +02:00
, mDeletedByContentFile(ref.mFlags & ESM4::Rec_Deleted)
, mEnabled(!(ref.mFlags & ESM4::Rec_Disabled))
, mPhysicsPostponed(false)
, mChanged(false)
{
}
2015-12-12 22:37:23 +01:00
RefData::RefData(const ESM::ObjectState& objectState, bool deletedByContentFile)
2020-11-13 11:39:47 +04:00
: mBaseNode(nullptr)
, mPosition(objectState.mPosition)
, mAnimationState(objectState.mAnimationState)
2020-11-13 11:39:47 +04:00
, mCustomData(nullptr)
, mFlags(objectState.mFlags) // Loading from a savegame -> assume changed
, mDeletedByContentFile(deletedByContentFile)
, mEnabled(objectState.mEnabled != 0)
, mPhysicsPostponed(false)
, mChanged(true)
{
// "Note that the ActivationFlag_UseEnabled is saved to the reference,
// which will result in permanently suppressed activation if the reference script is removed.
// This occurred when removing the animated containers mod, and the fix in MCP is to reset UseEnabled to true on
// loading a game."
mFlags &= (~Flag_SuppressActivate);
}
RefData::RefData(const RefData& refData)
2020-11-13 11:39:47 +04:00
: mBaseNode(nullptr)
, mCustomData(nullptr)
{
try
{
copy(refData);
mFlags &= ~(Flag_SuppressActivate | Flag_OnActivate | Flag_ActivationBuffered);
}
catch (...)
{
cleanup();
throw;
}
}
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
void RefData::write(ESM::ObjectState& objectState, const ESM::RefId& scriptId) const
{
objectState.mHasLocals = mLocals.write(objectState.mLocals, scriptId);
objectState.mEnabled = mEnabled;
objectState.mPosition = mPosition;
objectState.mFlags = mFlags;
objectState.mAnimationState = mAnimationState;
}
2012-01-30 12:38:13 +01:00
RefData& RefData::operator=(const RefData& refData)
{
try
{
cleanup();
copy(refData);
}
catch (...)
{
cleanup();
throw;
}
return *this;
}
RefData::~RefData()
{
try
{
cleanup();
}
catch (...)
{
}
}
Store RefData::mBaseNode as osg::ref_ptr Direct leak of 16197408 byte(s) in 56241 object(s) allocated from: #0 0x5572356d4d42 in operator new(unsigned long) (/home/elsid/dev/openmw/build/clang/asan/openmw+0xae0d42) #1 0x557236938196 in (anonymous namespace)::addObject(MWWorld::Ptr const&, MWWorld::World const&, std::__1::vector<ESM::RefNum, std::__1::allocator<ESM::RefNum> > const&, MWPhysics::PhysicsSystem&, MWRender::RenderingManager&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:119:42 #2 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7::operator()(MWWorld::Ptr const&) const /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:62 #3 0x55723692e51b in void (anonymous namespace)::InsertVisitor::insert<MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7>(MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7&&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:230:21 #4 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:23 #5 0x55723692d451 in MWWorld::Scene::loadCell(MWWorld::CellStore*, Loading::Listener*, bool, osg::Vec3f const&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:449:9 #6 0x5572369299f5 in MWWorld::Scene::changeCellGrid(osg::Vec3f const&, int, int, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:612:17 #7 0x557236928521 in MWWorld::Scene::update(float) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:315:13 #8 0x5572368d4c98 in MWWorld::World::update(float, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1833:22 #9 0x557236ebbb72 in OMW::Engine::frame(float) /home/elsid/dev/openmw/apps/openmw/engine.cpp:418:25 #10 0x557236ed250a in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:1102:14 #11 0x557236eb621a in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:228:17 #12 0x55723774d622 in wrapApplication(int (*)(int, char**), int, char**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) /home/elsid/dev/openmw/components/debug/debugging.cpp:328:19 #13 0x557236eb651f in main /home/elsid/dev/openmw/apps/openmw/main.cpp:240:12 #14 0x7fbf58a3f2cf (/usr/lib/libc.so.6+0x232cf) (BuildId: e637217a46491314667a7a37b2155cb07afc1a40) Direct leak of 396288 byte(s) in 1376 object(s) allocated from: #0 0x5572356d4d42 in operator new(unsigned long) (/home/elsid/dev/openmw/build/clang/asan/openmw+0xae0d42) #1 0x557236938196 in (anonymous namespace)::addObject(MWWorld::Ptr const&, MWWorld::World const&, std::__1::vector<ESM::RefNum, std::__1::allocator<ESM::RefNum> > const&, MWPhysics::PhysicsSystem&, MWRender::RenderingManager&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:119:42 #2 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7::operator()(MWWorld::Ptr const&) const /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:62 #3 0x55723692e51b in void (anonymous namespace)::InsertVisitor::insert<MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7>(MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7&&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:230:21 #4 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:23 #5 0x55723692d451 in MWWorld::Scene::loadCell(MWWorld::CellStore*, Loading::Listener*, bool, osg::Vec3f const&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:449:9 #6 0x5572369299f5 in MWWorld::Scene::changeCellGrid(osg::Vec3f const&, int, int, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:612:17 #7 0x557236936eb2 in MWWorld::Scene::changeToExteriorCell(ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:888:9 #8 0x55723689a5ac in MWWorld::World::changeToExteriorCell(ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1003:22 #9 0x5572368c249d in MWWorld::World::changeToCell(ESM::CellId const&, ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1014:13 #10 0x557236e9bbce in MWState::StateManager::loadGame(MWState::Character const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/statemanagerimp.cpp:545:52 #11 0x557236e998db in MWState::StateManager::loadGame(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/statemanagerimp.cpp:377:17 #12 0x557236ed18fb in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:1066:24 #13 0x557236eb621a in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:228:17 #14 0x55723774d622 in wrapApplication(int (*)(int, char**), int, char**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) /home/elsid/dev/openmw/components/debug/debugging.cpp:328:19 #15 0x557236eb651f in main /home/elsid/dev/openmw/apps/openmw/main.cpp:240:12 #16 0x7fbf58a3f2cf (/usr/lib/libc.so.6+0x232cf) (BuildId: e637217a46491314667a7a37b2155cb07afc1a40)
2022-07-08 18:58:23 +02:00
RefData::RefData(RefData&& other) = default;
RefData& RefData::operator=(RefData&& other) = default;
Store RefData::mBaseNode as osg::ref_ptr Direct leak of 16197408 byte(s) in 56241 object(s) allocated from: #0 0x5572356d4d42 in operator new(unsigned long) (/home/elsid/dev/openmw/build/clang/asan/openmw+0xae0d42) #1 0x557236938196 in (anonymous namespace)::addObject(MWWorld::Ptr const&, MWWorld::World const&, std::__1::vector<ESM::RefNum, std::__1::allocator<ESM::RefNum> > const&, MWPhysics::PhysicsSystem&, MWRender::RenderingManager&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:119:42 #2 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7::operator()(MWWorld::Ptr const&) const /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:62 #3 0x55723692e51b in void (anonymous namespace)::InsertVisitor::insert<MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7>(MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7&&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:230:21 #4 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:23 #5 0x55723692d451 in MWWorld::Scene::loadCell(MWWorld::CellStore*, Loading::Listener*, bool, osg::Vec3f const&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:449:9 #6 0x5572369299f5 in MWWorld::Scene::changeCellGrid(osg::Vec3f const&, int, int, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:612:17 #7 0x557236928521 in MWWorld::Scene::update(float) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:315:13 #8 0x5572368d4c98 in MWWorld::World::update(float, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1833:22 #9 0x557236ebbb72 in OMW::Engine::frame(float) /home/elsid/dev/openmw/apps/openmw/engine.cpp:418:25 #10 0x557236ed250a in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:1102:14 #11 0x557236eb621a in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:228:17 #12 0x55723774d622 in wrapApplication(int (*)(int, char**), int, char**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) /home/elsid/dev/openmw/components/debug/debugging.cpp:328:19 #13 0x557236eb651f in main /home/elsid/dev/openmw/apps/openmw/main.cpp:240:12 #14 0x7fbf58a3f2cf (/usr/lib/libc.so.6+0x232cf) (BuildId: e637217a46491314667a7a37b2155cb07afc1a40) Direct leak of 396288 byte(s) in 1376 object(s) allocated from: #0 0x5572356d4d42 in operator new(unsigned long) (/home/elsid/dev/openmw/build/clang/asan/openmw+0xae0d42) #1 0x557236938196 in (anonymous namespace)::addObject(MWWorld::Ptr const&, MWWorld::World const&, std::__1::vector<ESM::RefNum, std::__1::allocator<ESM::RefNum> > const&, MWPhysics::PhysicsSystem&, MWRender::RenderingManager&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:119:42 #2 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7::operator()(MWWorld::Ptr const&) const /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:62 #3 0x55723692e51b in void (anonymous namespace)::InsertVisitor::insert<MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7>(MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7&&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:230:21 #4 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:23 #5 0x55723692d451 in MWWorld::Scene::loadCell(MWWorld::CellStore*, Loading::Listener*, bool, osg::Vec3f const&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:449:9 #6 0x5572369299f5 in MWWorld::Scene::changeCellGrid(osg::Vec3f const&, int, int, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:612:17 #7 0x557236936eb2 in MWWorld::Scene::changeToExteriorCell(ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:888:9 #8 0x55723689a5ac in MWWorld::World::changeToExteriorCell(ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1003:22 #9 0x5572368c249d in MWWorld::World::changeToCell(ESM::CellId const&, ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1014:13 #10 0x557236e9bbce in MWState::StateManager::loadGame(MWState::Character const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/statemanagerimp.cpp:545:52 #11 0x557236e998db in MWState::StateManager::loadGame(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/statemanagerimp.cpp:377:17 #12 0x557236ed18fb in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:1066:24 #13 0x557236eb621a in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:228:17 #14 0x55723774d622 in wrapApplication(int (*)(int, char**), int, char**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) /home/elsid/dev/openmw/components/debug/debugging.cpp:328:19 #15 0x557236eb651f in main /home/elsid/dev/openmw/apps/openmw/main.cpp:240:12 #16 0x7fbf58a3f2cf (/usr/lib/libc.so.6+0x232cf) (BuildId: e637217a46491314667a7a37b2155cb07afc1a40)
2022-07-08 18:58:23 +02:00
void RefData::setBaseNode(osg::ref_ptr<SceneUtil::PositionAttitudeTransform> base)
{
Store RefData::mBaseNode as osg::ref_ptr Direct leak of 16197408 byte(s) in 56241 object(s) allocated from: #0 0x5572356d4d42 in operator new(unsigned long) (/home/elsid/dev/openmw/build/clang/asan/openmw+0xae0d42) #1 0x557236938196 in (anonymous namespace)::addObject(MWWorld::Ptr const&, MWWorld::World const&, std::__1::vector<ESM::RefNum, std::__1::allocator<ESM::RefNum> > const&, MWPhysics::PhysicsSystem&, MWRender::RenderingManager&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:119:42 #2 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7::operator()(MWWorld::Ptr const&) const /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:62 #3 0x55723692e51b in void (anonymous namespace)::InsertVisitor::insert<MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7>(MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7&&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:230:21 #4 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:23 #5 0x55723692d451 in MWWorld::Scene::loadCell(MWWorld::CellStore*, Loading::Listener*, bool, osg::Vec3f const&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:449:9 #6 0x5572369299f5 in MWWorld::Scene::changeCellGrid(osg::Vec3f const&, int, int, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:612:17 #7 0x557236928521 in MWWorld::Scene::update(float) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:315:13 #8 0x5572368d4c98 in MWWorld::World::update(float, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1833:22 #9 0x557236ebbb72 in OMW::Engine::frame(float) /home/elsid/dev/openmw/apps/openmw/engine.cpp:418:25 #10 0x557236ed250a in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:1102:14 #11 0x557236eb621a in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:228:17 #12 0x55723774d622 in wrapApplication(int (*)(int, char**), int, char**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) /home/elsid/dev/openmw/components/debug/debugging.cpp:328:19 #13 0x557236eb651f in main /home/elsid/dev/openmw/apps/openmw/main.cpp:240:12 #14 0x7fbf58a3f2cf (/usr/lib/libc.so.6+0x232cf) (BuildId: e637217a46491314667a7a37b2155cb07afc1a40) Direct leak of 396288 byte(s) in 1376 object(s) allocated from: #0 0x5572356d4d42 in operator new(unsigned long) (/home/elsid/dev/openmw/build/clang/asan/openmw+0xae0d42) #1 0x557236938196 in (anonymous namespace)::addObject(MWWorld::Ptr const&, MWWorld::World const&, std::__1::vector<ESM::RefNum, std::__1::allocator<ESM::RefNum> > const&, MWPhysics::PhysicsSystem&, MWRender::RenderingManager&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:119:42 #2 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7::operator()(MWWorld::Ptr const&) const /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:62 #3 0x55723692e51b in void (anonymous namespace)::InsertVisitor::insert<MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7>(MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*)::$_7&&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:230:21 #4 0x55723692e51b in MWWorld::Scene::insertCell(MWWorld::CellStore&, Loading::Listener*) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:913:23 #5 0x55723692d451 in MWWorld::Scene::loadCell(MWWorld::CellStore*, Loading::Listener*, bool, osg::Vec3f const&) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:449:9 #6 0x5572369299f5 in MWWorld::Scene::changeCellGrid(osg::Vec3f const&, int, int, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:612:17 #7 0x557236936eb2 in MWWorld::Scene::changeToExteriorCell(ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/scene.cpp:888:9 #8 0x55723689a5ac in MWWorld::World::changeToExteriorCell(ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1003:22 #9 0x5572368c249d in MWWorld::World::changeToCell(ESM::CellId const&, ESM::Position const&, bool, bool) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:1014:13 #10 0x557236e9bbce in MWState::StateManager::loadGame(MWState::Character const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/statemanagerimp.cpp:545:52 #11 0x557236e998db in MWState::StateManager::loadGame(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/statemanagerimp.cpp:377:17 #12 0x557236ed18fb in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:1066:24 #13 0x557236eb621a in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:228:17 #14 0x55723774d622 in wrapApplication(int (*)(int, char**), int, char**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) /home/elsid/dev/openmw/components/debug/debugging.cpp:328:19 #15 0x557236eb651f in main /home/elsid/dev/openmw/apps/openmw/main.cpp:240:12 #16 0x7fbf58a3f2cf (/usr/lib/libc.so.6+0x232cf) (BuildId: e637217a46491314667a7a37b2155cb07afc1a40)
2022-07-08 18:58:23 +02:00
mBaseNode = std::move(base);
}
SceneUtil::PositionAttitudeTransform* RefData::getBaseNode()
{
2015-05-30 01:00:24 +02:00
return mBaseNode;
}
2015-12-18 18:02:57 +01:00
const SceneUtil::PositionAttitudeTransform* RefData::getBaseNode() const
{
return mBaseNode;
}
void RefData::setLocals(const ESM::Script& script)
{
if (mLocals.configure(script) && !mLocals.isEmpty())
mChanged = true;
}
2015-12-12 22:37:23 +01:00
void RefData::setDeletedByContentFile(bool deleted)
{
2015-12-12 22:37:23 +01:00
mDeletedByContentFile = deleted;
}
bool RefData::isDeletedByContentFile() const
{
2015-12-12 22:37:23 +01:00
return mDeletedByContentFile;
}
MWScript::Locals& RefData::getLocals()
{
return mLocals;
}
bool RefData::isEnabled() const
{
return mEnabled;
}
void RefData::enable()
{
if (!mEnabled)
{
mChanged = true;
mEnabled = true;
}
}
void RefData::disable()
{
if (mEnabled)
{
mChanged = true;
mEnabled = false;
}
}
void RefData::setPosition(const ESM::Position& pos)
{
mChanged = true;
mPosition = pos;
}
2015-12-07 03:51:03 +01:00
const ESM::Position& RefData::getPosition() const
{
return mPosition;
}
void RefData::setCustomData(std::unique_ptr<CustomData>&& value) noexcept
{
mChanged = true; // We do not currently track CustomData, so assume anything with a CustomData is changed
mCustomData = std::move(value);
}
CustomData* RefData::getCustomData()
{
return mCustomData.get();
}
const CustomData* RefData::getCustomData() const
{
return mCustomData.get();
}
bool RefData::hasChanged() const
{
return mChanged || !mAnimationState.empty();
}
2017-01-14 00:10:43 +01:00
bool RefData::activateByScript()
{
bool ret = (mFlags & Flag_ActivationBuffered);
mFlags &= ~(Flag_SuppressActivate | Flag_OnActivate);
return ret;
}
bool RefData::activate()
{
2017-01-14 00:10:43 +01:00
if (mFlags & Flag_SuppressActivate)
{
2017-01-14 00:10:43 +01:00
mFlags |= Flag_OnActivate | Flag_ActivationBuffered;
return false;
}
2017-01-14 00:10:43 +01:00
else
{
return true;
}
}
2017-01-14 00:10:43 +01:00
bool RefData::onActivate()
{
2017-01-14 00:10:43 +01:00
bool ret = mFlags & Flag_OnActivate;
mFlags |= Flag_SuppressActivate;
mFlags &= (~Flag_OnActivate);
return ret;
}
const ESM::AnimationState& RefData::getAnimationState() const
{
return mAnimationState;
}
ESM::AnimationState& RefData::getAnimationState()
{
return mAnimationState;
}
}