mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 19:39:41 +00:00
add project file to content file list when running OpenMW from OpenCS
This commit is contained in:
parent
10fa205ced
commit
081588f484
5 changed files with 26 additions and 8 deletions
|
@ -2211,7 +2211,8 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
|||
mTools (*this), mResDir(resDir),
|
||||
mProjectPath ((configuration.getUserDataPath() / "projects") /
|
||||
(savePath.filename().string() + ".project")),
|
||||
mSaving (*this, mProjectPath, encoding)
|
||||
mSaving (*this, mProjectPath, encoding),
|
||||
mRunner (mProjectPath)
|
||||
{
|
||||
if (mContentFiles.empty())
|
||||
throw std::runtime_error ("Empty content file sequence");
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
|
||||
#include "operation.hpp"
|
||||
|
||||
CSMDoc::Runner::Runner() : mRunning (false), mStartup (0)
|
||||
CSMDoc::Runner::Runner (const boost::filesystem::path& projectPath)
|
||||
: mRunning (false), mStartup (0), mProjectPath (projectPath)
|
||||
{
|
||||
connect (&mProcess, SIGNAL (finished (int, QProcess::ExitStatus)),
|
||||
this, SLOT (finished (int, QProcess::ExitStatus)));
|
||||
|
@ -73,7 +74,10 @@ void CSMDoc::Runner::start (bool delayed)
|
|||
else
|
||||
arguments << "--new-game=1";
|
||||
|
||||
arguments << ("--script-run="+mStartup->fileName());
|
||||
arguments << ("--script-run="+mStartup->fileName());;
|
||||
|
||||
arguments <<
|
||||
QString::fromUtf8 (("--data="+mProjectPath.parent_path().string()).c_str());
|
||||
|
||||
for (std::vector<std::string>::const_iterator iter (mContentFiles.begin());
|
||||
iter!=mContentFiles.end(); ++iter)
|
||||
|
@ -81,6 +85,9 @@ void CSMDoc::Runner::start (bool delayed)
|
|||
arguments << QString::fromUtf8 (("--content="+*iter).c_str());
|
||||
}
|
||||
|
||||
arguments
|
||||
<< QString::fromUtf8 (("--content="+mProjectPath.filename().string()).c_str());
|
||||
|
||||
mProcess.start (path, arguments);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QTextDocument>
|
||||
|
@ -25,10 +27,11 @@ namespace CSMDoc
|
|||
std::string mStartupInstruction;
|
||||
QTemporaryFile *mStartup;
|
||||
QTextDocument mLog;
|
||||
boost::filesystem::path mProjectPath;
|
||||
|
||||
public:
|
||||
|
||||
Runner();
|
||||
Runner (const boost::filesystem::path& projectPath);
|
||||
|
||||
~Runner();
|
||||
|
||||
|
|
|
@ -81,7 +81,13 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
|
|||
mMagicEffects.load (esm);
|
||||
} else if (n.val == ESM::REC_SKIL) {
|
||||
mSkills.load (esm);
|
||||
} else {
|
||||
}
|
||||
else if (n.val==ESM::REC_FILT || ESM::REC_DBGP)
|
||||
{
|
||||
// ignore project file only records
|
||||
esm.skipRecord();
|
||||
}
|
||||
else {
|
||||
std::stringstream error;
|
||||
error << "Unknown record: " << n.toString();
|
||||
throw std::runtime_error(error.str());
|
||||
|
|
|
@ -174,8 +174,9 @@ namespace MWWorld
|
|||
|
||||
gameContentLoader.addLoader(".esm", &esmLoader);
|
||||
gameContentLoader.addLoader(".esp", &esmLoader);
|
||||
gameContentLoader.addLoader(".omwgame", &omwLoader);
|
||||
gameContentLoader.addLoader(".omwaddon", &omwLoader);
|
||||
gameContentLoader.addLoader(".omwgame", &esmLoader);
|
||||
gameContentLoader.addLoader(".omwaddon", &esmLoader);
|
||||
gameContentLoader.addLoader(".project", &esmLoader);
|
||||
|
||||
loadContentFiles(fileCollections, contentFiles, gameContentLoader);
|
||||
|
||||
|
@ -2435,7 +2436,7 @@ namespace MWWorld
|
|||
if (!selectedSpell.empty())
|
||||
{
|
||||
const ESM::Spell* spell = getStore().get<ESM::Spell>().search(selectedSpell);
|
||||
|
||||
|
||||
// A power can be used once per 24h
|
||||
if (spell->mData.mType == ESM::Spell::ST_Power)
|
||||
stats.getSpells().usePower(spell->mId);
|
||||
|
|
Loading…
Reference in a new issue