2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2025-01-12 19:47:15 +01:00

engine: add pfnIsCvarReadOnly to mainui API

This commit is contained in:
Alibek Omarov 2024-10-25 04:59:34 +03:00
parent 25b2c0f7e3
commit 55bdded6a4
2 changed files with 15 additions and 0 deletions

View File

@ -1303,6 +1303,16 @@ static gameinfo2_t *pfnGetModInfo( int gi_version, int i )
return &gameui.modsInfo[i];
}
static int pfnIsCvarReadOnly( const char *name )
{
convar_t *cv = Cvar_FindVar( name );
if( !cv )
return -1;
return FBitSet( cv->flags, FCVAR_READ_ONLY ) ? 1 : 0;
}
static ui_extendedfuncs_t gExtendedfuncs =
{
pfnEnableTextInput,
@ -1318,6 +1328,7 @@ static ui_extendedfuncs_t gExtendedfuncs =
&gNetApi,
pfnGetGameInfo,
pfnGetModInfo,
pfnIsCvarReadOnly,
};
void UI_UnloadProgs( void )

View File

@ -222,6 +222,10 @@ typedef struct ui_extendedfuncs_s {
// new mods info
gameinfo2_t *(*pfnGetGameInfo)( int gi_version ); // might return NULL if gi_version is unsupported
gameinfo2_t *(*pfnGetModInfo)( int gi_version, int mod_index ); // continiously call it until it returns null
// returns 1 if cvar has read-only flag
// or -1 if cvar not found
int (*pfnIsCvarReadOnly)( const char *name );
} ui_extendedfuncs_t;
// deprecated export from old engine