mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
engine: common: hpak: use statically allocated hpk_maxsize cvar because gamedll can re-register it for some reason
This commit is contained in:
parent
c24a1fafc5
commit
129de871e3
@ -29,10 +29,10 @@ typedef struct hash_pack_queue_s
|
|||||||
struct hash_pack_queue_s *next;
|
struct hash_pack_queue_s *next;
|
||||||
} hash_pack_queue_t;
|
} hash_pack_queue_t;
|
||||||
|
|
||||||
convar_t *hpk_maxsize;
|
static CVAR_DEFINE_AUTO( hpk_maxsize, "4", FCVAR_ARCHIVE, "set limit by size for all HPK-files ( 0 - unlimited )" );
|
||||||
hash_pack_queue_t *gp_hpak_queue = NULL;
|
static hash_pack_queue_t *gp_hpak_queue = NULL;
|
||||||
hpak_header_t hash_pack_header;
|
static hpak_header_t hash_pack_header;
|
||||||
hpak_info_t hash_pack_info;
|
static hpak_info_t hash_pack_info;
|
||||||
|
|
||||||
const char *HPAK_TypeFromIndex( int type )
|
const char *HPAK_TypeFromIndex( int type )
|
||||||
{
|
{
|
||||||
@ -504,7 +504,7 @@ void HPAK_CheckSize( const char *filename )
|
|||||||
string pakname;
|
string pakname;
|
||||||
int maxsize;
|
int maxsize;
|
||||||
|
|
||||||
maxsize = hpk_maxsize->value;
|
maxsize = hpk_maxsize.value;
|
||||||
if( maxsize <= 0 ) return;
|
if( maxsize <= 0 ) return;
|
||||||
|
|
||||||
if( !COM_CheckString( filename ) )
|
if( !COM_CheckString( filename ) )
|
||||||
@ -515,8 +515,8 @@ void HPAK_CheckSize( const char *filename )
|
|||||||
|
|
||||||
if( FS_FileSize( pakname, false ) > ( maxsize * 1048576 ))
|
if( FS_FileSize( pakname, false ) > ( maxsize * 1048576 ))
|
||||||
{
|
{
|
||||||
Con_Printf( "Server: Size of %s > %f MB, deleting.\n", filename, hpk_maxsize->value );
|
Con_Printf( "Server: Size of %s > %f MB, deleting.\n", filename, hpk_maxsize.value );
|
||||||
Log_Printf( "Server: Size of %s > %f MB, deleting.\n", filename, hpk_maxsize->value );
|
Log_Printf( "Server: Size of %s > %f MB, deleting.\n", filename, hpk_maxsize.value );
|
||||||
FS_Delete( filename );
|
FS_Delete( filename );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1097,7 +1097,7 @@ void HPAK_Init( void )
|
|||||||
Cmd_AddRestrictedCommand( "hpkremove", HPAK_Remove_f, "remove specified file from HPK-file" );
|
Cmd_AddRestrictedCommand( "hpkremove", HPAK_Remove_f, "remove specified file from HPK-file" );
|
||||||
Cmd_AddRestrictedCommand( "hpkval", HPAK_Validate_f, "validate specified HPK-file" );
|
Cmd_AddRestrictedCommand( "hpkval", HPAK_Validate_f, "validate specified HPK-file" );
|
||||||
Cmd_AddRestrictedCommand( "hpkextract", HPAK_Extract_f, "extract all lumps from specified HPK-file" );
|
Cmd_AddRestrictedCommand( "hpkextract", HPAK_Extract_f, "extract all lumps from specified HPK-file" );
|
||||||
hpk_maxsize = Cvar_Get( "hpk_maxsize", "0", FCVAR_ARCHIVE, "set limit by size for all HPK-files ( 0 - unlimited )" );
|
Cvar_RegisterVariable( &hpk_maxsize );
|
||||||
|
|
||||||
gp_hpak_queue = NULL;
|
gp_hpak_queue = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user