|
@@ -208,6 +208,8 @@ int main(int argc, char * argv[])
|
|
|
("lobby-host", "if this client hosts session")
|
|
("lobby-host", "if this client hosts session")
|
|
|
("lobby-uuid", po::value<std::string>(), "uuid to the server")
|
|
("lobby-uuid", po::value<std::string>(), "uuid to the server")
|
|
|
("lobby-connections", po::value<ui16>(), "connections of server")
|
|
("lobby-connections", po::value<ui16>(), "connections of server")
|
|
|
|
|
+ ("lobby-username", po::value<std::string>(), "player name")
|
|
|
|
|
+ ("lobby-gamemode", po::value<bool>(), "use 0 for new game and 1 for load game")
|
|
|
("uuid", po::value<std::string>(), "uuid for the client");
|
|
("uuid", po::value<std::string>(), "uuid for the client");
|
|
|
|
|
|
|
|
if(argc > 1)
|
|
if(argc > 1)
|
|
@@ -489,13 +491,41 @@ int main(int argc, char * argv[])
|
|
|
session["autoSkip"].Bool() = vm.count("autoSkip");
|
|
session["autoSkip"].Bool() = vm.count("autoSkip");
|
|
|
session["oneGoodAI"].Bool() = vm.count("oneGoodAI");
|
|
session["oneGoodAI"].Bool() = vm.count("oneGoodAI");
|
|
|
session["aiSolo"].Bool() = false;
|
|
session["aiSolo"].Bool() = false;
|
|
|
|
|
+ std::shared_ptr<CMainMenu> mmenu;
|
|
|
|
|
|
|
|
|
|
+ if(vm.count("testmap"))
|
|
|
|
|
+ {
|
|
|
|
|
+ session["testmap"].String() = vm["testmap"].as<std::string>();
|
|
|
|
|
+ session["onlyai"].Bool() = true;
|
|
|
|
|
+ boost::thread(&CServerHandler::debugStartTest, CSH, session["testmap"].String(), false);
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(vm.count("testsave"))
|
|
|
|
|
+ {
|
|
|
|
|
+ session["testsave"].String() = vm["testsave"].as<std::string>();
|
|
|
|
|
+ session["onlyai"].Bool() = true;
|
|
|
|
|
+ boost::thread(&CServerHandler::debugStartTest, CSH, session["testsave"].String(), true);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ mmenu = CMainMenu::create();
|
|
|
|
|
+ GH.curInt = mmenu.get();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ std::vector<std::string> names;
|
|
|
session["lobby"].Bool() = false;
|
|
session["lobby"].Bool() = false;
|
|
|
if(vm.count("lobby"))
|
|
if(vm.count("lobby"))
|
|
|
{
|
|
{
|
|
|
session["lobby"].Bool() = true;
|
|
session["lobby"].Bool() = true;
|
|
|
session["host"].Bool() = false;
|
|
session["host"].Bool() = false;
|
|
|
session["address"].String() = vm["lobby-address"].as<std::string>();
|
|
session["address"].String() = vm["lobby-address"].as<std::string>();
|
|
|
|
|
+ if(vm.count("lobby-username"))
|
|
|
|
|
+ session["username"].String() = vm["lobby-username"].as<std::string>();
|
|
|
|
|
+ else
|
|
|
|
|
+ session["username"].String() = settings["launcher"]["lobbyUsername"].String();
|
|
|
|
|
+ if(vm.count("lobby-gamemode"))
|
|
|
|
|
+ session["gamemode"].Integer() = vm["lobby-gamemode"].as<ui16>();
|
|
|
|
|
+ else
|
|
|
|
|
+ session["gamemode"].Integer() = 0;
|
|
|
CSH->uuid = vm["uuid"].as<std::string>();
|
|
CSH->uuid = vm["uuid"].as<std::string>();
|
|
|
session["port"].Integer() = vm["lobby-port"].as<ui16>();
|
|
session["port"].Integer() = vm["lobby-port"].as<ui16>();
|
|
|
logGlobal->info("Remote lobby mode at %s:%d, uuid is %s", session["address"].String(), session["port"].Integer(), CSH->uuid);
|
|
logGlobal->info("Remote lobby mode at %s:%d, uuid is %s", session["address"].String(), session["port"].Integer(), CSH->uuid);
|
|
@@ -510,23 +540,11 @@ int main(int argc, char * argv[])
|
|
|
//we should not reconnect to previous game in online mode
|
|
//we should not reconnect to previous game in online mode
|
|
|
Settings saveSession = settings.write["server"]["reconnect"];
|
|
Settings saveSession = settings.write["server"]["reconnect"];
|
|
|
saveSession->Bool() = false;
|
|
saveSession->Bool() = false;
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(vm.count("testmap"))
|
|
|
|
|
- {
|
|
|
|
|
- session["testmap"].String() = vm["testmap"].as<std::string>();
|
|
|
|
|
- session["onlyai"].Bool() = true;
|
|
|
|
|
- boost::thread(&CServerHandler::debugStartTest, CSH, session["testmap"].String(), false);
|
|
|
|
|
- }
|
|
|
|
|
- else if(vm.count("testsave"))
|
|
|
|
|
- {
|
|
|
|
|
- session["testsave"].String() = vm["testsave"].as<std::string>();
|
|
|
|
|
- session["onlyai"].Bool() = true;
|
|
|
|
|
- boost::thread(&CServerHandler::debugStartTest, CSH, session["testsave"].String(), true);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- GH.curInt = CMainMenu::create().get();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //start lobby immediately
|
|
|
|
|
+ names.push_back(session["username"].String());
|
|
|
|
|
+ ESelectionScreen sscreen = session["gamemode"].Integer() == 0 ? ESelectionScreen::newGame : ESelectionScreen::loadGame;
|
|
|
|
|
+ mmenu->openLobby(sscreen, session["host"].Bool(), &names, ELoadMode::MULTI);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Restore remote session - start game immediately
|
|
// Restore remote session - start game immediately
|