From d481222d92db18b37c5905a9a6ae7e9c607727c9 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 21 Apr 2011 18:23:46 +0200 Subject: [PATCH] all program options (except help) can now be used from a cfg file --- apps/openmw/main.cpp | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 059bf39f7..f6f023592 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -55,12 +55,20 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine) ->default_value (std::vector(), "") ->multitoken(), "plugin file(s)") - ( "fps", "show fps counter") - ( "debug", "debug mode" ) - ( "nosound", "disable all sound" ) - ( "script-verbose", "verbose script output" ) - ( "new-game", "activate char gen/new game mechanics" ) - ( "script-all", "compile all scripts (excluding dialogue scripts) at startup") + ( "fps", boost::program_options::value()-> + implicit_value (true)->default_value (false), "show fps counter") + ( "debug", boost::program_options::value()-> + implicit_value (true)->default_value (false), "debug mode" ) + ( "nosound", boost::program_options::value()-> + implicit_value (true)->default_value (false), "disable all sound" ) + ( "script-verbose", boost::program_options::value()-> + implicit_value (true)->default_value (false), "verbose script output" ) + ( "new-game", boost::program_options::value()-> + implicit_value (true)->default_value (false), + "activate char gen/new game mechanics" ) + ( "script-all", boost::program_options::value()-> + implicit_value (true)->default_value (false), + "compile all scripts (excluding dialogue scripts) at startup") ; bpo::variables_map variables; @@ -118,23 +126,23 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine) // startup-settings engine.setCell (variables["start"].as()); - if (variables.count ("new-game")) + if (variables["new-game"].as()==true) engine.setNewGame(); // other settings - if (variables.count ("fps")) + if (variables["fps"].as()==true) engine.showFPS(); - if (variables.count ("debug")) + if (variables["debug"].as()==true) engine.enableDebugMode(); - if (variables.count ("no-sound")) + if (variables["nosound"].as()==true) engine.disableSound(); - if (variables.count ("script-verbose")) + if (variables["script-verbose"].as()==true) engine.enableVerboseScripts(); - if (variables.count ("script-all")) + if (variables["script-all"].as()==true) engine.setCompileAll (true); return true;