Fixed valgrind warning about uninitialized variable:

==16814== Conditional jump or move depends on uninitialised value(s)
==16814==    at 0xA945B8: Terrain::QuadTreeNode::update(Ogre::Vector3 const&, Loading::Listener*) (quadtreenode.cpp:269)
==16814==    by 0xA94A77: Terrain::QuadTreeNode::update(Ogre::Vector3 const&, Loading::Listener*) (quadtreenode.cpp:354)
==16814==    by 0xA77541: Terrain::World::update(Ogre::Vector3 const&) (world.cpp:159)
==16814==    by 0x6EBA17: MWRender::RenderingManager::requestMap(MWWorld::CellStore*) (renderingmanager.cpp:649)
==16814==    by 0x8A25C4: MWWorld::Scene::loadCell(MWWorld::CellStore*, Loading::Listener*) (scene.cpp:157)
==16814==    by 0x8A2CEA: MWWorld::Scene::changeCell(int, int, ESM::Position const&, bool) (scene.cpp:296)
==16814==    by 0x8A2DE0: MWWorld::Scene::changeToExteriorCell(ESM::Position const&) (scene.cpp:440)
==16814==    by 0x85AC17: MWWorld::World::changeToExteriorCell(ESM::Position const&) (worldimp.cpp:761)
==16814==    by 0x927E38: OMW::Engine::prepareEngine(Settings::Manager&) (engine.cpp:436)
==16814==    by 0x92843D: OMW::Engine::go() (engine.cpp:483)
==16814==    by 0x6C6B3F: main (main.cpp:279)
==16814==  Uninitialised value was created by a heap allocation
==16814==    at 0x4C27CC2: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16814==    by 0xA93E60: Terrain::QuadTreeNode::createChild(Terrain::ChildDirection, float, Ogre::Vector2 const&) (quadtreenode.cpp:178)
==16814==    by 0xA7733E: Terrain::World::buildQuadTree(Terrain::QuadTreeNode*) (world.cpp:139)
==16814==    by 0xA76B18: Terrain::World::World(Loading::Listener*, Ogre::SceneManager*, Terrain::Storage*, int, bool, bool) (world.cpp:94)
==16814==    by 0x6EC6EB: MWRender::RenderingManager::enableTerrain(bool) (renderingmanager.cpp:1013)
==16814==    by 0x8A2A00: MWWorld::Scene::changeCell(int, int, ESM::Position const&, bool) (scene.cpp:206)
==16814==    by 0x8A2DE0: MWWorld::Scene::changeToExteriorCell(ESM::Position const&) (scene.cpp:440)
==16814==    by 0x85AC17: MWWorld::World::changeToExteriorCell(ESM::Position const&) (worldimp.cpp:761)
==16814==    by 0x927E38: OMW::Engine::prepareEngine(Settings::Manager&) (engine.cpp:436)
==16814==    by 0x92843D: OMW::Engine::go() (engine.cpp:483)
==16814==    by 0x6C6B3F: main (main.cpp:279)

Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
actorid
Lukasz Gromanowski 11 years ago
parent 6de39a7329
commit 60fb75b03a

@ -140,17 +140,19 @@ namespace
}
QuadTreeNode::QuadTreeNode(World* terrain, ChildDirection dir, float size, const Ogre::Vector2 &center, QuadTreeNode* parent)
: mSize(size)
, mCenter(center)
, mParent(parent)
, mDirection(dir)
: mMaterialGenerator(NULL)
, mIsActive(false)
, mIsDummy(false)
, mSize(size)
, mLodLevel(Log2(mSize))
, mBounds(Ogre::AxisAlignedBox::BOX_NULL)
, mWorldBounds(Ogre::AxisAlignedBox::BOX_NULL)
, mDirection(dir)
, mCenter(center)
, mSceneNode(NULL)
, mParent(parent)
, mTerrain(terrain)
, mChunk(NULL)
, mMaterialGenerator(NULL)
, mBounds(Ogre::AxisAlignedBox::BOX_NULL)
, mWorldBounds(Ogre::AxisAlignedBox::BOX_NULL)
{
mBounds.setNull();
for (int i=0; i<4; ++i)
@ -168,8 +170,6 @@ QuadTreeNode::QuadTreeNode(World* terrain, ChildDirection dir, float size, const
pos = mCenter - pos;
mSceneNode->setPosition(Ogre::Vector3(pos.x*8192, pos.y*8192, 0));
mLodLevel = Log2(mSize);
mMaterialGenerator = new MaterialGenerator(mTerrain->getShadersEnabled());
}

Loading…
Cancel
Save