summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorglx22 <glx@openttd.org>2021-05-17 15:46:38 +0200
committerLoïc Guilloux <glx22@users.noreply.github.com>2021-05-29 21:08:25 +0200
commit5799402f7a4872d03809838dd7fa01db42bbd282 (patch)
tree6b54e235c14621035b4ec7923edb93980be5f056 /src/network
parent994bf19aef3dde6c9482434bdc51688f76a937ea (diff)
downloadopenttd-5799402f7a4872d03809838dd7fa01db42bbd282.tar.xz
Codechange: Rename window related DeleteXXX to match new behaviour
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network.cpp4
-rw-r--r--src/network/network_chat_gui.cpp2
-rw-r--r--src/network/network_client.cpp10
-rw-r--r--src/network/network_content.cpp4
-rw-r--r--src/network/network_content_gui.cpp6
-rw-r--r--src/network/network_gui.cpp18
6 files changed, 22 insertions, 22 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 2bc358944..d89789cf9 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -668,7 +668,7 @@ public:
void OnFailure() override
{
- DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
+ CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
ShowErrorMessage(STR_NETWORK_ERROR_NOCONNECTION, INVALID_STRING_ID, WL_ERROR);
}
@@ -988,7 +988,7 @@ void NetworkDisconnect(bool blocking, bool close_admins)
if (_settings_client.network.server_advertise) NetworkUDPRemoveAdvertise(blocking);
- DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
+ CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
NetworkClose(close_admins);
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 53546aa87..b42f0c562 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -533,6 +533,6 @@ static WindowDesc _chat_window_desc(
*/
void ShowNetworkChatQueryWindow(DestType type, int dest)
{
- DeleteWindowByClass(WC_SEND_NETWORK_MSG);
+ CloseWindowByClass(WC_SEND_NETWORK_MSG);
new NetworkChatWindow(&_chat_window_desc, type, dest);
}
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 44359941a..161bbf412 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -204,7 +204,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
this->CloseConnection(res);
_networking = false;
- DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
+ CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
return;
}
@@ -560,7 +560,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p)
{
/* We try to join a server which is full */
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_FULL, INVALID_STRING_ID, WL_CRITICAL);
- DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
+ CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
return NETWORK_RECV_STATUS_SERVER_FULL;
}
@@ -569,7 +569,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *
{
/* We try to join a server where we are banned */
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_BANNED, INVALID_STRING_ID, WL_CRITICAL);
- DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
+ CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
return NETWORK_RECV_STATUS_SERVER_BANNED;
}
@@ -754,7 +754,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_ERROR(Packet *p
/* Perform an emergency save if we had already entered the game */
if (this->status == STATUS_ACTIVE) ClientNetworkEmergencySave();
- DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
+ CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
return NETWORK_RECV_STATUS_SERVER_ERROR;
}
@@ -924,7 +924,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet
this->last_packet = std::chrono::steady_clock::now();
if (!load_success) {
- DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
+ CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
ShowErrorMessage(STR_NETWORK_ERROR_SAVEGAMEERROR, INVALID_STRING_ID, WL_CRITICAL);
return NETWORK_RECV_STATUS_SAVEGAME;
}
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp
index e09b05ec7..f78a839b8 100644
--- a/src/network/network_content.cpp
+++ b/src/network/network_content.cpp
@@ -495,7 +495,7 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(Packet *p)
/* We have a file opened, thus are downloading internal content */
size_t toRead = p->RemainingBytesToTransfer();
if (toRead != 0 && (size_t)p->TransferOut(TransferOutFWrite, this->curFile) != toRead) {
- DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
+ CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR);
this->CloseConnection();
fclose(this->curFile);
@@ -529,7 +529,7 @@ bool ClientNetworkContentSocketHandler::BeforeDownload()
std::string filename = GetFullFilename(this->curInfo, true);
if (filename.empty() || (this->curFile = fopen(filename.c_str(), "wb")) == nullptr) {
/* Unless that fails of course... */
- DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
+ CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR);
return false;
}
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 8c75cb572..a74d902a3 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -74,7 +74,7 @@ struct ContentTextfileWindow : public TextfileWindow {
void ShowContentTextfileWindow(TextfileType file_type, const ContentInfo *ci)
{
- DeleteWindowById(WC_TEXTFILE, file_type);
+ CloseWindowById(WC_TEXTFILE, file_type);
new ContentTextfileWindow(file_type, ci);
}
@@ -267,7 +267,7 @@ public:
} else {
/* If downloading succeeded, close the online content window. This will close
* the current window as well. */
- DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
+ CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
}
}
}
@@ -1130,7 +1130,7 @@ void ShowNetworkContentListWindow(ContentVector *cv, ContentType type1, ContentT
_network_content_client.RequestContentList(cv, true);
}
- DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
+ CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
new NetworkContentListWindow(&_network_content_list_desc, cv != nullptr, types);
#else
ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, WL_ERROR);
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 7f179a05f..bd91cc25a 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -677,7 +677,7 @@ public:
{
switch (widget) {
case WID_NG_CANCEL: // Cancel button
- DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
+ CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
break;
case WID_NG_NAME: // Sort by name
@@ -966,8 +966,8 @@ static WindowDesc _network_game_window_desc(
void ShowNetworkGameWindow()
{
static bool first = true;
- DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
- DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
+ CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
+ CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
/* Only show once */
if (first) {
@@ -1265,8 +1265,8 @@ static void ShowNetworkStartServerWindow()
{
if (!NetworkValidateClientName()) return;
- DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
- DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
+ CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
+ CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
new NetworkStartServerWindow(&_network_start_server_window_desc);
}
@@ -1559,8 +1559,8 @@ static void ShowNetworkLobbyWindow(NetworkGameList *ngl)
{
if (!NetworkValidateClientName()) return;
- DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
- DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
+ CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
+ CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
_settings_client.network.last_joined = ngl->connection_string;
@@ -2519,7 +2519,7 @@ static WindowDesc _network_join_status_window_desc(
void ShowJoinStatusWindow()
{
- DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
+ CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
new NetworkJoinStatusWindow(&_network_join_status_window_desc);
}
@@ -2642,7 +2642,7 @@ static WindowDesc _network_company_password_window_desc(
void ShowNetworkCompanyPasswordWindow(Window *parent)
{
- DeleteWindowById(WC_COMPANY_PASSWORD_WINDOW, 0);
+ CloseWindowById(WC_COMPANY_PASSWORD_WINDOW, 0);
new NetworkCompanyPasswordWindow(&_network_company_password_window_desc, parent);
}