diff --git a/engine/common/dedicated.c b/engine/common/dedicated.c index ed28f859..4ffe506d 100644 --- a/engine/common/dedicated.c +++ b/engine/common/dedicated.c @@ -388,7 +388,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui numi = (short *)(pinhl + 1); } - if( host.type == HOST_DEDICATED ) + if( Host_IsDedicated() ) { // skip frames loading if( loaded ) *loaded = true; // done @@ -494,4 +494,4 @@ void Mod_UnloadSpriteModel( model_t *mod ) memset( mod, 0, sizeof( *mod )); } -#endif // XASH_DEDICATED \ No newline at end of file +#endif // XASH_DEDICATED diff --git a/engine/common/filesystem.c b/engine/common/filesystem.c index 6c7c766b..58193bb6 100644 --- a/engine/common/filesystem.c +++ b/engine/common/filesystem.c @@ -1446,7 +1446,7 @@ void FS_Init( void ) #endif // ignore commandlineoption "-game" for other stuff - if( host.type == HOST_NORMAL || host.type == HOST_DEDICATED ) + if( host.type == HOST_NORMAL || Host_IsDedicated() ) { stringlistinit( &dirs ); listdirectory( &dirs, "./", false ); diff --git a/engine/common/host.c b/engine/common/host.c index 898dffbf..a277d223 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -145,7 +145,7 @@ Host_CheckSleep */ void Host_CheckSleep( void ) { - if( host.type == HOST_DEDICATED ) + if( Host_IsDedicated() ) { // let the dedicated server some sleep Sys_Sleep( 1 ); @@ -470,7 +470,7 @@ qboolean Host_FilterTime( float time ) // limit fps to withing tolerable range fps = bound( MIN_FPS, fps, MAX_FPS ); - if( host.type == HOST_DEDICATED ) + if( Host_IsDedicated() ) { if(( host.realtime - oldtime ) < ( 1.0 / ( fps + 1.0 ))) return false; @@ -746,7 +746,6 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha } } - host.type = HOST_NORMAL; // predict state host.con_showalways = true; #ifdef XASH_DEDICATED @@ -925,7 +924,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa ID_Init(); - if( host.type == HOST_DEDICATED ) + if( Host_IsDedicated() ) { #ifdef _WIN32 Wcon_InitConsoleCommands (); @@ -967,7 +966,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa oldtime = Sys_DoubleTime() - 0.1; - if( host.type == HOST_DEDICATED && GameState->nextstate == STATE_RUNFRAME ) + if( Host_IsDedicated() && GameState->nextstate == STATE_RUNFRAME ) Con_Printf( "type 'map ' to run server... (TAB-autocomplete is working too)\n" ); // main window message loop diff --git a/engine/common/net_ws.c b/engine/common/net_ws.c index 9802d885..799f4124 100644 --- a/engine/common/net_ws.c +++ b/engine/common/net_ws.c @@ -1450,7 +1450,7 @@ void NET_SendPacket( netsrc_t sock, size_t length, const void *data, netadr_t to return; #endif } - if( host.type == HOST_DEDICATED ) + if( Host_IsDedicated() ) { MsgDev( D_ERROR, "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to )); } @@ -1642,13 +1642,13 @@ static void NET_OpenIP( void ) if( !port ) port = PORT_SERVER; // forcing to default net.ip_sockets[NS_SERVER] = NET_IPSocket( net_ipname->string, port, false ); - if( !NET_IsSocketValid( net.ip_sockets[NS_SERVER] ) && host.type == HOST_DEDICATED ) + if( !NET_IsSocketValid( net.ip_sockets[NS_SERVER] ) && Host_IsDedicated() ) Host_Error( "Couldn't allocate dedicated server IP port %d.\n", port ); sv_port = port; } // dedicated servers don't need client ports - if( host.type == HOST_DEDICATED ) return; + if( Host_IsDedicated() ) return; if( !NET_IsSocketValid( net.ip_sockets[NS_CLIENT] ) ) { diff --git a/engine/common/sys_con.c b/engine/common/sys_con.c index 47824edd..000e8079 100644 --- a/engine/common/sys_con.c +++ b/engine/common/sys_con.c @@ -22,7 +22,7 @@ GNU General Public License for more details. #define XASH_COLORIZE_CONSOLE // use with caution, running engine in Qt Creator may cause a freeze in read() call // I was never encountered this bug anywhere else, so still enable by default -#define XASH_USE_SELECT +// #define XASH_USE_SELECT #endif #ifdef XASH_USE_SELECT diff --git a/engine/platform/sdl/events.c b/engine/platform/sdl/events.c index a6a4440d..fb4c645d 100644 --- a/engine/platform/sdl/events.c +++ b/engine/platform/sdl/events.c @@ -397,7 +397,7 @@ static void SDLash_EventFilter( SDL_Event *event ) return; if( ( host.status == HOST_SHUTDOWN ) || - ( host.type == HOST_DEDICATED ) ) + ( Host_IsDedicated() ) ) break; // no need to activate switch( event->window.event ) { diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index 63815ba5..10c8adca 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -2036,7 +2036,7 @@ void SV_TSourceEngineQuery( netadr_t from ) MSG_WriteByte( &buf, count ); MSG_WriteByte( &buf, svs.maxclients ); MSG_WriteByte( &buf, PROTOCOL_VERSION ); - MSG_WriteByte( &buf, host.type == HOST_DEDICATED ? 'D' : 'L' ); + MSG_WriteByte( &buf, Host_IsDedicated() ? 'D' : 'L' ); MSG_WriteByte( &buf, 'W' ); if( Q_stricmp( GI->gamefolder, "valve" )) diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index 533efb6d..bfbe91ce 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -3393,7 +3393,7 @@ pfnIsDedicatedServer */ int pfnIsDedicatedServer( void ) { - return (host.type == HOST_DEDICATED); + return Host_IsDedicated(); } /* diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index 04c21752..15717da2 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -568,7 +568,7 @@ void SV_ActivateServer( int runPhysics ) Log_Printf( "Started map \"%s\" (CRC \"%u\")\n", sv.name, sv.worldmapCRC ); // dedicated server purge unused resources here - if( host.type == HOST_DEDICATED ) + if( Host_IsDedicated() ) Mod_FreeUnused (); host.movevars_changed = true; @@ -709,7 +709,7 @@ void SV_SetupClients( void ) svs.maxclients = (int)sv_maxclients->value; // dedicated servers are can't be single player and are usually DM - if( host.type == HOST_DEDICATED ) + if( Host_IsDedicated() ) svs.maxclients = bound( 4, svs.maxclients, MAX_CLIENTS ); else svs.maxclients = bound( 1, svs.maxclients, MAX_CLIENTS ); diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 94e03790..b1cd54d2 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -532,7 +532,7 @@ qboolean SV_IsSimulating( void ) if( !SV_HasActivePlayers( )) return false; - if( host.type == HOST_DEDICATED ) + if( Host_IsDedicated() ) return true; // always active for dedicated servers // allow to freeze everything in singleplayer @@ -735,7 +735,7 @@ void SV_AddToMaster( netadr_t from, sizebuf_t *msg ) Info_SetValueForKey( s, "bots", va( "%d", bots ), len ); // bot count Info_SetValueForKey( s, "gamedir", GI->gamefolder, len ); // gamedir Info_SetValueForKey( s, "map", sv.name, len ); // current map - Info_SetValueForKey( s, "type", (host.type == HOST_DEDICATED) ? "d" : "l", len ); // dedicated or local + Info_SetValueForKey( s, "type", (Host_IsDedicated()) ? "d" : "l", len ); // dedicated or local Info_SetValueForKey( s, "password", "0", len ); // is password set Info_SetValueForKey( s, "os", "w", len ); // Windows Info_SetValueForKey( s, "secure", "0", len ); // server anti-cheat diff --git a/engine/server/sv_pmove.c b/engine/server/sv_pmove.c index de5c2914..e73e4823 100644 --- a/engine/server/sv_pmove.c +++ b/engine/server/sv_pmove.c @@ -514,7 +514,7 @@ static void pfnPlaybackEventFull( int flags, int clientindex, word eventindex, f ent = EDICT_NUM( clientindex + 1 ); if( !SV_IsValidEdict( ent )) return; - if( host.type == HOST_DEDICATED ) + if( Host_IsDedicated() ) flags |= FEV_NOTHOST; // no local clients for dedicated server SV_PlaybackEventFull( flags, ent, eventindex, diff --git a/engine/server/sv_save.c b/engine/server/sv_save.c index f7d1243e..1f55ff5e 100644 --- a/engine/server/sv_save.c +++ b/engine/server/sv_save.c @@ -1996,7 +1996,7 @@ qboolean SV_LoadGame( const char *pPath ) file_t *pFile; int flags; - if( host.type == HOST_DEDICATED ) + if( Host_IsDedicated() ) return false; if( !COM_CheckString( pPath ))