Rename close window functions to match upstream
This commit is contained in:
@@ -112,7 +112,7 @@ NetworkRecvStatus NetworkGameSocketHandler::CloseConnection(bool error)
|
||||
/* Clients drop back to the main menu */
|
||||
if (!_network_server && _networking) {
|
||||
ClientNetworkEmergencySave();
|
||||
DeleteNetworkClientWindows();
|
||||
CloseNetworkClientWindows();
|
||||
_switch_mode = SM_MENU;
|
||||
_networking = false;
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_LOSTCONNECTION, INVALID_STRING_ID, WL_CRITICAL);
|
||||
|
||||
@@ -1035,7 +1035,7 @@ void NetworkDisconnect(bool blocking, bool close_admins)
|
||||
}
|
||||
}
|
||||
|
||||
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
|
||||
|
||||
NetworkClose(close_admins);
|
||||
|
||||
|
||||
@@ -532,6 +532,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);
|
||||
}
|
||||
|
||||
@@ -237,7 +237,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;
|
||||
}
|
||||
|
||||
@@ -267,8 +267,8 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
|
||||
ClientNetworkEmergencySave();
|
||||
}
|
||||
|
||||
DeleteNetworkClientWindows();
|
||||
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
|
||||
CloseNetworkClientWindows();
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
|
||||
|
||||
if (_game_mode != GM_MENU) _switch_mode = SM_MENU;
|
||||
_networking = false;
|
||||
@@ -1395,7 +1395,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_SETTINGS_ACCESS
|
||||
|
||||
_network_settings_access = p->Recv_bool();
|
||||
|
||||
DeleteWindowById(WC_CHEATS, 0);
|
||||
CloseWindowById(WC_CHEATS, 0);
|
||||
ReInitAllWindows(false);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
|
||||
@@ -502,7 +502,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);
|
||||
@@ -536,7 +536,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;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,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);
|
||||
}
|
||||
|
||||
@@ -293,7 +293,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1142,7 +1142,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);
|
||||
|
||||
@@ -648,7 +648,7 @@ void ClientNetworkCoordinatorSocketHandler::CloseStunHandler(const std::string &
|
||||
*/
|
||||
void ClientNetworkCoordinatorSocketHandler::CloseTurnHandler(const std::string &token)
|
||||
{
|
||||
DeleteWindowByClass(WC_NETWORK_ASK_RELAY);
|
||||
CloseWindowByClass(WC_NETWORK_ASK_RELAY);
|
||||
|
||||
auto turn_it = this->turn_handlers.find(token);
|
||||
if (turn_it == this->turn_handlers.end()) return;
|
||||
|
||||
@@ -744,7 +744,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
|
||||
@@ -1035,7 +1035,7 @@ static WindowDesc _network_game_window_desc(
|
||||
void ShowNetworkGameWindow()
|
||||
{
|
||||
static bool first = true;
|
||||
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
|
||||
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
|
||||
|
||||
/* Only show once */
|
||||
if (first) {
|
||||
@@ -1309,7 +1309,7 @@ static void ShowNetworkStartServerWindow()
|
||||
{
|
||||
if (!NetworkValidateOurClientName()) return;
|
||||
|
||||
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
||||
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
||||
|
||||
new NetworkStartServerWindow(&_network_start_server_window_desc);
|
||||
}
|
||||
@@ -2301,7 +2301,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);
|
||||
}
|
||||
|
||||
@@ -2423,7 +2423,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);
|
||||
}
|
||||
@@ -2532,7 +2532,7 @@ static WindowDesc _network_ask_relay_desc(
|
||||
*/
|
||||
void ShowNetworkAskRelay(const std::string &server_connection_string, const std::string &relay_connection_string, const std::string &token)
|
||||
{
|
||||
DeleteWindowByClass(WC_NETWORK_ASK_RELAY);
|
||||
CloseWindowByClass(WC_NETWORK_ASK_RELAY);
|
||||
|
||||
Window *parent = GetMainWindow();
|
||||
new NetworkAskRelayWindow(&_network_ask_relay_desc, parent, server_connection_string, relay_connection_string, token);
|
||||
|
||||
Reference in New Issue
Block a user