diff --git a/src/network/core/game_info.cpp b/src/network/core/game_info.cpp index dcba625e12..54150ea357 100644 --- a/src/network/core/game_info.cpp +++ b/src/network/core/game_info.cpp @@ -48,7 +48,7 @@ const char *GetNetworkRevisionString() /* Start by taking a chance on the full revision string. */ network_revision = stredup(_openttd_revision); /* Ensure it's not longer than the packet buffer length. */ - if (strlen(network_revision) >= NETWORK_REVISION_LENGTH) network_revision[NETWORK_REVISION_LENGTH - 1] = '\0'; + if (strlen(network_revision) >= NETWORK_REVISION_LENGTH - 1) network_revision[NETWORK_REVISION_LENGTH - 1] = '\0'; /* Tag names are not mangled further. */ if (_openttd_revision_tagged) { diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 19e4354d06..9bbae56bf0 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -130,7 +130,7 @@ void BaseNetworkContentDownloadStatusWindow::DrawWidget(const Rect &r, int widge StringID str; if (this->downloaded_bytes == this->total_bytes) { str = STR_CONTENT_DOWNLOAD_COMPLETE; - } else if (!StrEmpty(this->name)) { + } else if (!this->name.empty()) { SetDParamStr(0, this->name); SetDParam(1, this->downloaded_files); SetDParam(2, this->total_files); @@ -146,7 +146,7 @@ void BaseNetworkContentDownloadStatusWindow::DrawWidget(const Rect &r, int widge void BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(const ContentInfo *ci, int bytes) { if (ci->id != this->cur_id) { - strecpy(this->name, ci->filename.c_str(), lastof(this->name)); + this->name = ci->filename; this->cur_id = ci->id; this->downloaded_files++; } diff --git a/src/network/network_content_gui.h b/src/network/network_content_gui.h index 4853101bbf..f3049867de 100644 --- a/src/network/network_content_gui.h +++ b/src/network/network_content_gui.h @@ -22,8 +22,8 @@ protected: uint total_files; ///< Number of files to download uint downloaded_files; ///< Number of files downloaded - uint32 cur_id; ///< The current ID of the downloaded file - char name[48]; ///< The current name of the downloaded file + uint32 cur_id; ///< The current ID of the downloaded file + std::string name; ///< The current name of the downloaded file public: /** diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 64c23d333b..c5249eb23e 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -1909,7 +1909,7 @@ private: if (_network_server) this->buttons[line_count].emplace_back(new CompanyButton(SPR_ADMIN, STR_NETWORK_CLIENT_LIST_ADMIN_COMPANY_TOOLTIP, COLOUR_RED, company_id, &NetworkClientListWindow::OnClickCompanyAdmin, company_id == COMPANY_SPECTATOR)); this->buttons[line_count].emplace_back(chat_button); - if (own_ci->client_playas != company_id) this->buttons[line_count].emplace_back(new CompanyButton(SPR_JOIN, STR_NETWORK_CLIENT_LIST_JOIN_TOOLTIP, COLOUR_ORANGE, company_id, &NetworkClientListWindow::OnClickCompanyJoin)); + if (own_ci->client_playas != company_id) this->buttons[line_count].emplace_back(new CompanyButton(SPR_JOIN, STR_NETWORK_CLIENT_LIST_JOIN_TOOLTIP, COLOUR_ORANGE, company_id, &NetworkClientListWindow::OnClickCompanyJoin, company_id != COMPANY_SPECTATOR && Company::Get(company_id)->is_ai)); this->line_count += 1;