1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 07:23:51 +00:00

removed duplicate code from World class

This commit is contained in:
Marc Zinnschlag 2010-07-27 19:09:35 +08:00 committed by apreiml
parent 0ff742fb6c
commit 858f174355
3 changed files with 9 additions and 20 deletions

View file

@ -187,7 +187,7 @@ void OMW::Engine::go()
loadBSA(); loadBSA();
// Create the world // Create the world
mEnvironment.mWorld = new MWWorld::World (mOgre, mDataDir, mMaster, mCellName, mNewGame); mEnvironment.mWorld = new MWWorld::World (mOgre, mDataDir, mMaster, mNewGame);
// Set up the GUI system // Set up the GUI system
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre.getWindow(), mGuiManager = new OEngine::GUI::MyGUIManager(mOgre.getWindow(),
@ -219,6 +219,12 @@ void OMW::Engine::go()
mEnvironment.mMechanicsManager->configureGUI(); mEnvironment.mMechanicsManager->configureGUI();
// load cell
ESM::Position pos;
pos.pos[0] = pos.pos[1] = pos.pos[2] = 0;
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
mEnvironment.mWorld->changeCell (mCellName, pos);
// Sets up the input system // Sets up the input system
MWInput::MWInputManager input(mOgre, mEnvironment.mWorld->getPlayerPos(), MWInput::MWInputManager input(mOgre, mEnvironment.mWorld->getPlayerPos(),
*mEnvironment.mWindowManager, mDebug); *mEnvironment.mWindowManager, mDebug);

View file

@ -164,7 +164,7 @@ namespace MWWorld
} }
World::World (OEngine::Render::OgreRenderer& renderer, const boost::filesystem::path& dataDir, World::World (OEngine::Render::OgreRenderer& renderer, const boost::filesystem::path& dataDir,
const std::string& master, const std::string& startCell, bool newGame) const std::string& master, bool newGame)
: mSkyManager (0), mScene (renderer), mPlayerPos (0), mCurrentCell (0), mGlobalVariables (0), : mSkyManager (0), mScene (renderer), mPlayerPos (0), mCurrentCell (0), mGlobalVariables (0),
mSky (false), mCellChanged (false) mSky (false), mCellChanged (false)
{ {
@ -177,13 +177,7 @@ namespace MWWorld
mEsm.open (masterPath.file_string()); mEsm.open (masterPath.file_string());
mStore.load (mEsm); mStore.load (mEsm);
mInteriors[startCell].loadInt (startCell, mStore, mEsm);
mCurrentCell = &mInteriors[startCell];
insertInteriorScripts (mInteriors[startCell]);
mPlayerPos = new MWRender::PlayerPos (mScene.getCamera(), mStore.npcs.find ("player")); mPlayerPos = new MWRender::PlayerPos (mScene.getCamera(), mStore.npcs.find ("player"));
mPlayerPos->setCell (&mInteriors[startCell]);
// global variables // global variables
mGlobalVariables = new Globals (mStore); mGlobalVariables = new Globals (mStore);
@ -194,19 +188,8 @@ namespace MWWorld
mGlobalVariables->setInt ("chargenstate", 1); mGlobalVariables->setInt ("chargenstate", 1);
} }
// This connects the cell data with the rendering scene.
mActiveCells.insert (std::make_pair (&mInteriors[startCell],
new MWRender::InteriorCellRender (mInteriors[startCell], mScene)));
// Load the cell and insert it into the renderer
for (CellRenderCollection::iterator iter (mActiveCells.begin());
iter!=mActiveCells.end(); ++iter)
iter->second->show();
mSkyManager = mSkyManager =
MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera()); MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera());
toggleSky();
} }
World::~World() World::~World()

View file

@ -74,7 +74,7 @@ namespace MWWorld
public: public:
World (OEngine::Render::OgreRenderer& renderer, const boost::filesystem::path& master, World (OEngine::Render::OgreRenderer& renderer, const boost::filesystem::path& master,
const std::string& dataDir, const std::string& startCell, bool newGame); const std::string& dataDir, bool newGame);
~World(); ~World();