77#include " QuickStartGame.h"
88#include " RTTR_Version.h"
99#include " RttrConfig.h"
10+ #include " ai/random.h"
1011#include " files.h"
1112#include " random/Random.h"
1213#include " s25util/System.h"
@@ -30,6 +31,7 @@ int main(int argc, char** argv)
3031 boost::optional<std::string> replay_path;
3132 boost::optional<std::string> savegame_path;
3233 unsigned random_init = static_cast <unsigned >(std::chrono::high_resolution_clock::now ().time_since_epoch ().count ());
34+ unsigned random_ai_init = random_init;
3335
3436 po::options_description desc (" Allowed options" );
3537 // clang-format off
@@ -41,6 +43,7 @@ int main(int argc, char** argv)
4143 (" replay" , po::value (&replay_path)," Filename to write replay to (optional)" )
4244 (" save" , po::value (&savegame_path)," Filename to write savegame to (optional)" )
4345 (" random_init" , po::value (&random_init)," Seed value for the random number generator (optional)" )
46+ (" random_ai_init" , po::value (&random_ai_init)," Seed value for the AI random number generator (optional)" )
4447 (" maxGF" , po::value<unsigned >()->default_value (std::numeric_limits<unsigned >::max ())," Maximum number of game frames to run (optional)" )
4548 (" version" , " Show version information and exit" )
4649 ;
@@ -85,10 +88,12 @@ int main(int argc, char** argv)
8588 bnw::cout << argv[i] << " " ;
8689 bnw::cout << std::endl;
8790 bnw::cout << " random_init: " << random_init << std::endl;
91+ bnw::cout << " random_ai_init: " << random_ai_init << std::endl;
8892 bnw::cout << std::endl;
8993
9094 RTTRCONFIG .Init ();
9195 RANDOM .Init (random_init);
96+ AI::getRandomGenerator ().seed (random_ai_init);
9297
9398 const bfs::path mapPath = RTTRCONFIG .ExpandPath (options[" map" ].as <std::string>());
9499 const std::vector<AI ::Info> ais = ParseAIOptions (options[" ai" ].as <std::vector<std::string>>());
0 commit comments