]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
corrected the misspelled name GAME_NEXIUZ (and related things) to GAME_NEXUIZ (and...
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index 455d0bef1088d87f9d932d504fbb6b398a5a1c9c..7b24461bc841c99613fb0ad71877eb5cd459f7e2 100644 (file)
--- a/host.c
+++ b/host.c
@@ -321,13 +321,13 @@ Writes key bindings and archived cvars to config.cfg
 */
 void Host_WriteConfiguration (void)
 {
-       QFile *f;
+       qfile_t *f;
 
 // dedicated servers initialize the host but don't parse and set the
 // config.cfg cvars
        if (host_initialized && cls.state != ca_dedicated)
        {
-               f = Qopen (va("%s/config.cfg",com_gamedir), "w");
+               f = FS_Open ("config.cfg", "w", false);
                if (!f)
                {
                        Con_Printf ("Couldn't write config.cfg.\n");
@@ -337,7 +337,7 @@ void Host_WriteConfiguration (void)
                Key_WriteBindings (f);
                Cvar_WriteVariables (f);
 
-               Qclose (f);
+               FS_Close (f);
        }
 }
 
@@ -428,25 +428,31 @@ void SV_DropClient (qboolean crash)
        if (!crash)
        {
                // send any final messages (don't check for errors)
+#if 1
+               // LordHavoc: no opportunity for resending, so reliable is silly
+               MSG_WriteByte (&host_client->message, svc_disconnect);
+               NET_SendUnreliableMessage (host_client->netconnection, &host_client->message);
+#else
                if (NET_CanSendMessage (host_client->netconnection))
                {
                        MSG_WriteByte (&host_client->message, svc_disconnect);
                        NET_SendMessage (host_client->netconnection, &host_client->message);
                }
+#endif
+       }
 
-               if (sv.active && host_client->edict && host_client->spawned) // LordHavoc: don't call QC if server is dead (avoids recursive Host_Error in some mods when they run out of edicts)
-               {
-               // call the prog function for removing a client
-               // this will set the body to a dead frame, among other things
-                       saveSelf = pr_global_struct->self;
-                       pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
-                       PR_ExecuteProgram (pr_global_struct->ClientDisconnect, "QC function ClientDisconnect is missing");
-                       pr_global_struct->self = saveSelf;
-               }
-
-               Sys_Printf ("Client %s removed\n",host_client->name);
+       if (sv.active && host_client->edict && host_client->spawned) // LordHavoc: don't call QC if server is dead (avoids recursive Host_Error in some mods when they run out of edicts)
+       {
+       // call the prog function for removing a client
+       // this will set the body to a dead frame, among other things
+               saveSelf = pr_global_struct->self;
+               pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
+               PR_ExecuteProgram (pr_global_struct->ClientDisconnect, "QC function ClientDisconnect is missing");
+               pr_global_struct->self = saveSelf;
        }
 
+       Sys_Printf ("Client %s removed\n",host_client->name);
+
 // break the net connection
        NET_Close (host_client->netconnection);
        host_client->netconnection = NULL;
@@ -832,11 +838,11 @@ void Host_Frame (float time)
 
        time1 = Sys_DoubleTime ();
        _Host_Frame (time);
-       time2 = Sys_DoubleTime ();      
-       
+       time2 = Sys_DoubleTime ();
+
        timetotal += time2 - time1;
        timecount++;
-       
+
        if (timecount < 1000)
                return;
 
@@ -856,7 +862,6 @@ void Host_Frame (float time)
 //============================================================================
 
 void Render_Init(void);
-void QuakeIO_Init(void);
 
 /*
 ====================
@@ -880,7 +885,6 @@ void Host_Init (void)
        Memory_Init_Commands();
        R_Modules_Init();
        Cbuf_Init ();
-       QuakeIO_Init ();
        V_Init ();
        COM_Init ();
        Host_InitLocal ();
@@ -898,7 +902,6 @@ void Host_Init (void)
 
        if (cls.state != ca_dedicated)
        {
-               Gamma_Init();
                Palette_Init();
                VID_Shared_Init();
                VID_Init();
@@ -916,8 +919,8 @@ void Host_Init (void)
        Cbuf_Execute ();
 
        host_initialized = true;
-       
-       Con_Printf ("========Quake Initialized=========\n");    
+
+       Con_Printf ("========Quake Initialized=========\n");
 
        if (cls.state != ca_dedicated)
                VID_Open();
@@ -935,15 +938,15 @@ to run quit through here before the final handoff to the sys code.
 void Host_Shutdown(void)
 {
        static qboolean isdown = false;
-       
+
        if (isdown)
        {
-               printf ("recursive shutdown\n");
+               Con_Printf ("recursive shutdown\n");
                return;
        }
        isdown = true;
 
-       Host_WriteConfiguration (); 
+       Host_WriteConfiguration ();
 
        CDAudio_Shutdown ();
        NET_Shutdown ();