diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2010-09-29 18:04:22 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:41 +0000 |
commit | 3e5b31af20cb275d777eb2d006b9d525e4f08c7e (patch) | |
tree | 4a4273cf565c501a9520a9fc285873c689fe9e3c /src/ui/ui_atoms.c | |
parent | 3161697c566765dbc4b3200d159b98c4e233d213 (diff) |
* Fix /me in teamsay menu
Diffstat (limited to 'src/ui/ui_atoms.c')
-rw-r--r-- | src/ui/ui_atoms.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/ui/ui_atoms.c b/src/ui/ui_atoms.c index 9c98f867..0d50e286 100644 --- a/src/ui/ui_atoms.c +++ b/src/ui/ui_atoms.c @@ -88,6 +88,34 @@ char *UI_Argv( int arg ) return buffer; } +char *UI_ConcatArgs( int arg, char *buf, int len ) +{ + char *p; + int c; + + if( len <= 0 ) + return buf; + + p = buf; + c = trap_Argc(); + + for( ; arg < c; arg++ ) + { + char *argp = UI_Argv( arg ); + + while( *argp && p < &buf[ len - 1 ] ) + *p++ = *argp++; + + if( p < &buf[ len - 2 ] ) + *p++ = ' '; + else + break; + } + + *p = '\0'; + + return buf; +} char *UI_Cvar_VariableString( const char *var_name ) { @@ -153,12 +181,27 @@ static void UI_MessageMode_f( void ) Menus_ActivateByName( "say" ); } +static void UI_Me_f( void ) +{ + char buf[ MAX_SAY_TEXT - 4 ], *cmd; + + UI_ConcatArgs( 1, buf, sizeof( buf ) ); + + if( uiInfo.chatTeam ) + cmd = "say_team"; + else + cmd = "say"; + + trap_Cmd_ExecuteText( EXEC_APPEND, va( "%s \"/me %s\"", cmd, buf ) ); +} + struct uicmd { char *cmd; void ( *function )( void ); } commands[ ] = { { "closemenus", UI_CloseMenus_f }, + { "me", UI_Me_f }, { "menu", UI_Menu_f }, { "messagemode", UI_MessageMode_f }, { "messagemode2", UI_MessageMode_f }, |