mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 20:53:50 +00:00
added new switch: --script-warn
This commit is contained in:
parent
8bcdf54570
commit
4ee43612f6
6 changed files with 47 additions and 23 deletions
|
@ -155,6 +155,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
||||||
, mSkipMenu (false)
|
, mSkipMenu (false)
|
||||||
, mUseSound (true)
|
, mUseSound (true)
|
||||||
, mCompileAll (false)
|
, mCompileAll (false)
|
||||||
|
, mWarningsMode (1)
|
||||||
, mScriptContext (0)
|
, mScriptContext (0)
|
||||||
, mFSStrict (false)
|
, mFSStrict (false)
|
||||||
, mScriptConsoleMode (false)
|
, mScriptConsoleMode (false)
|
||||||
|
@ -424,7 +425,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||||
mScriptContext->setExtensions (&mExtensions);
|
mScriptContext->setExtensions (&mExtensions);
|
||||||
|
|
||||||
mEnvironment.setScriptManager (new MWScript::ScriptManager (MWBase::Environment::get().getWorld()->getStore(),
|
mEnvironment.setScriptManager (new MWScript::ScriptManager (MWBase::Environment::get().getWorld()->getStore(),
|
||||||
mVerboseScripts, *mScriptContext));
|
mVerboseScripts, *mScriptContext, mWarningsMode));
|
||||||
|
|
||||||
// Create game mechanics system
|
// Create game mechanics system
|
||||||
MWMechanics::MechanicsManager* mechanics = new MWMechanics::MechanicsManager;
|
MWMechanics::MechanicsManager* mechanics = new MWMechanics::MechanicsManager;
|
||||||
|
@ -612,8 +613,12 @@ void OMW::Engine::setStartupScript (const std::string& path)
|
||||||
mStartupScript = path;
|
mStartupScript = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OMW::Engine::setActivationDistanceOverride (int distance)
|
void OMW::Engine::setActivationDistanceOverride (int distance)
|
||||||
{
|
{
|
||||||
mActivationDistanceOverride = distance;
|
mActivationDistanceOverride = distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OMW::Engine::setWarningsMode (int mode)
|
||||||
|
{
|
||||||
|
mWarningsMode = mode;
|
||||||
|
}
|
|
@ -74,6 +74,7 @@ namespace OMW
|
||||||
bool mSkipMenu;
|
bool mSkipMenu;
|
||||||
bool mUseSound;
|
bool mUseSound;
|
||||||
bool mCompileAll;
|
bool mCompileAll;
|
||||||
|
int mWarningsMode;
|
||||||
std::string mFocusName;
|
std::string mFocusName;
|
||||||
std::map<std::string,std::string> mFallbackMap;
|
std::map<std::string,std::string> mFallbackMap;
|
||||||
bool mScriptConsoleMode;
|
bool mScriptConsoleMode;
|
||||||
|
@ -181,6 +182,8 @@ namespace OMW
|
||||||
/// Override the game setting specified activation distance.
|
/// Override the game setting specified activation distance.
|
||||||
void setActivationDistanceOverride (int distance);
|
void setActivationDistanceOverride (int distance);
|
||||||
|
|
||||||
|
void setWarningsMode (int mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Files::ConfigurationManager& mCfgMgr;
|
Files::ConfigurationManager& mCfgMgr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -137,6 +137,13 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
||||||
("script-run", bpo::value<std::string>()->default_value(""),
|
("script-run", bpo::value<std::string>()->default_value(""),
|
||||||
"select a file containing a list of console commands that is executed on startup")
|
"select a file containing a list of console commands that is executed on startup")
|
||||||
|
|
||||||
|
("script-warn", bpo::value<int>()->implicit_value (1)
|
||||||
|
->default_value (1),
|
||||||
|
"handling of warnings when compiling scripts\n"
|
||||||
|
"\t0 - ignore warning\n"
|
||||||
|
"\t1 - show warning but consider script as correctly compiled anyway\n"
|
||||||
|
"\t2 - treat warnings as errors")
|
||||||
|
|
||||||
("skip-menu", bpo::value<bool>()->implicit_value(true)
|
("skip-menu", bpo::value<bool>()->implicit_value(true)
|
||||||
->default_value(false), "skip main menu on game startup")
|
->default_value(false), "skip main menu on game startup")
|
||||||
|
|
||||||
|
@ -242,6 +249,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
||||||
engine.setScriptConsoleMode (variables["script-console"].as<bool>());
|
engine.setScriptConsoleMode (variables["script-console"].as<bool>());
|
||||||
engine.setStartupScript (variables["script-run"].as<std::string>());
|
engine.setStartupScript (variables["script-run"].as<std::string>());
|
||||||
engine.setActivationDistanceOverride (variables["activate-dist"].as<int>());
|
engine.setActivationDistanceOverride (variables["activate-dist"].as<int>());
|
||||||
|
engine.setWarningsMode (variables["script-warn"].as<int>());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
namespace MWScript
|
namespace MWScript
|
||||||
{
|
{
|
||||||
ScriptManager::ScriptManager (const MWWorld::ESMStore& store, bool verbose,
|
ScriptManager::ScriptManager (const MWWorld::ESMStore& store, bool verbose,
|
||||||
Compiler::Context& compilerContext)
|
Compiler::Context& compilerContext, int warningsMode)
|
||||||
: mErrorHandler (std::cerr), mStore (store), mVerbose (verbose),
|
: mErrorHandler (std::cerr), mStore (store), mVerbose (verbose),
|
||||||
mCompilerContext (compilerContext), mParser (mErrorHandler, mCompilerContext),
|
mCompilerContext (compilerContext), mParser (mErrorHandler, mCompilerContext),
|
||||||
mOpcodesInstalled (false), mGlobalScripts (store)
|
mOpcodesInstalled (false), mGlobalScripts (store)
|
||||||
{}
|
{
|
||||||
|
mErrorHandler.setWarningsMode (warningsMode);
|
||||||
|
}
|
||||||
|
|
||||||
bool ScriptManager::compile (const std::string& name)
|
bool ScriptManager::compile (const std::string& name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace MWScript
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ScriptManager (const MWWorld::ESMStore& store, bool verbose,
|
ScriptManager (const MWWorld::ESMStore& store, bool verbose,
|
||||||
Compiler::Context& compilerContext);
|
Compiler::Context& compilerContext, int warningsMode);
|
||||||
|
|
||||||
virtual void run (const std::string& name, Interpreter::Context& interpreterContext);
|
virtual void run (const std::string& name, Interpreter::Context& interpreterContext);
|
||||||
///< Run the script with the given name (compile first, if not compiled yet)
|
///< Run the script with the given name (compile first, if not compiled yet)
|
||||||
|
|
|
@ -67,6 +67,12 @@ Allowed options:
|
||||||
--script-run arg select a file containing a list of
|
--script-run arg select a file containing a list of
|
||||||
console commands that is executed on
|
console commands that is executed on
|
||||||
startup
|
startup
|
||||||
|
--script-warn [=arg(=1)] (=1) handling of warnings when compiling
|
||||||
|
scripts
|
||||||
|
0 - ignore warning
|
||||||
|
1 - show warning but consider script as
|
||||||
|
correctly compiled anyway
|
||||||
|
2 - treat warnings as errors
|
||||||
--new-game [=arg(=1)] (=0) activate char gen/new game mechanics
|
--new-game [=arg(=1)] (=0) activate char gen/new game mechanics
|
||||||
--fs-strict [=arg(=1)] (=0) strict file system handling (no case
|
--fs-strict [=arg(=1)] (=0) strict file system handling (no case
|
||||||
folding)
|
folding)
|
||||||
|
|
Loading…
Reference in a new issue