Browse Source

Remove gamedir[] from engine-side gameinfo_t

pull/2/head
Alibek Omarov 7 years ago
parent
commit
314a6deba9
  1. 8
      engine/client/cl_game.c
  2. 4
      engine/client/cl_main.c
  3. 2
      engine/common/common.c
  4. 3
      engine/common/common.h
  5. 14
      engine/common/filesystem.c
  6. 4
      engine/server/sv_client.c
  7. 2
      engine/server/sv_game.c
  8. 4
      engine/server/sv_main.c

8
engine/client/cl_game.c

@ -2557,7 +2557,7 @@ const char *pfnGetGameDirectory( void )
{ {
static char szGetGameDir[MAX_SYSPATH]; static char szGetGameDir[MAX_SYSPATH];
Q_sprintf( szGetGameDir, "%s/%s", host.rootdir, GI->gamedir ); Q_sprintf( szGetGameDir, "%s/%s", host.rootdir, GI->gamefolder );
return szGetGameDir; return szGetGameDir;
} }
@ -3576,8 +3576,8 @@ void NetAPI_SendRequest( int context, int request, int flags, double timeout, ne
if( !nr->resp.remote_address.port ) nr->resp.remote_address.port = MSG_BigShort( PORT_MASTER ); if( !nr->resp.remote_address.port ) nr->resp.remote_address.port = MSG_BigShort( PORT_MASTER );
// grab the list from the master server // grab the list from the master server
Q_strcpy( &fullquery[22], GI->gamedir ); Q_strcpy( &fullquery[22], GI->gamefolder );
NET_SendPacket( NS_CLIENT, Q_strlen( GI->gamedir ) + 23, fullquery, nr->resp.remote_address ); NET_SendPacket( NS_CLIENT, Q_strlen( GI->gamefolder ) + 23, fullquery, nr->resp.remote_address );
clgame.request_type = NET_REQUEST_CLIENT; clgame.request_type = NET_REQUEST_CLIENT;
clgame.master_request = nr; // holds the master request unitl the master acking clgame.master_request = nr; // holds the master request unitl the master acking
} }
@ -4092,7 +4092,7 @@ void CL_UnloadProgs( void )
Mod_ClearUserData(); Mod_ClearUserData();
// NOTE: HLFX 0.5 has strange bug: hanging on exit if no map was loaded // NOTE: HLFX 0.5 has strange bug: hanging on exit if no map was loaded
if( Q_stricmp( GI->gamedir, "hlfx" ) || GI->version != 0.5f ) if( Q_stricmp( GI->gamefolder, "hlfx" ) || GI->version != 0.5f )
clgame.dllFuncs.pfnShutdown(); clgame.dllFuncs.pfnShutdown();
Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY ); Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );

4
engine/client/cl_main.c

@ -1440,9 +1440,9 @@ void CL_InternetServers_f( void )
if( !NET_StringToAdr( MASTERSERVER_ADR, &adr ) ) if( !NET_StringToAdr( MASTERSERVER_ADR, &adr ) )
MsgDev( D_ERROR, "Can't resolve adr: %s\n", MASTERSERVER_ADR ); MsgDev( D_ERROR, "Can't resolve adr: %s\n", MASTERSERVER_ADR );
Q_strcpy( &fullquery[22], GI->gamedir ); Q_strcpy( &fullquery[22], GI->gamefolder );
NET_SendPacket( NS_CLIENT, Q_strlen( GI->gamedir ) + 23, fullquery, adr ); NET_SendPacket( NS_CLIENT, Q_strlen( GI->gamefolder ) + 23, fullquery, adr );
// now we clearing the vgui request // now we clearing the vgui request
if( clgame.master_request != NULL ) if( clgame.master_request != NULL )

2
engine/common/common.c

@ -1275,7 +1275,7 @@ pfnGetGameDir
void pfnGetGameDir( char *szGetGameDir ) void pfnGetGameDir( char *szGetGameDir )
{ {
if( !szGetGameDir ) return; if( !szGetGameDir ) return;
Q_sprintf( szGetGameDir, "%s/%s", host.rootdir, GI->gamedir ); Q_sprintf( szGetGameDir, "%s/%s", host.rootdir, GI->gamefolder );
} }
qboolean COM_IsSafeFileToDownload( const char *filename ) qboolean COM_IsSafeFileToDownload( const char *filename )

3
engine/common/common.h

@ -205,7 +205,7 @@ typedef enum
#define FS_CUSTOM_PATH 8 // custom directory #define FS_CUSTOM_PATH 8 // custom directory
#define GI SI.GameInfo #define GI SI.GameInfo
#define FS_Gamedir() SI.GameInfo->gamedir #define FS_Gamedir() SI.GameInfo->gamefolder
#define FS_Title() SI.GameInfo->title #define FS_Title() SI.GameInfo->title
#define GameState (&host.game) #define GameState (&host.game)
@ -250,7 +250,6 @@ typedef struct gameinfo_s
// filesystem info // filesystem info
char gamefolder[MAX_QPATH]; // used for change game '-game x' char gamefolder[MAX_QPATH]; // used for change game '-game x'
char basedir[MAX_QPATH]; // base game directory (like 'id1' for Quake or 'valve' for Half-Life) char basedir[MAX_QPATH]; // base game directory (like 'id1' for Quake or 'valve' for Half-Life)
char gamedir[MAX_QPATH]; // game directory (can be match with basedir, used as game dir and as write path)
char falldir[MAX_QPATH]; // used as second basedir char falldir[MAX_QPATH]; // used as second basedir
char startmap[MAX_QPATH];// map to start singleplayer game char startmap[MAX_QPATH];// map to start singleplayer game
char trainmap[MAX_QPATH];// map to start hazard course (if specified) char trainmap[MAX_QPATH];// map to start hazard course (if specified)

14
engine/common/filesystem.c

@ -852,11 +852,11 @@ void FS_Rescan( void )
FS_ClearSearchPath(); FS_ClearSearchPath();
if( Q_stricmp( GI->basedir, GI->gamedir )) if( Q_stricmp( GI->basedir, GI->gamefolder ))
FS_AddGameHierarchy( GI->basedir, 0 ); FS_AddGameHierarchy( GI->basedir, 0 );
if( Q_stricmp( GI->basedir, GI->falldir ) && Q_stricmp( GI->gamedir, GI->falldir )) if( Q_stricmp( GI->basedir, GI->falldir ) && Q_stricmp( GI->gamefolder, GI->falldir ))
FS_AddGameHierarchy( GI->falldir, 0 ); FS_AddGameHierarchy( GI->falldir, 0 );
FS_AddGameHierarchy( GI->gamedir, FS_GAMEDIR_PATH ); FS_AddGameHierarchy( GI->gamefolder, FS_GAMEDIR_PATH );
if( FS_FileExists( va( "%s.rc", SI.basedirName ), false )) if( FS_FileExists( va( "%s.rc", SI.basedirName ), false ))
Q_strncpy( SI.rcName, SI.basedirName, sizeof( SI.rcName )); // e.g. valve.rc Q_strncpy( SI.rcName, SI.basedirName, sizeof( SI.rcName )); // e.g. valve.rc
@ -890,8 +890,10 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
if( Q_strlen( GameInfo->basedir )) if( Q_strlen( GameInfo->basedir ))
FS_Printf( f, "basedir\t\t\"%s\"\n", GameInfo->basedir ); FS_Printf( f, "basedir\t\t\"%s\"\n", GameInfo->basedir );
if( Q_strlen( GameInfo->gamedir )) // DEPRECATED: gamedir key isn't supported by FWGS fork
FS_Printf( f, "gamedir\t\t\"%s\"\n", GameInfo->gamedir ); // but write it anyway to keep compability with original Xash3D
if( Q_strlen( GameInfo->gamefolder ))
FS_Printf( f, "gamedir\t\t\"%s\"\n", GameInfo->gamefolder );
if( Q_strlen( GameInfo->falldir )) if( Q_strlen( GameInfo->falldir ))
FS_Printf( f, "fallback_dir\t\"%s\"\n", GameInfo->falldir ); FS_Printf( f, "fallback_dir\t\"%s\"\n", GameInfo->falldir );
@ -1341,7 +1343,7 @@ static qboolean FS_ParseGameInfo( const char *gamedir, gameinfo_t *GameInfo )
{ {
// now we have copy of game info from basedir but needs to change gamedir // now we have copy of game info from basedir but needs to change gamedir
Con_DPrintf( "Convert %s to %s\n", default_gameinfo_path, gameinfo_path ); Con_DPrintf( "Convert %s to %s\n", default_gameinfo_path, gameinfo_path );
Q_strncpy( tmpGameInfo.gamedir, gamedir, sizeof( tmpGameInfo.gamedir )); Q_strncpy( tmpGameInfo.gamefolder, gamedir, sizeof( tmpGameInfo.gamefolder ));
FS_WriteGameInfo( gameinfo_path, &tmpGameInfo ); FS_WriteGameInfo( gameinfo_path, &tmpGameInfo );
} }
else FS_CreateDefaultGameInfo( gameinfo_path ); else FS_CreateDefaultGameInfo( gameinfo_path );

4
engine/server/sv_client.c

@ -2030,7 +2030,7 @@ void SV_TSourceEngineQuery( netadr_t from )
MSG_WriteByte( &buf, host.type == HOST_DEDICATED ? 'D' : 'L' ); MSG_WriteByte( &buf, host.type == HOST_DEDICATED ? 'D' : 'L' );
MSG_WriteByte( &buf, 'W' ); MSG_WriteByte( &buf, 'W' );
if( Q_stricmp( GI->gamedir, "valve" )) if( Q_stricmp( GI->gamefolder, "valve" ))
{ {
MSG_WriteByte( &buf, 1 ); // mod MSG_WriteByte( &buf, 1 ); // mod
MSG_WriteString( &buf, GI->game_url ); MSG_WriteString( &buf, GI->game_url );
@ -2442,4 +2442,4 @@ void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg )
return; return;
} }
} }
} }

2
engine/server/sv_game.c

@ -4549,7 +4549,7 @@ qboolean SV_ParseEdict( char **pfile, edict_t *ent )
#ifdef HACKS_RELATED_HLMODS #ifdef HACKS_RELATED_HLMODS
// chemical existence have broked changelevels // chemical existence have broked changelevels
if( !Q_stricmp( GI->gamedir, "ce" )) if( !Q_stricmp( GI->gamefolder, "ce" ))
{ {
if( !Q_stricmp( sv.name, "ce08_02" ) && !Q_stricmp( classname, "info_player_start_force" )) if( !Q_stricmp( sv.name, "ce08_02" ) && !Q_stricmp( classname, "info_player_start_force" ))
adjust_origin = true; adjust_origin = true;

4
engine/server/sv_main.c

@ -716,7 +716,7 @@ void SV_AddToMaster( netadr_t from, sizebuf_t *msg )
Info_SetValueForKey( s, "players", va( "%d", clients ), len ); // current player number, without bots Info_SetValueForKey( s, "players", va( "%d", clients ), len ); // current player number, without bots
Info_SetValueForKey( s, "max", va( "%d", svs.maxclients ), len ); // max_players Info_SetValueForKey( s, "max", va( "%d", svs.maxclients ), len ); // max_players
Info_SetValueForKey( s, "bots", va( "%d", bots ), len ); // bot count Info_SetValueForKey( s, "bots", va( "%d", bots ), len ); // bot count
Info_SetValueForKey( s, "gamedir", GI->gamedir, len ); // gamedir Info_SetValueForKey( s, "gamedir", GI->gamefolder, len ); // gamedir
Info_SetValueForKey( s, "map", sv.name, len ); // current map 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.type == HOST_DEDICATED) ? "d" : "l", len ); // dedicated or local
Info_SetValueForKey( s, "password", "0", len ); // is password set Info_SetValueForKey( s, "password", "0", len ); // is password set
@ -967,4 +967,4 @@ void SV_Shutdown( const char *finalmsg )
Log_Close(); Log_Close();
svs.initialized = false; svs.initialized = false;
} }

Loading…
Cancel
Save