diff --git a/src/newgrf_sound.cpp b/src/newgrf_sound.cpp index c79ca59ffb..356b7dfaf8 100644 --- a/src/newgrf_sound.cpp +++ b/src/newgrf_sound.cpp @@ -156,7 +156,7 @@ bool LoadNewGRFSound(SoundEntry *sound) Debug(grf, 1, "LoadNewGRFSound [{}]: RIFF does not contain any sound data", file.GetSimplifiedFilename()); /* Clear everything that was read */ - MemSetT(sound, 0); + *sound = {}; return false; } diff --git a/src/sound.cpp b/src/sound.cpp index 09b6e13cbc..b0c3ed856e 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -21,7 +21,7 @@ #include "safeguards.h" -static SoundEntry _original_sounds[ORIGINAL_SAMPLE_COUNT]; +static std::array _original_sounds; static void OpenBankFile(const std::string &filename) { @@ -31,12 +31,12 @@ static void OpenBankFile(const std::string &filename) */ static std::unique_ptr original_sound_file; - memset(_original_sounds, 0, sizeof(_original_sounds)); + _original_sounds.fill({}); /* If there is no sound file (nosound set), don't load anything */ if (filename.empty()) return; - original_sound_file.reset(new RandomAccessFile(filename, BASESET_DIR)); + original_sound_file = std::make_unique(filename, BASESET_DIR); size_t pos = original_sound_file->GetPos(); uint count = original_sound_file->ReadDword();