added new switch: --script-warn

actorid
Marc Zinnschlag 11 years ago
parent 8bcdf54570
commit 4ee43612f6

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

@ -48,42 +48,48 @@ Allowed options:
--version print version information and quit --version print version information and quit
--data arg (=data) set data directories (later directories --data arg (=data) set data directories (later directories
have higher priority) have higher priority)
--data-local arg set local data directory (highest --data-local arg set local data directory (highest
priority) priority)
--fallback-archive arg (=fallback-archive) --fallback-archive arg (=fallback-archive)
set fallback BSA archives (later set fallback BSA archives (later
archives have higher priority) archives have higher priority)
--resources arg (=resources) set resources directory --resources arg (=resources) set resources directory
--start arg (=Beshara) set initial cell --start arg (=Beshara) set initial cell
--content arg content file(s): esm/esp, or --content arg content file(s): esm/esp, or
omwgame/omwaddon omwgame/omwaddon
--anim-verbose [=arg(=1)] (=0) output animation indices files --anim-verbose [=arg(=1)] (=0) output animation indices files
--no-sound [=arg(=1)] (=0) disable all sounds --no-sound [=arg(=1)] (=0) disable all sounds
--script-verbose [=arg(=1)] (=0) verbose script output --script-verbose [=arg(=1)] (=0) verbose script output
--script-all [=arg(=1)] (=0) compile all scripts (excluding dialogue --script-all [=arg(=1)] (=0) compile all scripts (excluding dialogue
scripts) at startup scripts) at startup
--script-console [=arg(=1)] (=0) enable console-only script --script-console [=arg(=1)] (=0) enable console-only script
functionality functionality
--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)
--encoding arg (=win1252) Character encoding used in OpenMW game --encoding arg (=win1252) Character encoding used in OpenMW game
messages: messages:
win1250 - Central and Eastern European win1250 - Central and Eastern European
such as Polish, Czech, Slovak, such as Polish, Czech, Slovak,
Hungarian, Slovene, Bosnian, Croatian, Hungarian, Slovene, Bosnian, Croatian,
Serbian (Latin script), Romanian and Serbian (Latin script), Romanian and
Albanian languages Albanian languages
win1251 - Cyrillic alphabet such as win1251 - Cyrillic alphabet such as
Russian, Bulgarian, Serbian Cyrillic Russian, Bulgarian, Serbian Cyrillic
and other languages and other languages
win1252 - Western European (Latin) win1252 - Western European (Latin)
alphabet, used by default alphabet, used by default
--fallback arg fallback values --fallback arg fallback values
--no-grab Don't grab mouse cursor --no-grab Don't grab mouse cursor

Loading…
Cancel
Save