From 6ae15f08e07756a36899f465770476a39a3fe9c2 Mon Sep 17 00:00:00 2001 From: elsid Date: Mon, 12 Sep 2022 16:48:15 +0200 Subject: [PATCH] Avoid chained operator() calls to prevent formatting issues --- apps/bsatool/bsatool.cpp | 19 ++-- apps/bulletobjecttool/main.cpp | 40 ++++--- apps/esmtool/esmtool.cpp | 37 +++---- apps/essimporter/main.cpp | 14 +-- apps/mwiniimporter/main.cpp | 23 ++-- apps/navmeshtool/main.cpp | 57 +++++----- apps/niftest/niftest.cpp | 7 +- apps/opencs/editor.cpp | 26 ++--- apps/openmw/options.cpp | 103 +++++++++--------- apps/openmw_test_suite/mwworld/test_store.cpp | 10 +- components/files/configurationmanager.cpp | 12 +- 11 files changed, 167 insertions(+), 181 deletions(-) diff --git a/apps/bsatool/bsatool.cpp b/apps/bsatool/bsatool.cpp index b250cf9862..c45e4ff0dc 100644 --- a/apps/bsatool/bsatool.cpp +++ b/apps/bsatool/bsatool.cpp @@ -45,21 +45,18 @@ bool parseOptions (int argc, char** argv, Arguments &info) " Create an archive.\n\n" "Allowed options"); - desc.add_options() - ("help,h", "print help message.") - ("version,v", "print version information and quit.") - ("long,l", "Include extra information in archive listing.") - ("full-path,f", "Create directory hierarchy on file extraction " - "(always true for extractall).") - ; + auto addOption = desc.add_options(); + addOption("help,h", "print help message."); + addOption("version,v", "print version information and quit."); + addOption("long,l", "Include extra information in archive listing."); + addOption("full-path,f", "Create directory hierarchy on file extraction (always true for extractall)."); // input-file is hidden and used as a positional argument bpo::options_description hidden("Hidden Options"); - hidden.add_options() - ( "mode,m", bpo::value(), "bsatool mode") - ( "input-file,i", bpo::value< Files::MaybeQuotedPathContainer >(), "input file") - ; + auto addHiddenOption = hidden.add_options(); + addHiddenOption("mode,m", bpo::value(), "bsatool mode"); + addHiddenOption("input-file,i", bpo::value< Files::MaybeQuotedPathContainer >(), "input file"); bpo::positional_options_description p; p.add("mode", 1).add("input-file", 3); diff --git a/apps/bulletobjecttool/main.cpp b/apps/bulletobjecttool/main.cpp index 5acd57dbb1..a274fd9209 100644 --- a/apps/bulletobjecttool/main.cpp +++ b/apps/bulletobjecttool/main.cpp @@ -39,41 +39,39 @@ namespace using Fallback::FallbackMap; bpo::options_description result; + auto addOption = result.add_options(); + addOption("help", "print help message"); - result.add_options() - ("help", "print help message") + addOption("version", "print version information and quit"); - ("version", "print version information and quit") + addOption("data", bpo::value()->default_value(Files::MaybeQuotedPathContainer(), "data") + ->multitoken()->composing(), "set data directories (later directories have higher priority)"); - ("data", bpo::value()->default_value(Files::MaybeQuotedPathContainer(), "data") - ->multitoken()->composing(), "set data directories (later directories have higher priority)") + addOption("data-local", bpo::value()->default_value(Files::MaybeQuotedPathContainer::value_type(), ""), + "set local data directory (highest priority)"); - ("data-local", bpo::value()->default_value(Files::MaybeQuotedPathContainer::value_type(), ""), - "set local data directory (highest priority)") + addOption("fallback-archive", bpo::value()->default_value(StringsVector(), "fallback-archive") + ->multitoken()->composing(), "set fallback BSA archives (later archives have higher priority)"); - ("fallback-archive", bpo::value()->default_value(StringsVector(), "fallback-archive") - ->multitoken()->composing(), "set fallback BSA archives (later archives have higher priority)") + addOption("resources", bpo::value()->default_value(Files::MaybeQuotedPath(), "resources"), + "set resources directory"); - ("resources", bpo::value()->default_value(Files::MaybeQuotedPath(), "resources"), - "set resources directory") + addOption("content", bpo::value()->default_value(StringsVector(), "") + ->multitoken()->composing(), "content file(s): esm/esp, or omwgame/omwaddon/omwscripts"); - ("content", bpo::value()->default_value(StringsVector(), "") - ->multitoken()->composing(), "content file(s): esm/esp, or omwgame/omwaddon/omwscripts") + addOption("fs-strict", bpo::value()->implicit_value(true) + ->default_value(false), "strict file system handling (no case folding)"); - ("fs-strict", bpo::value()->implicit_value(true) - ->default_value(false), "strict file system handling (no case folding)") - - ("encoding", bpo::value()-> + addOption("encoding", bpo::value()-> default_value("win1252"), "Character encoding used in OpenMW game messages:\n" "\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, Croatian, Serbian (Latin script), Romanian and Albanian languages\n" "\n\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n" - "\n\twin1252 - Western European (Latin) alphabet, used by default") + "\n\twin1252 - Western European (Latin) alphabet, used by default"); - ("fallback", bpo::value()->default_value(FallbackMap(), "") - ->multitoken()->composing(), "fallback values") + addOption("fallback", bpo::value()->default_value(FallbackMap(), "") + ->multitoken()->composing(), "fallback values"); ; - Files::ConfigurationManager::addCommonOptions(result); return result; diff --git a/apps/esmtool/esmtool.cpp b/apps/esmtool/esmtool.cpp index 2e274bfe74..76f11bf692 100644 --- a/apps/esmtool/esmtool.cpp +++ b/apps/esmtool/esmtool.cpp @@ -49,28 +49,27 @@ struct ESMData bool parseOptions (int argc, char** argv, Arguments &info) { bpo::options_description desc("Inspect and extract from Morrowind ES files (ESM, ESP, ESS)\nSyntax: esmtool [options] mode infile [outfile]\nAllowed modes:\n dump\t Dumps all readable data from the input file.\n clone\t Clones the input file to the output file.\n comp\t Compares the given files.\n\nAllowed options"); - - desc.add_options() - ("help,h", "print help message.") - ("version,v", "print version information and quit.") - ("raw,r", bpo::value(), + auto addOption = desc.add_options(); + addOption("help,h", "print help message."); + addOption("version,v", "print version information and quit."); + addOption("raw,r", bpo::value(), "Show an unformatted list of all records and subrecords of given format:\n" "\n\tTES3" - "\n\tTES4") + "\n\tTES4"); // The intention is that this option would interact better // with other modes including clone, dump, and raw. - ("type,t", bpo::value< std::vector >(), + addOption("type,t", bpo::value< std::vector >(), "Show only records of this type (four character record code). May " - "be specified multiple times. Only affects dump mode.") - ("name,n", bpo::value(), - "Show only the record with this name. Only affects dump mode.") - ("plain,p", "Print contents of dialogs, books and scripts. " + "be specified multiple times. Only affects dump mode."); + addOption("name,n", bpo::value(), + "Show only the record with this name. Only affects dump mode."); + addOption("plain,p", "Print contents of dialogs, books and scripts. " "(skipped by default)" - "Only affects dump mode.") - ("quiet,q", "Suppress all record information. Useful for speed tests.") - ("loadcells,C", "Browse through contents of all cells.") + "Only affects dump mode."); + addOption("quiet,q", "Suppress all record information. Useful for speed tests."); + addOption("loadcells,C", "Browse through contents of all cells."); - ( "encoding,e", bpo::value(&(info.encoding))-> + addOption( "encoding,e", bpo::value(&(info.encoding))-> default_value("win1252"), "Character encoding used in ESMTool:\n" "\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, Croatian, Serbian (Latin script), Romanian and Albanian languages\n" @@ -82,11 +81,9 @@ bool parseOptions (int argc, char** argv, Arguments &info) // input-file is hidden and used as a positional argument bpo::options_description hidden("Hidden Options"); - - hidden.add_options() - ( "mode,m", bpo::value(), "esmtool mode") - ( "input-file,i", bpo::value< Files::MaybeQuotedPathContainer >(), "input file") - ; + auto addHiddenOption = hidden.add_options(); + addHiddenOption( "mode,m", bpo::value(), "esmtool mode"); + addHiddenOption( "input-file,i", bpo::value< Files::MaybeQuotedPathContainer >(), "input file"); bpo::positional_options_description p; p.add("mode", 1).add("input-file", 2); diff --git a/apps/essimporter/main.cpp b/apps/essimporter/main.cpp index 56c3828c1c..e9c58b1c39 100644 --- a/apps/essimporter/main.cpp +++ b/apps/essimporter/main.cpp @@ -16,13 +16,12 @@ int main(int argc, char** argv) { bpo::options_description desc("Syntax: openmw-essimporter infile.ess outfile.omwsave\nAllowed options"); bpo::positional_options_description p_desc; - desc.add_options() - ("help,h", "produce help message") - ("mwsave,m", bpo::value(), "morrowind .ess save file") - ("output,o", bpo::value(), "output file (.omwsave)") - ("compare,c", "compare two .ess files") - ("encoding", boost::program_options::value()->default_value("win1252"), "encoding of the save file") - ; + auto addOption = desc.add_options(); + addOption("help,h", "produce help message"); + addOption("mwsave,m", bpo::value(), "morrowind .ess save file"); + addOption("output,o", bpo::value(), "output file (.omwsave)"); + addOption("compare,c", "compare two .ess files"); + addOption("encoding", boost::program_options::value()->default_value("win1252"), "encoding of the save file"); p_desc.add("mwsave", 1).add("output", 1); Files::ConfigurationManager::addCommonOptions(desc); @@ -32,7 +31,6 @@ int main(int argc, char** argv) .options(desc) .positional(p_desc) .run(); - bpo::store(parsed, variables); if(variables.count("help") || !variables.count("mwsave") || !variables.count("output")) { diff --git a/apps/mwiniimporter/main.cpp b/apps/mwiniimporter/main.cpp index 690afe64c8..d3040aca07 100644 --- a/apps/mwiniimporter/main.cpp +++ b/apps/mwiniimporter/main.cpp @@ -61,20 +61,20 @@ int wmain(int argc, wchar_t *wargv[]) { { bpo::options_description desc("Syntax: openmw-iniimporter inifile configfile\nAllowed options"); bpo::positional_options_description p_desc; - desc.add_options() - ("help,h", "produce help message") - ("verbose,v", "verbose output") - ("ini,i", bpo::value(), "morrowind.ini file") - ("cfg,c", bpo::value(), "openmw.cfg file") - ("output,o", bpo::value()->default_value({}), "openmw.cfg file") - ("game-files,g", "import esm and esp files") - ("fonts,f", "import bitmap fonts") - ("no-archives,A", "disable bsa archives import") - ("encoding,e", bpo::value()-> default_value("win1252"), + auto addOption = desc.add_options(); + addOption("help,h", "produce help message"); + addOption("verbose,v", "verbose output"); + addOption("ini,i", bpo::value(), "morrowind.ini file"); + addOption("cfg,c", bpo::value(), "openmw.cfg file"); + addOption("output,o", bpo::value()->default_value({}), "openmw.cfg file"); + addOption("game-files,g", "import esm and esp files"); + addOption("fonts,f", "import bitmap fonts"); + addOption("no-archives,A", "disable bsa archives import"); + addOption("encoding,e", bpo::value()-> default_value("win1252"), "Character encoding used in OpenMW game messages:\n" "\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, Croatian, Serbian (Latin script), Romanian and Albanian languages\n" "\n\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n" - "\n\twin1252 - Western European (Latin) alphabet, used by default") + "\n\twin1252 - Western European (Latin) alphabet, used by default"); ; p_desc.add("ini", 1).add("cfg", 1); @@ -84,7 +84,6 @@ int wmain(int argc, wchar_t *wargv[]) { .options(desc) .positional(p_desc) .run(); - bpo::store(parsed, vm); if(vm.count("help") || !vm.count("ini") || !vm.count("cfg")) { diff --git a/apps/navmeshtool/main.cpp b/apps/navmeshtool/main.cpp index 3d80454499..d67db05529 100644 --- a/apps/navmeshtool/main.cpp +++ b/apps/navmeshtool/main.cpp @@ -54,52 +54,51 @@ namespace NavMeshTool using Fallback::FallbackMap; bpo::options_description result; + auto addOption = result.add_options(); + addOption("help", "print help message"); - result.add_options() - ("help", "print help message") + addOption("version", "print version information and quit"); - ("version", "print version information and quit") + addOption("data", bpo::value()->default_value(Files::MaybeQuotedPathContainer(), "data") + ->multitoken()->composing(), "set data directories (later directories have higher priority)"); - ("data", bpo::value()->default_value(Files::MaybeQuotedPathContainer(), "data") - ->multitoken()->composing(), "set data directories (later directories have higher priority)") + addOption("data-local", bpo::value()->default_value(Files::MaybeQuotedPathContainer::value_type(), ""), + "set local data directory (highest priority)"); - ("data-local", bpo::value()->default_value(Files::MaybeQuotedPathContainer::value_type(), ""), - "set local data directory (highest priority)") + addOption("fallback-archive", bpo::value()->default_value(StringsVector(), "fallback-archive") + ->multitoken()->composing(), "set fallback BSA archives (later archives have higher priority)"); - ("fallback-archive", bpo::value()->default_value(StringsVector(), "fallback-archive") - ->multitoken()->composing(), "set fallback BSA archives (later archives have higher priority)") + addOption("resources", bpo::value()->default_value(Files::MaybeQuotedPath(), "resources"), + "set resources directory"); - ("resources", bpo::value()->default_value(Files::MaybeQuotedPath(), "resources"), - "set resources directory") + addOption("content", bpo::value()->default_value(StringsVector(), "") + ->multitoken()->composing(), "content file(s): esm/esp, or omwgame/omwaddon/omwscripts"); - ("content", bpo::value()->default_value(StringsVector(), "") - ->multitoken()->composing(), "content file(s): esm/esp, or omwgame/omwaddon/omwscripts") + addOption("fs-strict", bpo::value()->implicit_value(true) + ->default_value(false), "strict file system handling (no case folding)"); - ("fs-strict", bpo::value()->implicit_value(true) - ->default_value(false), "strict file system handling (no case folding)") - - ("encoding", bpo::value()-> + addOption("encoding", bpo::value()-> default_value("win1252"), "Character encoding used in OpenMW game messages:\n" "\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, Croatian, Serbian (Latin script), Romanian and Albanian languages\n" "\n\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n" - "\n\twin1252 - Western European (Latin) alphabet, used by default") + "\n\twin1252 - Western European (Latin) alphabet, used by default"); + + addOption("fallback", bpo::value()->default_value(Fallback::FallbackMap(), "") + ->multitoken()->composing(), "fallback values"); - ("fallback", bpo::value()->default_value(Fallback::FallbackMap(), "") - ->multitoken()->composing(), "fallback values") + addOption("threads", bpo::value()->default_value(std::max(std::thread::hardware_concurrency() - 1, 1)), + "number of threads for parallel processing"); - ("threads", bpo::value()->default_value(std::max(std::thread::hardware_concurrency() - 1, 1)), - "number of threads for parallel processing") + addOption("process-interior-cells", bpo::value()->implicit_value(true) + ->default_value(false), "build navmesh for interior cells"); - ("process-interior-cells", bpo::value()->implicit_value(true) - ->default_value(false), "build navmesh for interior cells") + addOption("remove-unused-tiles", bpo::value()->implicit_value(true) + ->default_value(false), "remove tiles from cache that will not be used with current content profile"); - ("remove-unused-tiles", bpo::value()->implicit_value(true) - ->default_value(false), "remove tiles from cache that will not be used with current content profile") + addOption("write-binary-log", bpo::value()->implicit_value(true) + ->default_value(false), "write progress in binary messages to be consumed by the launcher"); - ("write-binary-log", bpo::value()->implicit_value(true) - ->default_value(false), "write progress in binary messages to be consumed by the launcher") - ; Files::ConfigurationManager::addCommonOptions(result); return result; diff --git a/apps/niftest/niftest.cpp b/apps/niftest/niftest.cpp index 9328c4f2c6..0b29f364c4 100644 --- a/apps/niftest/niftest.cpp +++ b/apps/niftest/niftest.cpp @@ -75,10 +75,9 @@ bool parseOptions (int argc, char** argv, std::vector &f " niftool \n" " Scan the file or directories for nif errors.\n\n" "Allowed options"); - desc.add_options() - ("help,h", "print help message.") - ("input-file", bpo::value< Files::MaybeQuotedPathContainer >(), "input file") - ; + auto addOption = desc.add_options(); + addOption("help,h", "print help message."); + addOption("input-file", bpo::value< Files::MaybeQuotedPathContainer >(), "input file"); //Default option if none provided bpo::positional_options_description p; diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 24d328e0c5..b5af84d079 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -89,19 +89,19 @@ boost::program_options::variables_map CS::Editor::readConfiguration() boost::program_options::variables_map variables; boost::program_options::options_description desc("Syntax: openmw-cs \nAllowed options"); - desc.add_options() - ("data", boost::program_options::value()->default_value(Files::MaybeQuotedPathContainer(), "data")->multitoken()->composing()) - ("data-local", boost::program_options::value()->default_value(Files::MaybeQuotedPathContainer::value_type(), "")) - ("fs-strict", boost::program_options::value()->implicit_value(true)->default_value(false)) - ("encoding", boost::program_options::value()->default_value("win1252")) - ("resources", boost::program_options::value()->default_value(Files::MaybeQuotedPath(), "resources")) - ("fallback-archive", boost::program_options::value>()-> - default_value(std::vector(), "fallback-archive")->multitoken()) - ("fallback", boost::program_options::value()->default_value(FallbackMap(), "") - ->multitoken()->composing(), "fallback values") - ("script-blacklist", boost::program_options::value>()->default_value(std::vector(), "") - ->multitoken(), "exclude specified script from the verifier (if the use of the blacklist is enabled)") - ("script-blacklist-use", boost::program_options::value()->implicit_value(true) + auto addOption = desc.add_options(); + addOption("data", boost::program_options::value()->default_value(Files::MaybeQuotedPathContainer(), "data")->multitoken()->composing()); + addOption("data-local", boost::program_options::value()->default_value(Files::MaybeQuotedPathContainer::value_type(), "")); + addOption("fs-strict", boost::program_options::value()->implicit_value(true)->default_value(false)); + addOption("encoding", boost::program_options::value()->default_value("win1252")); + addOption("resources", boost::program_options::value()->default_value(Files::MaybeQuotedPath(), "resources")); + addOption("fallback-archive", boost::program_options::value>()-> + default_value(std::vector(), "fallback-archive")->multitoken()); + addOption("fallback", boost::program_options::value()->default_value(FallbackMap(), "") + ->multitoken()->composing(), "fallback values"); + addOption("script-blacklist", boost::program_options::value>()->default_value(std::vector(), "") + ->multitoken(), "exclude specified script from the verifier (if the use of the blacklist is enabled)"); + addOption("script-blacklist-use", boost::program_options::value()->implicit_value(true) ->default_value(true), "enable script blacklisting"); Files::ConfigurationManager::addCommonOptions(desc); diff --git a/apps/openmw/options.cpp b/apps/openmw/options.cpp index f557e42282..0cbfe2700a 100644 --- a/apps/openmw/options.cpp +++ b/apps/openmw/options.cpp @@ -18,92 +18,91 @@ namespace OpenMW bpo::options_description desc("Syntax: openmw \nAllowed options"); Files::ConfigurationManager::addCommonOptions(desc); - desc.add_options() - ("help", "print help message") - ("version", "print version information and quit") + auto addOption = desc.add_options(); + addOption("help", "print help message"); + addOption("version", "print version information and quit"); - ("data", bpo::value()->default_value(Files::MaybeQuotedPathContainer(), "data") - ->multitoken()->composing(), "set data directories (later directories have higher priority)") + addOption("data", bpo::value()->default_value(Files::MaybeQuotedPathContainer(), "data") + ->multitoken()->composing(), "set data directories (later directories have higher priority)"); - ("data-local", bpo::value()->default_value(Files::MaybeQuotedPath(), ""), - "set local data directory (highest priority)") + addOption("data-local", bpo::value()->default_value(Files::MaybeQuotedPath(), ""), + "set local data directory (highest priority)"); - ("fallback-archive", bpo::value()->default_value(StringsVector(), "fallback-archive") - ->multitoken()->composing(), "set fallback BSA archives (later archives have higher priority)") + addOption("fallback-archive", bpo::value()->default_value(StringsVector(), "fallback-archive") + ->multitoken()->composing(), "set fallback BSA archives (later archives have higher priority)"); - ("resources", bpo::value()->default_value(Files::MaybeQuotedPath(), "resources"), - "set resources directory") + addOption("resources", bpo::value()->default_value(Files::MaybeQuotedPath(), "resources"), + "set resources directory"); - ("start", bpo::value()->default_value(""), - "set initial cell") + addOption("start", bpo::value()->default_value(""), + "set initial cell"); - ("content", bpo::value()->default_value(StringsVector(), "") - ->multitoken()->composing(), "content file(s): esm/esp, or omwgame/omwaddon/omwscripts") + addOption("content", bpo::value()->default_value(StringsVector(), "") + ->multitoken()->composing(), "content file(s): esm/esp, or omwgame/omwaddon/omwscripts"); - ("groundcover", bpo::value()->default_value(StringsVector(), "") - ->multitoken()->composing(), "groundcover content file(s): esm/esp, or omwgame/omwaddon") + addOption("groundcover", bpo::value()->default_value(StringsVector(), "") + ->multitoken()->composing(), "groundcover content file(s): esm/esp, or omwgame/omwaddon"); - ("no-sound", bpo::value()->implicit_value(true) - ->default_value(false), "disable all sounds") + addOption("no-sound", bpo::value()->implicit_value(true) + ->default_value(false), "disable all sounds"); - ("script-all", bpo::value()->implicit_value(true) - ->default_value(false), "compile all scripts (excluding dialogue scripts) at startup") + addOption("script-all", bpo::value()->implicit_value(true) + ->default_value(false), "compile all scripts (excluding dialogue scripts) at startup"); - ("script-all-dialogue", bpo::value()->implicit_value(true) - ->default_value(false), "compile all dialogue scripts at startup") + addOption("script-all-dialogue", bpo::value()->implicit_value(true) + ->default_value(false), "compile all dialogue scripts at startup"); - ("script-console", bpo::value()->implicit_value(true) - ->default_value(false), "enable console-only script functionality") + addOption("script-console", bpo::value()->implicit_value(true) + ->default_value(false), "enable console-only script functionality"); - ("script-run", bpo::value()->default_value(""), - "select a file containing a list of console commands that is executed on startup") + addOption("script-run", bpo::value()->default_value(""), + "select a file containing a list of console commands that is executed on startup"); - ("script-warn", bpo::value()->implicit_value (1) + addOption("script-warn", bpo::value()->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") + "\t2 - treat warnings as errors"); - ("script-blacklist", bpo::value()->default_value(StringsVector(), "") - ->multitoken()->composing(), "ignore the specified script (if the use of the blacklist is enabled)") + addOption("script-blacklist", bpo::value()->default_value(StringsVector(), "") + ->multitoken()->composing(), "ignore the specified script (if the use of the blacklist is enabled)"); - ("script-blacklist-use", bpo::value()->implicit_value(true) - ->default_value(true), "enable script blacklisting") + addOption("script-blacklist-use", bpo::value()->implicit_value(true) + ->default_value(true), "enable script blacklisting"); - ("load-savegame", bpo::value()->default_value(Files::MaybeQuotedPath(), ""), - "load a save game file on game startup (specify an absolute filename or a filename relative to the current working directory)") + addOption("load-savegame", bpo::value()->default_value(Files::MaybeQuotedPath(), ""), + "load a save game file on game startup (specify an absolute filename or a filename relative to the current working directory)"); - ("skip-menu", bpo::value()->implicit_value(true) - ->default_value(false), "skip main menu on game startup") + addOption("skip-menu", bpo::value()->implicit_value(true) + ->default_value(false), "skip main menu on game startup"); - ("new-game", bpo::value()->implicit_value(true) - ->default_value(false), "run new game sequence (ignored if skip-menu=0)") + addOption("new-game", bpo::value()->implicit_value(true) + ->default_value(false), "run new game sequence (ignored if skip-menu=0)"); - ("fs-strict", bpo::value()->implicit_value(true) - ->default_value(false), "strict file system handling (no case folding)") + addOption("fs-strict", bpo::value()->implicit_value(true) + ->default_value(false), "strict file system handling (no case folding)"); - ("encoding", bpo::value()-> + addOption("encoding", bpo::value()-> default_value("win1252"), "Character encoding used in OpenMW game messages:\n" "\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, Croatian, Serbian (Latin script), Romanian and Albanian languages\n" "\n\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n" - "\n\twin1252 - Western European (Latin) alphabet, used by default") + "\n\twin1252 - Western European (Latin) alphabet, used by default"); - ("fallback", bpo::value()->default_value(Fallback::FallbackMap(), "") - ->multitoken()->composing(), "fallback values") + addOption("fallback", bpo::value()->default_value(Fallback::FallbackMap(), "") + ->multitoken()->composing(), "fallback values"); - ("no-grab", bpo::value()->implicit_value(true)->default_value(false), "Don't grab mouse cursor") + addOption("no-grab", bpo::value()->implicit_value(true)->default_value(false), "Don't grab mouse cursor"); - ("export-fonts", bpo::value()->implicit_value(true) - ->default_value(false), "Export Morrowind .fnt fonts to PNG image and XML file in current directory") + addOption("export-fonts", bpo::value()->implicit_value(true) + ->default_value(false), "Export Morrowind .fnt fonts to PNG image and XML file in current directory"); - ("activate-dist", bpo::value ()->default_value (-1), "activation distance override") + addOption("activate-dist", bpo::value ()->default_value (-1), "activation distance override"); - ("random-seed", bpo::value () + addOption("random-seed", bpo::value () ->default_value(Misc::Rng::generateDefaultSeed()), - "seed value for random number generator") - ; + "seed value for random number generator"); return desc; } diff --git a/apps/openmw_test_suite/mwworld/test_store.cpp b/apps/openmw_test_suite/mwworld/test_store.cpp index d3c7176540..07166e607c 100644 --- a/apps/openmw_test_suite/mwworld/test_store.cpp +++ b/apps/openmw_test_suite/mwworld/test_store.cpp @@ -61,11 +61,11 @@ struct ContentFileTest : public ::testing::Test boost::program_options::variables_map variables; boost::program_options::options_description desc("Allowed options"); - desc.add_options() - ("data", boost::program_options::value()->default_value(Files::MaybeQuotedPathContainer(), "data")->multitoken()->composing()) - ("content", boost::program_options::value>()->default_value(std::vector(), "") - ->multitoken()->composing(), "content file(s): esm/esp, or omwgame/omwaddon") - ("data-local", boost::program_options::value()->default_value(Files::MaybeQuotedPathContainer::value_type(), "")); + auto addOption = desc.add_options(); + addOption("data", boost::program_options::value()->default_value(Files::MaybeQuotedPathContainer(), "data")->multitoken()->composing()); + addOption("content", boost::program_options::value>()->default_value(std::vector(), "") + ->multitoken()->composing(), "content file(s): esm/esp, or omwgame/omwaddon"); + addOption("data-local", boost::program_options::value()->default_value(Files::MaybeQuotedPathContainer::value_type(), "")); Files::ConfigurationManager::addCommonOptions(desc); mConfigurationManager.readConfiguration(variables, desc, true); diff --git a/components/files/configurationmanager.cpp b/components/files/configurationmanager.cpp index 550bb3eb1c..fa600c6e38 100644 --- a/components/files/configurationmanager.cpp +++ b/components/files/configurationmanager.cpp @@ -177,12 +177,12 @@ void ConfigurationManager::addExtraConfigDirs(std::stack& void ConfigurationManager::addCommonOptions(bpo::options_description& description) { - description.add_options() - ("config", bpo::value()->default_value(Files::MaybeQuotedPathContainer(), "") - ->multitoken()->composing(), "additional config directories") - ("replace", bpo::value>()->default_value(std::vector(), "")->multitoken()->composing(), - "settings where the values from the current source should replace those from lower-priority sources instead of being appended") - ("user-data", bpo::value()->default_value(Files::MaybeQuotedPath(), ""), + auto addOption = description.add_options(); + addOption("config", bpo::value()->default_value(Files::MaybeQuotedPathContainer(), "") + ->multitoken()->composing(), "additional config directories"); + addOption("replace", bpo::value>()->default_value(std::vector(), "")->multitoken()->composing(), + "settings where the values from the current source should replace those from lower-priority sources instead of being appended"); + addOption("user-data", bpo::value()->default_value(Files::MaybeQuotedPath(), ""), "set user data directory (used for saves, screenshots, etc)"); }