This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.5a
in repository iortcw.

commit 93ce1b353f1f3e71672ffeac238a5710f514e441
Author: MAN-AT-ARMS <m4n4t4...@gmail.com>
Date:   Fri Oct 14 20:03:49 2016 -0400

    All: Handle ERR_DROP during Com_GameRestart
---
 MP/code/qcommon/common.c | 27 +++++++++++++++++++++------
 SP/code/qcommon/common.c | 30 ++++++++++++++++++++++++------
 2 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/MP/code/qcommon/common.c b/MP/code/qcommon/common.c
index cb6a8a4..76547f2 100644
--- a/MP/code/qcommon/common.c
+++ b/MP/code/qcommon/common.c
@@ -131,6 +131,7 @@ int com_frameNumber;
 qboolean       com_errorEntered = qfalse;
 qboolean       com_fullyInitialized = qfalse;
 qboolean       com_gameRestarting = qfalse;
+qboolean       com_gameClientRestarting = qfalse;
 
 char com_errorMessage[MAXPRINTMSG];
 
@@ -278,6 +279,7 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
        static int lastErrorTime;
        static int errorCount;
        int currentTime;
+       qboolean restartClient;
 
        if(com_errorEntered)
                Sys_Error("recursive error after: %s", com_errorMessage);
@@ -310,9 +312,17 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
        if (code != ERR_DISCONNECT && code != ERR_NEED_CD)
                Cvar_Set( "com_errorMessage", com_errorMessage );
 
+       restartClient = com_gameClientRestarting && !( com_cl_running && 
com_cl_running->integer );
+
+       com_gameRestarting = qfalse;
+       com_gameClientRestarting = qfalse;
+
        if (code == ERR_DISCONNECT || code == ERR_SERVERDISCONNECT) {
                VM_Forced_Unload_Start();
                SV_Shutdown( "Server disconnected" );
+               if ( restartClient ) {
+                       CL_Init();
+               }
                CL_Disconnect( qtrue );
                CL_FlushMemory();
                VM_Forced_Unload_Done();
@@ -324,6 +334,9 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
                Com_Printf( "********************\nERROR: 
%s\n********************\n", com_errorMessage );
                VM_Forced_Unload_Start();
                SV_Shutdown (va("Server crashed: %s",  com_errorMessage));
+               if ( restartClient ) {
+                       CL_Init();
+               }
                CL_Disconnect( qtrue );
                CL_FlushMemory();
                VM_Forced_Unload_Done();
@@ -333,6 +346,9 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
        } else if ( code == ERR_NEED_CD ) {
                VM_Forced_Unload_Start();
                SV_Shutdown( "Server didn't have CD" );
+               if ( restartClient ) {
+                       CL_Init();
+               }
                if ( com_cl_running && com_cl_running->integer ) {
                        CL_Disconnect( qtrue );
                        CL_FlushMemory();
@@ -2393,16 +2409,14 @@ void Com_GameRestart(int checksumFeed, qboolean 
disconnect)
        // make sure no recursion can be triggered
        if(!com_gameRestarting && com_fullyInitialized)
        {
-               int clWasRunning;
-               
                com_gameRestarting = qtrue;
-               clWasRunning = com_cl_running->integer;
-               
+               com_gameClientRestarting = com_cl_running->integer;
+
                // Kill server if we have one
                if(com_sv_running->integer)
                        SV_Shutdown("Game directory changed");
 
-               if(clWasRunning)
+               if(com_gameClientRestarting)
                {
                        if(disconnect)
                                CL_Disconnect(qfalse);
@@ -2424,13 +2438,14 @@ void Com_GameRestart(int checksumFeed, qboolean 
disconnect)
                        NET_Restart_f();
                }
 
-               if(clWasRunning)
+               if(com_gameClientRestarting)
                {
                        CL_Init();
                        CL_StartHunkUsers(qfalse);
                }
                
                com_gameRestarting = qfalse;
+               com_gameClientRestarting = qfalse;
        }
 }
 
diff --git a/SP/code/qcommon/common.c b/SP/code/qcommon/common.c
index 94f0da3..e07f021 100644
--- a/SP/code/qcommon/common.c
+++ b/SP/code/qcommon/common.c
@@ -131,6 +131,7 @@ int com_frameNumber;
 qboolean       com_errorEntered = qfalse;
 qboolean       com_fullyInitialized = qfalse;
 qboolean       com_gameRestarting = qfalse;
+qboolean       com_gameClientRestarting = qfalse;
 
 char com_errorMessage[MAXPRINTMSG];
 
@@ -278,6 +279,7 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
        static int lastErrorTime;
        static int errorCount;
        int currentTime;
+       qboolean restartClient;
 
        if(com_errorEntered)
                Sys_Error("recursive error after: %s", com_errorMessage);
@@ -315,9 +317,17 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
                Cvar_Set( "com_errorMessage", com_errorMessage );
        }
 
+       restartClient = com_gameClientRestarting && !( com_cl_running && 
com_cl_running->integer );
+
+       com_gameRestarting = qfalse;
+       com_gameClientRestarting = qfalse;
+
        if (code == ERR_DISCONNECT || code == ERR_SERVERDISCONNECT) {
                VM_Forced_Unload_Start();
                SV_Shutdown( "Server disconnected" );
+               if ( restartClient ) {
+                       CL_Init();
+               }
                CL_Disconnect( qtrue );
                CL_FlushMemory();
                VM_Forced_Unload_Done();
@@ -328,6 +338,9 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
        } else if ( code == ERR_ENDGAME ) {  //----(SA) added
                VM_Forced_Unload_Start();
                SV_Shutdown( "endgame" );
+               if ( restartClient ) {
+                       CL_Init();
+               }
                if ( com_cl_running && com_cl_running->integer ) {
                        CL_Disconnect( qtrue );
                        CL_FlushMemory();
@@ -345,6 +358,9 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
                Com_Printf( "********************\nERROR: 
%s\n********************\n", com_errorMessage );
                VM_Forced_Unload_Start();
                SV_Shutdown (va("Server crashed: %s",  com_errorMessage));
+               if ( restartClient ) {
+                       CL_Init();
+               }
                CL_Disconnect( qtrue );
                CL_FlushMemory();
                VM_Forced_Unload_Done();
@@ -354,6 +370,9 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
        } else if ( code == ERR_NEED_CD ) {
                VM_Forced_Unload_Start();
                SV_Shutdown( "Server didn't have CD" );
+               if ( restartClient ) {
+                       CL_Init();
+               }
                if ( com_cl_running && com_cl_running->integer ) {
                        CL_Disconnect( qtrue );
                        CL_FlushMemory();
@@ -1933,16 +1952,14 @@ void Com_GameRestart(int checksumFeed, qboolean 
disconnect)
        // make sure no recursion can be triggered
        if(!com_gameRestarting && com_fullyInitialized)
        {
-               int clWasRunning;
-               
                com_gameRestarting = qtrue;
-               clWasRunning = com_cl_running->integer;
-               
+               com_gameClientRestarting = com_cl_running->integer;
+
                // Kill server if we have one
                if(com_sv_running->integer)
                        SV_Shutdown("Game directory changed");
 
-               if(clWasRunning)
+               if(com_gameClientRestarting)
                {
                        if(disconnect)
                                CL_Disconnect(qfalse);
@@ -1964,13 +1981,14 @@ void Com_GameRestart(int checksumFeed, qboolean 
disconnect)
                        NET_Restart_f();
                }
 
-               if(clWasRunning)
+               if(com_gameClientRestarting)
                {
                        CL_Init();
                        CL_StartHunkUsers(qfalse);
                }
                
                com_gameRestarting = qfalse;
+               com_gameClientRestarting = qfalse;
        }
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/iortcw.git

_______________________________________________
Pkg-games-commits mailing list
Pkg-games-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to