From 4552277c4ea9df208eb8c991ba7b15099ef78db4 Mon Sep 17 00:00:00 2001 From: Rafael Barreto Date: Thu, 21 Oct 2010 12:57:52 +0000 Subject: [PATCH] avoiding message spam with unregistered sounds git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5782 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/soundlocation.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/src/soundlocation.cpp b/source/src/soundlocation.cpp index 954220d7..691b2561 100644 --- a/source/src/soundlocation.cpp +++ b/source/src/soundlocation.cpp @@ -5,17 +5,18 @@ #define DEBUGCOND (audiodebug==1) VARP(gainscale, 1, 90, 100); - +bool warn_about_unregistered_sound = true; location::location(int sound, const worldobjreference &r, int priority) : cfg(NULL), src(NULL), ref(NULL), stale(false), playmillis(0) { vector &sounds = (r.type==worldobjreference::WR_ENTITY ? mapsounds : gamesounds); if(!sounds.inrange(sound)) { - conoutf("unregistered sound: %d", sound); + if (warn_about_unregistered_sound) conoutf("you have at least one unregistered sound: %d", sound); + warn_about_unregistered_sound = false; // warn just once... how people are able to have this issue?! stale = true; return; } - + // get sound config cfg = &sounds[sound]; cfg->onattach();