]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Replace cls.state == ca_dedicated with sv_dedicated Nikoli/build-system2
authorNikoli <nikoli@lavabit.com>
Wed, 7 Aug 2013 17:48:43 +0000 (21:48 +0400)
committerNikoli <nikoli@lavabit.com>
Wed, 7 Aug 2013 17:48:43 +0000 (21:48 +0400)
23 files changed:
cd_shared.c
cl_main.c
cl_parse.c
cl_screen.c
client.h
console.c
cvar.c
gl_rmain.c
gl_textures.c
host.c
host_cmd.c
model_alias.c
model_brush.c
model_shared.c
model_sprite.c
netconn.c
prvm_cmds.c
quakedef.h
sv_main.c
sys_linux.c
sys_sdl.c
sys_win.c
vid_shared.c

index 43b4a7f43338cadf08df419faf21c4da21ac66d2..4d4f0c77c43962cd955b0ab092ed563dc3cf3323 100644 (file)
@@ -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
index ec4ca8b64442e207bfcb55cb01abfb05661ad9c8..91dd2f8c27324542135ee7338fd102cb86f83694 100644 (file)
--- 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
index bf25e20e56f9d12a64c626eeea072668838e9cfd..6b9733783f0ac3dd1da2f81c044a2b8227bc7484 100644 (file)
@@ -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
                        {
index 2867607d88da1157118e3afd2f2012b13815d6cf..eee9d91401c0380c5733439cc2890d273623a04d 100644 (file)
@@ -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
index f830c2e74c05976953403879fbc1bb6ca584a9bd..e11cbc8349f917fa2fc5621e895fad176b1ad9fd 100644 (file)
--- 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
 }
index 983786d12a119611e3cfe76af3f748cedd3ff3a2..2fe64cb26157a7eb8b504a184305bed6dabca8e8 100644 (file)
--- 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 06afc0d2295141b01d4b1b78407d3723550eb491..6f498971fd36b4e429101e65c43aeeb84794f1bc 100644 (file)
--- 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.
index 8f69fb09ecb25b4505d66e30ca75a8433ef45b46..cd4fec2e6387af3360d971f5ab118127ca17902e 100644 (file)
@@ -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);
index 077d918fd79d1aeae6756521931f755aa3e04e5d..e9df27cd2473c637cfd1fde881a99c245e1d2873 100644 (file)
@@ -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 55eb88ba45f438cd6c9d954c817ed3d5dfd25b2f..8e95eb1c910d3fd7dbbbfd593aeafe9f3a0d2a01 100644 (file)
--- 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();
index d14fc9078104171c386c93258324dcbec5ec9326..63b98881407e43d03d2592e836739482f9d8781b 100644 (file)
@@ -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;
index ddcd849e63e487a838e3dcf4c836a0cbc5261567..9650189606f67c68256fd801eaefbb5e0b210b8f 100644 (file)
@@ -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)
index b8e64da458f37cbd8582ee13b863ee3013112289..2749b08979d4cb0156057db9fcead18e4dd7b11e 100644 (file)
@@ -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);
index 5c87e3ddfce988d8bf77c7881a56689a85a2e71a..9c7b0e5192ee0b9fd883b345dd1af3847a0ca6a1 100644 (file)
@@ -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;
index e24c8421ce84eae2e99afcb78eb6735ed2c698c7..f6731d76b378e12bbcce180461e4eb785783b376 100644 (file)
@@ -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++)
                {
index 00adb61a7ca265edda56cc95b02ab019207d58cb..27c0cf8df17c6b29ad0084fbc491b970d1b244ec 100755 (executable)
--- 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)
                {
index 00c9ede9fcd5dc6ad0fa253d6ede33caf399fa0b..5d7ae135420e9a7cbc72facb912202608b3d4b11 100644 (file)
@@ -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;
+               }
        }
 }
 
index 61ab84914fdab063ddaeb03cea56cf2b7783b40a..a1c8238dcb02f9c2bf9422b7c40e5c92bb7fe7a4 100644 (file)
@@ -401,6 +401,8 @@ extern char engineversion[128];
 #endif
 #include "csprogs.h"
 
+extern qboolean sv_dedicated;
+
 extern qboolean noclip_anglehack;
 
 extern cvar_t developer;
index 0c1627035552341c07a80d91f123c455acb87234..5ff8bd19501368b00e3e6b8b1a0931c2250ae5b2 100644 (file)
--- 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();
index 0b954301e6c0d92927cfcecad7a17cac0df4f86d..f813b98267cf5e263ac41fb6cdd375417dc54a02 100644 (file)
@@ -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;
index cd769979c2753535a32c4b68d79707a25b5a9f4a..78b8f603c7646c0ad2dac38cc6d18f504bdf8c9c 100644 (file)
--- 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;
index de1f47187c2e0f766414bebf630c3d62cdcae9ed..1c8fd1c17eb9592961902f4e736f27333cdfe38c 100644 (file)
--- 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
index 1efc23760b57801bed4111618f1031a57ac1cf0a..fea61a9532181fd7d81a20b212e28def28ad2868 100644 (file)
@@ -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;