From 3f007d29ccd36b348508b8f6f4aa8472c5b24430 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Mon, 1 Aug 2011 14:34:50 +0200 Subject: [PATCH] move mInteriors and mExterior back to World::World --- apps/openmw/mwworld/scene.cpp | 10 +++++----- apps/openmw/mwworld/scene.hpp | 2 -- apps/openmw/mwworld/world.cpp | 10 ++++++++++ apps/openmw/mwworld/world.hpp | 7 +++++++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 3d85aa60f..444e3b334 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -110,8 +110,8 @@ namespace MWWorld if (iter==mActiveCells.end()) { - mExteriors[std::make_pair (x, y)].loadExt (x, y, mWorld->getStore(), mWorld->getEsmReader()); - Ptr::CellStore *cell = &mExteriors[std::make_pair (x, y)]; + mWorld->getExterior(x, y)->loadExt (x, y, mWorld->getStore(), mWorld->getEsmReader()); + Ptr::CellStore *cell = mWorld->getExterior(x, y); loadCell (cell, new MWRender::ExteriorCellRender (*cell, mEnvironment, mScene)); } @@ -136,7 +136,7 @@ namespace MWWorld mCurrentCell = iter->first; // adjust player - playerCellChange (&mExteriors[std::make_pair (X, Y)], position, adjustPlayerPos); + playerCellChange (mWorld->getExterior(X, Y), position, adjustPlayerPos); // Sky system mWorld->adjustSky(); @@ -181,8 +181,8 @@ namespace MWWorld // Load cell. std::cout << "cellName:" << cellName << std::endl; - mInteriors[cellName].loadInt (cellName, mWorld->getStore(), mWorld->getEsmReader()); - Ptr::CellStore *cell = &mInteriors[cellName]; + mWorld->getInterior(cellName)->loadInt (cellName, mWorld->getStore(), mWorld->getEsmReader()); + Ptr::CellStore *cell = mWorld->getInterior(cellName); loadCell (cell, new MWRender::InteriorCellRender (*cell, mEnvironment, mScene)); diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index 0c06e24b0..f7e3fc7e6 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -59,8 +59,6 @@ namespace MWWorld MWRender::MWScene mScene; Ptr::CellStore *mCurrentCell; // the cell, the player is in CellRenderCollection mActiveCells; - std::map mInteriors; - std::map, Ptr::CellStore> mExteriors; bool mCellChanged; Environment& mEnvironment; World *mWorld; diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index 69d52c172..4d2c1590a 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -320,6 +320,16 @@ namespace MWWorld delete mGlobalVariables; delete mWorldScene; } + + 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]; + } MWWorld::Player& World::getPlayer() { diff --git a/apps/openmw/mwworld/world.hpp b/apps/openmw/mwworld/world.hpp index 47848d6a3..a9e2668db 100644 --- a/apps/openmw/mwworld/world.hpp +++ b/apps/openmw/mwworld/world.hpp @@ -76,6 +76,9 @@ namespace MWWorld bool mSky; Environment& mEnvironment; int mNextDynamicRecord; + + std::map mInteriors; + std::map, Ptr::CellStore> mExteriors; OEngine::Physic::PhysicEngine* mPhysEngine; @@ -99,6 +102,10 @@ namespace MWWorld Environment& environment, const std::string& encoding); ~World(); + + Ptr::CellStore *getExterior (int x, int y); + + Ptr::CellStore *getInterior (std::string name); void removeScripts (Ptr::CellStore *cell);