diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 56f78afe3..c3d0cc821 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -26,6 +26,8 @@ #endif +#include "config.hpp" + using namespace std; /// Parse command line options and openmw.cfg file (if one exists). Results are directly @@ -41,7 +43,8 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine) "Syntax: openmw \nAllowed options"); desc.add_options() - ("help", "print help message") + ("help", "print help message and quit") + ("version", "print version information and quit") ("data", bpo::value >() ->default_value (std::vector(), "data") ->multitoken(), @@ -105,12 +108,23 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine) if (globalConfigFile.is_open()) bpo::store ( bpo::parse_config_file (globalConfigFile, desc), variables); + bool run = true; + if (variables.count ("help")) { std::cout << desc << std::endl; - return false; + run = false; + } + + if (variables.count ("version")) + { + std::cout << "OpenMW version " << OPENMW_VERSION << std::endl; + run = false; } + if (!run) + return false; + // directory settings if (variables["fs-strict"].as()==true) engine.enableFSStrict();