diff --git a/engine/client/cl_gameui.c b/engine/client/cl_gameui.c index 54a48ea2..4b4d8945 100644 --- a/engine/client/cl_gameui.c +++ b/engine/client/cl_gameui.c @@ -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 ) diff --git a/engine/menu_int.h b/engine/menu_int.h index 8dd840c4..5b9fb429 100644 --- a/engine/menu_int.h +++ b/engine/menu_int.h @@ -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