1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Fixed logic for reconnection attempts to local server. Cleanup.

Added distinct fields in config for local and remote connection.
Removed code for restoring last session since it does not works as
intended and often triggers after crash
This commit is contained in:
Ivan Savenko
2023-12-26 19:27:47 +02:00
parent a3639e77b1
commit 2396c14114
5 changed files with 60 additions and 123 deletions

View File

@@ -568,8 +568,8 @@ CSimpleJoinScreen::CSimpleJoinScreen(bool host)
inputPort->filters += std::bind(&CTextInput::numberFilter, _1, _2, 0, 65535);
inputAddress->giveFocus();
}
inputAddress->setText(host ? CServerHandler::localhostAddress : CSH->getHostAddress(), true);
inputPort->setText(std::to_string(CSH->getHostPort()), true);
inputAddress->setText(host ? CSH->getLocalHostname() : CSH->getRemoteHostname(), true);
inputPort->setText(std::to_string(host ? CSH->getLocalPort() : CSH->getRemotePort()), true);
buttonCancel = std::make_shared<CButton>(Point(142, 142), AnimationPath::builtin("MUBCANC.DEF"), CGI->generaltexth->zelp[561], std::bind(&CSimpleJoinScreen::leaveScreen, this), EShortcut::GLOBAL_CANCEL);
statusBar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(7, 186, 218, 18), 7, 186));
@@ -614,7 +614,7 @@ void CSimpleJoinScreen::startConnection(const std::string & addr, ui16 port)
if(addr.empty())
CSH->startLocalServerAndConnect();
else
CSH->justConnectToServer(addr, port);
CSH->connectToServer(addr, port);
}
CLoadingScreen::CLoadingScreen()