summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2020-06-27 08:29:40 +0100
committerCharles Pigott <charlespigott@googlemail.com>2020-06-27 14:51:14 +0100
commit224acb78b03defd075aafec9d3340b3bc0dcedfc (patch)
tree96d9fd595086226541b8e38b18a414a25dd9b648 /src
parent8a655c7fb6375ad47b951b5011657dfa31cc76a6 (diff)
downloadopenttd-224acb78b03defd075aafec9d3340b3bc0dcedfc.tar.xz
Fix: Compiler warnings about memsetting non-trivial classes
Diffstat (limited to 'src')
-rw-r--r--src/cargotype.cpp2
-rw-r--r--src/network/network_gui.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/cargotype.cpp b/src/cargotype.cpp
index 52dd196c8..8421c482e 100644
--- a/src/cargotype.cpp
+++ b/src/cargotype.cpp
@@ -42,8 +42,8 @@ void SetupCargoForClimate(LandscapeID l)
assert(l < lengthof(_default_climate_cargo));
/* Reset and disable all cargo types */
- memset(CargoSpec::array, 0, sizeof(CargoSpec::array));
for (CargoID i = 0; i < lengthof(CargoSpec::array); i++) {
+ *CargoSpec::Get(i) = {};
CargoSpec::Get(i)->bitnum = INVALID_CARGO;
/* Set defaults for newer properties, which old GRFs do not know */
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index ab72d9521..c430c47e5 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1580,7 +1580,7 @@ struct NetworkLobbyWindow : public Window {
NetworkTCPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // company info
NetworkUDPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // general data
/* Clear the information so removed companies don't remain */
- memset(this->company_info, 0, sizeof(this->company_info));
+ for (auto &company : this->company_info) company = {};
break;
}
}