Skip to content

Commit

Permalink
commandline option for precise timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Apr 27, 2014
1 parent 86b68cf commit 03721d9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/commandline_options.cpp
Expand Up @@ -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(),
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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"))
Expand Down
2 changes: 2 additions & 0 deletions src/commandline_options.hpp
Expand Up @@ -79,6 +79,8 @@ friend std::ostream& operator<<(std::ostream &os, const commandline_options& cmd
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.
Expand Down
4 changes: 4 additions & 0 deletions src/game.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 03721d9

Please sign in to comment.