fix reconnect

This commit is contained in:
notify 2023-04-20 21:48:53 +08:00
parent f0212d54cf
commit f488cc4b69
2 changed files with 7 additions and 0 deletions

View File

@ -39,6 +39,10 @@
<source>%1 logged out</source> <source>%1 logged out</source>
<translation> &lt;b>%1&lt;/b> </translation> <translation> &lt;b>%1&lt;/b> </translation>
</message> </message>
<message>
<source>%1 backed</source>
<translation> &lt;b>%1&lt;/b> </translation>
</message>
</context> </context>
<context> <context>

View File

@ -307,7 +307,10 @@ void Server::handleNameAndPassword(ClientSocket *client, const QString &name,
if (player->getState() == Player::Offline) { if (player->getState() == Player::Offline) {
auto room = player->getRoom(); auto room = player->getRoom();
player->setSocket(client); player->setSocket(client);
player->alive = true;
client->disconnect(this); client->disconnect(this);
broadcast("ServerMessage",
tr("%1 backed").arg(player->getScreenName()));
room->pushRequest(QString("%1,reconnect").arg(id)); room->pushRequest(QString("%1,reconnect").arg(id));
return; return;
} else { } else {