From ce0d4ff5401e0f11c77d7299a6e9afb6b5f10394 Mon Sep 17 00:00:00 2001 From: Nikoli Date: Wed, 7 Aug 2013 21:48:43 +0400 Subject: [PATCH] Replace cls.state == ca_dedicated with sv_dedicated --- cd_shared.c | 2 +- cl_main.c | 4 ++-- cl_parse.c | 2 +- cl_screen.c | 2 +- client.h | 1 - console.c | 2 +- cvar.c | 4 ++-- gl_rmain.c | 10 +++++----- gl_textures.c | 6 +++--- host.c | 26 ++++++++++++++------------ host_cmd.c | 18 +++++++++--------- model_alias.c | 2 +- model_brush.c | 20 ++++++++++---------- model_shared.c | 6 +++--- model_sprite.c | 4 ++-- netconn.c | 4 ++-- prvm_cmds.c | 33 +++++++++++++++++---------------- quakedef.h | 2 ++ sv_main.c | 10 +++++----- sys_linux.c | 2 +- sys_sdl.c | 2 +- sys_win.c | 10 +++++----- vid_shared.c | 2 +- 23 files changed, 89 insertions(+), 85 deletions(-) diff --git a/cd_shared.c b/cd_shared.c index 43b4a7f4..4d4f0c77 100644 --- a/cd_shared.c +++ b/cd_shared.c @@ -708,7 +708,7 @@ int CDAudio_Init (void) { int i; - if (cls.state == ca_dedicated) + if (sv_dedicated) return -1; // COMMANDLINEOPTION: Sound: -nocdaudio disables CD audio support diff --git a/cl_main.c b/cl_main.c index ec4ca8b6..91dd2f8c 100644 --- a/cl_main.c +++ b/cl_main.c @@ -335,7 +335,7 @@ This is also called on Host_Error, so it shouldn't cause any errors */ void CL_Disconnect(void) { - if (cls.state == ca_dedicated) + if (sv_dedicated) return; if (COM_CheckParm("-profilegameonly")) @@ -420,7 +420,7 @@ Host should be either "local" or a net address */ void CL_EstablishConnection(const char *host, int firstarg) { - if (cls.state == ca_dedicated) + if (sv_dedicated) return; // don't connect to a server if we're benchmarking a demo diff --git a/cl_parse.c b/cl_parse.c index bf25e20e..6b973378 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -331,7 +331,7 @@ void CL_KeepaliveMessage (qboolean readmessages) if(!thisrecursive) { - if(cls.state != ca_dedicated) + if(!sv_dedicated) { if(countdownupdate <= 0) // check if time stepped backwards { diff --git a/cl_screen.c b/cl_screen.c index 2867607d..eee9d914 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -2589,7 +2589,7 @@ void SCR_UpdateLoadingScreen (qboolean clear, qboolean startup) int old_key_consoleactive; // don't do anything if not initialized yet - if (vid_hidden || cls.state == ca_dedicated) + if (vid_hidden || sv_dedicated) return; // limit update rate diff --git a/client.h b/client.h index f830c2e7..e11cbc83 100644 --- a/client.h +++ b/client.h @@ -698,7 +698,6 @@ typedef struct cshift_s typedef enum cactive_e { ca_uninitialized, // during early startup - ca_dedicated, // a dedicated server with no ability to start a client ca_disconnected, // full screen console with no connection ca_connected // valid netcon, talking to a server } diff --git a/console.c b/console.c index 983786d1..2fe64cb2 100644 --- a/console.c +++ b/console.c @@ -1114,7 +1114,7 @@ void Con_MaskPrint(int additionalmask, const char *msg) // send to log file Log_ConPrint(line); // send to scrollable buffer - if (con_initialized && cls.state != ca_dedicated) + if (con_initialized && !sv_dedicated) { Con_PrintToHistory(line, mask); } diff --git a/cvar.c b/cvar.c index 06afc0d2..6f498971 100644 --- a/cvar.c +++ b/cvar.c @@ -358,9 +358,9 @@ static void Cvar_SetQuick_Internal (cvar_t *var, const char *value) } } #endif - if ((var->flags & CVAR_USERINFO) && cls.state != ca_dedicated) + if ((var->flags & CVAR_USERINFO) && !sv_dedicated) CL_SetInfo(var->name, var->string, true, false, false, false); - else if ((var->flags & CVAR_NQUSERINFOHACK) && cls.state != ca_dedicated) + else if ((var->flags & CVAR_NQUSERINFOHACK) && !sv_dedicated) { // update the cls.userinfo to have proper values for the // silly nq config variables. diff --git a/gl_rmain.c b/gl_rmain.c index 8f69fb09..cd4fec2e 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -3356,7 +3356,7 @@ skinframe_t *R_SkinFrame_LoadExternal(const char *name, int textureflags, qboole int mymiplevel; char vabuf[1024]; - if (cls.state == ca_dedicated) + if (sv_dedicated) return NULL; // return an existing skinframe if already loaded @@ -3565,7 +3565,7 @@ skinframe_t *R_SkinFrame_LoadInternalBGRA(const char *name, int textureflags, co skinframe_t *skinframe; char vabuf[1024]; - if (cls.state == ca_dedicated) + if (sv_dedicated) return NULL; // if already loaded just return it, otherwise make a new skinframe @@ -3635,7 +3635,7 @@ skinframe_t *R_SkinFrame_LoadInternalQuake(const char *name, int textureflags, i int featuresmask; skinframe_t *skinframe; - if (cls.state == ca_dedicated) + if (sv_dedicated) return NULL; // if already loaded just return it, otherwise make a new skinframe @@ -3759,7 +3759,7 @@ skinframe_t *R_SkinFrame_LoadInternal8bit(const char *name, int textureflags, co skinframe_t *skinframe; char vabuf[1024]; - if (cls.state == ca_dedicated) + if (sv_dedicated) return NULL; // if already loaded just return it, otherwise make a new skinframe @@ -3812,7 +3812,7 @@ skinframe_t *R_SkinFrame_LoadMissing(void) { skinframe_t *skinframe; - if (cls.state == ca_dedicated) + if (sv_dedicated) return NULL; skinframe = R_SkinFrame_Find("missing", TEXF_FORCENEAREST, 0, 0, 0, true); diff --git a/gl_textures.c b/gl_textures.c index 077d918f..e9df27cd 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -1609,7 +1609,7 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden unsigned char *temppixels = NULL; qboolean swaprb; - if (cls.state == ca_dedicated) + if (sv_dedicated) return NULL; // see if we need to swap red and blue (BGRA <-> RGBA conversion) @@ -1944,7 +1944,7 @@ rtexture_t *R_LoadTextureRenderBuffer(rtexturepool_t *rtexturepool, const char * gltexturepool_t *pool = (gltexturepool_t *)rtexturepool; textypeinfo_t *texinfo; - if (cls.state == ca_dedicated) + if (sv_dedicated) return NULL; texinfo = R_GetTexTypeInfo(textype, TEXF_RENDERTARGET | TEXF_CLAMP); @@ -2221,7 +2221,7 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen KTX_dimensions sizes; #endif - if (cls.state == ca_dedicated) + if (sv_dedicated) return NULL; #ifdef __ANDROID__ diff --git a/host.c b/host.c index 55eb88ba..8e95eb1c 100644 --- a/host.c +++ b/host.c @@ -50,6 +50,8 @@ Memory is cleared / released when a server or client begins, not when they end. int host_framecount = 0; // LordHavoc: set when quit is executed qboolean host_shuttingdown = false; +// dedicated server +qboolean sv_dedicated = false; // the accumulated mainloop time since application started (with filtering), without any slowmo or clamping double realtime; @@ -164,7 +166,7 @@ void Host_Error (const char *error, ...) Host_ShutdownServer (); SV_UnlockThreadMutex(); - if (cls.state == ca_dedicated) + if (sv_dedicated) Sys_Error ("Host_Error: %s",hosterrorstring2); // dedicated servers exit CL_Disconnect (); @@ -191,7 +193,7 @@ static void Host_ServerOptions (void) if (i) { #endif - cls.state = ca_dedicated; + sv_dedicated = true; // check for -dedicated specifying how many players if (i && i + 1 < com_argc && atoi (com_argv[i+1]) >= 1) svs.maxclients = atoi (com_argv[i+1]); @@ -288,7 +290,7 @@ static void Host_SaveConfig_to(const char *file) // dedicated servers initialize the host but don't parse and set the // config.cfg cvars // LordHavoc: don't save a config if it crashed in startup - if (host_framecount >= 3 && cls.state != ca_dedicated && !COM_CheckParm("-benchmark") && !COM_CheckParm("-capturedemo")) + if (host_framecount >= 3 && !sv_dedicated && !COM_CheckParm("-benchmark") && !COM_CheckParm("-capturedemo")) { f = FS_OpenRealFile(file, "wb", false); if (!f) @@ -410,7 +412,7 @@ void SV_BroadcastPrint(const char *msg) } } - if (sv_echobprint.integer && cls.state == ca_dedicated) + if (sv_echobprint.integer && sv_dedicated) Con_Print(msg); } @@ -788,7 +790,7 @@ void Host_Main(void) //Con_Printf("%6.0f %6.0f\n", cl_timer * 1000000.0, sv_timer * 1000000.0); // if the accumulators haven't become positive yet, wait a while - if (cls.state == ca_dedicated) + if (sv_dedicated) wait = sv_timer * -1000000.0; else if (!sv.active || svs.threaded) wait = cl_timer * -1000000.0; @@ -931,7 +933,7 @@ void Host_Main(void) // //------------------- - if (cls.state != ca_dedicated && (cl_timer > 0 || cls.timedemo || ((vid_activewindow ? cl_maxfps : cl_maxidlefps).value < 1))) + if (!sv_dedicated && (cl_timer > 0 || cls.timedemo || ((vid_activewindow ? cl_maxfps : cl_maxidlefps).value < 1))) { R_TimeReport("---"); Collision_Cache_NewFrame(); @@ -1079,7 +1081,7 @@ void Host_Main(void) qboolean vid_opened = false; void Host_StartVideo(void) { - if (!vid_opened && cls.state != ca_dedicated) + if (!vid_opened && !sv_dedicated) { vid_opened = true; // make sure we open sockets before opening video because the Windows Firewall "unblock?" dialog can screw up the graphics context on some graphics drivers @@ -1275,7 +1277,7 @@ static void Host_Init (void) Thread_Init(); - if (cls.state == ca_dedicated) + if (sv_dedicated) Cmd_AddCommand ("disconnect", CL_Disconnect_f, "disconnect from server (or disconnect all clients if running a server)"); else { @@ -1325,7 +1327,7 @@ static void Host_Init (void) SCR_BeginLoadingPlaque(true); #ifdef CONFIG_MENU - if (cls.state != ca_dedicated) + if (!sv_dedicated) { MR_Init(); } @@ -1360,7 +1362,7 @@ static void Host_Init (void) Cbuf_Execute(); } - if (cls.state == ca_dedicated || COM_CheckParm("-listen")) + if (sv_dedicated || COM_CheckParm("-listen")) if (!sv.active && !cls.demoplayback && !cls.connect_trying) { Cbuf_AddText("startmap_dm\n"); @@ -1379,7 +1381,7 @@ static void Host_Init (void) //Host_StartVideo(); - if (cls.state != ca_dedicated) + if (!sv_dedicated) SV_StartThread(); } @@ -1444,7 +1446,7 @@ void Host_Shutdown(void) NetConn_Shutdown (); //PR_Shutdown (); - if (cls.state != ca_dedicated) + if (!sv_dedicated) { #ifdef CONFIG_CLIENT R_Modules_Shutdown(); diff --git a/host_cmd.c b/host_cmd.c index d14fc907..63b98881 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -1373,7 +1373,7 @@ static void Host_Say(qboolean teamonly) if (cmd_source == src_command) { - if (cls.state == ca_dedicated) + if (sv_dedicated) { fromServer = true; teamonly = false; @@ -1424,7 +1424,7 @@ static void Host_Say(qboolean teamonly) SV_ClientPrint(text); host_client = save; - if (cls.state == ca_dedicated) + if (sv_dedicated) Con_Print(&text[1]); } @@ -1454,7 +1454,7 @@ static void Host_Tell_f(void) if (cmd_source == src_command) { - if (cls.state == ca_dedicated) + if (sv_dedicated) fromServer = true; else { @@ -1767,7 +1767,7 @@ static void Host_Pause_f (void) { if (cmd_source == src_client) { - if(cls.state == ca_dedicated || host_client != &svs.clients[0]) // non-admin + if(sv_dedicated || host_client != &svs.clients[0]) // non-admin { print("Pause not allowed.\n"); return; @@ -1903,7 +1903,7 @@ static void Host_Spawn_f (void) PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict); prog->ExecuteProgram(prog, PRVM_serverfunction(ClientConnect), "QC function ClientConnect is missing"); - if (cls.state == ca_dedicated) + if (sv_dedicated) Con_Printf("%s connected\n", host_client->name); PRVM_serverglobalfloat(time) = sv.time; @@ -2066,7 +2066,7 @@ static void Host_Kick_f (void) { if (cmd_source == src_command) { - if (cls.state == ca_dedicated) + if (sv_dedicated) who = "Console"; else who = cl_name.string; @@ -2390,7 +2390,7 @@ static void Host_Startdemos_f (void) { int i, c; - if (cls.state == ca_dedicated || COM_CheckParm("-listen") || COM_CheckParm("-benchmark") || COM_CheckParm("-demo") || COM_CheckParm("-capturedemo")) + if (sv_dedicated || COM_CheckParm("-listen") || COM_CheckParm("-benchmark") || COM_CheckParm("-demo") || COM_CheckParm("-capturedemo")) return; c = Cmd_Argc() - 1; @@ -2427,7 +2427,7 @@ Return to looping demos */ static void Host_Demos_f (void) { - if (cls.state == ca_dedicated) + if (sv_dedicated) return; if (cls.demonum == -1) cls.demonum = 1; @@ -2476,7 +2476,7 @@ static void Host_SendCvar_f (void) return; old = host_client; - if (cls.state != ca_dedicated) + if (!sv_dedicated) i = 1; else i = 0; diff --git a/model_alias.c b/model_alias.c index ddcd849e..96501896 100644 --- a/model_alias.c +++ b/model_alias.c @@ -903,7 +903,7 @@ static void Mod_MDL_LoadFrames (unsigned char* datapointer, int inverts, int *ve static void Mod_BuildAliasSkinFromSkinFrame(texture_t *texture, skinframe_t *skinframe) { - if (cls.state == ca_dedicated) + if (sv_dedicated) return; // hack if (!skinframe) diff --git a/model_brush.c b/model_brush.c index b8e64da4..2749b089 100644 --- a/model_brush.c +++ b/model_brush.c @@ -1556,7 +1556,7 @@ static void R_Q1BSP_LoadSplitSky (unsigned char *src, int width, int height, int unsigned int *alphapixels = (unsigned int *)Mem_Alloc(tempmempool, w*h*sizeof(unsigned char[4])); // allocate a texture pool if we need it - if (loadmodel->texturepool == NULL && cls.state != ca_dedicated) + if (loadmodel->texturepool == NULL && !sv_dedicated) loadmodel->texturepool = R_AllocTexturePool(); if (bytesperpixel == 4) @@ -1646,7 +1646,7 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb) loadmodel->data_textures = (texture_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_textures * sizeof(texture_t)); // fill out all slots with notexture - if (cls.state != ca_dedicated) + if (!sv_dedicated) skinframe = R_SkinFrame_LoadMissing(); else skinframe = NULL; @@ -1655,7 +1655,7 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb) strlcpy(tx->name, "NO TEXTURE FOUND", sizeof(tx->name)); tx->width = 16; tx->height = 16; - if (cls.state != ca_dedicated) + if (!sv_dedicated) { tx->numskinframes = 1; tx->skinframerate = 1; @@ -1801,7 +1801,7 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb) tx->surfaceflags = mod_q1bsp_texture_solid.surfaceflags; } - if (cls.state != ca_dedicated) + if (!sv_dedicated) { // LordHavoc: HL sky textures are entirely different than quake if (!loadmodel->brush.ishlbsp && !strncmp(tx->name, "sky", 3) && mtwidth == mtheight * 2) @@ -2644,7 +2644,7 @@ static void Mod_Q1BSP_LoadFaces(sizebuf_t *sb) ; // now that we've decided the lightmap texture size, we can do the rest - if (cls.state != ca_dedicated) + if (!sv_dedicated) { int stainmapsize = 0; mod_alloclightmap_state_t allocState; @@ -3731,7 +3731,7 @@ static int Mod_Q1BSP_CreateShadowMesh(dp_model_t *mod) int j; int numshadowmeshtriangles = 0; msurface_t *surface; - if (cls.state == ca_dedicated) + if (sv_dedicated) return 0; // make a single combined shadow mesh to allow optimized shadow volume creation @@ -4959,7 +4959,7 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l, lump_t *faceslump) external = false; loadmodel->brushq3.lightmapsize = 128; - if (cls.state == ca_dedicated) + if (sv_dedicated) return; if(mod_q3bsp_nolightmaps.integer) @@ -5128,7 +5128,7 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l, lump_t *faceslump) loadmodel->brushq3.data_deluxemaps = (rtexture_t **)Mem_Alloc(loadmodel->mempool, loadmodel->brushq3.num_mergedlightmaps * sizeof(rtexture_t *)); // allocate a texture pool if we need it - if (loadmodel->texturepool == NULL && cls.state != ca_dedicated) + if (loadmodel->texturepool == NULL && !sv_dedicated) loadmodel->texturepool = R_AllocTexturePool(); mergedpixels = (unsigned char *) Mem_Alloc(tempmempool, mergedwidth * mergedheight * 4); @@ -5333,7 +5333,7 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l) else out->effect = loadmodel->brushq3.data_effects + n; - if (cls.state != ca_dedicated) + if (!sv_dedicated) { out->lightmaptexture = NULL; out->deluxemaptexture = r_texture_blanknormalmap; @@ -5656,7 +5656,7 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l) VectorClear(out->maxs); if (out->num_vertices) { - if (cls.state != ca_dedicated && out->lightmaptexture) + if (!sv_dedicated && out->lightmaptexture) { // figure out which part of the merged lightmap this fits into int lightmapindex = LittleLong(in->lightmapindex) >> (loadmodel->brushq3.deluxemapping ? 1 : 0); diff --git a/model_shared.c b/model_shared.c index 5c87e3dd..9c7b0e51 100644 --- a/model_shared.c +++ b/model_shared.c @@ -2560,7 +2560,7 @@ nothing GL_ZERO GL_ONE texture->skinframerate = primarylayer->framerate; for (j = 0;j < primarylayer->numframes;j++) { - if(cls.state == ca_dedicated) + if(sv_dedicated) { texture->skinframes[j] = NULL; } @@ -2581,7 +2581,7 @@ nothing GL_ZERO GL_ONE texture->backgroundskinframerate = backgroundlayer->framerate; for (j = 0;j < backgroundlayer->numframes;j++) { - if(cls.state == ca_dedicated) + if(sv_dedicated) { texture->skinframes[j] = NULL; } @@ -2733,7 +2733,7 @@ nothing GL_ZERO GL_ONE texture->supercontents = SUPERCONTENTS_SOLID | SUPERCONTENTS_OPAQUE; } texture->numskinframes = 1; - if(cls.state == ca_dedicated) + if(sv_dedicated) { texture->skinframes[0] = NULL; success = false; diff --git a/model_sprite.c b/model_sprite.c index e24c8421..f6731d76 100644 --- a/model_sprite.c +++ b/model_sprite.c @@ -203,7 +203,7 @@ static void Mod_Sprite_SharedSetup(const unsigned char *datapointer, int version if (modelradius < x + y) modelradius = x + y; - if (cls.state != ca_dedicated) + if (!sv_dedicated) { skinframe = NULL; // note: Nehahra's null.spr has width == 0 and height == 0 @@ -454,7 +454,7 @@ void Mod_IDS2_Load(dp_model_t *mod, void *buffer, void *bufferend) modelradius = x + y; } - if (cls.state != ca_dedicated) + if (!sv_dedicated) { for (i = 0;i < loadmodel->numframes;i++) { diff --git a/netconn.c b/netconn.c index 00adb61a..27c0cf8d 100755 --- a/netconn.c +++ b/netconn.c @@ -1025,7 +1025,7 @@ void NetConn_OpenServerPorts(int opennetports) Con_Printf("Server using port %i\n", port); if (sv_netport.integer != port) Cvar_SetValueQuick(&sv_netport, port); - if (cls.state != ca_dedicated) + if (!sv_dedicated) NetConn_OpenServerPort(NULL, LHNETADDRESSTYPE_LOOP, 1, 1); if (opennetports) { @@ -1116,7 +1116,7 @@ void NetConn_UpdateSockets(void) // TODO add logic to automatically close sockets if needed LHNET_DefaultDSCP(net_tos_dscp.integer); - if (cls.state != ca_dedicated) + if (!sv_dedicated) { if (clientport2 != cl_netport.integer) { diff --git a/prvm_cmds.c b/prvm_cmds.c index 00c9ede9..5d7ae135 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -2793,7 +2793,7 @@ void VM_isserver(prvm_prog_t *prog) { VM_SAFEPARMCOUNT(0,VM_serverstate); - PRVM_G_FLOAT(OFS_RETURN) = sv.active && (svs.maxclients > 1 || cls.state == ca_dedicated); + PRVM_G_FLOAT(OFS_RETURN) = sv.active && (svs.maxclients > 1 || sv_dedicated); } /* @@ -2821,21 +2821,22 @@ void VM_clientstate(prvm_prog_t *prog) { VM_SAFEPARMCOUNT(0,VM_clientstate); - - switch( cls.state ) { - case ca_uninitialized: - case ca_dedicated: - PRVM_G_FLOAT(OFS_RETURN) = 0; - break; - case ca_disconnected: - PRVM_G_FLOAT(OFS_RETURN) = 1; - break; - case ca_connected: - PRVM_G_FLOAT(OFS_RETURN) = 2; - break; - default: - // should never be reached! - break; + if(sv_dedicated) + PRVM_G_FLOAT(OFS_RETURN) = 0; + else + { + switch( cls.state ) { + case ca_uninitialized: + case ca_disconnected: + PRVM_G_FLOAT(OFS_RETURN) = 1; + break; + case ca_connected: + PRVM_G_FLOAT(OFS_RETURN) = 2; + break; + default: + // should never be reached! + break; + } } } diff --git a/quakedef.h b/quakedef.h index 61ab8491..a1c8238d 100644 --- a/quakedef.h +++ b/quakedef.h @@ -401,6 +401,8 @@ extern char engineversion[128]; #endif #include "csprogs.h" +extern qboolean sv_dedicated; + extern qboolean noclip_anglehack; extern cvar_t developer; diff --git a/sv_main.c b/sv_main.c index 0c162703..5ff8bd19 100644 --- a/sv_main.c +++ b/sv_main.c @@ -3254,10 +3254,10 @@ void SV_SpawnServer (const char *server) // SV_LockThreadMutex(); - if(cls.state == ca_dedicated) + if(sv_dedicated) Sys_MakeProcessNice(); - if (cls.state != ca_dedicated) + if (!sv_dedicated) { SCR_BeginLoadingPlaque(false); S_StopAllSounds(); @@ -3283,7 +3283,7 @@ void SV_SpawnServer (const char *server) { Con_Printf("Couldn't load map %s\n", modelname); - if(cls.state == ca_dedicated) + if(sv_dedicated) Sys_MakeProcessMean(); // SV_UnlockThreadMutex(); @@ -3485,7 +3485,7 @@ void SV_SpawnServer (const char *server) SV_Physics (); } - if (cls.state == ca_dedicated) + if (sv_dedicated) Mod_PurgeUnused(); // create a baseline for more efficient communications @@ -3529,7 +3529,7 @@ void SV_SpawnServer (const char *server) Con_DPrint("Server spawned.\n"); NetConn_Heartbeat (2); - if(cls.state == ca_dedicated) + if(sv_dedicated) Sys_MakeProcessMean(); // SV_UnlockThreadMutex(); diff --git a/sys_linux.c b/sys_linux.c index 0b954301..f813b982 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -76,7 +76,7 @@ void Sys_PrintToTerminal(const char *text) char *Sys_ConsoleInput(void) { - //if (cls.state == ca_dedicated) + //if (sv_dedicated) { static char text[MAX_INPUTLINE]; static unsigned int len = 0; diff --git a/sys_sdl.c b/sys_sdl.c index cd769979..78b8f603 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -101,7 +101,7 @@ void Sys_PrintToTerminal(const char *text) char *Sys_ConsoleInput(void) { -// if (cls.state == ca_dedicated) +// if (sv_dedicated) { static char text[MAX_INPUTLINE]; int len = 0; diff --git a/sys_win.c b/sys_win.c index de1f4718..1c8fd1c1 100644 --- a/sys_win.c +++ b/sys_win.c @@ -67,13 +67,13 @@ void Sys_Error (const char *error, ...) Con_Printf ("Quake Error: %s\n", text); // close video so the message box is visible, unless we already tried that - if (!in_sys_error0 && cls.state != ca_dedicated) + if (!in_sys_error0 && !sv_dedicated) { in_sys_error0 = 1; VID_Shutdown(); } - if (!in_sys_error3 && cls.state != ca_dedicated) + if (!in_sys_error3 && !sv_dedicated) { in_sys_error3 = true; MessageBox(NULL, text, "Quake Error", MB_OK | MB_SETFOREGROUND | MB_ICONSTOP); @@ -102,7 +102,7 @@ void Sys_Shutdown (void) CloseHandle (tevent); #endif - if (cls.state == ca_dedicated) + if (sv_dedicated) FreeConsole (); #ifdef QHOST @@ -128,7 +128,7 @@ char *Sys_ConsoleInput (void) int ch; DWORD numread, numevents, dummy; - if (cls.state != ca_dedicated) + if (!sv_dedicated) return NULL; for ( ;; ) @@ -241,7 +241,7 @@ void Sys_InitConsole (void) hinput = GetStdHandle (STD_INPUT_HANDLE); // LordHavoc: can't check cls.state because it hasn't been initialized yet - // if (cls.state == ca_dedicated) + // if (sv_dedicated) if (COM_CheckParm("-dedicated")) { //if ((houtput == 0) || (houtput == INVALID_HANDLE_VALUE)) // LordHavoc: on Windows XP this is never 0 or invalid, but hinput is invalid diff --git a/vid_shared.c b/vid_shared.c index 1efc2376..fea61a95 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -1542,7 +1542,7 @@ void VID_UpdateGamma(qboolean force, int rampsize) qboolean gamma_changed = false; // LordHavoc: don't mess with gamma tables if running dedicated - if (cls.state == ca_dedicated) + if (sv_dedicated) return; wantgamma = v_hwgamma.integer; -- 2.39.2