|
@@ -114,8 +114,8 @@ public:
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-std::string SERVER_NAME_AFFIX = "server";
|
|
|
|
-std::string SERVER_NAME = GameConstants::VCMI_VERSION + std::string(" (") + SERVER_NAME_AFFIX + ')';
|
|
|
|
|
|
+std::string NAME_AFFIX = "server";
|
|
|
|
+std::string NAME = GameConstants::VCMI_VERSION + std::string(" (") + NAME_AFFIX + ')';
|
|
|
|
|
|
CVCMIServer::CVCMIServer(boost::program_options::variables_map & opts)
|
|
CVCMIServer::CVCMIServer(boost::program_options::variables_map & opts)
|
|
: port(3030), io(std::make_shared<boost::asio::io_service>()), state(EServerState::LOBBY), cmdLineOptions(opts), currentClientId(1), currentPlayerId(1), restartGameplay(false)
|
|
: port(3030), io(std::make_shared<boost::asio::io_service>()), state(EServerState::LOBBY), cmdLineOptions(opts), currentClientId(1), currentPlayerId(1), restartGameplay(false)
|
|
@@ -293,7 +293,7 @@ void CVCMIServer::connectionAccepted(const boost::system::error_code & ec)
|
|
try
|
|
try
|
|
{
|
|
{
|
|
logNetwork->info("We got a new connection! :)");
|
|
logNetwork->info("We got a new connection! :)");
|
|
- auto c = std::make_shared<CConnection>(upcomingConnection, SERVER_NAME, uuid);
|
|
|
|
|
|
+ auto c = std::make_shared<CConnection>(upcomingConnection, NAME, uuid);
|
|
upcomingConnection.reset();
|
|
upcomingConnection.reset();
|
|
connections.insert(c);
|
|
connections.insert(c);
|
|
c->handler = std::make_shared<boost::thread>(&CVCMIServer::threadHandleClient, this, c);
|
|
c->handler = std::make_shared<boost::thread>(&CVCMIServer::threadHandleClient, this, c);
|
|
@@ -920,14 +920,9 @@ int main(int argc, char * argv[])
|
|
console = new CConsoleHandler();
|
|
console = new CConsoleHandler();
|
|
CBasicLogConfigurator logConfig(VCMIDirs::get().userLogsPath() / "VCMI_Server_log.txt", console);
|
|
CBasicLogConfigurator logConfig(VCMIDirs::get().userLogsPath() / "VCMI_Server_log.txt", console);
|
|
logConfig.configureDefault();
|
|
logConfig.configureDefault();
|
|
- logGlobal->info(SERVER_NAME);
|
|
|
|
|
|
+ logGlobal->info(NAME);
|
|
|
|
|
|
- boost::program_options::variables_map opts;
|
|
|
|
-#ifdef VCMI_IOS
|
|
|
|
- argc = 1;
|
|
|
|
- boost::condition_variable * cond = reinterpret_cast<boost::condition_variable *>(argv[1]);
|
|
|
|
- cond->notify_one();
|
|
|
|
-#else
|
|
|
|
|
|
+ boost::program_options::variables_map opts;
|
|
handleCommandOptions(argc, argv, opts);
|
|
handleCommandOptions(argc, argv, opts);
|
|
preinitDLL(console);
|
|
preinitDLL(console);
|
|
settings.init();
|
|
settings.init();
|
|
@@ -935,7 +930,6 @@ int main(int argc, char * argv[])
|
|
|
|
|
|
loadDLLClasses();
|
|
loadDLLClasses();
|
|
srand((ui32)time(nullptr));
|
|
srand((ui32)time(nullptr));
|
|
-#endif
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
boost::asio::io_service io_service;
|
|
boost::asio::io_service io_service;
|
|
@@ -975,17 +969,10 @@ int main(int argc, char * argv[])
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-#ifdef VCMI_ANDROID
|
|
|
|
|
|
+#if defined(VCMI_ANDROID) || defined(VCMI_IOS)
|
|
void CVCMIServer::create()
|
|
void CVCMIServer::create()
|
|
{
|
|
{
|
|
const char * foo[1] = {"android-server"};
|
|
const char * foo[1] = {"android-server"};
|
|
main(1, const_cast<char **>(foo));
|
|
main(1, const_cast<char **>(foo));
|
|
}
|
|
}
|
|
-#elif defined(VCMI_IOS)
|
|
|
|
-void CVCMIServer::create(boost::condition_variable * cond)
|
|
|
|
-{
|
|
|
|
- const auto executablePath = VCMIDirs::get().serverPath();
|
|
|
|
- void *argv[] = {const_cast<char *>(executablePath.c_str()), cond};
|
|
|
|
- main(2, reinterpret_cast<char **>(argv));
|
|
|
|
-}
|
|
|
|
#endif
|
|
#endif
|