Moved mStartupScript to World, so that it is executed for a New game

This commit is contained in:
scrawl 2014-05-21 09:25:45 +02:00
parent 9fe505c8fa
commit b39b572c5a
3 changed files with 8 additions and 7 deletions

View file

@ -380,7 +380,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
// Create the world // Create the world
mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mContentFiles, mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mContentFiles,
mResDir, mCfgMgr.getCachePath(), mEncoder, mFallbackMap, mResDir, mCfgMgr.getCachePath(), mEncoder, mFallbackMap,
mActivationDistanceOverride, mCellName)); mActivationDistanceOverride, mCellName, mStartupScript));
MWBase::Environment::get().getWorld()->setupPlayer(); MWBase::Environment::get().getWorld()->setupPlayer();
input->setPlayer(&mEnvironment.getWorld()->getPlayer()); input->setPlayer(&mEnvironment.getWorld()->getPlayer());
@ -464,9 +464,6 @@ void OMW::Engine::go()
else else
{ {
MWBase::Environment::get().getStateManager()->newGame (true); MWBase::Environment::get().getStateManager()->newGame (true);
if (!mStartupScript.empty())
MWBase::Environment::get().getWindowManager()->executeInConsole (mStartupScript);
} }
// Start the main rendering loop // Start the main rendering loop

View file

@ -126,14 +126,14 @@ namespace MWWorld
const std::vector<std::string>& contentFiles, const std::vector<std::string>& contentFiles,
const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir,
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) int activationDistanceOverride, const std::string& startCell, const std::string& startupScript)
: mPlayer (0), mLocalScripts (mStore), : mPlayer (0), mLocalScripts (mStore),
mSky (true), mCells (mStore, mEsm), mSky (true), mCells (mStore, mEsm),
mActivationDistanceOverride (activationDistanceOverride), mActivationDistanceOverride (activationDistanceOverride),
mFallback(fallbackMap), mTeleportEnabled(true), mLevitationEnabled(true), mFallback(fallbackMap), mTeleportEnabled(true), mLevitationEnabled(true),
mFacedDistance(FLT_MAX), mGodMode(false), mContentFiles (contentFiles), mFacedDistance(FLT_MAX), mGodMode(false), mContentFiles (contentFiles),
mGoToJail(false), mGoToJail(false),
mStartCell (startCell) mStartCell (startCell), mStartupScript(startupScript)
{ {
mPhysics = new PhysicsSystem(renderer); mPhysics = new PhysicsSystem(renderer);
mPhysEngine = mPhysics->getEngine(); mPhysEngine = mPhysics->getEngine();
@ -241,6 +241,8 @@ namespace MWWorld
delete mWeatherManager; delete mWeatherManager;
mWeatherManager = 0; mWeatherManager = 0;
mWeatherManager = new MWWorld::WeatherManager(mRendering,&mFallback); mWeatherManager = new MWWorld::WeatherManager(mRendering,&mFallback);
MWBase::Environment::get().getWindowManager()->executeInConsole(mStartupScript);
} }
void World::clear() void World::clear()

View file

@ -94,6 +94,8 @@ namespace MWWorld
std::string mFacedHandle; std::string mFacedHandle;
float mFacedDistance; float mFacedDistance;
std::string mStartupScript;
std::map<MWWorld::Ptr, int> mDoorStates; std::map<MWWorld::Ptr, int> mDoorStates;
///< only holds doors that are currently moving. 1 = opening, 2 = closing ///< only holds doors that are currently moving. 1 = opening, 2 = closing
@ -151,7 +153,7 @@ namespace MWWorld
const std::vector<std::string>& contentFiles, const std::vector<std::string>& contentFiles,
const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir,
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); int activationDistanceOverride, const std::string& startCell, const std::string& startupScript);
virtual ~World(); virtual ~World();