From d21f222a877a1184c545bb90a26c519b60e13e7c Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Mon, 3 Mar 2025 09:36:20 -0700 Subject: [PATCH] Replace lambda with unnamed namespace function This more closely ties the function to the variable it operates on. --- NAS2D/Mixer/MixerSDL.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/NAS2D/Mixer/MixerSDL.cpp b/NAS2D/Mixer/MixerSDL.cpp index ab7bd6f5..d1280bb7 100644 --- a/NAS2D/Mixer/MixerSDL.cpp +++ b/NAS2D/Mixer/MixerSDL.cpp @@ -53,6 +53,12 @@ namespace // Global so it can be accessed without capturing `this` Signal<> musicFinished; + + + void onMusicFinished() + { + musicFinished(); + } } @@ -114,7 +120,7 @@ MixerSDL::MixerSDL(const Options& options) musicVolume(options.musicVolume); musicFinished.connect({this, &MixerSDL::onMusicFinished}); - Mix_HookMusicFinished([]() { musicFinished(); }); + Mix_HookMusicFinished(&::onMusicFinished); }