mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-27 06:04:25 +01:00
Codechange: Use EncodedString for error messages. (#13569)
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "../fileio_func.h"
|
||||
#include "../base_media_base.h"
|
||||
#include "../settings_type.h"
|
||||
#include "../strings_func.h"
|
||||
#include "network_content.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
@@ -496,7 +497,10 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(Packet &p)
|
||||
size_t toRead = p.RemainingBytesToTransfer();
|
||||
if (toRead != 0 && static_cast<size_t>(p.TransferOut(TransferOutFWrite, std::ref(this->curFile))) != toRead) {
|
||||
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);
|
||||
ShowErrorMessage(
|
||||
GetEncodedString(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD),
|
||||
GetEncodedString(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE),
|
||||
WL_ERROR);
|
||||
this->CloseConnection();
|
||||
this->curFile.reset();
|
||||
|
||||
@@ -529,7 +533,10 @@ bool ClientNetworkContentSocketHandler::BeforeDownload()
|
||||
if (filename.empty() || !(this->curFile = FileHandle::Open(filename, "wb")).has_value()) {
|
||||
/* Unless that fails of course... */
|
||||
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);
|
||||
ShowErrorMessage(
|
||||
GetEncodedString(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD),
|
||||
GetEncodedString(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE),
|
||||
WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -568,7 +575,7 @@ void ClientNetworkContentSocketHandler::AfterDownload()
|
||||
|
||||
this->OnDownloadComplete(this->curInfo->id);
|
||||
} else {
|
||||
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_EXTRACT, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(GetEncodedString(STR_CONTENT_ERROR_COULD_NOT_EXTRACT), {}, WL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user