]> granicus.if.org Git - nethack/commitdiff
add a sounds.c comment in two places
authornhmall <nhmall@nethack.org>
Wed, 25 Jan 2023 20:14:27 +0000 (15:14 -0500)
committernhmall <nhmall@nethack.org>
Wed, 25 Jan 2023 20:14:27 +0000 (15:14 -0500)
src/sounds.c

index e6845f267be8dc018841ae24230b2bb1966311d5..2c68a78f8c29b1e1c10124f7ce6836fdec2f3909 100644 (file)
@@ -1556,6 +1556,10 @@ play_sound_for_message(const char* msg)
 {
     audio_mapping *snd;
 
+    /* we do this check here first, in order to completely
+     * avoid doing the regex search when there won't be a
+     * sound anyway, despite a match.
+     */
     if (soundprocs.sound_play_usersound) {
         snd = sound_matches_message(msg);
         if (snd) {
@@ -1569,6 +1573,10 @@ maybe_play_sound(const char* msg)
 {
     audio_mapping *snd;
 
+    /* we do this check here first, in order to completely
+     * avoid doing the regex search when there won't be a
+     * sound anyway, despite a match.
+     */
     if (soundprocs.sound_play_usersound) {
         snd = sound_matches_message(msg);
         if (snd) {