summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2007-09-17 00:32:29 +0000
committerAndrey Nazarov <skuller@skuller.net>2007-09-17 00:32:29 +0000
commit480fa3d3bd4e50b253c9e3d66e550090f92bf44d (patch)
treebf899fbf85f43222bb1cf04e42f20f26941e23bb
parent74e2433dab4deea1760cc72848114f4365349796 (diff)
Do not spam MVD_GameShutdown each time SV_Shutdown is called.
-rw-r--r--source/mvd_client.c21
-rw-r--r--source/mvd_game.c20
-rw-r--r--source/mvd_local.h2
-rw-r--r--source/sv_main.c2
4 files changed, 25 insertions, 20 deletions
diff --git a/source/mvd_client.c b/source/mvd_client.c
index 964a511..ba45235 100644
--- a/source/mvd_client.c
+++ b/source/mvd_client.c
@@ -982,6 +982,27 @@ void MVD_Play_f( void ) {
strcpy( mvd->demopath, buffer );
}
+
+void MVD_Shutdown( void ) {
+ mvd_t *mvd, *next;
+
+ LIST_FOR_EACH_SAFE( mvd_t, mvd, next, &mvd_channels, entry ) {
+ MVD_Disconnect( mvd );
+ MVD_ClearState( mvd );
+ MVD_Free( mvd );
+ }
+
+ List_Init( &mvd_channels );
+ List_Init( &mvd_ready );
+
+ if( mvd_clients ) {
+ Z_Free( mvd_clients );
+ mvd_clients = NULL;
+ }
+
+ Z_LeakTest( TAG_MVD );
+}
+
static const cmdreg_t c_mvd[] = {
{ "mvdplay", MVD_Play_f, MVD_Play_g },
{ "mvdconnect", MVD_Connect_f },
diff --git a/source/mvd_game.c b/source/mvd_game.c
index dbda980..81db708 100644
--- a/source/mvd_game.c
+++ b/source/mvd_game.c
@@ -616,31 +616,15 @@ static void MVD_GameInit( void ) {
gameFeatures = GAME_FEATURE_CLIENTNUM|GAME_FEATURE_PROPERINUSE;
}
-void MVD_GameShutdown( void ) {
- mvd_t *mvd, *next;
-
+static void MVD_GameShutdown( void ) {
Com_Printf( "----- MVD_GameShutdown -----\n" );
- LIST_FOR_EACH_SAFE( mvd_t, mvd, next, &mvd_channels, entry ) {
- MVD_Disconnect( mvd );
- MVD_ClearState( mvd );
- MVD_Free( mvd );
- }
-
- List_Init( &mvd_channels );
- List_Init( &mvd_ready );
-
- if( mvd_clients ) {
- Z_Free( mvd_clients );
- mvd_clients = NULL;
- }
+ MVD_Shutdown();
mvd_ge.edicts = NULL;
mvd_ge.edict_size = 0;
mvd_ge.num_edicts = 0;
mvd_ge.max_edicts = 0;
-
- Z_LeakTest( TAG_MVD );
}
static void MVD_GameSpawnEntities( const char *mapname, const char *entstring, const char *spawnpoint ) {
diff --git a/source/mvd_local.h b/source/mvd_local.h
index 3bb3d1b..c528aff 100644
--- a/source/mvd_local.h
+++ b/source/mvd_local.h
@@ -175,6 +175,7 @@ void MVD_ClearState( mvd_t *mvd );
void MVD_ChangeLevel( mvd_t *mvd );
void MVD_GetStream( const char *uri );
void MVD_Free( mvd_t *mvd );
+void MVD_Shutdown( void );
const char *MVD_Play_g( const char *partial, int state );
@@ -203,5 +204,4 @@ extern game_export_t mvd_ge;
void MVD_UpdateClient( udpClient_t *client );
void MVD_SwitchChannel( udpClient_t *client, mvd_t *mvd );
-void MVD_GameShutdown( void );
diff --git a/source/sv_main.c b/source/sv_main.c
index e85757a..07ffe6d 100644
--- a/source/sv_main.c
+++ b/source/sv_main.c
@@ -1782,7 +1782,7 @@ void SV_Shutdown( const char *finalmsg, killtype_t type ) {
Cvar_Set( "sv_paused", "0" );
if( !svs.initialized ) {
- MVD_GameShutdown(); // make sure MVD client is down
+ MVD_Shutdown(); // make sure MVD client is down
return;
}