1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-11 11:31:52 +02:00
vcmi/Odpalarka/main.cpp
Michał W. Urbańczyk c8115d41a8 Imposed time limits on AIs.
Simple action validation.
2011-10-11 13:16:28 +00:00

38 lines
987 B
C++

#include "../global.h"
#include <boost/thread.hpp>
#include <boost/bind.hpp>
int main(int argc, const char **argv)
{
std::string runnername =
#ifdef _WIN32
"VCMI_BattleAiHost.exe"
#else
"./vcmirunner"
#endif
;
std::string servername =
#ifdef _WIN32
"VCMI_server.exe"
#else
"./vcmiserver"
#endif
;
std::string serverCommand = servername + " b1.json StupidAI MadAI"; // StupidAI MadAI
boost::thread t(boost::bind(std::system, serverCommand.c_str()));
boost::thread tt(boost::bind(std::system, runnername.c_str()));
boost::thread ttt(boost::bind(std::system, runnername.c_str()));
if(argc == 2)
{
boost::this_thread::sleep(boost::posix_time::millisec(500)); //FIXME
boost::thread tttt(boost::bind(std::system, "VCMI_Client.exe -battle"));
}
else if(argc == 1)
boost::thread tttt(boost::bind(std::system, runnername.c_str()));
//boost::this_thread::sleep(boost::posix_time::seconds(5));
t.join();
return EXIT_SUCCESS;
}