Browse Source

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

pull/2/head
Andrey Akhmichin 1 year ago committed by Alibek Omarov
parent
commit
3299999f3d
  1. 1
      engine/common/common.h
  2. 13
      engine/common/infostring.c

1
engine/common/common.h

@ -818,6 +818,7 @@ const char *Info_ValueForKey( const char *s, const char *key ); @@ -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 );

13
engine/common/infostring.c

@ -496,3 +496,16 @@ qboolean Info_SetValueForKey( char *s, const char *key, const char *value, int m @@ -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 );
}

Loading…
Cancel
Save