]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
For now, ground snd_restart and snd_unloadallsounds if the client is still connected...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 9 Sep 2007 08:15:29 +0000 (08:15 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 9 Sep 2007 08:15:29 +0000 (08:15 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7563 d7cf8633-e32d-0410-b094-e92efae38249

snd_main.c

index 93decebf4f427bb3ea1eb1863b641bb97895fd93..ea880aaa0ea2cf0b215cc64f8e87aba9e798c5db 100644 (file)
@@ -688,6 +688,14 @@ void S_Shutdown(void)
 
 void S_Restart_f(void)
 {
+       // NOTE: we can't free all sounds if we are running a map (this frees sfx_t that are still referenced by precaches)
+       // So, refuse to do this if we are connected.
+       if(cls.state == ca_connected)
+       {
+               Con_Printf("snd_restart would wreak havoc if you do that while connected!\n");
+               return;
+       }
+
        S_Shutdown();
        S_Startup();
 }
@@ -783,6 +791,14 @@ void S_UnloadAllSounds_f (void)
 {
        int i;
 
+       // NOTE: we can't free all sounds if we are running a map (this frees sfx_t that are still referenced by precaches)
+       // So, refuse to do this if we are connected.
+       if(cls.state == ca_connected)
+       {
+               Con_Printf("snd_unloadallsounds would wreak havoc if you do that while connected!\n");
+               return;
+       }
+
        // stop any active sounds
        S_StopAllSounds();