Skip to content

Commit

Permalink
Replace lambda with unnamed namespace function
Browse files Browse the repository at this point in the history
This more closely ties the function to the variable it operates on.
  • Loading branch information
DanRStevens committed Mar 3, 2025
1 parent 0cf8c47 commit d21f222
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion NAS2D/Mixer/MixerSDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ namespace

// Global so it can be accessed without capturing `this`
Signal<> musicFinished;


void onMusicFinished()
{
musicFinished();
}
}


Expand Down Expand Up @@ -114,7 +120,7 @@ MixerSDL::MixerSDL(const Options& options)
musicVolume(options.musicVolume);

musicFinished.connect({this, &MixerSDL::onMusicFinished});
Mix_HookMusicFinished([]() { musicFinished(); });
Mix_HookMusicFinished(&::onMusicFinished);
}


Expand Down

0 comments on commit d21f222

Please sign in to comment.