commandline option for precise timestamps

This commit is contained in:
gfgtdf 2014-04-26 02:44:01 +02:00
parent 86b68cf8d6
commit 03721d9fe6
3 changed files with 10 additions and 0 deletions

View file

@ -66,6 +66,7 @@ commandline_options::commandline_options ( int argc, char** argv ) :
log(),
load(),
logdomains(),
log_precise_timestamps(false),
multiplayer(false),
multiplayer_ai_config(),
multiplayer_algorithm(),
@ -191,6 +192,7 @@ commandline_options::commandline_options ( int argc, char** argv ) :
("log-warning", po::value<std::string>(), "sets the severity level of the specified log domain(s) to 'warning'. Similar to --log-error.")
("log-info", po::value<std::string>(), "sets the severity level of the specified log domain(s) to 'info'. Similar to --log-error.")
("log-debug", po::value<std::string>(), "sets the severity level of the specified log domain(s) to 'debug'. Similar to --log-error.")
("log-precise", "shows the timestamps in the logfile with more precision")
;
po::options_description multiplayer_opts("Multiplayer options");
@ -316,6 +318,8 @@ commandline_options::commandline_options ( int argc, char** argv ) :
parse_log_domains_(vm["log-debug"].as<std::string>(),3);
if (vm.count("logdomains"))
logdomains = vm["logdomains"].as<std::string>();
if (vm.count("log-precise"))
log_precise_timestamps = true;
if (vm.count("max-fps"))
max_fps = vm["max-fps"].as<int>();
if (vm.count("multiplayer"))

View file

@ -79,6 +79,8 @@ public:
boost::optional<std::string> load;
/// Non-empty if --logdomains was given on the command line. Prints possible logdomains filtered by given string and exits.
boost::optional<std::string> logdomains;
/// True if --log-precise was given on the command line. Shows timestamps in log with more precision.
bool log_precise_timestamps;
/// True if --multiplayer was given on the command line. Goes directly into multiplayer mode.
bool multiplayer;
/// Non-empty if --ai-config was given on the command line. Vector of pairs (side number, value). Dependent on --multiplayer.

View file

@ -27,6 +27,7 @@
#include "gui/widgets/window.hpp"
#include "help.hpp"
#include "loadscreen.hpp"
#include "log.hpp"
#include "playcampaign.hpp"
#include "preferences_display.hpp"
#include "replay.hpp"
@ -355,6 +356,9 @@ static int process_command_args(const commandline_options& cmdline_opts) {
std::cout << game_config::path << "\n";
return 0;
}
if(cmdline_opts.log_precise_timestamps) {
lg::precise_timestamps(true);
}
if(cmdline_opts.rng_seed) {
srand(*cmdline_opts.rng_seed);
}