main.cpp 968 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "../global.h"
  2. #include <boost/thread.hpp>
  3. #include <boost/bind.hpp>
  4. int main(int argc, const char **)
  5. {
  6. std::string runnername =
  7. #ifdef _WIN32
  8. "VCMI_BattleAiHost.exe"
  9. #else
  10. "./vcmirunner"
  11. #endif
  12. ;
  13. std::string servername =
  14. #ifdef _WIN32
  15. "VCMI_server.exe"
  16. #else
  17. "./vcmiserver"
  18. #endif
  19. ;
  20. std::string serverCommand = servername + " b1.json StupidAI StupidAI";
  21. boost::thread t(boost::bind(std::system, serverCommand.c_str()));
  22. boost::thread tt(boost::bind(std::system, runnername.c_str()));
  23. boost::thread ttt(boost::bind(std::system, runnername.c_str()));
  24. if(argc == 2)
  25. {
  26. boost::this_thread::sleep(boost::posix_time::millisec(500)); //FIXME
  27. boost::thread tttt(boost::bind(std::system, "VCMI_Client.exe -battle"));
  28. }
  29. else if(argc == 1)
  30. boost::thread tttt(boost::bind(std::system, runnername.c_str()));
  31. //boost::this_thread::sleep(boost::posix_time::seconds(5));
  32. t.join();
  33. return EXIT_SUCCESS;
  34. }