From ad0e9707850b535c63d3da4210366e7244df575d Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 11:32:29 +0800 Subject: [PATCH] UTF-8 chat, ryzom/ryzomcore#335 --- ryzom/client/src/character_cl.cpp | 2 +- ryzom/client/src/client_chat_manager.cpp | 159 +++++++++--------- ryzom/client/src/client_chat_manager.h | 20 +-- ryzom/client/src/commands.cpp | 130 +++++++------- .../src/interface_v3/action_handler_edit.cpp | 4 +- .../src/interface_v3/action_handler_game.cpp | 20 +-- .../src/interface_v3/action_handler_misc.cpp | 4 +- .../src/interface_v3/action_handler_move.cpp | 2 +- .../interface_v3/action_handler_phrase.cpp | 4 +- .../client/src/interface_v3/chat_displayer.h | 2 +- ryzom/client/src/interface_v3/chat_filter.cpp | 17 +- ryzom/client/src/interface_v3/chat_filter.h | 12 +- .../src/interface_v3/chat_text_manager.cpp | 74 ++++---- .../src/interface_v3/chat_text_manager.h | 6 +- ryzom/client/src/interface_v3/chat_window.cpp | 48 +++--- ryzom/client/src/interface_v3/chat_window.h | 12 +- .../client/src/interface_v3/guild_manager.cpp | 10 +- .../src/interface_v3/interface_manager.cpp | 8 +- .../src/interface_v3/interface_manager.h | 4 +- .../src/interface_v3/inventory_manager.cpp | 4 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 14 +- .../client/src/interface_v3/music_player.cpp | 6 +- .../src/interface_v3/people_interraction.cpp | 43 +++-- .../src/interface_v3/people_interraction.h | 4 +- ryzom/client/src/interface_v3/people_list.cpp | 10 +- ryzom/client/src/interface_v3/people_list.h | 4 +- ryzom/client/src/item_group_manager.cpp | 5 +- ryzom/client/src/main_loop.cpp | 6 +- ryzom/client/src/misc.cpp | 32 ++-- ryzom/client/src/misc.h | 6 +- ryzom/client/src/net_manager.cpp | 98 +++++------ ryzom/client/src/user_entity.cpp | 26 +-- .../common/src/game_share/msg_client_server.h | 12 +- 33 files changed, 397 insertions(+), 411 deletions(-) diff --git a/ryzom/client/src/character_cl.cpp b/ryzom/client/src/character_cl.cpp index d68a836de..676bf11f4 100644 --- a/ryzom/client/src/character_cl.cpp +++ b/ryzom/client/src/character_cl.cpp @@ -10367,7 +10367,7 @@ NLMISC_COMMAND(pvpMode, "modify pvp mode", "[ ]") str+="in_safe_zone "; if( pvpMode&PVP_MODE::PvpSafe) str+="safe "; - IM->displaySystemInfo(ucstring(str)); + IM->displaySystemInfo(str); nlinfo(" %s",str.c_str()); } else diff --git a/ryzom/client/src/client_chat_manager.cpp b/ryzom/client/src/client_chat_manager.cpp index 06c9c9776..a6ec40bdd 100644 --- a/ryzom/client/src/client_chat_manager.cpp +++ b/ryzom/client/src/client_chat_manager.cpp @@ -241,7 +241,7 @@ CClientChatManager::CClientChatManager() } //------------------------------------------------------- -const ucstring *CClientChatManager::cycleLastTell() +const string *CClientChatManager::cycleLastTell() { if (_TellPeople.empty()) return NULL; _TellPeople.push_front(_TellPeople.back()); @@ -282,10 +282,10 @@ void CClientChatManager::init( const string& /* staticDBFileName */ ) // chat // //----------------------------------------------- -void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam ) +void CClientChatManager::chat( const string& strIn, bool isChatTeam ) { // Truncate to 255 chars max (because of server restriction) - ucstring str= strIn.substr(0,255); + ucstring str= ucstring(strIn).substr(0,255); // send str to IOS CBitMemStream bms; @@ -303,7 +303,7 @@ void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) { - bms.serial( str ); + bms.serial( str ); // FIXME: UTF-8 NetMngr.push( bms ); //nlinfo("impulseCallBack : %s %s sent", msgType.c_str(), str.toString().c_str()); } @@ -321,11 +321,11 @@ void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam ) // tell // //----------------------------------------------- -void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn ) +void CClientChatManager::tell( const string& receiverIn, const string& strIn ) { // Truncate to 255 chars max (because of server restriction) string receiver= receiverIn.substr(0,255); - ucstring str= strIn.substr(0,255); + ucstring str= ucstring(strIn).substr(0,255); // *** send str CBitMemStream bms; @@ -333,7 +333,7 @@ void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) { bms.serial( receiver ); - bms.serial( str ); + bms.serial( str ); // FIXME: UTF-8 NetMngr.push( bms ); //nlinfo("impulseCallBack : %s %s %s sent", msgType.c_str(), receiver.c_str(), str.toString().c_str()); } @@ -345,10 +345,10 @@ void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn ) // *** manage list of last telled people // remove the telled people from list (if present) - std::list::iterator it = _TellPeople.begin(); + std::list::iterator it = _TellPeople.begin(); while(it != _TellPeople.end()) { - if (*it == ucstring(receiver)) + if (*it == receiver) { it = _TellPeople.erase(it); nlassert(_NumTellPeople != 0); @@ -454,14 +454,14 @@ void CClientChatManager::processTellString(NLMISC::CBitMemStream& bms, IChatDisp // Serial. For tell message, there is no chat mode, coz we know we are in tell mode ! bms.serial (chatMsg.CompressedIndex); bms.serial (chatMsg.SenderNameId); - bms.serial (chatMsg.Content); + bms.serial (chatMsg.Content); // FIXME: UTF-8 if (PermanentlyBanned) return; chatMsg.ChatMode = (uint8) CChatGroup::tell; // If !complete, wait - ucstring senderStr; + string senderStr; bool complete = true; complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); if (!complete) @@ -472,8 +472,8 @@ void CClientChatManager::processTellString(NLMISC::CBitMemStream& bms, IChatDisp } // display - ucstring ucstr; - buildTellSentence(senderStr, chatMsg.Content, ucstr); + string ucstr; + buildTellSentence(senderStr, chatMsg.Content.toUtf8(), ucstr); chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr); } @@ -488,9 +488,9 @@ void CClientChatManager::processFarTellString(NLMISC::CBitMemStream& bms, IChatD if (PermanentlyBanned) return; // display - ucstring ucstr; - buildTellSentence(farTellMsg.SenderName, farTellMsg.Text, ucstr); - chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, farTellMsg.SenderName); + string ucstr; + buildTellSentence(farTellMsg.SenderName.toUtf8(), farTellMsg.Text.toUtf8(), ucstr); + chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, farTellMsg.SenderName.toUtf8()); } @@ -505,7 +505,7 @@ void CClientChatManager::processChatString( NLMISC::CBitMemStream& bms, IChatDis CChatMsg chatMsg; bms.serial( chatMsg ); CChatGroup::TGroupType type = static_cast(chatMsg.ChatMode); - ucstring senderStr; + string senderStr; bool complete = true; complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); @@ -528,9 +528,9 @@ void CClientChatManager::processChatString( NLMISC::CBitMemStream& bms, IChatDis } // display - ucstring ucstr; - buildChatSentence(chatMsg.CompressedIndex, senderStr, chatMsg.Content, type, ucstr); - chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, chatMsg.Content, type, chatMsg.DynChatChanID, senderStr); + string ucstr; + buildChatSentence(chatMsg.CompressedIndex, senderStr, chatMsg.Content.toUtf8(), type, ucstr); + chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, chatMsg.Content.toUtf8(), type, chatMsg.DynChatChanID, senderStr); } @@ -545,8 +545,8 @@ void CClientChatManager::processTellString2(NLMISC::CBitMemStream& bms, IChatDis bms.serial(chatMsg.PhraseId); // if !complete, wait - ucstring senderStr; - ucstring rawMessage; + string senderStr; + string rawMessage; bool complete = true; complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, rawMessage); @@ -558,7 +558,7 @@ void CClientChatManager::processTellString2(NLMISC::CBitMemStream& bms, IChatDis } // display - ucstring ucstr; + string ucstr; buildTellSentence(senderStr, rawMessage, ucstr); chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr); } @@ -571,8 +571,8 @@ void CClientChatManager::processChatString2(NLMISC::CBitMemStream& bms, IChatDis bms.serial( chatMsg ); if (PermanentlyBanned) return; CChatGroup::TGroupType type = static_cast(chatMsg.ChatMode); - ucstring senderStr; - ucstring rawMessage; + string senderStr; + string rawMessage; // here, the type cannot be dyn_chat (no DynChatId in the message) => discard if(type==CChatGroup::dyn_chat) @@ -592,11 +592,11 @@ void CClientChatManager::processChatString2(NLMISC::CBitMemStream& bms, IChatDis return; } - rawMessage += ucstring(" "); - rawMessage += chatMsg.CustomTxt; + rawMessage += " "; + rawMessage += chatMsg.CustomTxt.toUtf8(); // display - ucstring ucstr; + string ucstr; buildChatSentence(chatMsg.CompressedIndex, senderStr, rawMessage, type, ucstr); chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, rawMessage, type, CEntityId::Unknown, senderStr); } @@ -615,7 +615,7 @@ void CClientChatManager::processChatStringWithNoSender( NLMISC::CBitMemStream& b chatMsg.SenderNameId = 0; chatMsg.ChatMode = type; chatMsg.PhraseId = phraseID; - ucstring ucstr; + string ucstr; // if !complete, wait bool complete = STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, ucstr); @@ -627,7 +627,7 @@ void CClientChatManager::processChatStringWithNoSender( NLMISC::CBitMemStream& b } // diplay - ucstring senderName(""); + string senderName; chatDisplayer.displayChat(INVALID_DATASET_INDEX, ucstr, ucstr, type, CEntityId::Unknown, senderName); } @@ -643,7 +643,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer) for( itMsg = _ChatBuffer.begin(); itMsg != _ChatBuffer.end(); ) { CChatGroup::TGroupType type = static_cast(itMsg->ChatMode); - ucstring sender, content; + string sender, content; // all strings received? bool complete = true; @@ -652,7 +652,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer) if(itMsg->UsePhraseId) complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(itMsg->PhraseId, content); else - content= itMsg->Content; + content= itMsg->Content.toUtf8(); if (type == CChatGroup::dyn_chat) { @@ -666,7 +666,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer) // if complete, process if (complete) { - ucstring ucstr; + string ucstr; if (itMsg->SenderNameId == 0) { ucstr = content; @@ -703,7 +703,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer) // getString // //----------------------------------------------- -ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) +string CClientChatManager::getString( CBitMemStream& bms, string& ucstr ) { // deal with parameters @@ -714,8 +714,8 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { // search if a parameter exists in the string sprintf(chTmp,"$%d",dynParamIdx); - ucstring ucstrTmp( chTmp ); - ucstring::size_type idx = ucstr.find(ucstrTmp); + string ucstrTmp( chTmp ); + string::size_type idx = ucstr.find(ucstrTmp); // if there's a parameter in the string if( idx != ucstring::npos ) @@ -728,7 +728,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { bool huff; bms.serialBit(huff); - const ucstring dynStr("???"); + const string dynStr("???"); if( huff ) { nldebug(" receiving huffman dynamic parameter in static string"); @@ -756,8 +756,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { string dynStr; bms.serial( dynStr ); - ucstring ucDynStr(dynStr); - ucstr.replace( idx, ucstrTmp.size()+1, ucDynStr ); + ucstr.replace( idx, ucstrTmp.size()+1, dynStr ); } break; @@ -766,7 +765,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { uint32 nb; bms.serial( nb ); - ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); + ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) ); } break; /* @@ -794,7 +793,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { sint32 nb; bms.serial( nb ); - ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); + ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) ); } break; /* @@ -823,7 +822,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { float nb; bms.serial( nb ); - ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); + ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) ); } break; @@ -849,7 +848,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) // getString // //----------------------------------------------- -bool CClientChatManager::getString( ucstring &result, std::vector& args, const ucstring &ucstrbase ) +bool CClientChatManager::getString( string &result, std::vector& args, const string &ucstrbase ) { result = ucstrbase; @@ -863,17 +862,17 @@ bool CClientChatManager::getString( ucstring &result, std::vector& args, { // search if a parameter exists in the string sprintf(chTmp,"$%d",dynParamIdx); - ucstring ucstrTmp( chTmp ); - ucstring::size_type idx = result.find(ucstrTmp); + string ucstrTmp( chTmp ); + string::size_type idx = result.find(ucstrTmp); // if there's a parameter in the string - if( idx != ucstring::npos ) + if( idx != string::npos ) { - ucstring rep; + string rep; rep = "???"; if (dynParamIdx >= args.size()) { - nlwarning ("Missing args for string '%s', only %d args, need arg %d", ucstrbase.toString().c_str(), args.size(), dynParamIdx); + nlwarning ("Missing args for string '%s', only %d args, need arg %d", ucstrbase.c_str(), args.size(), dynParamIdx); } else { @@ -948,15 +947,15 @@ bool CClientChatManager::getString( ucstring &result, std::vector& args, } // getString // // *************************************************************************** -void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstring &msg, ucstring &result) +void CClientChatManager::buildTellSentence(const string &sender, const string &msg, string &result) { // If no sender name was provided, show only the msg if ( sender.empty() ) result = msg; else { - ucstring name = CEntityCL::removeTitleAndShardFromName(sender.toUtf8()); - ucstring csr; + string name = CEntityCL::removeTitleAndShardFromName(sender); + string csr; // special case where there is only a title, very rare case for some NPC if (name.empty()) @@ -965,29 +964,29 @@ void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstrin CCharacterCL *entity = dynamic_cast(EntitiesMngr.getEntityByName(sender, true, true)); bool bWoman = entity && entity->getGender() == GSGENDER::female; - name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman); + name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); { // Sometimes translation contains another title ucstring::size_type pos = name.find('$'); if (pos != ucstring::npos) { - name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name.toUtf8()), bWoman); + name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name), bWoman); } } } else { // Does the char have a CSR title? - csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring(""); + csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? "(CSR) " : ""; } - result = csr + name + ucstring(" ") + CI18N::get("tellsYou") + ucstring(": ") + msg; + result = csr + name + " " + CI18N::get("tellsYou") + ": " + msg; } } // *************************************************************************** -void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderIndex */, const ucstring &sender, const ucstring &msg, CChatGroup::TGroupType type, ucstring &result) +void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderIndex */, const string &sender, const string &msg, CChatGroup::TGroupType type, string &result) { // if its a tell, then use buildTellSentence if(type==CChatGroup::tell) @@ -1005,35 +1004,35 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde // get the category if any. Note, in some case (chat from other player), there is not categories // and we do not want getStringCategory to return 'SYS' category. - ucstring finalMsg; + string finalMsg; string catStr = getStringCategory(msg, finalMsg, false); - ucstring cat; + string cat; if (!catStr.empty()) - cat = string("&")+catStr+"&"; + cat = "&" + catStr + "&"; - if ( ! cat.empty()) + if (!cat.empty()) { result = msg; return; } // Format the sentence with the provided sender name - ucstring senderName = CEntityCL::removeTitleAndShardFromName(sender.toUtf8()); + string senderName = CEntityCL::removeTitleAndShardFromName(sender); - ucstring csr; + string csr; // Does the char have a CSR title? - csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring(""); + csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? "(CSR) " : ""; - if (UserEntity && senderName.toUtf8() == UserEntity->getDisplayName()) + if (UserEntity && senderName == UserEntity->getDisplayName()) { // The player talks switch(type) { case CChatGroup::shout: - result = cat + csr + CI18N::get("youShout") + ucstring(": ") + finalMsg; + result = cat + csr + CI18N::get("youShout") + ": " + finalMsg; break; default: - result = cat + csr + CI18N::get("youSay") + ucstring(": ") + finalMsg; + result = cat + csr + CI18N::get("youSay") + ": " + finalMsg; break; } } @@ -1046,13 +1045,13 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde // We need the gender to display the correct title bool bWoman = entity && entity->getGender() == GSGENDER::female; - senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman); + senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); { // Sometimes translation contains another title ucstring::size_type pos = senderName.find('$'); if (pos != ucstring::npos) { - senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName.toUtf8()), bWoman); + senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName), bWoman); } } } @@ -1061,10 +1060,10 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde switch(type) { case CChatGroup::shout: - result = cat + csr + senderName + ucstring(" ") + CI18N::get("heShout") + ucstring(": ") + finalMsg; + result = cat + csr + senderName + " " + CI18N::get("heShout") + ": " + finalMsg; break; default: - result = cat + csr + senderName + ucstring(" ") + CI18N::get("heSays") + ucstring(": ") + finalMsg; + result = cat + csr + senderName + " " + CI18N::get("heSays") + ": " + finalMsg; break; } } @@ -1174,7 +1173,7 @@ void CClientChatManager::updateDynamicChatChannels(IChatDisplayer &chatDisplayer class CHandlerTell : public IActionHandler { - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { string receiver = getParam (sParams, "player"); string message; @@ -1219,7 +1218,7 @@ REGISTER_ACTION_HANDLER( CHandlerTell, "tell"); class CHandlerEnterTell : public IActionHandler { - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + void execute (CCtrlBase * /* pCaller */, const string &sParams) { CInterfaceManager *im = CInterfaceManager::getInstance(); string receiver = getParam (sParams, "player"); @@ -1295,7 +1294,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne case CChatGroup::guild: if (guildActive) pUserBut->setHardText("uiFilterGuild"); break; case CChatGroup::dyn_chat: uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChannelDbIndex); - ucstring title; + string title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); if (title.empty()) { @@ -1305,7 +1304,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne } else { - pUserBut->setHardText(title.toUtf8()); + pUserBut->setHardText(title); } break; } @@ -1337,7 +1336,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne class CHandlerTalk : public IActionHandler { - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + void execute (CCtrlBase * /* pCaller */, const string &sParams) { // Param uint mode; @@ -1376,7 +1375,7 @@ class CHandlerTalk : public IActionHandler else { CInterfaceManager *im = CInterfaceManager::getInstance(); - im->displaySystemInfo (ucstring::makeFromUtf8(cmd) + ": " + CI18N::get ("uiCommandNotExists")); + im->displaySystemInfo (cmd + ": " + CI18N::get ("uiCommandNotExists")); } } else @@ -1409,7 +1408,7 @@ REGISTER_ACTION_HANDLER( CHandlerTalk, "talk"); class CHandlerEnterTalk : public IActionHandler { - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + void execute (CCtrlBase * /* pCaller */, const string &sParams) { // Param uint mode; @@ -1436,10 +1435,10 @@ REGISTER_ACTION_HANDLER( CHandlerEnterTalk, "enter_talk"); class CHandlerTalkMessage : public IActionHandler { - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + void execute (CCtrlBase * /* pCaller */, const string &sParams) { // Param - ucstring text = CI18N::get ("uiTalkMemMsg"+sParams); + string text = CI18N::get ("uiTalkMemMsg"+sParams); // Find the base group if (!text.empty()) @@ -1455,7 +1454,7 @@ REGISTER_ACTION_HANDLER( CHandlerTalkMessage, "talk_message"); class CHandlerSwapChatMode : public IActionHandler { - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + void execute (CCtrlBase * /* pCaller */, const string &sParams) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); bool updateCapture= getParam(sParams, "update_capture")=="1"; diff --git a/ryzom/client/src/client_chat_manager.h b/ryzom/client/src/client_chat_manager.h index 2f7decac9..06792a50f 100644 --- a/ryzom/client/src/client_chat_manager.h +++ b/ryzom/client/src/client_chat_manager.h @@ -137,11 +137,11 @@ public: * \param mode in which channel should this message goes * \param dynChatId is valid only if mode==dyn_chat. This the Id of channel (not the index in DB!) */ - virtual void displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer=0) =0; + virtual void displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer=0) =0; /** * display a player tell message */ - virtual void displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName) =0; + virtual void displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName) =0; /** * Clear a channel. * \param dynChatDbIndex is valid only if mode==dyn_chat. Contrary to displayChat, this is the Db Index (0..MaxDynChanPerPlayer) @@ -177,18 +177,18 @@ public : * \param str is the chat content (truncated to 255 char max) * \param isChatTeam special case for Chat TEAM */ - void chat( const ucstring& str, bool isChatTeam = false ); + void chat( const std::string& str, bool isChatTeam = false ); /** * Transmit a chat message to the receiver * \param receiver is the name of the listening char (truncated to 255 char max) * \param str is the chat content (truncated to 255 char max) */ - void tell( const std::string& receiver, const ucstring& str ); + void tell( const std::string& receiver, const std::string& str ); /** Get the last name of the people with which a 'tell' has been done, then move that name at the start of the list */ - const ucstring *cycleLastTell(); + const std::string *cycleLastTell(); /** Set the max number of name in the tell list */ @@ -263,12 +263,12 @@ public : * \param result decoded string * \return true if the string is finalize, false if some param are missing from network */ - bool getString( ucstring &result, std::vector& args, const ucstring& strbase ); + bool getString( std::string &result, std::vector& args, const std::string& strbase ); // build a sentence to be displayed in the chat (e.g add "you say", "you shout", "[user name] says" or "[user name] shout") - static void buildChatSentence(TDataSetIndex compressedSenderIndex, const ucstring &sender, const ucstring &msg, CChatGroup::TGroupType type, ucstring &result); + static void buildChatSentence(TDataSetIndex compressedSenderIndex, const std::string &sender, const std::string &msg, CChatGroup::TGroupType type, std::string &result); // build a sentence to be displayed in the tell - static void buildTellSentence(const ucstring &sender, const ucstring &msg, ucstring &result); + static void buildTellSentence(const std::string &sender, const std::string &msg, std::string &result); /// \name Dynamic Chat channel mgt @@ -338,7 +338,7 @@ private : std::list _ChatBuffer; // peoples - std::list _TellPeople; // the last people on which tells ha been done + std::list _TellPeople; // the last people on which tells ha been done uint _NumTellPeople; uint _MaxNumTellPeople; @@ -361,7 +361,7 @@ private : * \param str string with parameter values at end (str will change after) * \return decoded string (str) */ - ucstring getString( NLMISC::CBitMemStream& bms, ucstring& str ); + std::string getString( NLMISC::CBitMemStream& bms, std::string& str ); }; diff --git a/ryzom/client/src/commands.cpp b/ryzom/client/src/commands.cpp index d3a6a2df6..3fea9a2a7 100644 --- a/ryzom/client/src/commands.cpp +++ b/ryzom/client/src/commands.cpp @@ -240,20 +240,18 @@ NLMISC_COMMAND(equipGroup, "equip group ", "name") } if(CItemGroupManager::getInstance()->equipGroup(args[0])) { - ucstring msg = CI18N::get("cmdEquipGroupSuccess"); + string msg = CI18N::get("cmdEquipGroupSuccess"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return true; } else { - ucstring msg = CI18N::get("cmdEquipGroupError"); + string msg = CI18N::get("cmdEquipGroupError"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return false; @@ -274,10 +272,9 @@ NLMISC_COMMAND(moveGroup, "move group to ", "name dst") if(CItemGroupManager::getInstance()->moveGroup(args[0], INVENTORIES::toInventory(args[1]))) { - ucstring msg = CI18N::get("cmdMoveGroupSuccess"); + string msg = CI18N::get("cmdMoveGroupSuccess"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%inventory", args[1]); pIM->displaySystemInfo(msg); @@ -285,10 +282,9 @@ NLMISC_COMMAND(moveGroup, "move group to ", "name dst") } else { - ucstring msg = CI18N::get("cmdMoveGroupError"); + string msg = CI18N::get("cmdMoveGroupError"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%inventory", args[1]); pIM->displaySystemInfo(msg); @@ -312,24 +308,22 @@ NLMISC_COMMAND(createGroup, "create group [true](create a for ev removeUnequiped = !args[1].empty(); if(CItemGroupManager::getInstance()->createGroup(args[0], removeUnequiped)) { - ucstring msg; + string msg; if(removeUnequiped) msg = CI18N::get("cmdCreateGroupSuccess2"); else msg = CI18N::get("cmdCreateGroupSuccess1"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return true; } else { - ucstring msg = CI18N::get("cmdCreateGroupError"); + string msg = CI18N::get("cmdCreateGroupError"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return false; @@ -350,20 +344,18 @@ NLMISC_COMMAND(deleteGroup, "delete group ", "name") } if(CItemGroupManager::getInstance()->deleteGroup(args[0])) { - ucstring msg = CI18N::get("cmdDeleteGroupSuccess"); + string msg = CI18N::get("cmdDeleteGroupSuccess"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return true; } else { - ucstring msg = CI18N::get("cmdDeleteGroupError"); + string msg = CI18N::get("cmdDeleteGroupError"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return false; @@ -494,7 +486,7 @@ NLMISC_COMMAND(random, "Roll a dice and say the result around","[] [h if (!randomFromString(args[0], max)) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("uiRandomBadParameter"); + string msg = CI18N::get("uiRandomBadParameter"); strFindReplace(msg, "%s", args[0] ); pIM->displaySystemInfo(msg); return false; @@ -504,7 +496,7 @@ NLMISC_COMMAND(random, "Roll a dice and say the result around","[] [h if (!randomFromString(args[1], min)) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("uiRandomBadParameter"); + string msg = CI18N::get("uiRandomBadParameter"); strFindReplace(msg, "%s", args[1] ); pIM->displaySystemInfo(msg); return false; @@ -544,7 +536,7 @@ NLMISC_COMMAND(dumpShapePos, "Dump Last Added Shape Pos.", "") CInterfaceManager *IM = CInterfaceManager::getInstance(); CVector pos = ShapeAddedByCommand.back().getPos(); - IM->displaySystemInfo(ucstring(toString("Shape Pos = %f, %f, %f", pos.x, pos.y, pos.z))); + IM->displaySystemInfo(toString("Shape Pos = %f, %f, %f", pos.x, pos.y, pos.z)); return true; } //----------------------------------------------- @@ -1096,11 +1088,11 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic" { // Help CInterfaceManager *IM = CInterfaceManager::getInstance(); - IM->displaySystemInfo(ucstring("This command need 1 parameter :")); - IM->displaySystemInfo(ucstring(" :")); - IM->displaySystemInfo(ucstring("- none(to remove all verboses)")); - IM->displaySystemInfo(ucstring("- magic(to add debug infos about magic)")); - IM->displaySystemInfo(ucstring("- anim (to add debug infos about animation)")); + IM->displaySystemInfo("This command need 1 parameter :"); + IM->displaySystemInfo(" :"); + IM->displaySystemInfo("- none(to remove all verboses)"); + IM->displaySystemInfo("- magic(to add debug infos about magic)"); + IM->displaySystemInfo("- anim (to add debug infos about animation)"); } else { @@ -1114,11 +1106,11 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic" else { CInterfaceManager *IM = CInterfaceManager::getInstance(); - IM->displaySystemInfo(ucstring("This command need 1 parameter :")); - IM->displaySystemInfo(ucstring(" :")); - IM->displaySystemInfo(ucstring("- none(to remove all verboses)")); - IM->displaySystemInfo(ucstring("- magic(to add debug infos about magic)")); - IM->displaySystemInfo(ucstring("- anim (to add debug infos about animation)")); + IM->displaySystemInfo("This command need 1 parameter :"); + IM->displaySystemInfo(" :"); + IM->displaySystemInfo("- none(to remove all verboses)"); + IM->displaySystemInfo("- magic(to add debug infos about magic)"); + IM->displaySystemInfo("- anim (to add debug infos about animation)"); } } return true; @@ -1323,7 +1315,7 @@ NLMISC_COMMAND(execScript, "Execute a script file (.cmd)","") } else { - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("Cannot open file")); + CInterfaceManager::getInstance()->displaySystemInfo("Cannot open file"); } return true; @@ -1368,7 +1360,7 @@ NLMISC_COMMAND(db, "Modify Database"," ") { sint64 prop = node->getValue64(); string str = toString(prop); - pIM->displaySystemInfo(ucstring(str)); + pIM->displaySystemInfo(str); nlinfo("%s", str.c_str()); } else @@ -1722,7 +1714,7 @@ NLMISC_COMMAND(getSheetId, "get_sheet_id","") return false; CSheetId id(args[0]); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(toString(id.asInt()))); + CInterfaceManager::getInstance()->displaySystemInfo(toString(id.asInt())); return true; } @@ -1737,7 +1729,7 @@ NLMISC_COMMAND(getSheetName, "get_sheet_name","") string name = id.toString(); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(name)); + CInterfaceManager::getInstance()->displaySystemInfo(name); return true; } @@ -2388,7 +2380,7 @@ NLMISC_COMMAND(sheet2idx, "Return the index of a sheet", " displaySystemInfo(ucstring(result)); + IM->displaySystemInfo(result); nlinfo("'sheet2idx': %s", result.c_str()); return true; } @@ -2411,7 +2403,7 @@ NLMISC_COMMAND(dynstr, "display a dyn string value", "") uint dynId; fromString(args[0], dynId); - ucstring result; + string result; STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynId, result); CInterfaceManager::getInstance()->displaySystemInfo(result); @@ -2426,7 +2418,7 @@ NLMISC_COMMAND(serverstr, "display a server string value", "getString(dynId, result); CInterfaceManager::getInstance()->displaySystemInfo(result); @@ -2510,11 +2502,11 @@ NLMISC_COMMAND(mode, "Change the mode for an entity in a slot", " [ if(args.size() < 2) { // Help - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 paramters :")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the slot number of the entity to change")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the mode wanted for the entity, one of the following number :")); + CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 paramters :"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the slot number of the entity to change"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the mode wanted for the entity, one of the following number :"); for(uint i = 0; idisplaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::modeToString((MBEHAV::EMode)i).c_str()))); + CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::modeToString((MBEHAV::EMode)i).c_str())); } // Right parameters number else @@ -2544,7 +2536,7 @@ NLMISC_COMMAND(mode, "Change the mode for an entity in a slot", " [ } // Invalid slot. else - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); + CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot"); } // Command well done. @@ -2557,12 +2549,12 @@ NLMISC_COMMAND(behaviour, "Change the behaviour for an entity in a slot", " 6) { // Help - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 to 6 paramters :")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the slot number of the entity to change")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the behaviour to play for the entity, one of the following number :")); + CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 to 6 paramters :"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the slot number of the entity to change"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the behaviour to play for the entity, one of the following number :"); for(uint i = 0; idisplaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i).c_str()))); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END))); + CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i).c_str())); + CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END)); } else { @@ -2633,7 +2625,7 @@ NLMISC_COMMAND(behaviour, "Change the behaviour for an entity in a slot", "updateVisualProperty(NetMngr.getCurrentServerTick()+dt, CLFECOMMON::PROPERTY_BEHAVIOUR); } else - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); + CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot"); } // Command well done. @@ -2782,7 +2774,7 @@ NLMISC_COMMAND(spell, "Cast a spell", "\n" entity->updateVisualProperty(NetMngr.getCurrentServerTick()+50, CLFECOMMON::PROPERTY_BEHAVIOUR); } else - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); + CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot"); } // Command well done. @@ -4005,7 +3997,7 @@ NLMISC_COMMAND(displayInventoryCounter, "display the Inventory counter to compar srvVal&= pIM->getLocalSyncActionCounterMask(); locVal&= pIM->getLocalSyncActionCounterMask(); - pIM->displaySystemInfo(ucstring( "ServerCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); + pIM->displaySystemInfo("ServerCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)); // Well done. return true; @@ -4023,7 +4015,7 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "") srvVal&= PHRASE_EXECUTE_COUNTER_MASK; locVal&= PHRASE_EXECUTE_COUNTER_MASK; - pIM->displaySystemInfo(ucstring( "NextCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); + pIM->displaySystemInfo("NextCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)); // cycle srvVal= NLGUI::CDBManager::getInstance()->getDbProp(PHRASE_DB_COUNTER_CYCLE)->getValue32(); @@ -4031,7 +4023,7 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "") srvVal&= PHRASE_EXECUTE_COUNTER_MASK; locVal&= PHRASE_EXECUTE_COUNTER_MASK; - pIM->displaySystemInfo(ucstring( "CycleCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); + pIM->displaySystemInfo("CycleCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)); return true; } @@ -4114,7 +4106,7 @@ NLMISC_COMMAND(skillToInt, "Convert a skill to an int", "") { if (args.size() != 1) return false; CInterfaceManager *im = CInterfaceManager::getInstance(); - im->displaySystemInfo(ucstring(toString((uint) SKILLS::toSkill(args[0])))); + im->displaySystemInfo(toString((uint) SKILLS::toSkill(args[0]))); return true; } @@ -4520,7 +4512,7 @@ NLMISC_COMMAND(getSkillValue, "get a skill value by its name", "skill_name") CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:SKILL", skillId), false); if(node) { - pIM->displaySystemInfo(ucstring(toString(node->getValue32()))); + pIM->displaySystemInfo(toString(node->getValue32())); } return true; @@ -4550,7 +4542,7 @@ NLMISC_COMMAND(getBaseSkillValue, "get a baseskill value by its name", "skill_na CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:BaseSKILL", skillId), false); if(node) { - pIM->displaySystemInfo(ucstring(toString(node->getValue32()))); + pIM->displaySystemInfo(toString(node->getValue32())); } return true; @@ -4812,7 +4804,7 @@ NLMISC_COMMAND(stick_log, "", "") skel->getStickedObjects(sticks); nlinfo("StickedModels: %d", sticks.size()); - pIM->displaySystemInfo(ucstring(toString("StickedModels: %d", sticks.size()))); + pIM->displaySystemInfo(toString("StickedModels: %d", sticks.size())); for(uint i=0;i= args.size()) { // Not enough arguments - pIM->displaySystemInfo (ucstring(CommandName+" : ")+CI18N::get ("uiCommandWrongArgumentCount")); + pIM->displaySystemInfo (CommandName+" : "+CI18N::get ("uiCommandWrongArgumentCount")); return false; } else @@ -5414,7 +5406,7 @@ bool CUserCommand::execute(const std::string &/* rawCommandString */, const std: else { // Not enough argument - pIM->displaySystemInfo (ucstring(CommandName+" : ")+CI18N::get ("uiCommandWrongArgumentCount")); + pIM->displaySystemInfo (CommandName+" : "+CI18N::get ("uiCommandWrongArgumentCount")); return false; } return true; @@ -5658,7 +5650,7 @@ NLMISC_COMMAND(tickToDate, "convert a tick value into a readable ryzom time", "" CInterfaceManager *im = CInterfaceManager::getInstance(); float ryTime = rt.getRyzomTime(); std::string readableDate = toString("Day = %d, hour = %d:%d", rt.getRyzomDay(), (int) floorf(ryTime), (int) floorf(60.f * fmodf(ryTime, 1.f))); - im->displaySystemInfo(ucstring(readableDate)); + im->displaySystemInfo(readableDate); return true; } @@ -5930,7 +5922,7 @@ NLMISC_COMMAND(time, "Shows information about the current time", "") tm = gmtime(&date); strftime(cs_utc, size, "%X", tm); - ucstring msg = CI18N::get("uiCurrentLocalAndUtcTime"); + string msg = CI18N::get("uiCurrentLocalAndUtcTime"); strFindReplace(msg, "%local", cs_local); strFindReplace(msg, "%utc", cs_utc); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); @@ -5939,7 +5931,7 @@ NLMISC_COMMAND(time, "Shows information about the current time", "") NLMISC_COMMAND(playedTime, "Display character played time", "") { - ucstring msg = CI18N::get("uiPlayedTime"); + string msg = CI18N::get("uiPlayedTime"); strFindReplace(msg, "%time", NLMISC::secondsToHumanReadable(CharPlayedTime)); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); return true; @@ -5947,7 +5939,7 @@ NLMISC_COMMAND(playedTime, "Display character played time", "") NLMISC_COMMAND(version, "Display client version", "") { - ucstring msg = getDebugVersion(); + string msg = getDebugVersion(); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); return true; } diff --git a/ryzom/client/src/interface_v3/action_handler_edit.cpp b/ryzom/client/src/interface_v3/action_handler_edit.cpp index ffca45406..1f3b7ee4f 100644 --- a/ryzom/client/src/interface_v3/action_handler_edit.cpp +++ b/ryzom/client/src/interface_v3/action_handler_edit.cpp @@ -647,7 +647,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit CInterfaceManager *im = CInterfaceManager::getInstance(); if (!im->isInGame()) return; // there was no / at the start of the line so try to cycle through the last people on which a tell was done - const ucstring *lastTellPeople = ChatMngr.cycleLastTell(); + const string *lastTellPeople = ChatMngr.cycleLastTell(); if (!lastTellPeople) return; // Get chat box from ist edit box // If it isn't a user chat or the main chat, just display 'tell' with the name. Otherwise, change the target of the window @@ -661,7 +661,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit else { // it is not a filtered chat, display 'tell' (must be ingame) - _GroupEdit->setCommand("tell " + (*lastTellPeople).toUtf8() + ' ', false); + _GroupEdit->setCommand("tell " + (*lastTellPeople) + ' ', false); } } }; diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 4da75a8da..d574a7248 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -1358,19 +1358,19 @@ class CSelectItemSheet : public IActionHandler // display msg in the system infos if (!canUse) { - ucstring msg = CI18N::get("msgCantUseItem"); + string msg = CI18N::get("msgCantUseItem"); string cat = getStringCategory(msg, msg); im->displaySystemInfo(msg, cat); } if (!canBuild) { - ucstring msg = CI18N::get("msgCantBuild"); + string msg = CI18N::get("msgCantBuild"); string cat = getStringCategory(msg, msg); im->displaySystemInfo(msg, cat); } if (!canUseBuiltItem) { - ucstring msg = CI18N::get("msgCantUseBuiltItem"); + string msg = CI18N::get("msgCantUseBuiltItem"); string cat = getStringCategory(msg, msg); im->displaySystemInfo(msg, cat); } @@ -3797,7 +3797,7 @@ class CHandlerSetInterfaceScale : public IActionHandler } } - ucstring help("/setuiscale "+toString("%.1f .. %.1f", ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max)); + string help = "/setuiscale "+toString("%.1f .. %.1f", ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max); CInterfaceManager::getInstance()->displaySystemInfo(help); } }; @@ -3981,7 +3981,7 @@ public: // display parry mode msg CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgUserModeParry"); + string msg = CI18N::get("msgUserModeParry"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); } @@ -3998,7 +3998,7 @@ public: // display dodge mode msg CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgUserModeDodge"); + string msg = CI18N::get("msgUserModeDodge"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); } @@ -4533,7 +4533,7 @@ public: if( sCustomPhrase.empty() ) { // Create the message and send. - const string msgName = "COMMAND:EMOTE"; + static const string msgName = "COMMAND:EMOTE"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4548,7 +4548,7 @@ public: else { // Create the message and send. - const string msgName = "COMMAND:CUSTOM_EMOTE"; + static const string msgName = "COMMAND:CUSTOM_EMOTE"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4561,7 +4561,7 @@ public: { // display "no animation for emote" CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgCustomizedEmoteNoAnim"); + string msg = CI18N::get("msgCustomizedEmoteNoAnim"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); return; @@ -4573,7 +4573,7 @@ public: } out.serialEnum(behavToSend); - out.serial(ucstr); + out.serial(ucstr); // FIXME: UTF-8 (serial) NetMngr.push(out); //nlinfo("impulseCallBack : %s %d %s sent", msgName.c_str(), (uint32)behavToSend, sCustomPhrase.c_str()); } diff --git a/ryzom/client/src/interface_v3/action_handler_misc.cpp b/ryzom/client/src/interface_v3/action_handler_misc.cpp index 8190ab799..d6d41e32b 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -598,7 +598,7 @@ void getBuffer (CBitmap &btm) void displayScreenShotSavedInfo(const string &filename) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg("'" + filename + "' " + CI18N::get("uiScreenshotSaved")); + string msg = "'" + filename + "' " + CI18N::get("uiScreenshotSaved"); pIM->displaySystemInfo(msg); } @@ -885,7 +885,7 @@ class CAHCycleTell : public IActionHandler { CInterfaceManager *im = CInterfaceManager::getInstance(); if (!im->isInGame()) return; - const ucstring *lastTellPeople = ChatMngr.cycleLastTell(); + const string *lastTellPeople = ChatMngr.cycleLastTell(); if (!lastTellPeople) return; // just popup the main chat //CChatWindow *w = PeopleInterraction.MainChat.Window; diff --git a/ryzom/client/src/interface_v3/action_handler_move.cpp b/ryzom/client/src/interface_v3/action_handler_move.cpp index cbdfb9491..415dedbbc 100644 --- a/ryzom/client/src/interface_v3/action_handler_move.cpp +++ b/ryzom/client/src/interface_v3/action_handler_move.cpp @@ -441,7 +441,7 @@ class CAHToggleDodgeParry : public IActionHandler virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg; + string msg; // 0 - dodge mode // 1 - parry mode if (NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DEFENSE:DEFENSE_MODE")->getValue32() == 0) diff --git a/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 033f99bbf..56382bf54 100644 --- a/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1173,7 +1173,7 @@ public: { // display "you can't cast while moving" CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgNoCastWhileMoving"); + string msg = CI18N::get("msgNoCastWhileMoving"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); return; @@ -1417,7 +1417,7 @@ public: else { // debug: - pIM->displaySystemInfo( ucstring("PHRASE:CANCEL_ALL") ); + pIM->displaySystemInfo("PHRASE:CANCEL_ALL"); } } }; diff --git a/ryzom/client/src/interface_v3/chat_displayer.h b/ryzom/client/src/interface_v3/chat_displayer.h index a3218670d..217b4beb8 100644 --- a/ryzom/client/src/interface_v3/chat_displayer.h +++ b/ryzom/client/src/interface_v3/chat_displayer.h @@ -97,7 +97,7 @@ public: std::vector &rVal = acces.value (); for (uint i = 0; i < rVal.size(); ++i) { - CInterfaceManager::getInstance()->displayDebugInfo(ucstring(rVal[i].Str), rVal[i].Mode); + CInterfaceManager::getInstance()->displayDebugInfo(rVal[i].Str, rVal[i].Mode); } rVal.clear(); } diff --git a/ryzom/client/src/interface_v3/chat_filter.cpp b/ryzom/client/src/interface_v3/chat_filter.cpp index a5fd04c5b..237106170 100644 --- a/ryzom/client/src/interface_v3/chat_filter.cpp +++ b/ryzom/client/src/interface_v3/chat_filter.cpp @@ -170,7 +170,7 @@ void CChatInputFilter::chatWindowRemoved(CChatWindow *cw) } //============================================================================================================= -void CChatInputFilter::displayMessage(const ucstring &msg, NLMISC::CRGBA col, uint numBlinks /*=0*/, bool *windowVisible) +void CChatInputFilter::displayMessage(const string &msg, NLMISC::CRGBA col, uint numBlinks /*=0*/, bool *windowVisible) { bool windowVisibleTmp = false; std::vector::iterator it; @@ -187,10 +187,9 @@ void CChatInputFilter::displayMessage(const ucstring &msg, NLMISC::CRGBA col, ui } //============================================================================================================= -void CChatInputFilter::displayTellMessage(/*TDataSetIndex &receiverIndex, */const ucstring &msg, const ucstring &sender, NLMISC::CRGBA col, uint numBlinks /*=0*/,bool *windowVisible /*=NULL*/) +void CChatInputFilter::displayTellMessage(/*TDataSetIndex &receiverIndex, */const string &msg, const string &sender, NLMISC::CRGBA col, uint numBlinks /*=0*/,bool *windowVisible /*=NULL*/) { - ucstring senderLwr; - senderLwr.fromUtf8(NLMISC::toLower(sender.toUtf8())); + string senderLwr = NLMISC::toLower(sender); // look in people lists std::vector::iterator peopleListIt; @@ -290,7 +289,7 @@ void CChatTargetFilter::setChat(CChatWindow *w) } //============================================================================================================= -void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow) +void CChatTargetFilter::msgEntered(const string &msg, CChatWindow *chatWindow) { // Common Target case if (ClientCfg.Local) @@ -307,9 +306,9 @@ void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow) else if (!_TargetPlayer.empty()) { // the target must be a player, make a tell on him - ChatMngr.tell(_TargetPlayer.toString(), msg); + ChatMngr.tell(_TargetPlayer, msg); // direct output in the chat - chatWindow->displayLocalPlayerTell(_TargetPlayer.toString(), msg); + chatWindow->displayLocalPlayerTell(_TargetPlayer, msg); } else { @@ -334,7 +333,7 @@ void CChatTargetFilter::setTargetPartyChat(CChatWindow *w) } //============================================================================================================= -void CChatTargetFilter::setTargetPlayer(const ucstring &targetPlayer) +void CChatTargetFilter::setTargetPlayer(const string &targetPlayer) { _TargetPlayer = targetPlayer; if (_TargetPartyChat) @@ -345,7 +344,7 @@ void CChatTargetFilter::setTargetPlayer(const ucstring &targetPlayer) // set the prompt if (_Chat) { - _Chat->setPrompt(targetPlayer + (ucchar) '>'); + _Chat->setPrompt(targetPlayer + '>'); } } diff --git a/ryzom/client/src/interface_v3/chat_filter.h b/ryzom/client/src/interface_v3/chat_filter.h index aeff77afc..317069899 100644 --- a/ryzom/client/src/interface_v3/chat_filter.h +++ b/ryzom/client/src/interface_v3/chat_filter.h @@ -42,10 +42,10 @@ public: * Listening windows will blick only if there isnt a single visible listening window, so that the player can know if there's a message * \param windowVisible is not NULL, points a bool that will be filled with true if one of the window on the which the msg was displayed is visible. */ - void displayMessage(const ucstring &msg, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); + void displayMessage(const std::string &msg, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); /** The same as displayMessage, but with sender name, so that the msg will be displayed in attached people lists as well */ - void displayTellMessage(/*TDataSetIndex &senderIndex, */const ucstring &msg, const ucstring &sender, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); + void displayTellMessage(/*TDataSetIndex &senderIndex, */const std::string &msg, const std::string &sender, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); /** Clear the messages in all registered chat windows */ void clearMessages(); @@ -134,8 +134,8 @@ public: /** Set a player as the target. This remove any previous window target * NB : this replace any previous party chat or target group or player */ - void setTargetPlayer(const ucstring &targetPlayer); - const ucstring &getTargetPlayer() const { return _TargetPlayer; } + void setTargetPlayer(const std::string &targetPlayer); + const std::string &getTargetPlayer() const { return _TargetPlayer; } //@} private: @@ -148,14 +148,14 @@ private: // @{ CChatWindow *_TargetPartyChat; // the target party chat CChatGroup::TGroupType _TargetGroup; - ucstring _TargetPlayer; + std::string _TargetPlayer; // relevant only if _TargetGroup==dyn_chat uint32 _TargetDynamicChannelDbIndex; // @} private: // from IChatWindowListener void chatWindowRemoved(CChatWindow *cw); - void msgEntered(const ucstring &msg, CChatWindow *chatWindow); + void msgEntered(const std::string &msg, CChatWindow *chatWindow); // copy not supported CChatTargetFilter(const CChatTargetFilter &/* other */):NLMISC::CRefCount() { nlassert(0); } CChatTargetFilter& operator=(const CChatTargetFilter &/* other */) { nlassert(0); return *this; } diff --git a/ryzom/client/src/interface_v3/chat_text_manager.cpp b/ryzom/client/src/interface_v3/chat_text_manager.cpp index dff2da28c..3e99cd8b5 100644 --- a/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -106,15 +106,13 @@ bool CChatTextManager::showTimestamps() const } //================================================================================= -static CInterfaceGroup *parseCommandTag(ucstring &line) +static CInterfaceGroup *parseCommandTag(string &line) { - string::size_type start = line.find(ucstring("/$$")); + string::size_type start = line.find("/$$"); if (start == string::npos) return NULL; - string::size_type end = line.find(ucstring("$$/"), start + 3); + string::size_type end = line.find("$$/", start + 3); if (end == string::npos) return NULL; - std::string commandLine; - ucstring ucCommandLine = line.substr(start + 3, end - start - 3); - ucCommandLine.toString(commandLine); + std::string commandLine = line.substr(start + 3, end - start - 3); line = line.substr(0, start) + line.substr(end +3); vector params; explode(commandLine, std::string("|"), params); @@ -221,11 +219,11 @@ static inline bool isUrlTag(const ucstring &s, ucstring::size_type index, ucstri // *************************************************************************** // isUrlTag must match -static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucstring &url, ucstring &title) +static inline void getUrlTag(const string &s, string::size_type &index, string &url, string &title) { bool isMarkdown = false; - ucstring::size_type textSize = s.size(); - ucstring::size_type pos; + string::size_type textSize = s.size(); + string::size_type pos; // see if we have markdown format if (s[index] == '(') @@ -250,8 +248,8 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst } } - ucchar chOpen = ' '; - ucchar chClose = ' '; + char chOpen = ' '; + char chClose = ' '; if (isMarkdown) { chOpen = '['; @@ -272,7 +270,7 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst pos = s.find_first_of(chClose, index); // handle common special case: 'text http://.../, text' - if (pos != ucstring::npos && index > 0) + if (pos != string::npos && index > 0) { if (s[index-1] == ' ' && (s[pos-1] == ',' || s[pos-1] == '.')) { @@ -308,7 +306,7 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst } // fallback to full string length as we did match http:// already and url spans to the end probably - if (pos == ucstring::npos) + if (pos == string::npos) { pos = textSize; } @@ -321,22 +319,22 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst } //================================================================================= -static void prependTimestamp(ucstring &msg) +static void prependTimestamp(string &msg) { - ucstring cur_time; + string cur_time; CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_CLOCK_12H", false); if (node && node->getValueBool()) cur_time = CInterfaceManager::getTimestampHuman("[%I:%M:%S %p] "); else cur_time = CInterfaceManager::getTimestampHuman(); - ucstring::size_type codePos = msg.find(ucstring("@{")); - if (codePos != ucstring::npos) + string::size_type codePos = msg.find("@{"); + if (codePos != string::npos) { // Prepend the current time (do it after the color if the color at first position. if (codePos == 0) { - codePos = msg.find(ucstring("}")); + codePos = msg.find(string("}")); msg = msg.substr(0, codePos + 1) + cur_time + msg.substr(codePos + 1, msg.length() - codePos); } else @@ -351,9 +349,9 @@ static void prependTimestamp(ucstring &msg) } //================================================================================= -CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA col, bool justified /*=false*/, bool plaintext /*=false*/) +CViewBase *CChatTextManager::createMsgText(const string &cstMsg, NLMISC::CRGBA col, bool justified /*=false*/, bool plaintext /*=false*/) { - ucstring msg = cstMsg; + string msg = cstMsg; CInterfaceGroup *commandGroup = parseCommandTag(msg); if (showTimestamps()) @@ -365,7 +363,7 @@ CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA } //================================================================================= -CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CRGBA col, bool justified, CInterfaceGroup *commandGroup) +CViewBase *CChatTextManager::createMsgTextSimple(const string &msg, NLMISC::CRGBA col, bool justified, CInterfaceGroup *commandGroup) { CViewText *vt = new CViewText(CViewText::TCtorParam()); // get parameters from config.xml @@ -379,14 +377,14 @@ CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CR // if text contain any color code, set the text formated and white, // otherwise, set text normal and apply global color - if (msg.find(ucstring("@{")) != ucstring::npos) + if (msg.find("@{") != string::npos) { - vt->setTextFormatTaged(msg.toUtf8()); + vt->setTextFormatTaged(msg); vt->setColor(NLMISC::CRGBA::White); } else { - vt->setText(msg.toUtf8()); + vt->setText(msg); vt->setColor(col); } @@ -401,9 +399,9 @@ CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CR } //================================================================================= -CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::CRGBA col, bool justified, bool plaintext, CInterfaceGroup *commandGroup) +CViewBase *CChatTextManager::createMsgTextComplex(const string &msg, NLMISC::CRGBA col, bool justified, bool plaintext, CInterfaceGroup *commandGroup) { - ucstring::size_type textSize = msg.size(); + string::size_type textSize = msg.size(); CGroupParagraph *para = new CGroupParagraph(CViewBase::TCtorParam()); para->setId("line"); @@ -412,7 +410,7 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C // use right click because left click might be used to activate chat window para->setRightClickHandler("copy_chat_popup"); - para->setRightClickHandlerParams(msg.toUtf8()); + para->setRightClickHandlerParams(msg); if (plaintext) { @@ -427,12 +425,12 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C // quickly check if text has links or not bool hasUrl; { - ucstring s = toLower(msg); - hasUrl = (s.find(ucstring("http://")) || s.find(ucstring("https://"))); + string s = toLower(msg); + hasUrl = (s.find("http://") || s.find("https://")); } - ucstring::size_type pos = 0; - for (ucstring::size_type i = 0; i< textSize;) + string::size_type pos = 0; + for (string::size_type i = 0; i< textSize;) { if (hasUrl && isUrlTag(msg, i, textSize)) { @@ -442,8 +440,8 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C para->addChild(vt); } - ucstring url; - ucstring title; + string url; + string title; getUrlTag(msg, i, url, title); if (url.size() > 0) { @@ -465,29 +463,29 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C if (title.size() > 0) { - vt->LinkTitle = title.toUtf8(); + vt->LinkTitle = title; vt->setText(vt->LinkTitle); } else { - vt->LinkTitle = url.toUtf8(); + vt->LinkTitle = url; vt->setText(vt->LinkTitle); } if (url.find_first_of('\'') != string::npos) { - ucstring clean; + string clean; for(string::size_type i = 0; i< url.size(); ++i) { if (url[i] == '\'') - clean += ucstring("%27"); + clean += "%27"; else clean += url[i]; } url = clean; } vt->setActionOnLeftClick("lua"); - vt->setParamsOnLeftClick("game:chatUrl('" + url.toUtf8() + "')"); + vt->setParamsOnLeftClick("game:chatUrl('" + url + "')"); para->addChildLink(vt); diff --git a/ryzom/client/src/interface_v3/chat_text_manager.h b/ryzom/client/src/interface_v3/chat_text_manager.h index 2f7e380be..1cf66730e 100644 --- a/ryzom/client/src/interface_v3/chat_text_manager.h +++ b/ryzom/client/src/interface_v3/chat_text_manager.h @@ -55,7 +55,7 @@ public: * \param justified Should be true for justified text (stretch spaces of line to fill the full width) * \param plaintext Text will not be parsed for uri markup links */ - NLGUI::CViewBase *createMsgText(const ucstring &msg, NLMISC::CRGBA col, bool justified = false, bool plaintext = false); + NLGUI::CViewBase *createMsgText(const std::string &msg, NLMISC::CRGBA col, bool justified = false, bool plaintext = false); // Singleton access static CChatTextManager &getInstance(); @@ -79,8 +79,8 @@ private: bool showTimestamps() const; - NLGUI::CViewBase *createMsgTextSimple(const ucstring &msg, NLMISC::CRGBA col, bool justified, NLGUI::CInterfaceGroup *commandGroup); - NLGUI::CViewBase *createMsgTextComplex(const ucstring &msg, NLMISC::CRGBA col, bool justified, bool plaintext, NLGUI::CInterfaceGroup *commandGroup); + NLGUI::CViewBase *createMsgTextSimple(const std::string &msg, NLMISC::CRGBA col, bool justified, NLGUI::CInterfaceGroup *commandGroup); + NLGUI::CViewBase *createMsgTextComplex(const std::string &msg, NLMISC::CRGBA col, bool justified, bool plaintext, NLGUI::CInterfaceGroup *commandGroup); }; // shortcut to get text manager instance diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index 8d7551803..eef48509e 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -204,11 +204,11 @@ bool CChatWindow::isVisible() const } //================================================================================= -void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/) +void CChatWindow::displayMessage(const string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/) { if (!_Chat) { - if (msg.toUtf8() != "WRN: There's no global chat") + if (msg != "WRN: There's no global chat") nlwarning(" There's no global chat"); return; } @@ -538,11 +538,11 @@ void CChatWindow::clearMessages(CChatGroup::TGroupType /* gt */, uint32 /* dynam // CChatGroupWindow // ////////////////////// -void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks, bool *windowVisible) +void CChatGroupWindow::displayMessage(const string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks, bool *windowVisible) { if (!_Chat) { - if (msg.toUtf8() != "WRN: There's no global chat") + if (msg != "WRN: There's no global chat") nlwarning(" There's no global chat"); return; } @@ -563,8 +563,8 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC CInterfaceManager *pIM= CInterfaceManager::getInstance(); CRGBA newMsgColor= CRGBA::stringToRGBA(CWidgetManager::getInstance()->getParser()->getDefine("chat_group_tab_color_newmsg").c_str()); - ucstring newmsg = msg; - ucstring prefix; + string newmsg = msg; + string prefix; if (gl != NULL) { @@ -599,20 +599,20 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC gl = gl2; // Add dyn chan number before string - ucstring prefix("[" + NLMISC::toString(dynamicChatDbIndex) + "]"); + string prefix = "[" + NLMISC::toString(dynamicChatDbIndex) + "]"; // Find position to put the new string // After timestamp? - size_t pos = newmsg.find(ucstring("]")); - size_t colonpos = newmsg.find(ucstring(": @{")); + size_t pos = newmsg.find("]"); + size_t colonpos = newmsg.find(": @{"); // If no ] found or if found but after the colon (so part of the user chat) - if (pos == ucstring::npos || (colonpos < pos)) + if (pos == string::npos || (colonpos < pos)) { // No timestamp, so put it right after the color and add a space - pos = newmsg.find(ucstring("}")); + pos = newmsg.find("}"); prefix += " "; } - if (pos == ucstring::npos) + if (pos == string::npos) newmsg = prefix + newmsg; else newmsg = newmsg.substr(0, pos + 1) + prefix + newmsg.substr(pos + 1); @@ -622,10 +622,10 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC if (node && node->getValueBool()) { uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChatDbIndex); - ucstring title; + string title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); - prefix = title.empty() ? ucstring("") : ucstring(" ") + title; - pos = newmsg.find(ucstring("] ")); + prefix = (title.empty() ? "" : " ") + title; + pos = newmsg.find("] "); if (pos == ucstring::npos) newmsg = prefix + newmsg; @@ -667,7 +667,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC } //================================================================================= -void CChatGroupWindow::displayTellMessage(const ucstring &msg, NLMISC::CRGBA col, const ucstring &sender) +void CChatGroupWindow::displayTellMessage(const string &msg, NLMISC::CRGBA col, const string &sender) { // If we are here with a tell message this is because the teller doesn't belong to any people list CGroupContainer *gcChat = createFreeTeller(sender); @@ -876,7 +876,7 @@ void CChatGroupWindow::setActiveFreeTeller(const ucstring &winName, bool bActive } //================================================================================= -ucstring CChatGroupWindow::getFreeTellerName(const std::string &containerID) +string CChatGroupWindow::getFreeTellerName(const std::string &containerID) { uint32 i; for (i = 0; i < _FreeTellers.size(); ++i) @@ -886,8 +886,8 @@ ucstring CChatGroupWindow::getFreeTellerName(const std::string &containerID) break; } if (i == _FreeTellers.size()) - return ucstring(""); - return _FreeTellers[i]->getUCTitle(); + return string(); + return _FreeTellers[i]->getTitle(); } //================================================================================= @@ -1306,7 +1306,7 @@ public: else { CInterfaceManager *im = CInterfaceManager::getInstance(); - im->displaySystemInfo (ucstring::makeFromUtf8(cmd) + ": " + CI18N::get ("uiCommandNotExists")); + im->displaySystemInfo (cmd + ": " + CI18N::get ("uiCommandNotExists")); } } else @@ -1410,16 +1410,16 @@ class CHandlerInviteToRingSession : public IActionHandler public: void execute (CCtrlBase *pCaller, const std::string &/* sParams */) { - ucstring playerName = ::getFreeTellerName(pCaller); + string playerName = ::getFreeTellerName(pCaller).toUtf8(); if (!playerName.empty()) { // ask the SBS to invite the character in the session - CSessionBrowserImpl::getInstance().inviteCharacterByName(CSessionBrowserImpl::getInstance().getCharId(), playerName.toUtf8()); + CSessionBrowserImpl::getInstance().inviteCharacterByName(CSessionBrowserImpl::getInstance().getCharId(), playerName); // additionaly, send a tell to signal the player he has been invited to a ring session - ChatMngr.tell(playerName.toUtf8(), CI18N::get("uiRingInviteNotification")); + ChatMngr.tell(playerName, CI18N::get("uiRingInviteNotification")); // CInterfaceManager *im = CInterfaceManager::getInstance(); - im->displaySystemInfo(ucstring("@{6F6F}") + playerName +ucstring(" @{FFFF}") + CI18N::get("uiRingInvitationSent"), "BC"); + im->displaySystemInfo("@{6F6F}" + playerName +" @{FFFF}" + CI18N::get("uiRingInvitationSent"), "BC"); // force a refresh of the ui CLuaManager::getInstance().executeLuaScript("CharTracking:forceRefresh()"); } diff --git a/ryzom/client/src/interface_v3/chat_window.h b/ryzom/client/src/interface_v3/chat_window.h index 13012ca31..39fc448f9 100644 --- a/ryzom/client/src/interface_v3/chat_window.h +++ b/ryzom/client/src/interface_v3/chat_window.h @@ -47,7 +47,7 @@ class CChatWindow; struct IChatWindowListener { // the user entered a msg in the given chat box - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) = 0; + virtual void msgEntered(const std::string &msg, CChatWindow *chatWindow) = 0; }; @@ -98,8 +98,8 @@ public: }; public: // display a message in this chat box with the given color - virtual void displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); - virtual void displayTellMessage(const ucstring &/* msg */, NLMISC::CRGBA /* col */, const ucstring &/* sender */) {} + virtual void displayMessage(const std::string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); + virtual void displayTellMessage(const std::string &/* msg */, NLMISC::CRGBA /* col */, const std::string &/* sender */) {} virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex); // Test if the window is visible bool isVisible() const; @@ -189,8 +189,8 @@ class CChatGroupWindow : public CChatWindow public: CChatGroupWindow() {} // display a message in this chat box with the given color (callback from chat input filter) - virtual void displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); - virtual void displayTellMessage(const ucstring &msg, NLMISC::CRGBA col, const ucstring &sender); + virtual void displayMessage(const std::string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); + virtual void displayTellMessage(const std::string &msg, NLMISC::CRGBA col, const std::string &sender); virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex); sint32 getTabIndex(); void setTabIndex(sint32 n); @@ -198,7 +198,7 @@ public: // Free Teller NLGUI::CGroupContainer *createFreeTeller(const ucstring &winName, const std::string &winColor=""); void setActiveFreeTeller(const ucstring &winName, bool bActive=true); - ucstring getFreeTellerName(const std::string &containerID); + std::string getFreeTellerName(const std::string &containerID); bool removeFreeTeller(const std::string &containerID); // Return true if free teller found void removeAllFreeTellers(); void saveFreeTeller(NLMISC::IStream &f); diff --git a/ryzom/client/src/interface_v3/guild_manager.cpp b/ryzom/client/src/interface_v3/guild_manager.cpp index 328579d06..74dc5d991 100644 --- a/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/ryzom/client/src/interface_v3/guild_manager.cpp @@ -370,8 +370,8 @@ void CGuildManager::update() { // See if we need to show any online/offline messages static map CachedGuildMembers; - ucstring onlineMessage = CI18N::get("uiPlayerOnline"); - ucstring offlineMessage = CI18N::get("uiPlayerOffline"); + const string &onlineMessage = CI18N::get("uiPlayerOnline"); + const string &offlineMessage = CI18N::get("uiPlayerOffline"); for (uint i = 0; i < _GuildMembers.size(); ++i) { @@ -390,8 +390,8 @@ void CGuildManager::update() continue; } - ucstring msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage; - strFindReplace(msg, "%s", _GuildMembers[i].Name); + string msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage; + strFindReplace(msg, "%s", _GuildMembers[i].Name.toUtf8()); string cat = getStringCategory(msg, msg); map::const_iterator it; NLMISC::CRGBA col = CRGBA::Yellow; @@ -1084,7 +1084,7 @@ public: MemberIndexSelected= nLineNb; MemberNameSelected = rGuildMembers[nLineNb].Name; - CPeopleInterraction::displayTellInMainChat(MemberNameSelected); + CPeopleInterraction::displayTellInMainChat(MemberNameSelected.toUtf8()); } // Current selection diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index a0d36f535..4330782bc 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -982,7 +982,7 @@ void CInterfaceManager::initInGame() // flush system msg buffer for( uint i=0; idisplaySystemInfo(ucstring(toString(im->getLocalSyncActionCounter()))); + im->displaySystemInfo(toString(im->getLocalSyncActionCounter())); return true; } diff --git a/ryzom/client/src/interface_v3/interface_manager.h b/ryzom/client/src/interface_v3/interface_manager.h index 059020018..39fd12dc4 100644 --- a/ryzom/client/src/interface_v3/interface_manager.h +++ b/ryzom/client/src/interface_v3/interface_manager.h @@ -292,12 +292,12 @@ public: void drawViews (NL3D::UCamera camera); // display a debug info - void displayDebugInfo(const ucstring &str, TSystemInfoMode mode = InfoMsg); + void displayDebugInfo(const std::string &str, TSystemInfoMode mode = InfoMsg); // get the color associated with the given system info mode NLMISC::CRGBA getDebugInfoColor(TSystemInfoMode mode); // display a system info string - void displaySystemInfo(const ucstring &str, const std::string &Category = "SYS"); + void displaySystemInfo(const std::string &str, const std::string &Category = "SYS"); NLMISC::CRGBA getSystemInfoColor(const std::string &Category = "SYS"); void setupOptions(); diff --git a/ryzom/client/src/interface_v3/inventory_manager.cpp b/ryzom/client/src/interface_v3/inventory_manager.cpp index 75cab6f78..3b16c41d2 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -3236,7 +3236,7 @@ class CHandlerInvTempToBag : public IActionHandler // If we cant find place display a message and dont send the request to the server if (!getInventory().isSpaceInAllBagsForItem(pCSDst)) { - ucstring msg = CI18N::get("msgCantPutItemInBag"); + string msg = CI18N::get("msgCantPutItemInBag"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); return; @@ -3322,7 +3322,7 @@ class CHandlerInvTempAll : public IActionHandler if (!bPlaceFound) { - ucstring msg = CI18N::get("msgCantPutItemInBag"); + string msg = CI18N::get("msgCantPutItemInBag"); string cat = getStringCategory(msg, msg); CInterfaceManager::getInstance()->displaySystemInfo(msg, cat); return; diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 21322295e..fec5ff3fe 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -1701,7 +1701,7 @@ int CLuaIHMRyzom::displaySystemInfo(CLuaState &ls) ucstring msg; nlverify(CLuaIHM::getUCStringOnStack(ls, 1, msg)); CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->displaySystemInfo(msg, ls.toString(2)); + pIM->displaySystemInfo(msg.toUtf8(), ls.toString(2)); return 0; } @@ -4247,27 +4247,27 @@ int CLuaIHMRyzom::displayChatMessage(CLuaState &ls) if (input == "around") { prop.readRGBA(std::string(dbPath + ":SAY").c_str(), " "); - ci.AroundMe.displayMessage(ucstring(msg), prop.getRGBA()); + ci.AroundMe.displayMessage(msg, prop.getRGBA()); } else if (input == "region") { prop.readRGBA(std::string(dbPath + ":REGION").c_str(), " "); - ci.Region.displayMessage(ucstring(msg), prop.getRGBA()); + ci.Region.displayMessage(msg, prop.getRGBA()); } else if (input == "universe") { prop.readRGBA(std::string(dbPath + ":UNIVERSE_NEW").c_str(), " "); - ci.Universe.displayMessage(ucstring(msg), prop.getRGBA()); + ci.Universe.displayMessage(msg, prop.getRGBA()); } else if (input == "guild") { prop.readRGBA(std::string(dbPath + ":CLADE").c_str(), " "); - ci.Guild.displayMessage(ucstring(msg), prop.getRGBA()); + ci.Guild.displayMessage(msg, prop.getRGBA()); } else if (input == "team") { prop.readRGBA(std::string(dbPath + ":GROUP").c_str(), " "); - ci.Team.displayMessage(ucstring(msg), prop.getRGBA()); + ci.Team.displayMessage(msg, prop.getRGBA()); } } if (ls.type(2) == LUA_TNUMBER) @@ -4275,7 +4275,7 @@ int CLuaIHMRyzom::displayChatMessage(CLuaState &ls) sint64 id = ls.toInteger(2); prop.readRGBA(toString("%s:DYN:%i", dbPath.c_str(), id).c_str(), " "); if (id >= 0 && id < CChatGroup::MaxDynChanPerPlayer) - ci.DynamicChat[id].displayMessage(ucstring(msg), prop.getRGBA()); + ci.DynamicChat[id].displayMessage(msg, prop.getRGBA()); } return 1; } diff --git a/ryzom/client/src/interface_v3/music_player.cpp b/ryzom/client/src/interface_v3/music_player.cpp index 889b83495..b45af6c7b 100644 --- a/ryzom/client/src/interface_v3/music_player.cpp +++ b/ryzom/client/src/interface_v3/music_player.cpp @@ -623,9 +623,9 @@ void CMusicPlayer::createPlaylistFromMusic() if (extensions.empty()) { // in the very unlikely scenario - const ucstring message("Sound driver has no support for music."); + static const string message("Sound driver has no support for music."); CInterfaceManager::getInstance()->displaySystemInfo(message, "SYS"); - nlinfo("%s", message.toUtf8().c_str()); + nlinfo("%s", message.c_str()); return; } std::string newPath = CPath::makePathAbsolute(CPath::standardizePath(ClientCfg.MediaPlayerDirectory), CPath::getCurrentPath(), true); @@ -635,7 +635,7 @@ void CMusicPlayer::createPlaylistFromMusic() std::string msg(CI18N::get("uiMk_system6")); msg += ": " + newPath + " (" + extlist + ")"; - CInterfaceManager::getInstance()->displaySystemInfo(ucstring::makeFromUtf8(msg), "SYS"); + CInterfaceManager::getInstance()->displaySystemInfo(msg, "SYS"); nlinfo("%s", msg.c_str()); // Recursive scan for files from media directory diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index de7c9023a..eaf6386c2 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -91,7 +91,7 @@ static const sint PARTY_CHAT_SPAWN_DELTA = 20; // to avoid that all party chat a /** Display an error msg in the system info window, and also in the last window that triggered the command (so that the user is sure to see it) */ -static void displayVisibleSystemMsg(const ucstring &msg, const string &cat = "CHK"); +static void displayVisibleSystemMsg(const std::string &msg, const string &cat = "CHK"); ////////////////////////////// @@ -102,7 +102,7 @@ static void displayVisibleSystemMsg(const ucstring &msg, const string &cat = "CH struct CPartyChatEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -120,7 +120,7 @@ struct CPartyChatEntryHandler : public IChatWindowListener // handler to manage user entry in 'around me' window struct CAroundMeEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -138,7 +138,7 @@ struct CAroundMeEntryHandler : public IChatWindowListener // handler to manage user entry in 'region' window struct CRegionEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -156,7 +156,7 @@ struct CRegionEntryHandler : public IChatWindowListener // handler to manage user entry in 'universe' window struct CUniverseEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -174,7 +174,7 @@ struct CUniverseEntryHandler : public IChatWindowListener // handler to manage user entry in 'guild chat' window struct CGuildChatEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -191,7 +191,7 @@ struct CGuildChatEntryHandler : public IChatWindowListener // handler to manage user entry in 'team chat' window struct CTeamChatEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -208,7 +208,7 @@ struct CTeamChatEntryHandler : public IChatWindowListener // handler to manage user entry in a 'talk with friend' window struct CFriendTalkEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -225,10 +225,9 @@ struct CFriendTalkEntryHandler : public IChatWindowListener // handler to manage user entry in a debug console window struct CDebugConsoleEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow * /* chatWindow */) + virtual void msgEntered(const string &msg, CChatWindow * /* chatWindow */) { - std::string str = msg.toString(); - NLMISC::ICommand::execute( str, g_log ); + NLMISC::ICommand::execute( msg, g_log ); } }; @@ -242,7 +241,7 @@ public: DbIndex= 0; } - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -1410,8 +1409,8 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS // Player is not in my guild, and the status change is from offline to online/abroad online or vice versa. if (showMsg) { - ucstring msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline"); - strFindReplace(msg, "%s", FriendList.getName(index)); + string msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline"); + strFindReplace(msg, "%s", FriendList.getName(index).toUtf8()); string cat = getStringCategory(msg, msg); map::const_iterator it; NLMISC::CRGBA col = CRGBA::Yellow; @@ -1883,7 +1882,7 @@ void CPeopleInterraction::refreshActiveUserChats() } //================================================================================================================= -void CPeopleInterraction::talkInDynamicChannel(uint32 channelNb,ucstring sentence) +void CPeopleInterraction::talkInDynamicChannel(uint32 channelNb,string sentence) { if(channelNbgetName(peopleIndex)); + CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8()); } } }; @@ -2160,7 +2159,7 @@ class CHandlerTellContact : public IActionHandler uint peopleIndex; if (PeopleInterraction.getPeopleFromContainerID(gc->getId(), list, peopleIndex)) { - CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex)); + CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8()); } } @@ -2416,7 +2415,7 @@ class CHandlerValidatePartyChatName : public IActionHandler if (!gc) return; CGroupEditBox *eb = dynamic_cast(gc->getGroup("eb")); if (!eb) return; - ucstring title = eb->getInputStringAsUtf16(); + string title = eb->getInputString(); // TODO GAMEDEV : create (or join ?) a new channel. Each channel (party chat) should have a unique name in the game // moreover, it should not have the name of another available chat window (for example, it shouldn't be named 'Around Me') @@ -2425,7 +2424,7 @@ class CHandlerValidatePartyChatName : public IActionHandler if (!PeopleInterraction.testValidPartyChatName(title)) { - displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiInvalidPartyChatName")); + displayVisibleSystemMsg(title + " : " + CI18N::get("uiInvalidPartyChatName")); return; } @@ -3315,7 +3314,7 @@ REGISTER_INTERFACE_USER_FCT("getNumUserChatLeft", getNumUserChatLeft) // STATIC FUNCTIONS IMPLEMENTATIONS // ////////////////////////////////////// -static void displayVisibleSystemMsg(const ucstring &msg, const string &cat) +static void displayVisibleSystemMsg(const string &msg, const string &cat) { CInterfaceManager *im = CInterfaceManager::getInstance(); im->displaySystemInfo(msg, cat); @@ -3328,7 +3327,7 @@ static void displayVisibleSystemMsg(const ucstring &msg, const string &cat) #if !FINAL_VERSION NLMISC_COMMAND(testSI, "tmp", "tmp") { - PeopleInterraction.ChatInput.DebugInfo.displayMessage(ucstring("test"), CRGBA::Red); + PeopleInterraction.ChatInput.DebugInfo.displayMessage("test", CRGBA::Red); return true; } #endif diff --git a/ryzom/client/src/interface_v3/people_interraction.h b/ryzom/client/src/interface_v3/people_interraction.h index 591a005e2..a88db2a65 100644 --- a/ryzom/client/src/interface_v3/people_interraction.h +++ b/ryzom/client/src/interface_v3/people_interraction.h @@ -250,14 +250,14 @@ public: // Test if the given chat is a user chat (this includes the main chat) bool isUserChat(CChatWindow *cw) const; - void talkInDynamicChannel(uint32 channelNb,ucstring sentence); + void talkInDynamicChannel(uint32 channelNb,std::string sentence); CChatGroupWindow *getChatGroupWindow() const; void updateAllFreeTellerHeaders(); void removeAllFreeTellers(); - static void displayTellInMainChat(const ucstring &playerName); + static void displayTellInMainChat(const std::string &playerName); private: // create various chat & people lists void createTeamChat(); diff --git a/ryzom/client/src/interface_v3/people_list.cpp b/ryzom/client/src/interface_v3/people_list.cpp index 3f0481b1f..e5426ccfb 100644 --- a/ryzom/client/src/interface_v3/people_list.cpp +++ b/ryzom/client/src/interface_v3/people_list.cpp @@ -449,7 +449,7 @@ void CPeopleList::setContactId(uint index, uint32 contactId) } //================================================================== -void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, const ucstring &msg,uint numBlinks /*=0*/) +void CPeopleList::displayLocalPlayerTell(const string &receiver, uint index, const string &msg,uint numBlinks /*=0*/) { if (_ContactType == CPeopleListDesc::Ignore) { @@ -473,13 +473,13 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c } string csr = CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""; - string finalMsg = csr + CI18N::get("youTell") + ": " + msg.toUtf8(); + string finalMsg = csr + CI18N::get("youTell") + ": " + msg; // display msg with good color CInterfaceProperty prop; prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); string s = CI18N::get("youTellPlayer"); - strFindReplace(s, "%name", receiver.toUtf8()); + strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA())); CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); @@ -497,7 +497,7 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c //================================================================== -void CPeopleList::displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA col, uint /* numBlinks */ /*= 0*/) +void CPeopleList::displayMessage(uint index, const string &msg, NLMISC::CRGBA col, uint /* numBlinks */ /*= 0*/) { if (_ContactType == CPeopleListDesc::Ignore) { @@ -951,7 +951,7 @@ class CHandlerContactEntry : public IActionHandler pWin->displayTellMessage(final, prop.getRGBA(), pWin->getFreeTellerName(str)); string s = CI18N::get("youTellPlayer"); - strFindReplace(s, "%name", pWin->getFreeTellerName(str).toUtf8()); + strFindReplace(s, "%name", pWin->getFreeTellerName(str)); strFindReplace(final, CI18N::get("youTell"), s); CInterfaceManager::getInstance()->log(final, CChatGroup::groupTypeToString(CChatGroup::tell)); } diff --git a/ryzom/client/src/interface_v3/people_list.h b/ryzom/client/src/interface_v3/people_list.h index 32317b6b8..da7556aa5 100644 --- a/ryzom/client/src/interface_v3/people_list.h +++ b/ryzom/client/src/interface_v3/people_list.h @@ -113,8 +113,8 @@ public: /** Display a message for the given people * If the window is closed, it causes it to blink (and also the parent window) */ - void displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA col, uint numBlinks = 0); - void displayLocalPlayerTell(const ucstring &receiver, uint index, const ucstring &msg, uint numBlinks = 0); + void displayMessage(uint index, const std::string &msg, NLMISC::CRGBA col, uint numBlinks = 0); + void displayLocalPlayerTell(const std::string &receiver, uint index, const std::string &msg, uint numBlinks = 0); // Is the given people window visible ? bool isPeopleChatVisible(uint index) const; // reset remove everything from the interface diff --git a/ryzom/client/src/item_group_manager.cpp b/ryzom/client/src/item_group_manager.cpp index 5e5f0d6c9..ad35a2a97 100644 --- a/ryzom/client/src/item_group_manager.cpp +++ b/ryzom/client/src/item_group_manager.cpp @@ -697,10 +697,9 @@ void CItemGroupManager::listGroup() for(int i=0;i<_Groups.size();i++) { CItemGroup group = _Groups[i]; - ucstring msg = NLMISC::CI18N::get("cmdListGroupLine"); + string msg = NLMISC::CI18N::get("cmdListGroupLine"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(group.name); + string nameUC = group.name; NLMISC::strFindReplace(msg, "%name", nameUC); NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.Items.size())); pIM->displaySystemInfo(msg); diff --git a/ryzom/client/src/main_loop.cpp b/ryzom/client/src/main_loop.cpp index d9de05961..881e14431 100644 --- a/ryzom/client/src/main_loop.cpp +++ b/ryzom/client/src/main_loop.cpp @@ -1165,7 +1165,7 @@ bool mainLoop() if (BanMsgCountdown < 0.f) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgPermanentlyBanned"); + string msg = CI18N::get("msgPermanentlyBanned"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); BanMsgCountdown = BanMsgRepeatTime; @@ -3448,11 +3448,11 @@ NLMISC_COMMAND(dumpFontTexture, "Write font texture to file", "") { std::string fname = CFile::findNewFile("font-texture.tga"); TextContext->dumpCacheTexture(fname.c_str()); - im->displaySystemInfo(ucstring(fname + " created"), "SYS"); + im->displaySystemInfo(fname + " created", "SYS"); } else { - im->displaySystemInfo(ucstring("Error: TextContext == NULL"), "SYS"); + im->displaySystemInfo("Error: TextContext == NULL", "SYS"); } return true; } diff --git a/ryzom/client/src/misc.cpp b/ryzom/client/src/misc.cpp index ee247e921..9816202d4 100644 --- a/ryzom/client/src/misc.cpp +++ b/ryzom/client/src/misc.cpp @@ -871,14 +871,14 @@ bool setVect(CVector &vectToChange, const CVector &vect, bool compute, bool chec return true; }// setVect // -NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest) +NLMISC::CRGBA interpClientCfgColor(const string &src, string &dest) { CRGBA color = CRGBA::White; if (src.size() >= 3) { - if (src[0] == (ucchar) '&') + if (src[0] == '&') { - ucstring::size_type nextPos = src.find((ucchar) '&', 1); + string::size_type nextPos = src.find('&', 1); if (nextPos != ucstring::npos) { std::string colorCode; @@ -911,7 +911,7 @@ NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest) return color; } -std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAddSysByDefault) +std::string getStringCategory(const string &src, string &dest, bool alwaysAddSysByDefault) { std::string str = getStringCategoryIfAny(src, dest); if (alwaysAddSysByDefault) @@ -921,41 +921,41 @@ std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAd } -std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest) +std::string getStringCategoryIfAny(const string &src, string &dest) { std::string colorCode; if (src.size() >= 3) { - uint startPos = 0; + size_t startPos = 0; // Skip or if present at beginning - ucstring preTag; - const uint PreTagSize = 5; - const ucstring newTag(""); + string preTag; + const size_t PreTagSize = 5; + static const string newTag = ""; if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == newTag) ) { startPos = PreTagSize; preTag = newTag; } - const ucstring chgTag(""); + static const string chgTag = ""; if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == chgTag) ) { startPos = PreTagSize; preTag = chgTag; } - if (src[startPos] == (ucchar) '&') + if (src[startPos] == '&') { - ucstring::size_type nextPos = src.find((ucchar) '&', startPos+1); - if (nextPos != ucstring::npos) + string::size_type nextPos = src.find('&', startPos+1); + if (nextPos != string::npos) { - uint codeSize = (uint)nextPos - startPos - 1; + size_t codeSize = nextPos - startPos - 1; colorCode.resize( codeSize ); - for(uint k = 0; k < codeSize; ++k) + for(ptrdiff_t k = 0; k < (ptrdiff_t)codeSize; ++k) { colorCode[k] = tolower((char) src[k + startPos + 1]); } - ucstring destTmp; + string destTmp; if ( startPos != 0 ) destTmp = preTag; // leave or in the dest string destTmp += src.substr(nextPos + 1); diff --git a/ryzom/client/src/misc.h b/ryzom/client/src/misc.h index 49127d100..96568c22e 100644 --- a/ryzom/client/src/misc.h +++ b/ryzom/client/src/misc.h @@ -165,11 +165,11 @@ bool setVect(NLMISC::CVector &vectToChange, const NLMISC::CVector &vect, bool co // read color from client cfg system info colors -NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest); +NLMISC::CRGBA interpClientCfgColor(const std::string &src, std::string &dest); // Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return "SYS" -std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAddSysByDefault = true); +std::string getStringCategory(const std::string &src, std::string &dest, bool alwaysAddSysByDefault = true); // Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return "" -std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest); +std::string getStringCategoryIfAny(const std::string &src, std::string &dest); bool getRelativeFloatFromString(const std::string src, float &dst); void updateVector(const std::string part, NLMISC::CVector &dst, float value, bool add = false); diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index 9f05fe860..f4ceb511c 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -600,21 +600,21 @@ void impulsePermanentUnban(NLMISC::CBitMemStream &impulse) class CInterfaceChatDisplayer : public CClientChatManager::IChatDisplayer { public: - virtual void displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer=0); - virtual void displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName); + virtual void displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer=0); + virtual void displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName); virtual void clearChannel(CChatGroup::TGroupType mode, uint32 dynChatDbIndex); private: // Add colorization tag for sender name - void colorizeSender(ucstring &text, const ucstring &senderName, CRGBA baseColor); + void colorizeSender(string &text, const string &senderName, CRGBA baseColor); }; static CInterfaceChatDisplayer InterfaceChatDisplayer; -void CInterfaceChatDisplayer::colorizeSender(ucstring &text, const ucstring &senderName, CRGBA baseColor) +void CInterfaceChatDisplayer::colorizeSender(string &text, const string &senderName, CRGBA baseColor) { // find the sender/text separator to put color tags - ucstring::size_type pos = senderName.toUtf8().length() - 1; + ucstring::size_type pos = senderName.length() - 1; if (pos != ucstring::npos) { string str; @@ -624,36 +624,36 @@ void CInterfaceChatDisplayer::colorizeSender(ucstring &text, const ucstring &sen CChatWindow::encodeColorTag(prop.getRGBA(), str, false); - str += text.toUtf8().substr(0, pos+1); + str += text.substr(0, pos+1); CChatWindow::encodeColorTag(baseColor, str, true); - str += text.toUtf8().substr(pos+1); + str += text.substr(pos+1); - text.fromUtf8(str); + text = str; } } // display a chat from network to interface -void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer) +void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring finalString; + string finalString; string stringCategory = getStringCategory(ucstr, finalString); bool bubbleWanted = true; // Subtract rawMessage from ucstr so that the 'sender' part remains. - ucstring senderPart = ucstr.luabind_substr(0, ucstr.length() - rawMessage.length()); + string senderPart = ucstr.substr(0, ucstr.length() - rawMessage.length()); // search a "{no_bubble}" tag { - ucstring::size_type index = finalString.find(ucstring("{no_bubble}")); + string::size_type index = finalString.find("{no_bubble}"); const size_t tokenSize= 11; // length of "{no_bubble}" - if (index != ucstring::npos) + if (index != string::npos) { bubbleWanted = false; - finalString = finalString.luabind_substr(0, index) + finalString.substr(index+tokenSize,finalString.size()); + finalString = finalString.substr(0, index) + finalString.substr(index+tokenSize,finalString.size()); } } @@ -665,9 +665,9 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c // Remove all {break} for(;;) { - ucstring::size_type index = finalString.find(ucstring("{break}")); + string::size_type index = finalString.find("{break}"); if (index == ucstring::npos) break; - finalString = finalString.luabind_substr(0, index) + finalString.luabind_substr(index+7,finalString.size()); + finalString = finalString.substr(0, index) + finalString.substr(index+7,finalString.size()); } // select DB @@ -716,10 +716,10 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c // find the sender/text separator to put color tags if (senderPart.empty() && stringCategory == "emt") { - size_t pos = finalString.find(ucstring(": "), 0); - if (pos != ucstring::npos) + size_t pos = finalString.find(": ", 0); + if (pos != string::npos) { - senderPart = finalString.luabind_substr(0, pos + 2); + senderPart = finalString.substr(0, pos + 2); } } colorizeSender(finalString, senderPart, col); @@ -786,16 +786,16 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c if (pIM->getLogState()) { // Add dyn chan number before string - ucstring prefix("[" + NLMISC::toString(dbIndex) + "]"); + string prefix = "[" + NLMISC::toString(dbIndex) + "]"; // Find position to put the new string // After timestamp? - size_t pos = finalString.find(ucstring("]")); - size_t colonpos = finalString.find(ucstring(": @{")); + size_t pos = finalString.find("]"); + size_t colonpos = finalString.find(": @{"); // If no ] found or if found but after the colon (so part of the user chat) - if (pos == ucstring::npos || (colonpos < pos)) + if (pos == string::npos || (colonpos < pos)) { // No timestamp, so put it right after the color and add a space - pos = finalString.find(ucstring("}"));; + pos = finalString.find("}");; prefix += " "; } finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1); @@ -803,28 +803,28 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c if (node && node->getValueBool()) { uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex); - ucstring title; + string title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); - prefix = title.empty() ? ucstring("") : ucstring(" ") + title; - pos = finalString.find(ucstring("] ")); + prefix = (title.empty() ? "" : " ") + title; + pos = finalString.find("] "); finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos); } } } else { - nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.toString().c_str()); + nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.c_str()); } } else { - ucstring::size_type index = finalString.find(ucstring("")); + string::size_type index = finalString.find(""); if (index != ucstring::npos) { bubbleWanted = false; finalString = finalString.substr(index+6,finalString.size()); - ucstring::size_type index2 = finalString.find(ucstring(" ")); - ucstring playerName; + string::size_type index2 = finalString.find(string(" ")); + string playerName; if (index2 < (finalString.size()-3)) { playerName = finalString.substr(0,index2); @@ -832,7 +832,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c } if (!senderName.empty()) { - CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()), true, true); + CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName), true, true); if (senderEntity) { if (senderEntity->Type != CEntityCL::Player) @@ -840,16 +840,16 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c if (playerName.empty()) { senderEntity->removeStateFx(); - senderEntity->setStateFx(finalString.toString()); + senderEntity->setStateFx(finalString); nlinfo("empty"); } else { - CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName.toUtf8()), false, true); + CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName), false, true); if (destEntity) { destEntity->removeStateFx(); - destEntity->setStateFx(finalString.toString()); + destEntity->setStateFx(finalString); nlinfo("no empty"); } } @@ -866,7 +866,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c // if tell, bkup sendername if (mode == CChatGroup::tell && windowVisible && !senderName.empty()) { - PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()); + PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName); } } @@ -876,7 +876,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c // **** Process chat entry for the bubbles // todo hulud : registering a chat callback would be better than calling this hardcoded action handler - ucstring finalRawMessage; + string finalRawMessage; // remove color qualifier from raw string getStringCategory(rawMessage, finalRawMessage); if (bubbleWanted) @@ -902,7 +902,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c channel = "#" + toString((uint32)mode); } } - if (!stringCategory.empty() && NLMISC::toUpper(stringCategory) != "SYS") + if (!stringCategory.empty() && NLMISC::compareCaseInsensitive(stringCategory.c_str(), "SYS")) // Not empty and not 'SYS' { channel = channel + "/" + stringCategory; } @@ -912,13 +912,13 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c // display a tell from network to interface -void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName) +void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName) { - ucstring finalString = ucstr; + string finalString = ucstr; // for now, '&' are removed by server so use another format until a special msg is made - if (strFindReplace(finalString, ucstring(""), ucstring())) + if (strFindReplace(finalString, "", string())) { CLuaManager::getInstance().executeLuaScript("RingAccessPoint:forceRefresh()"); } @@ -928,13 +928,13 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); bool windowVisible; - ucstring goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()); + string goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName); // The sender part is up to and including the first ":" after the goodSenderName - ucstring::size_type pos = finalString.find(goodSenderName); + string::size_type pos = finalString.find(goodSenderName); pos = finalString.find(':', pos); pos = finalString.find(' ', pos); - ucstring senderPart = finalString.substr(0, pos+1); + string senderPart = finalString.substr(0, pos+1); colorizeSender(finalString, senderPart, prop.getRGBA()); PeopleInterraction.ChatInput.Tell.displayTellMessage(/*senderIndex, */finalString, goodSenderName, prop.getRGBA(), 2, &windowVisible); @@ -2125,7 +2125,7 @@ void impulseWhere(NLMISC::CBitMemStream &impulse) sprintf(buf,"Your server position is : X= %g Y= %g Z= %g",xf,yf,zf); nlinfo(buf); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(buf)); + CInterfaceManager::getInstance()->displaySystemInfo(buf); }// impulseWhere // //----------------------------------------------- @@ -4204,7 +4204,7 @@ std::string WebServer; NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", " ") { if (args.empty()) return false; - ucstring player = args[0]; + string player = args[0]; std::string msg; if (args.size() >= 2) { @@ -4215,7 +4215,7 @@ NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", " ") { if (args.empty()) return false; - ucstring player = args[0]; + string player = args[0]; std::string msg; if (args.size() >= 2) { @@ -4234,7 +4234,7 @@ NLMISC_COMMAND(localTell, "Temp : simulate a tell in local mode", " } } // TDataSetIndex dsi = INVALID_DATASET_ROW; - InterfaceChatDisplayer.displayTell(/*dsi, */ucstring(msg), player); + InterfaceChatDisplayer.displayTell(/*dsi, */msg, player); return true; } diff --git a/ryzom/client/src/user_entity.cpp b/ryzom/client/src/user_entity.cpp index a09256703..b2dcb0cab 100644 --- a/ryzom/client/src/user_entity.cpp +++ b/ryzom/client/src/user_entity.cpp @@ -2948,7 +2948,7 @@ bool CUserEntity::sit(bool s) // autowalk disabled UserControls.autowalkState(false); - const string msgName = "COMMAND:SIT"; + static const string msgName = "COMMAND:SIT"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -2963,7 +2963,7 @@ bool CUserEntity::sit(bool s) // display sit msg CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgUserIsSitting"); + string msg = CI18N::get("msgUserIsSitting"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); } @@ -2976,7 +2976,7 @@ bool CUserEntity::sit(bool s) { if(mode(MBEHAV::NORMAL)) { - const string msgName = "COMMAND:SIT"; + static const string msgName = "COMMAND:SIT"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -2991,7 +2991,7 @@ bool CUserEntity::sit(bool s) // display stand msg CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgUserIsStanding"); + string msg = CI18N::get("msgUserIsStanding"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); } @@ -3067,7 +3067,7 @@ void CUserEntity::setAFK(bool b, string afkTxt) } // send afk state - string msgName = "COMMAND:AFK"; + static const string msgName = "COMMAND:AFK"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -3081,15 +3081,15 @@ void CUserEntity::setAFK(bool b, string afkTxt) ucstring ucstr; ucstr.fromUtf8( afkTxt ); CBitMemStream outTxt; - msgName = "STRING:AFK_TXT"; - if( GenericMsgHeaderMngr.pushNameToStream(msgName,outTxt) ) + static const string msgNameTxt = "STRING:AFK_TXT"; + if( GenericMsgHeaderMngr.pushNameToStream(msgNameTxt,outTxt) ) { outTxt.serial( ucstr ); NetMngr.push( outTxt ); } else { - nlwarning("CUserEntity:setAFK: unknown message named '%s'.", msgName.c_str()); + nlwarning("CUserEntity:setAFK: unknown message named '%s'.", msgNameTxt.c_str()); } @@ -3111,7 +3111,7 @@ void CUserEntity::rollDice(sint16 min, sint16 max, bool local) } sint16 roll = min + (sint16)dice->rand(max-min); - ucstring msg = CI18N::get("msgRollDiceLocal"); + string msg = CI18N::get("msgRollDiceLocal"); strFindReplace(msg, "%min", toString(min)); strFindReplace(msg, "%max", toString(max)); strFindReplace(msg, "%roll", toString(roll)); @@ -3143,7 +3143,7 @@ bool CUserEntity::canEngageCombat() { // display "you can't fight while sitting" message) CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgCantFightSit"); + string msg = CI18N::get("msgCantFightSit"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); @@ -3154,7 +3154,7 @@ bool CUserEntity::canEngageCombat() { // display "you can't fight while swiming" message) CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgCantFightSwim"); + string msg = CI18N::get("msgCantFightSwim"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); @@ -3165,7 +3165,7 @@ bool CUserEntity::canEngageCombat() { // display "you can't fight while swimming" message) CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgCantFightRide"); + string msg = CI18N::get("msgCantFightRide"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); @@ -4140,7 +4140,7 @@ void CUserEntity::switchVelocity(bool userRequest) // display message : your are running, you are walking CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg; + string msg; if( _Run ) msg = CI18N::get("msgUserIsRunning"); else diff --git a/ryzom/common/src/game_share/msg_client_server.h b/ryzom/common/src/game_share/msg_client_server.h index 08dc0e171..c66e7856a 100644 --- a/ryzom/common/src/game_share/msg_client_server.h +++ b/ryzom/common/src/game_share/msg_client_server.h @@ -633,7 +633,7 @@ public: uint8 ChatMode; // uint32 DynChatChanID; NLMISC::CEntityId DynChatChanID; - ucstring Content; + ucstring Content; // FIXME: UTF-8 (serial) CChatMsg() { @@ -650,7 +650,7 @@ public: f.serial( ChatMode ); if(ChatMode==CChatGroup::dyn_chat) f.serial(DynChatChanID); - f.serial( Content ); + f.serial( Content ); // FIXME: UTF-8 (serial) } }; @@ -669,7 +669,7 @@ public: uint32 SenderNameId; uint8 ChatMode; uint32 PhraseId; - ucstring CustomTxt; + ucstring CustomTxt; // FIXME: UTF-8 (serial) CChatMsg2() { @@ -685,7 +685,7 @@ public: f.serial( SenderNameId ); f.serial( ChatMode ); f.serial( PhraseId ); - f.serial( CustomTxt ); + f.serial( CustomTxt ); // FIXME: UTF-8 (serial) } }; @@ -700,8 +700,8 @@ public: class CFarTellMsg { public: - ucstring SenderName; - ucstring Text; + ucstring SenderName; // FIXME: UTF-8 (serial) + ucstring Text; // FIXME: UTF-8 (serial) void serial(NLMISC::CBitMemStream &f) {