engine: common: add printf-like version of Info_SetValueForKey function.

This commit is contained in:
Andrey Akhmichin 2023-01-27 06:43:28 +05:00 committed by Alibek Omarov
parent 91be4f6521
commit 3299999f3d
2 changed files with 14 additions and 0 deletions

View File

@ -818,6 +818,7 @@ const char *Info_ValueForKey( const char *s, const char *key );
void Info_RemovePrefixedKeys( char *start, char prefix );
qboolean Info_RemoveKey( char *s, const char *key );
qboolean Info_SetValueForKey( char *s, const char *key, const char *value, int maxsize );
qboolean Info_SetValueForKeyf( char *s, const char *key, int maxsize, const char *format, ... ) _format( 4 );
qboolean Info_SetValueForStarKey( char *s, const char *key, const char *value, int maxsize );
qboolean Info_IsValid( const char *s );
void Info_WriteVars( file_t *f );

View File

@ -496,3 +496,16 @@ qboolean Info_SetValueForKey( char *s, const char *key, const char *value, int m
return Info_SetValueForStarKey( s, key, value, maxsize );
}
qboolean Info_SetValueForKeyf( char *s, const char *key, int maxsize, const char *format, ... )
{
char value[MAX_VA_STRING];
va_list args;
va_start( args, format );
Q_vsnprintf( value, sizeof( value ), format, args );
va_end( args );
return Info_SetValueForKey( s, key, value, maxsize );
}