mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 03:23:15 +01:00
fix #3158: close network status window doesn't abort
This commit is contained in:
@@ -656,7 +656,9 @@ bool Network::BeginClient(const char* host, unsigned short port)
|
||||
|
||||
char str_resolving[256];
|
||||
format_string(str_resolving, STR_MULTIPLAYER_RESOLVING, NULL);
|
||||
window_network_status_open(str_resolving);
|
||||
window_network_status_open(str_resolving, []() -> void {
|
||||
gNetwork.Close();
|
||||
});
|
||||
|
||||
mode = NETWORK_MODE_CLIENT;
|
||||
|
||||
@@ -846,7 +848,9 @@ void Network::UpdateClient()
|
||||
if (connect(server_connection.socket, (sockaddr *)&(*server_address.ss), (*server_address.ss_len)) == SOCKET_ERROR && (LAST_SOCKET_ERROR() == EINPROGRESS || LAST_SOCKET_ERROR() == EWOULDBLOCK)){
|
||||
char str_connecting[256];
|
||||
format_string(str_connecting, STR_MULTIPLAYER_CONNECTING, NULL);
|
||||
window_network_status_open(str_connecting);
|
||||
window_network_status_open(str_connecting, []() -> void {
|
||||
gNetwork.Close();
|
||||
});
|
||||
server_connect_time = SDL_GetTicks();
|
||||
status = NETWORK_STATUS_CONNECTING;
|
||||
} else {
|
||||
@@ -899,7 +903,9 @@ void Network::UpdateClient()
|
||||
Client_Send_AUTH(gConfigNetwork.player_name, "");
|
||||
char str_authenticating[256];
|
||||
format_string(str_authenticating, STR_MULTIPLAYER_AUTHENTICATING, NULL);
|
||||
window_network_status_open(str_authenticating);
|
||||
window_network_status_open(str_authenticating, []() -> void {
|
||||
gNetwork.Close();
|
||||
});
|
||||
}
|
||||
}
|
||||
}break;
|
||||
@@ -917,7 +923,7 @@ void Network::UpdateClient()
|
||||
format_string(str_disconnected, STR_MULTIPLAYER_DISCONNECTED_NO_REASON, NULL);
|
||||
}
|
||||
|
||||
window_network_status_open(str_disconnected);
|
||||
window_network_status_open(str_disconnected, NULL);
|
||||
}
|
||||
Close();
|
||||
}
|
||||
@@ -928,7 +934,7 @@ void Network::UpdateClient()
|
||||
_desynchronised = true;
|
||||
char str_desync[256];
|
||||
format_string(str_desync, STR_MULTIPLAYER_DESYNC, NULL);
|
||||
window_network_status_open(str_desync);
|
||||
window_network_status_open(str_desync, NULL);
|
||||
if (!gConfigNetwork.stay_connected) {
|
||||
Close();
|
||||
}
|
||||
@@ -1761,7 +1767,9 @@ void Network::Client_Handle_MAP(NetworkConnection& connection, NetworkPacket& pa
|
||||
char str_downloading_map[256];
|
||||
unsigned int downloading_map_args[2] = {(offset + chunksize) / 1000, size / 1000};
|
||||
format_string(str_downloading_map, STR_MULTIPLAYER_DOWNLOADING_MAP, downloading_map_args);
|
||||
window_network_status_open(str_downloading_map);
|
||||
window_network_status_open(str_downloading_map, []() -> void {
|
||||
gNetwork.Close();
|
||||
});
|
||||
memcpy(&chunk_buffer[offset], (void*)packet.Read(chunksize), chunksize);
|
||||
if (offset + chunksize == size) {
|
||||
window_network_status_close();
|
||||
|
||||
Reference in New Issue
Block a user