Use special message for kicking high ping and starting game
This commit is contained in:
parent
157dc89cd2
commit
398b173eec
@ -91,8 +91,8 @@ ClientLobby::ClientLobby(const TransportAddress& a, std::shared_ptr<Server> s)
|
||||
m_disconnected_msg[PDI_TIMEOUT] = _("Server connection timed out.");
|
||||
m_disconnected_msg[PDI_NORMAL] = _("Server has been shut down.");
|
||||
m_disconnected_msg[PDI_KICK] = _("You were kicked from the server.");
|
||||
m_disconnected_msg[PDI_BAD_CONNECTION] =
|
||||
_("Bad network connection is detected.");
|
||||
m_disconnected_msg[PDI_KICK_HIGH_PING] =
|
||||
_("You were kicked: Ping too high.");
|
||||
m_first_connect = true;
|
||||
m_spectator = false;
|
||||
m_server_live_joinable = false;
|
||||
@ -906,16 +906,16 @@ void ClientLobby::startGame(Event* event)
|
||||
assert(nim);
|
||||
nim->restoreCompleteState(event->data());
|
||||
|
||||
core::stringw err_msg = _("Failed to start the network game.");
|
||||
joinStartGameThread();
|
||||
m_start_game_thread = std::thread([start_time, this]()
|
||||
m_start_game_thread = std::thread([start_time, this, err_msg]()
|
||||
{
|
||||
const uint64_t cur_time = STKHost::get()->getNetworkTimer();
|
||||
if (!(start_time > cur_time))
|
||||
{
|
||||
Log::warn("ClientLobby", "Network timer is too slow to catch "
|
||||
Log::error("ClientLobby", "Network timer is too slow to catch "
|
||||
"up, you must have a poor network.");
|
||||
STKHost::get()->setErrorMessage(
|
||||
m_disconnected_msg.at(PDI_BAD_CONNECTION));
|
||||
STKHost::get()->setErrorMessage(err_msg);
|
||||
STKHost::get()->requestShutdown();
|
||||
return;
|
||||
}
|
||||
|
@ -794,7 +794,7 @@ void STKHost::mainLoop()
|
||||
p.second->setDisconnected(true);
|
||||
std::lock_guard<std::mutex> lock(m_enet_cmd_mutex);
|
||||
m_enet_cmd.emplace_back(p.second->getENetPeer(),
|
||||
(ENetPacket*)NULL, PDI_BAD_CONNECTION,
|
||||
(ENetPacket*)NULL, PDI_KICK_HIGH_PING,
|
||||
ECT_DISCONNECT);
|
||||
}
|
||||
else if (!p.second->hasWarnedForHighPing())
|
||||
|
@ -49,7 +49,7 @@ enum PeerDisconnectInfo : unsigned int
|
||||
PDI_TIMEOUT = 0, //!< Timeout disconnected (default in enet).
|
||||
PDI_NORMAL = 1, //!< Normal disconnction with acknowledgement
|
||||
PDI_KICK = 2, //!< Kick disconnection
|
||||
PDI_BAD_CONNECTION = 3, //!< Bad connection disconnection
|
||||
PDI_KICK_HIGH_PING = 3, //!< Too high ping, kicked by server
|
||||
}; // PeerDisconnectInfo
|
||||
|
||||
/*! \class STKPeer
|
||||
|
Loading…
Reference in New Issue
Block a user