summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-05-30 12:41:45 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-06-10 20:09:44 +0200
commitdfb89f3891ec73b4d5a6f46092ad825dabec6bb7 (patch)
tree60a3d770ef11c85241d6e111249581ad52dc5a2a /src/network/core
parent6bb3f034e4788b67c7c3b4c8cf4a5de44c8644d0 (diff)
downloadopenttd-dfb89f3891ec73b4d5a6f46092ad825dabec6bb7.tar.xz
Codechange: [ContentInfo] Do not use memset/memcpy to make it possible to use vector/string
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/tcp_content.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/network/core/tcp_content.cpp b/src/network/core/tcp_content.cpp
index abeb3d925..ddea9fd5e 100644
--- a/src/network/core/tcp_content.cpp
+++ b/src/network/core/tcp_content.cpp
@@ -22,8 +22,11 @@
/** Clear everything in the struct */
ContentInfo::ContentInfo()
+ : /* Temporary... will be removed later in the PR. */
+ type((ContentType)0), id((ContentID)0), filesize(0), filename(""), name(""), version(""),
+ url(""), description(""), unique_id(0), md5sum(""), dependency_count(0), dependencies(nullptr),
+ tag_count(0), tags(nullptr), state((State)0), upgrade(false)
{
- memset(this, 0, sizeof(*this));
}
/** Free everything allocated */
@@ -42,7 +45,7 @@ void ContentInfo::TransferFrom(ContentInfo *other)
if (other != this) {
free(this->dependencies);
free(this->tags);
- memcpy(this, other, sizeof(ContentInfo));
+ *this = *other;
other->dependencies = nullptr;
other->tags = nullptr;
}