diff --git a/engine/common/cmd.c b/engine/common/cmd.c index f4d673c7..17ae6b03 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -120,6 +120,18 @@ void Cbuf_AddText( const char *text ) Cbuf_AddTextToBuffer( &cmd_text, text ); } +void Cbuf_AddTextf( const char *fmt, ... ) +{ + va_list va; + char buf[MAX_VA_STRING]; + + va_start( va, fmt ); + Q_vsnprintf( buf, sizeof( buf ), fmt, va ); + va_end( va ); + + Cbuf_AddText( buf ); +} + /* ============ Cbuf_AddFilteredText diff --git a/engine/common/common.h b/engine/common/common.h index e80d8eea..08404a3a 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -425,6 +425,7 @@ void FS_Shutdown( void ); void Cbuf_Init( void ); void Cbuf_Clear( void ); void Cbuf_AddText( const char *text ); +void Cbuf_AddTextf( const char *text, ... ) _format( 1 ); void Cbuf_AddFilteredText( const char *text ); void Cbuf_InsertText( const char *text ); void Cbuf_ExecStuffCmds( void );