Remove gamedir[] from engine-side gameinfo_t

This commit is contained in:
Alibek Omarov 2018-04-21 01:22:00 +03:00
parent d3990e03e6
commit 314a6deba9
8 changed files with 21 additions and 20 deletions

View File

@ -2557,7 +2557,7 @@ const char *pfnGetGameDirectory( void )
{
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;
}
@ -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 );
// grab the list from the master server
Q_strcpy( &fullquery[22], GI->gamedir );
NET_SendPacket( NS_CLIENT, Q_strlen( GI->gamedir ) + 23, fullquery, nr->resp.remote_address );
Q_strcpy( &fullquery[22], GI->gamefolder );
NET_SendPacket( NS_CLIENT, Q_strlen( GI->gamefolder ) + 23, fullquery, nr->resp.remote_address );
clgame.request_type = NET_REQUEST_CLIENT;
clgame.master_request = nr; // holds the master request unitl the master acking
}
@ -4092,7 +4092,7 @@ void CL_UnloadProgs( void )
Mod_ClearUserData();
// 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();
Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );

View File

@ -1440,9 +1440,9 @@ void CL_InternetServers_f( void )
if( !NET_StringToAdr( MASTERSERVER_ADR, &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
if( clgame.master_request != NULL )

View File

@ -1275,7 +1275,7 @@ pfnGetGameDir
void pfnGetGameDir( char *szGetGameDir )
{
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 )

View File

@ -205,7 +205,7 @@ typedef enum
#define FS_CUSTOM_PATH 8 // custom directory
#define GI SI.GameInfo
#define FS_Gamedir() SI.GameInfo->gamedir
#define FS_Gamedir() SI.GameInfo->gamefolder
#define FS_Title() SI.GameInfo->title
#define GameState (&host.game)
@ -250,7 +250,6 @@ typedef struct gameinfo_s
// filesystem info
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 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 startmap[MAX_QPATH];// map to start singleplayer game
char trainmap[MAX_QPATH];// map to start hazard course (if specified)

View File

@ -852,11 +852,11 @@ void FS_Rescan( void )
FS_ClearSearchPath();
if( Q_stricmp( GI->basedir, GI->gamedir ))
if( Q_stricmp( GI->basedir, GI->gamefolder ))
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->gamedir, FS_GAMEDIR_PATH );
FS_AddGameHierarchy( GI->gamefolder, FS_GAMEDIR_PATH );
if( FS_FileExists( va( "%s.rc", SI.basedirName ), false ))
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 ))
FS_Printf( f, "basedir\t\t\"%s\"\n", GameInfo->basedir );
if( Q_strlen( GameInfo->gamedir ))
FS_Printf( f, "gamedir\t\t\"%s\"\n", GameInfo->gamedir );
// DEPRECATED: gamedir key isn't supported by FWGS fork
// 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 ))
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
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 );
}
else FS_CreateDefaultGameInfo( gameinfo_path );

View File

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

View File

@ -4549,7 +4549,7 @@ qboolean SV_ParseEdict( char **pfile, edict_t *ent )
#ifdef HACKS_RELATED_HLMODS
// 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" ))
adjust_origin = true;

View File

@ -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, "max", va( "%d", svs.maxclients ), len ); // max_players
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, "type", (host.type == HOST_DEDICATED) ? "d" : "l", len ); // dedicated or local
Info_SetValueForKey( s, "password", "0", len ); // is password set
@ -967,4 +967,4 @@ void SV_Shutdown( const char *finalmsg )
Log_Close();
svs.initialized = false;
}
}