Skip to content

Commit

Permalink
server menu: handle proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Piglit committed Aug 30, 2024
1 parent 47dcb0d commit 50e18c2
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/menus/serverCreationScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,17 +430,7 @@ ServerCampaignScreen::ServerCampaignScreen()
auto filename = scenario_list->getEntryValue(scenario_list->getSelectionIndex());
ScenarioInfo info(filename);

if (info.settings.empty())
{
// Start the selected scenario.
gameGlobalInfo->scenario = info.name;
gameGlobalInfo->startScenario(filename);

// Destroy this screen and move on to control screen
destroy();
new MissionControlScreen(getRenderLayer());
}
else if (info.proxy != "")
if (info.proxy != "")
{
string host_name = info.proxy;
auto host = sp::io::network::Address(host_name);
Expand All @@ -454,13 +444,22 @@ ServerCampaignScreen::ServerCampaignScreen()
new GameServerProxy(host, port, password, listenPort, proxyName);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
new JoinServerScreen(ServerBrowserMenu::SearchSource::Local, sp::io::network::Address("127.0.0.1"), listenPort);
// FIXME: use the correct event
campaign_client->notifyCampaignServer("scenario_start", nlohmann::json {
campaign_client->notifyCampaignServer("scenario_join", nlohmann::json {
{"filename", info.filename.c_str()},
{"name", info.name.c_str()},
});
destroy();
}
else if (info.settings.empty())
{
// Start the selected scenario.
gameGlobalInfo->scenario = info.name;
gameGlobalInfo->startScenario(filename);

// Destroy this screen and move on to control screen
destroy();
new MissionControlScreen(getRenderLayer());
}
else
{
new ServerScenarioOptionsScreen(filename);
Expand Down

0 comments on commit 50e18c2

Please sign in to comment.