diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index d6776e564..1f73770eb 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -2375,6 +2375,8 @@ bool CSMDoc::Document::isBlacklisted (const CSMWorld::UniversalId& id) void CSMDoc::Document::startRunning (const std::string& profile, const std::string& startupInstruction) { + mRunner.configure (getData().getDebugProfiles().getRecord (profile).get()); + int state = getState(); if (state & State_Modified) diff --git a/apps/opencs/model/doc/runner.cpp b/apps/opencs/model/doc/runner.cpp index ce34f2b71..8b26668a7 100644 --- a/apps/opencs/model/doc/runner.cpp +++ b/apps/opencs/model/doc/runner.cpp @@ -7,6 +7,8 @@ CSMDoc::Runner::Runner() : mRunning (false) { connect (&mProcess, SIGNAL (finished (int, QProcess::ExitStatus)), this, SLOT (finished (int, QProcess::ExitStatus))); + + mProfile.blank(); } CSMDoc::Runner::~Runner() @@ -33,7 +35,15 @@ void CSMDoc::Runner::start (bool delayed) path.prepend(QString("./")); #endif - mProcess.start (path); + QStringList arguments; + arguments << "--skip-menu"; + + if (mProfile.mFlags & ESM::DebugProfile::Flag_BypassNewGame) + arguments << "--new-game=0"; + else + arguments << "--new-game=1"; + + mProcess.start (path, arguments); } mRunning = true; @@ -56,6 +66,11 @@ bool CSMDoc::Runner::isRunning() const return mRunning; } +void CSMDoc::Runner::configure (const ESM::DebugProfile& profile) +{ + mProfile = profile; +} + void CSMDoc::Runner::finished (int exitCode, QProcess::ExitStatus exitStatus) { mRunning = false; diff --git a/apps/opencs/model/doc/runner.hpp b/apps/opencs/model/doc/runner.hpp index 7d1bbd505..00092d0fe 100644 --- a/apps/opencs/model/doc/runner.hpp +++ b/apps/opencs/model/doc/runner.hpp @@ -4,6 +4,8 @@ #include #include +#include + namespace CSMDoc { class Runner : public QObject @@ -12,6 +14,7 @@ namespace CSMDoc QProcess mProcess; bool mRunning; + ESM::DebugProfile mProfile; public: @@ -29,6 +32,8 @@ namespace CSMDoc /// is not necessarily identical to the moment the child process is started. bool isRunning() const; + void configure (const ESM::DebugProfile& profile); + signals: void runStateChanged();