Fix: Compiler warnings about memsetting non-trivial classes

This commit is contained in:
Charles Pigott 2020-06-27 08:29:40 +01:00
parent f8bbd8dea0
commit d9702c9d20
2 changed files with 2 additions and 2 deletions

View File

@ -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 */

View File

@ -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;
}
}