Show error message from stk addons server if failing to join server
Translation is thread-safe now so it no longer needs constructor setup
This commit is contained in:
parent
5348876205
commit
4b9a84eeba
@ -74,7 +74,6 @@ bool ConnectToServer::m_done_intecept = false;
|
|||||||
ConnectToServer::ConnectToServer(std::shared_ptr<Server> server)
|
ConnectToServer::ConnectToServer(std::shared_ptr<Server> server)
|
||||||
: Protocol(PROTOCOL_CONNECTION)
|
: Protocol(PROTOCOL_CONNECTION)
|
||||||
{
|
{
|
||||||
m_quick_play_err_msg = _("No quick play server available.");
|
|
||||||
m_server_address = {};
|
m_server_address = {};
|
||||||
if (server)
|
if (server)
|
||||||
m_server = server;
|
m_server = server;
|
||||||
@ -220,7 +219,7 @@ void ConnectToServer::asynchronousUpdate()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Shutdown STKHost (go back to online menu too)
|
// Shutdown STKHost (go back to online menu too)
|
||||||
STKHost::get()->setErrorMessage(m_quick_play_err_msg);
|
STKHost::get()->setErrorMessage(_("No quick play server available."));
|
||||||
STKHost::get()->requestShutdown();
|
STKHost::get()->requestShutdown();
|
||||||
m_state = EXITING;
|
m_state = EXITING;
|
||||||
return;
|
return;
|
||||||
@ -369,8 +368,14 @@ void ConnectToServer::update(int ticks)
|
|||||||
if (STKHost::get()->getPeerCount() == 0)
|
if (STKHost::get()->getPeerCount() == 0)
|
||||||
{
|
{
|
||||||
// Shutdown STKHost (go back to online menu too)
|
// Shutdown STKHost (go back to online menu too)
|
||||||
STKHost::get()->setErrorMessage(
|
core::stringw err =
|
||||||
_("Cannot connect to server %s.", m_server->getName()));
|
_("Cannot connect to server %s.", m_server->getName());
|
||||||
|
if (!m_error_msg.empty())
|
||||||
|
{
|
||||||
|
err += L"\n";
|
||||||
|
err += m_error_msg;
|
||||||
|
}
|
||||||
|
STKHost::get()->setErrorMessage(err);
|
||||||
STKHost::get()->requestShutdown();
|
STKHost::get()->requestShutdown();
|
||||||
}
|
}
|
||||||
requestTerminate();
|
requestTerminate();
|
||||||
@ -515,9 +520,9 @@ bool ConnectToServer::registerWithSTKServer()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
irr::core::stringc error(request->getInfo().c_str());
|
m_error_msg = request->getInfo();
|
||||||
Log::error("ConnectToServer", "Failed to register client address: %s",
|
Log::error("ConnectToServer", "Failed to register client address: %s",
|
||||||
error.c_str());
|
StringUtils::wideToUtf8(m_error_msg).c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} // registerWithSTKServer
|
} // registerWithSTKServer
|
||||||
|
@ -40,7 +40,7 @@ class ConnectToServer : public Protocol
|
|||||||
private:
|
private:
|
||||||
std::shared_ptr<Server> m_server;
|
std::shared_ptr<Server> m_server;
|
||||||
|
|
||||||
irr::core::stringw m_quick_play_err_msg;
|
irr::core::stringw m_error_msg;
|
||||||
|
|
||||||
/** State for finite state machine. */
|
/** State for finite state machine. */
|
||||||
enum ConnectState : unsigned int
|
enum ConnectState : unsigned int
|
||||||
|
Loading…
Reference in New Issue
Block a user