From 6d8cfa7dfad44f56028319320ca3ca4ef0205f63 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 9 Aug 2011 09:56:09 +0200 Subject: [PATCH] fixed crash bug --- apps/openmw/mwworld/scene.cpp | 13 ++++++------- apps/openmw/mwworld/scene.hpp | 10 +++++----- apps/openmw/mwworld/world.cpp | 15 +++++++-------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index a6d06a75c..38180c5e5 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -31,7 +31,7 @@ namespace MWWorld } mWorld->removeScripts (iter->first); - + mEnvironment.mMechanicsManager->dropActors (iter->first); // FIXME: gehört in world? mEnvironment.mSoundManager->stopSound (iter->first); // FIXME: same delete iter->second; @@ -152,21 +152,21 @@ namespace MWWorld Scene::~Scene() { - /*for (CellRenderCollection::iterator iter (mActiveCells.begin()); + for (CellRenderCollection::iterator iter (mActiveCells.begin()); iter!=mActiveCells.end(); ++iter) - delete iter->second;*/ + delete iter->second; } bool Scene::hasCellChanged() const { return mCellChanged; } - + std::map Scene::getActiveCells () { return mActiveCells; } - + void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position) { SuppressDoingPhysics scopeGuard; @@ -206,7 +206,7 @@ namespace MWWorld changeCell (x, y, position, true); } - + Ptr::CellStore* Scene::getCurrentCell () { return mCurrentCell; @@ -217,4 +217,3 @@ namespace MWWorld mCellChanged = false; } } - diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index c6d996364..cddf288c3 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -57,7 +57,7 @@ namespace MWWorld typedef std::map CellRenderCollection; - MWRender::MWScene mScene; + MWRender::MWScene& mScene; Ptr::CellStore *mCurrentCell; // the cell, the player is in CellRenderCollection mActiveCells; bool mCellChanged; @@ -81,9 +81,9 @@ namespace MWWorld void changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos); ///< Move from exterior to interior or from interior cell to a different /// interior cell. - + Ptr::CellStore* getCurrentCell (); - + CellRenderCollection getActiveCells (); bool hasCellChanged() const; @@ -92,10 +92,10 @@ namespace MWWorld void changeToInteriorCell (const std::string& cellName, const ESM::Position& position); ///< Move to interior cell. - void changeToExteriorCell (const ESM::Position& position); + void changeToExteriorCell (const ESM::Position& position); ///< Move to exterior cell. - void markCellAsUnchanged(); + void markCellAsUnchanged(); std::string getFacedHandle(); }; diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index abb1cf5ba..3d4f1d4e8 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -283,7 +283,7 @@ namespace MWWorld mSky (false), mEnvironment (environment), mNextDynamicRecord (0) { mPhysEngine = physEng; - + mPhysics = new PhysicsSystem(renderer, physEng); boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master)); @@ -311,16 +311,16 @@ namespace MWWorld MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera(), resDir); mPhysEngine = physEng; - + mWorldScene = new Scene(environment, this, mScene, mPhysics); } World::~World() { - delete mPlayer; + delete mWorldScene; delete mSkyManager; delete mGlobalVariables; - //delete mWorldScene; + delete mPlayer; delete mPhysics; } @@ -347,12 +347,12 @@ namespace MWWorld return 0; } - + Ptr::CellStore *World::getExterior (int x, int y) { return &mExteriors[std::make_pair (x, y)]; } - + Ptr::CellStore *World::getInterior (std::string name) { return &mInteriors[name]; @@ -367,7 +367,7 @@ namespace MWWorld { return mStore; } - + ESM::ESMReader& World::getEsmReader() { return mEsm; @@ -768,4 +768,3 @@ namespace MWWorld return std::make_pair (stream.str(), created); } } -