/* ================== Host_ShutdownServer This only happens at the end of a game, not between levels ================== */ void Host_ShutdownServer(void) { prvm_prog_t *prog = SVVM_prog; int i; Con_DPrintf("Host_ShutdownServer\n"); if (!sv.active) return; NetConn_Heartbeat(2); NetConn_Heartbeat(2); // make sure all the clients know we're disconnecting World_End(&sv.world); if(prog->loaded) { if(PRVM_serverfunction(SV_Shutdown)) { func_t s = PRVM_serverfunction(SV_Shutdown); PRVM_serverglobalfloat(time) = sv.time; PRVM_serverfunction(SV_Shutdown) = 0; // prevent it from getting called again prog->ExecuteProgram(prog, s,"SV_Shutdown() required"); } } for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++) if (host_client->active) SV_DropClient(false); // server shutdown NetConn_CloseServerPorts(); sv.active = false; // // clear structures // memset(&sv, 0, sizeof(sv)); memset(svs.clients, 0, svs.maxclients*sizeof(client_t)); cl.islocalgame = false; }
/* ================== Host_ShutdownServer This only happens at the end of a game, not between levels ================== */ void Host_ShutdownServer(void) { int i; Con_DPrintf("Host_ShutdownServer\n"); if (!sv.active) return; NetConn_Heartbeat(2); NetConn_Heartbeat(2); // make sure all the clients know we're disconnecting SV_VM_Begin(); World_End(&sv.world); if(prog->loaded) if(prog->funcoffsets.SV_Shutdown) { func_t s = prog->funcoffsets.SV_Shutdown; prog->funcoffsets.SV_Shutdown = 0; // prevent it from getting called again PRVM_ExecuteProgram(s,"SV_Shutdown() required"); } for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++) if (host_client->active) SV_DropClient(false); // server shutdown SV_VM_End(); NetConn_CloseServerPorts(); sv.active = false; // // clear structures // memset(&sv, 0, sizeof(sv)); memset(svs.clients, 0, svs.maxclients*sizeof(client_t)); }