From 7b68ff42773976cafe39b59dc026350cda5c05fd Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Mon, 15 Jun 2009 14:01:36 +0000 Subject: fixed chaining of console commands, allows snatching updates of console variables. cleaned up some code --- src/game/client/gameclient.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/game/client/gameclient.cpp') diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index fc17b94f..fa2f4de0 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -248,7 +248,18 @@ void GAMECLIENT::on_console_init() // let all the other components register their console commands for(int i = 0; i < all.num; i++) all.components[i]->on_console_init(); - + + + // + { static COMMANDCHAIN chain; console_chain_command("player_name", &chain, conchain_special_infoupdate, this); } + { static COMMANDCHAIN chain; console_chain_command("player_use_custom_color", &chain, conchain_special_infoupdate, this); } + { static COMMANDCHAIN chain; console_chain_command("player_color_body", &chain, conchain_special_infoupdate, this); } + { static COMMANDCHAIN chain; console_chain_command("player_color_feet", &chain, conchain_special_infoupdate, this); } + { static COMMANDCHAIN chain; console_chain_command("player_skin", &chain, conchain_special_infoupdate, this); } + + + + // suppress_events = false; } @@ -954,3 +965,10 @@ void GAMECLIENT::con_kill(void *result, void *user_data) { ((GAMECLIENT*)user_data)->send_kill(-1); } + +void GAMECLIENT::conchain_special_infoupdate(void *result, void *user_data, CONSOLE_CALLBACK cb, void *cbuser) +{ + cb(result, cbuser); + if(console_arg_num(result)) + ((GAMECLIENT*)user_data)->send_info(false); +} -- cgit 1.4.1