Merge pull request #381 from OpenMW/master

Add OpenMW commits up to 31 Jan 2018
0.6.3
David Cernat 7 years ago committed by GitHub
commit 4496625154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -168,16 +168,16 @@ namespace MWWorld
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap,
int activationDistanceOverride, const std::string& startCell, const std::string& startupScript, int activationDistanceOverride, const std::string& startCell, const std::string& startupScript,
const std::string& resourcePath, const std::string& userDataPath) const std::string& resourcePath, const std::string& userDataPath)
: mResourceSystem(resourceSystem), mFallback(fallbackMap), mPlayer (0), mLocalScripts (mStore), : mResourceSystem(resourceSystem), mFallback(fallbackMap), mLocalScripts (mStore),
mSky (true), mCells (mStore, mEsm), mSky (true), mCells (mStore, mEsm),
mGodMode(false), mScriptsEnabled(true), mContentFiles (contentFiles), mUserDataPath(userDataPath), mGodMode(false), mScriptsEnabled(true), mContentFiles (contentFiles), mUserDataPath(userDataPath),
mActivationDistanceOverride (activationDistanceOverride), mStartupScript(startupScript), mActivationDistanceOverride (activationDistanceOverride), mStartupScript(startupScript),
mStartCell (startCell), mDistanceToFacedObject(-1), mTeleportEnabled(true), mStartCell (startCell), mDistanceToFacedObject(-1), mTeleportEnabled(true),
mLevitationEnabled(true), mGoToJail(false), mDaysInPrison(0), mSpellPreloadTimer(0.f) mLevitationEnabled(true), mGoToJail(false), mDaysInPrison(0), mSpellPreloadTimer(0.f)
{ {
mPhysics = new MWPhysics::PhysicsSystem(resourceSystem, rootNode); mPhysics.reset(new MWPhysics::PhysicsSystem(resourceSystem, rootNode));
mRendering = new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, &mFallback, resourcePath); mRendering.reset(new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, &mFallback, resourcePath));
mProjectileManager.reset(new ProjectileManager(mRendering->getLightRoot(), resourceSystem, mRendering, mPhysics)); mProjectileManager.reset(new ProjectileManager(mRendering->getLightRoot(), resourceSystem, mRendering.get(), mPhysics.get()));
mRendering->preloadCommonAssets(); mRendering->preloadCommonAssets();
@ -209,9 +209,9 @@ namespace MWWorld
mSwimHeightScale = mStore.get<ESM::GameSetting>().find("fSwimHeightScale")->getFloat(); mSwimHeightScale = mStore.get<ESM::GameSetting>().find("fSwimHeightScale")->getFloat();
mWeatherManager = new MWWorld::WeatherManager(*mRendering, mFallback, mStore); mWeatherManager.reset(new MWWorld::WeatherManager(*mRendering, mFallback, mStore));
mWorldScene = new Scene(*mRendering, mPhysics); mWorldScene.reset(new Scene(*mRendering.get(), mPhysics.get()));
} }
void World::fillGlobalVariables() void World::fillGlobalVariables()
@ -244,8 +244,8 @@ namespace MWWorld
// we don't want old weather to persist on a new game // we don't want old weather to persist on a new game
// Note that if reset later, the initial ChangeWeather that the chargen script calls will be lost. // Note that if reset later, the initial ChangeWeather that the chargen script calls will be lost.
delete mWeatherManager; mWeatherManager.reset();
mWeatherManager = new MWWorld::WeatherManager(*mRendering, mFallback, mStore); mWeatherManager.reset(new MWWorld::WeatherManager(*mRendering.get(), mFallback, mStore));
if (!bypass) if (!bypass)
{ {
@ -525,12 +525,6 @@ namespace MWWorld
{ {
// Must be cleared before mRendering is destroyed // Must be cleared before mRendering is destroyed
mProjectileManager->clear(); mProjectileManager->clear();
delete mWeatherManager;
delete mWorldScene;
delete mRendering;
delete mPhysics;
delete mPlayer;
} }
const ESM::Cell *World::getExterior (const std::string& cellName) const const ESM::Cell *World::getExterior (const std::string& cellName) const
@ -2314,7 +2308,7 @@ namespace MWWorld
{ {
const ESM::NPC *player = mStore.get<ESM::NPC>().find("player"); const ESM::NPC *player = mStore.get<ESM::NPC>().find("player");
if (!mPlayer) if (!mPlayer)
mPlayer = new MWWorld::Player(player); mPlayer.reset(new MWWorld::Player(player));
else else
{ {
// Remove the old CharacterController // Remove the old CharacterController
@ -3667,17 +3661,17 @@ namespace MWWorld
if (MWMechanics::isSummoningEffect(it->mEffectID)) if (MWMechanics::isSummoningEffect(it->mEffectID))
{ {
preload(mWorldScene, mStore, "VFX_Summon_Start"); preload(mWorldScene.get(), mStore, "VFX_Summon_Start");
preload(mWorldScene, mStore, MWMechanics::getSummonedCreature(it->mEffectID)); preload(mWorldScene.get(), mStore, MWMechanics::getSummonedCreature(it->mEffectID));
} }
preload(mWorldScene, mStore, effect->mCasting); preload(mWorldScene.get(), mStore, effect->mCasting);
preload(mWorldScene, mStore, effect->mHit); preload(mWorldScene.get(), mStore, effect->mHit);
if (it->mArea > 0) if (it->mArea > 0)
preload(mWorldScene, mStore, effect->mArea); preload(mWorldScene.get(), mStore, effect->mArea);
if (it->mRange == ESM::RT_Target) if (it->mRange == ESM::RT_Target)
preload(mWorldScene, mStore, effect->mBolt); preload(mWorldScene.get(), mStore, effect->mBolt);
} }
} }

@ -74,17 +74,11 @@ namespace MWWorld
Resource::ResourceSystem* mResourceSystem; Resource::ResourceSystem* mResourceSystem;
Fallback::Map mFallback; Fallback::Map mFallback;
MWRender::RenderingManager* mRendering;
MWWorld::WeatherManager* mWeatherManager;
MWWorld::Scene *mWorldScene;
MWWorld::Player *mPlayer;
std::vector<ESM::ESMReader> mEsm; std::vector<ESM::ESMReader> mEsm;
MWWorld::ESMStore mStore; MWWorld::ESMStore mStore;
LocalScripts mLocalScripts; LocalScripts mLocalScripts;
MWWorld::Globals mGlobalVariables; MWWorld::Globals mGlobalVariables;
MWPhysics::PhysicsSystem *mPhysics;
bool mSky; bool mSky;
ESM::Variant* mGameHour; ESM::Variant* mGameHour;
@ -98,6 +92,11 @@ namespace MWWorld
std::string mCurrentWorldSpace; std::string mCurrentWorldSpace;
std::unique_ptr<MWWorld::Player> mPlayer;
std::unique_ptr<MWPhysics::PhysicsSystem> mPhysics;
std::unique_ptr<MWRender::RenderingManager> mRendering;
std::unique_ptr<MWWorld::Scene> mWorldScene;
std::unique_ptr<MWWorld::WeatherManager> mWeatherManager;
std::shared_ptr<ProjectileManager> mProjectileManager; std::shared_ptr<ProjectileManager> mProjectileManager;
bool mGodMode; bool mGodMode;

Loading…
Cancel
Save