use --new-game/--skip-menu switches when running from OpenCS

This commit is contained in:
Marc Zinnschlag 2014-09-05 11:03:16 +02:00
parent a728d6d77a
commit 61a92da374
3 changed files with 23 additions and 1 deletions

View file

@ -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)

View file

@ -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;

View file

@ -4,6 +4,8 @@
#include <QObject>
#include <QProcess>
#include <components/esm/debugprofile.hpp>
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();