From 9db20a28cb37660a0382989e93fc35432a98d317 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 11 Jan 2017 15:12:06 +0200 Subject: [PATCH] Changed: Move dyn channel commands (/0, /1 ..) to commands.xml --- .../data/gamedev/interfaces_v3/commands.xml | 18 +++++ code/ryzom/client/src/client_chat_manager.cpp | 34 ++++++++- code/ryzom/client/src/commands.cpp | 71 ------------------- 3 files changed, 49 insertions(+), 74 deletions(-) diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml b/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml index 58f41d919..d7aabccae 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml @@ -50,6 +50,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/code/ryzom/client/src/client_chat_manager.cpp b/code/ryzom/client/src/client_chat_manager.cpp index 1bf6227d9..3211e764c 100644 --- a/code/ryzom/client/src/client_chat_manager.cpp +++ b/code/ryzom/client/src/client_chat_manager.cpp @@ -1375,8 +1375,24 @@ class CHandlerTalk : public IActionHandler } else { - ChatMngr.setChatMode((CChatGroup::TGroupType)mode); - ChatMngr.chat(text, mode == CChatGroup::team); + if (mode == CChatGroup::dyn_chat) + { + uint channel; + fromString(getParam (sParams, "channel"), channel); + if (channel < CChatGroup::MaxDynChanPerPlayer) + { + PeopleInterraction.talkInDynamicChannel(channel, text); + } + else + { + nlwarning("/ah talk: invalid dyn_chat channel %d\n", channel); + } + } + else + { + ChatMngr.setChatMode((CChatGroup::TGroupType)mode); + ChatMngr.chat(text, mode == CChatGroup::team); + } } } } @@ -1391,9 +1407,21 @@ class CHandlerEnterTalk : public IActionHandler { // Param uint mode; + uint channel = 0; + fromString(getParam (sParams, "mode"), mode); - ChatMngr.updateChatModeAndButton(mode); + if (mode == CChatGroup::dyn_chat) + { + fromString(getParam(sParams, "channel"), channel); + + if (channel >= CChatGroup::MaxDynChanPerPlayer) + { + channel = 0; + } + } + + ChatMngr.updateChatModeAndButton(mode, channel); } }; REGISTER_ACTION_HANDLER( CHandlerEnterTalk, "enter_talk"); diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index 70cbfc229..44b165c61 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -1198,77 +1198,6 @@ NLMISC_COMMAND(db, "Modify Database"," ") return true; } -static bool talkInChan(uint32 nb,std::vectorargs) -{ - uint32 maxChans = CChatGroup::MaxDynChanPerPlayer; - if (nb>=maxChans) - { - return false; - } - if(!args.empty()) - { - std::string tmp; - std::vector::const_iterator first(args.begin()),last(args.end()); - - for(;first!=last;++first) - { - tmp = tmp + (*first); - tmp = tmp+" "; - } - - ucstring uctmp; - uctmp.fromUtf8(tmp); - PeopleInterraction.talkInDynamicChannel(nb, uctmp); - return true; - } - else - { - ChatMngr.updateChatModeAndButton(CChatGroup::dyn_chat, nb); - } - return false; -} - -NLMISC_COMMAND(0,"talk in 0th dynamic chat channel"," ") -{ - return talkInChan(0,args); -} - -NLMISC_COMMAND(1,"talk in first dynamic chat channel"," ") -{ - return talkInChan(1,args); -} - -NLMISC_COMMAND(2,"talk in 2nd dynamic chat channel"," ") -{ - return talkInChan(2,args); -} - -NLMISC_COMMAND(3,"talk in 3rd dynamic chat channel"," ") -{ - return talkInChan(3,args); -} - -NLMISC_COMMAND(4,"talk in 4th dynamic chat channel"," ") -{ - return talkInChan(4,args); -} - -NLMISC_COMMAND(5,"talk in 5th dynamic chat channel"," ") -{ - return talkInChan(5,args); -} - -NLMISC_COMMAND(6,"talk in 6th dynamic chat channel"," ") -{ - return talkInChan(6,args); -} - -NLMISC_COMMAND(7,"talk in 7th dynamic chat channel"," ") -{ - return talkInChan(7,args); -} - - NLMISC_COMMAND(setItemName, "set name of items, sbrick, etc.."," ") { if (args.size() < 2) return false;