Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions game_engine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ int main(int argc, char *argv[]) {
constants.DEFAULT_MAP_HEIGHT,
"positive integer", cmd);
ValueArg<unsigned int> seed_arg("s", "seed", "The seed for the map generator.", false, 0, "positive integer", cmd);
ValueArg<unsigned int> timeout_arg("", "timeout", "Bot timeouts in milliseconds.", false, 2000, "positive integer", cmd);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like 2000 to be in a single place as magic constant. Right now it's also in

std::chrono::milliseconds timeout = 2000ms; /**< The networking timeout duration. */

How about creating constexpr in NetworkingConfig.hpp with 2000 and refer to that here and in the NetworkingConfig struct instead?

ValueArg<unsigned long> turn_limit_arg("", "turn-limit", "The maximum number of turns to play.",
false, 0, "positive integer", cmd);
ValueArg<std::string> replay_arg("i", "replay-directory", "The path to directory for replay output.", false, ".",
Expand Down Expand Up @@ -138,6 +139,7 @@ int main(int argc, char *argv[]) {

net::NetworkingConfig networking_config{};
networking_config.ignore_timeout = timeout_switch.getValue();
networking_config.timeout = std::chrono::milliseconds(timeout_arg.getValue());

hlt::Map map(map_parameters.width, map_parameters.height);
hlt::mapgen::Generator::generate(map, map_parameters);
Expand Down