diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index 572d39ac4..309377578 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -147,6 +147,9 @@ public: static void append(IStream &s, u32char c); static u32char get(IStream &s); + /// Get an UTF-8 string from an undefined ASCII-based codepage + static std::string fromAscii(std::string &str); + private: typedef u32char (*TIterator)(const void **addr); static u32char utf8Iterator(const void **addr); diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp index 64f2f8e55..dd7a88868 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -174,6 +174,21 @@ std::string CUtfStringView::toAscii() const return res; } +std::string CUtfStringView::fromAscii(std::string &str) +{ + std::string res; + res.reserve(str.size()); + for (std::string::iterator it(str.begin()), end(str.end()); it != end; ++it) + { + unsigned char c = *it; + if (c < 0x80) + res += (char)c; + else + res += '?'; + } + return res; +} + std::wstring CUtfStringView::toWide() const { #ifdef NL_OS_WINDOWS diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 63b8a6dd8..e31bd37fd 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -804,7 +804,7 @@ std::string buildPlayerNameForSaveFile(const std::string &playerNameIn) (c>='0' && c<='9') || (c=='_') ) { - ret[i]= tolower(c); + ret[i]= tolower(c); // TODO: toLowerAscii } else ret[i]= '_'; diff --git a/ryzom/client/src/entities.cpp b/ryzom/client/src/entities.cpp index 11c403403..7743cb02e 100644 --- a/ryzom/client/src/entities.cpp +++ b/ryzom/client/src/entities.cpp @@ -2419,14 +2419,8 @@ CEntityCL *CEntityManager::getEntityByKeywords (const std::vector &keywo //----------------------------------------------- CEntityCL *CEntityManager::getEntityByName (const string &name, bool caseSensitive, bool complete) const { - string source = name; - const uint size = (uint)source.size(); - if (!caseSensitive) - { - uint j; - for (j=0; jgetDisplayName(); + string value = caseSensitive ? _Entities[i]->getDisplayName() : toLower(_Entities[i]->getDisplayName()); // TODO: toLowerInsensitive bool foundEntity = false; - uint j; - if (!caseSensitive) - { - for (j=0; j= size) - { - if (std::operator==(source, value.substr (0, size))) - foundEntity = true; - } + if (NLMISC::startsWith(value, source)) + foundEntity = true; } if (foundEntity) diff --git a/ryzom/client/src/entity_cl.cpp b/ryzom/client/src/entity_cl.cpp index 4c1b4a842..8f96cb96b 100644 --- a/ryzom/client/src/entity_cl.cpp +++ b/ryzom/client/src/entity_cl.cpp @@ -2355,7 +2355,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) if (pVT != NULL) pVT->setText(_Title); CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:player")); - if (pGC != NULL) pGC->setUCTitle(_EntityName); + if (pGC != NULL) pGC->setTitle(_EntityName); CSkillManager *pSM = CSkillManager::getInstance(); pSM->setPlayerTitle(_TitleRaw); diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index 3ba05a570..9cad50e25 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -973,12 +973,12 @@ class CHandlerBrowse : public IActionHandler { if(params[i]=='%' && igetItemActualName().toUtf8(); + string title = setup.SrcSheet->getItemActualName(); setupHelpTitle(setup.HelpWindow, title ); getItemText (setup.SrcSheet, itemText, pIS); diff --git a/ryzom/client/src/interface_v3/action_handler_misc.cpp b/ryzom/client/src/interface_v3/action_handler_misc.cpp index 8b144f844..73c967bcb 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -836,7 +836,7 @@ class CAHReplyTeller : public IActionHandler { w->setKeyboardFocus(); w->enableBlink(1); - PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName.toUtf8())); + PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName)); CGroupEditBox *eb = w->getEditBox(); if (eb != NULL) { @@ -863,7 +863,7 @@ class CAHReplyTellerOnce : public IActionHandler { w->setKeyboardFocus(); w->enableBlink(1); - w->setCommand(ucstring("tell ") + CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName.toUtf8()) + ucstring(" "), false); + w->setCommand("tell " + CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName) + " ", false); CGroupEditBox *eb = w->getEditBox(); if (eb != NULL) { @@ -908,7 +908,7 @@ REGISTER_ACTION_HANDLER (CAHCycleTell, "cycle_tell") NLMISC_COMMAND(slsn, "Temp : set the name of the last sender.", "") { if (args.size() != 1) return false; - PeopleInterraction.LastSenderName = ucstring(args[0]); + PeopleInterraction.LastSenderName = args[0]; return true; } diff --git a/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 56382bf54..16a65e336 100644 --- a/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -279,9 +279,9 @@ void launchPhraseComposition(bool creation) // Set the Text of the Window if(creation) - window->setUCTitle(CI18N::get("uiPhraseCreate")); + window->setTitle(CI18N::get("uiPhraseCreate")); else - window->setUCTitle(CI18N::get("uiPhraseEdit")); + window->setTitle(CI18N::get("uiPhraseEdit")); // clear the sentence for a New Phrase creation. buildSentenceTarget->clearBuildingPhrase(); diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index 3eacf8a60..47fda6d00 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -188,8 +188,8 @@ void CActionPhraseFaber::launchFaberCastWindow(sint32 memoryLine, uint memoryIn window->setActive(true); // Setup the Title with a default text - ucstring title= CI18N::get("uiPhraseFaberExecuteNoPlan"); - window->setUCTitle (title); + string title= CI18N::get("uiPhraseFaberExecuteNoPlan"); + window->setTitle (title); } // **** setup DB observer! @@ -570,9 +570,9 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick if(window) { // Setup the Title with the item built - ucstring title= CI18N::get("uiPhraseFaberExecute"); + string title= CI18N::get("uiPhraseFaberExecute"); strFindReplace(title, "%item", STRING_MANAGER::CStringManagerClient::getItemLocalizedName(_ExecuteFromItemPlanBrick->FaberPlan.ItemBuilt) ); - window->setUCTitle (title); + window->setTitle (title); } diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index ce4ec3173..13e60fff8 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -250,7 +250,7 @@ void CBotChatPageTrade::begin() if (gc) { // set the title - gc->setUCTitle(_Title); + gc->setTitle(_Title); // show the buy mean CInterfaceGroup *money = dynamic_cast(gc->getGroup("money")); if (money) money->setActive((_BuyMean == Money) || (_BuyMean == MoneyFactionPoints)); diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.h b/ryzom/client/src/interface_v3/bot_chat_page_trade.h index ae11a2008..58a4e572d 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.h +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.h @@ -72,7 +72,7 @@ public: // set the buy mean (must be called before 'begin' is called) void setBuyMean(TBuyMean buyMean) { _BuyMean = buyMean; } // set the title of the window (actually applied when 'begin' is called) - void setTitle(const ucstring &title) { _Title = title; } + void setTitle(const std::string &title) { _Title = title; } // update the 'buy' dialog window for the given sphrase sheet (the player has changed an equipped weapon => action stats change) void updateSPhraseBuyDialog(); // invalidate window coords @@ -134,7 +134,7 @@ private: uint32 _CurrItemInventory; bool _BuyOnly; TBuyMean _BuyMean; - ucstring _Title; + std::string _Title; bool _ResaleEdit; bool _QuantityEdit; sint32 _QuantityCheck; diff --git a/ryzom/client/src/interface_v3/chat_filter.cpp b/ryzom/client/src/interface_v3/chat_filter.cpp index 237106170..c77a93fa5 100644 --- a/ryzom/client/src/interface_v3/chat_filter.cpp +++ b/ryzom/client/src/interface_v3/chat_filter.cpp @@ -363,8 +363,7 @@ void CChatTargetFilter::setTargetGroup(CChatGroup::TGroupType groupType, uint32 if (_Chat) { // set the prompt - const ucstring prompt(""); - _Chat->setPrompt(prompt + (ucchar) '>'); + _Chat->setPrompt(">"); // set the color string entry="UI:SAVE:CHAT:COLORS:"; diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index 58dc5d52a..816a2016a 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -135,10 +135,7 @@ bool CChatWindow::create(const CChatWindowDesc &desc, const std::string &chatId) return false; } _Chat->setLocalize (desc.Localize); - if (desc.Localize) - _Chat->setTitle(desc.Title.toString()); - else - _Chat->setUCTitle(desc.Title); + _Chat->setTitle(desc.Title); _Chat->setSavable(desc.Savable); // groups like system info don't have edit box. @@ -259,12 +256,12 @@ void CChatWindow::setMenu(const std::string &menuName) } //================================================================================= -void CChatWindow::setPrompt(const ucstring &prompt) +void CChatWindow::setPrompt(const string &prompt) { if (!_Chat) return; CGroupEditBox *eb = dynamic_cast(_Chat->getGroup("eb")); if (!eb) return; - eb->setPrompt(prompt.toUtf8()); + eb->setPrompt(prompt); } void CChatWindow::setPromptColor(NLMISC::CRGBA col) @@ -312,7 +309,7 @@ void CChatWindow::deleteContainer() } //================================================================================= -bool CChatWindow::rename(const ucstring &newName, bool newNameLocalize) +bool CChatWindow::rename(const string &newName, bool newNameLocalize) { return getChatWndMgr().rename(getTitle(), newName, newNameLocalize); } @@ -362,22 +359,22 @@ void CChatWindow::setCommand(const ucstring &command,bool execute) //================================================================================= -void CChatWindow::setEntry(const ucstring &entry) +void CChatWindow::setEntry(const string &entry) { if (!_EB) return; - _EB->setInputStringAsUtf16(entry); + _EB->setInputString(entry); } //================================================================================= -ucstring CChatWindow::getTitle() const +string CChatWindow::getTitle() const { if (!_Chat) { - return ucstring(""); + return string(); } else { - return _Chat->getUCTitle(); + return _Chat->getTitle(); } } @@ -472,7 +469,7 @@ void CChatWindow::setHeaderColor(const std::string &n) } //================================================================================= -void CChatWindow::displayLocalPlayerTell(const ucstring &receiver, const ucstring &msg, uint numBlinks /*= 0*/) +void CChatWindow::displayLocalPlayerTell(const string &receiver, const string &msg, uint numBlinks /*= 0*/) { string finalMsg; CInterfaceProperty prop; @@ -483,10 +480,10 @@ void CChatWindow::displayLocalPlayerTell(const ucstring &receiver, const ucstrin finalMsg += csr + CI18N::get("youTell") + ": "; prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); encodeColorTag(prop.getRGBA(), finalMsg, true); - finalMsg += msg.toUtf8(); + finalMsg += msg; string s = CI18N::get("youTellPlayer"); - strFindReplace(s, "%name", receiver.toUtf8()); + strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); displayMessage(finalMsg, prop.getRGBA(), CChatGroup::tell, 0, numBlinks); CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); @@ -730,13 +727,13 @@ const string CChatGroupWindow::getValidUiStringId(const string &stringId) } //================================================================================= -CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, const string &winColor) +CGroupContainer *CChatGroupWindow::createFreeTeller(const string &winNameIn, const string &winColor) { // must parse the entity name, and eventually make it Full with shard name (eg: 'ani.yoyo' becomes 'yoyo(Aniro)') - string winNameFull= CShardNames::getInstance().makeFullNameFromRelative(PlayerSelectedMainland, winNameIn.toString()); + string winNameFull= CShardNames::getInstance().makeFullNameFromRelative(PlayerSelectedMainland, winNameIn); // remove shard name if necessary - ucstring winName= CEntityCL::removeShardFromName(winNameFull); + string winName= CEntityCL::removeShardFromName(winNameFull); // get the color string sWinColor = winColor; @@ -745,12 +742,12 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c // Look if the free teller do not already exists uint32 i; - string sWinName = winName.toString(); + string sWinName = winName; sWinName = toLower(sWinName); for (i = 0; i < _FreeTellers.size(); ++i) { CGroupContainer *pGC = _FreeTellers[i]; - if (toLower(pGC->getUCTitle().toString()) == sWinName) + if (toLower(pGC->getTitle()) == sWinName) break; } // Create container if not present @@ -772,11 +769,11 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c if (!pGC) { delete pIG; - nlwarning(" group is not a container.(%s)", winName.toString().c_str()); + nlwarning(" group is not a container.(%s)", winName.c_str()); return NULL; } // set title from the name - pGC->setUCTitle(winName); + pGC->setTitle(winName); // pGC->setSavable(true); pGC->setEscapable(true); @@ -834,7 +831,7 @@ void CChatGroupWindow::updateAllFreeTellerHeaders() //================================================================================= void CChatGroupWindow::updateFreeTellerHeader(CGroupContainer &ft) { - ucstring name = ft.getUCTitle(); + string name = ft.getTitle(); CCtrlBaseButton *newFriendBut = dynamic_cast(ft.getCtrl("new_friend")); CCtrlBaseButton *ignoreBut = dynamic_cast(ft.getCtrl("ignore")); CCtrlBaseButton *inviteBut = dynamic_cast(ft.getCtrl("invite")); @@ -868,7 +865,7 @@ void CChatGroupWindow::updateFreeTellerHeader(CGroupContainer &ft) } //================================================================================= -void CChatGroupWindow::setActiveFreeTeller(const ucstring &winName, bool bActive) +void CChatGroupWindow::setActiveFreeTeller(const string &winName, bool bActive) { CGroupContainer *pGC = createFreeTeller(winName); if (pGC != NULL) @@ -1166,7 +1163,7 @@ CChatWindow *CChatWindowManager::createChatGroupWindow(const CChatWindowDesc &de } //================================================================================= -CChatWindow *CChatWindowManager::getChatWindow(const ucstring &title) +CChatWindow *CChatWindowManager::getChatWindow(const string &title) { TChatWindowMap::iterator it = _ChatWindowMap.find(title); if (it == _ChatWindowMap.end()) @@ -1179,12 +1176,12 @@ CChatWindow *CChatWindowManager::getChatWindow(const ucstring &title) } //================================================================================= -void CChatWindowManager::removeChatWindow(const ucstring &title) +void CChatWindowManager::removeChatWindow(const string &title) { TChatWindowMap::iterator it = _ChatWindowMap.find(title); if (it == _ChatWindowMap.end()) { - nlwarning("Unknown chat window '%s'", title.toUtf8().c_str()); + nlwarning("Unknown chat window '%s'", title.c_str()); return; } it->second->deleteContainer(); @@ -1213,11 +1210,11 @@ CChatWindow *CChatWindowManager::getChatWindowFromCaller(CCtrlBase *caller) } if (!father) return NULL; - return getChatWindow(father->getUCTitle()); + return getChatWindow(father->getTitle()); } //================================================================================= -bool CChatWindowManager::rename(const ucstring &oldName, const ucstring &newName, bool newNameLocalize) +bool CChatWindowManager::rename(const string &oldName, const string &newName, bool newNameLocalize) { // if (oldName == newName) return true; CChatWindow *newWin = getChatWindow(newName); @@ -1225,8 +1222,8 @@ bool CChatWindowManager::rename(const ucstring &oldName, const ucstring &newName TChatWindowMap::iterator it = _ChatWindowMap.find(oldName); if (it == _ChatWindowMap.end()) return false; _ChatWindowMap[newName] = it->second; - it->second->getContainer()->setLocalize(false); - it->second->getContainer()->setTitle(newName.toUtf8()); + it->second->getContainer()->setLocalize(newNameLocalize); + it->second->getContainer()->setTitle(newName); _ChatWindowMap.erase(it); return true; } diff --git a/ryzom/client/src/interface_v3/chat_window.h b/ryzom/client/src/interface_v3/chat_window.h index 39fc448f9..9a299ebfb 100644 --- a/ryzom/client/src/interface_v3/chat_window.h +++ b/ryzom/client/src/interface_v3/chat_window.h @@ -23,7 +23,7 @@ #ifndef CL_CHAT_WINDOW_H #define CL_CHAT_WINDOW_H -#include "nel/misc/ucstring.h" +#include "nel/misc/ucstring.h" // REMOVE #include "nel/misc/smart_ptr.h" #include "game_share/chat_group.h" @@ -57,7 +57,7 @@ struct CChatWindowDesc { typedef std::vector > TTemplateParams; - ucstring Title; // unique title for the window + std::string Title; // unique title for the window std::string FatherContainer; // name of the father container. If empty, the chat box must be added manually in the hierarchy std::string ChatTemplate; // Template for the chat interface, or "" to use the default one TTemplateParams ChatTemplateParams; // optional template parameters @@ -94,7 +94,7 @@ public: // called by a CChatWindow when it is deleted virtual void chatWindowRemoved(CChatWindow * /* cw */) {} // called by a CChatWindow when a msg has been displayed in it ('displayMessage' has been called) - //virtual void displayMessage(CChatWindow *cw, const ucstring &msg, NLMISC::CRGBA col, uint numBlinks = 0) {} + //virtual void displayMessage(CChatWindow *cw, const std::string &msg, NLMISC::CRGBA col, uint numBlinks = 0) {} }; public: // display a message in this chat box with the given color @@ -110,16 +110,16 @@ public: // set a command to be displayed and eventually executed in this chat window. std::string version for backward compatibility void setCommand(const std::string &command, bool execute); // set a command to be displayed and eventually executed in this chat window - void setCommand(const ucstring &command, bool execute); + void setCommand(const ucstring &command, bool execute); // REMOVE // set a string to be displayed in the edit box of this window (if it has one) - void setEntry(const ucstring &entry); + void setEntry(const std::string &entry); // Set listener to react to a chat entry void setListener(IChatWindowListener *listener) { _Listener = listener; } IChatWindowListener *getListener() const { return _Listener; } // Set the menu for the chat void setMenu(const std::string &menuName); // Set a new prompt for the chat window - void setPrompt(const ucstring &prompt); + void setPrompt(const std::string &prompt); // Set the color for the chat window void setPromptColor(NLMISC::CRGBA col); /** Get the container associated with this chat window @@ -131,7 +131,7 @@ public: /** try to rename the chat window * \return true if success */ - bool rename(const ucstring &newName, bool newNameLocalize); + bool rename(const std::string &newName, bool newNameLocalize); /** delete the container * Don't do it in the dtor, because done automatically at the end of the app by the interface manager. * Useful only if querried by the user @@ -140,7 +140,7 @@ public: // get the last chat window from which a command has been called static CChatWindow *getChatWindowLaunchingCommand() { return _ChatWindowLaunchingCommand; } // get the title of this chat window - ucstring getTitle() const; + std::string getTitle() const; // observers void addObserver(IObserver *obs); void removeObserver(IObserver *obs); @@ -154,7 +154,7 @@ public: void setAHOnCloseButtonParams(const std::string &n); void setHeaderColor(const std::string &n); // - void displayLocalPlayerTell(const ucstring &receiver, const ucstring &msg, uint numBlinks = 0); + void displayLocalPlayerTell(const std::string &receiver, const std::string &msg, uint numBlinks = 0); /// Encode a color tag '@{RGBA}' in the text. If append is true, append at end of text, otherwise, replace the text static void encodeColorTag(const NLMISC::CRGBA &color, std::string &text, bool append=true); @@ -196,8 +196,8 @@ public: void setTabIndex(sint32 n); // Free Teller - NLGUI::CGroupContainer *createFreeTeller(const ucstring &winName, const std::string &winColor=""); - void setActiveFreeTeller(const ucstring &winName, bool bActive=true); + NLGUI::CGroupContainer *createFreeTeller(const std::string &winName, const std::string &winColor=""); + void setActiveFreeTeller(const std::string &winName, bool bActive=true); std::string getFreeTellerName(const std::string &containerID); bool removeFreeTeller(const std::string &containerID); // Return true if free teller found void removeAllFreeTellers(); @@ -245,9 +245,9 @@ public: CChatWindow *createChatGroupWindow(const CChatWindowDesc &desc); // Get a chat window by its title - CChatWindow *getChatWindow(const ucstring &title); + CChatWindow *getChatWindow(const std::string &title); /// Remove a chat window by its title - void removeChatWindow(const ucstring &title); + void removeChatWindow(const std::string &title); // Remove a chat window by its pointer void removeChatWindow(CChatWindow *cw); /// from a ctrl of a chat box that triggered a menu, or an event, retrieve the associated chat box @@ -255,14 +255,14 @@ public: // Singleton pattern applied to the chat window manager static CChatWindowManager &getInstance(); // try to rename a window - bool rename(const ucstring &oldName, const ucstring &newName, bool newNameLocalize); + bool rename(const std::string &oldName, const std::string &newName, bool newNameLocalize); // warning : this is slow uint getNumChatWindow() const { return (uint)_ChatWindowMap.size(); } // warning : this is slow : for debug only CChatWindow *getChatWindowByIndex(uint index); /////////////////////////////////////////////////////////////////////////////////////// private: - typedef std::map > TChatWindowMap; + typedef std::map > TChatWindowMap; private: // TChatWindowMap _ChatWindowMap; diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 63392c583..dcfdc1fc9 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -102,9 +102,9 @@ void CControlSheetInfoWaiter::infoReceived() } -ucstring CControlSheetInfoWaiter::infoValidated() const +string CControlSheetInfoWaiter::infoValidated() const { - ucstring help; + ucstring help; // FIXME: Lua UTF-8 if (CtrlSheet && !LuaMethodName.empty()) { // delegate setup of context he help ( & window ) to lua @@ -131,7 +131,7 @@ ucstring CControlSheetInfoWaiter::infoValidated() const } } - return help; + return help.toUtf8(); } // *************************************************************************** @@ -3443,10 +3443,10 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const { // call lua function to update tooltip window _ItemInfoWaiter.sendRequest(); - help = _ItemInfoWaiter.infoValidated().toUtf8(); + help = _ItemInfoWaiter.infoValidated(); // its expected to get at least item name back if (help.empty()) - help = getItemActualName().toUtf8(); + help = getItemActualName(); } else if (!_ContextHelp.empty()) { @@ -3454,7 +3454,7 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const } else { - help = getItemActualName().toUtf8();; + help = getItemActualName();; } } else @@ -3575,7 +3575,7 @@ void CDBCtrlSheet::getContextHelpToolTip(std::string &help) const if (useItemInfoForFamily(item->Family)) { _ItemInfoWaiter.sendRequest(); - help = _ItemInfoWaiter.infoValidated().toUtf8(); + help = _ItemInfoWaiter.infoValidated(); return; } } @@ -4563,11 +4563,11 @@ void CDBCtrlSheet::initArmourColors() // *************************************************************************** -ucstring CDBCtrlSheet::getItemActualName() const +string CDBCtrlSheet::getItemActualName() const { const CItemSheet *pIS= asItemSheet(); if(!pIS) - return ucstring(); + return string(); else { string ret; @@ -4587,7 +4587,7 @@ ucstring CDBCtrlSheet::getItemActualName() const if (pIS->Family == ITEMFAMILY::SCROLL_R2) { const R2::TMissionItem *mi = R2::getEditor().getPlotItemInfos(getSheetId()); - if (mi) return mi->Name; + if (mi) return mi->Name.toUtf8(); } // if item is not a mp, append faber_quality & faber_stat_type // Don't append quality and stat type for Named Items!!! diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.h b/ryzom/client/src/interface_v3/dbctrl_sheet.h index 9440222f4..dfe3b7140 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -73,7 +73,7 @@ public: : IItemInfoWaiter(), Requesting(false) { } public: - ucstring infoValidated() const; + std::string infoValidated() const; void sendRequest(); virtual void infoReceived(); }; @@ -582,7 +582,7 @@ public: void setItemColor(sint32 val) {if(_UserColor) _UserColor->setValue32(val);} // Get the Actual item name. Localized version of SheetId, or given by server through NAMEID. - ucstring getItemActualName() const; + std::string getItemActualName() const; /// true if support drag copy (with CTRL). action handler has to check control. bool canDragCopy() const {return _DragCopy;} diff --git a/ryzom/client/src/interface_v3/group_career.cpp b/ryzom/client/src/interface_v3/group_career.cpp index d3f3e2563..10cfca35e 100644 --- a/ryzom/client/src/interface_v3/group_career.cpp +++ b/ryzom/client/src/interface_v3/group_career.cpp @@ -63,13 +63,13 @@ bool CGroupCareer::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) if (Career >= ROLES::NB_ROLES) Career = ROLES::fighter; - ucstring sTmp = ROLES::roleToUCString(Career); + string sTmp = ROLES::roleToUCString(Career); for (uint32 i= 0; i < sTmp.size(); ++i) if (sTmp[i] < 128) if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') ) sTmp[i] = sTmp[i] - 'a' + 'A'; - setUCTitle (sTmp); + setTitle (sTmp); return true; } @@ -133,7 +133,7 @@ bool CGroupJob::parse (xmlNodePtr /* cur */, CInterfaceGroup * /* parentGroup */ // if (sTmp[i] < 128) // if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') ) // sTmp[i] = sTmp[i] - 'a' + 'A'; -// setUCTitle (sTmp); +// seUCTitle (sTmp); // // return true; } diff --git a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp index 9494deacf..4c21fee47 100644 --- a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp +++ b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp @@ -626,11 +626,11 @@ static DECLARE_INTERFACE_USER_FCT(getChatWin) CChatWindowManager &rCWM = CChatWindowManager::getInstance(); - ucstring title = CI18N::get(args[0].getString()); + string title = CI18N::get(args[0].getString()); CChatWindow *window = rCWM.getChatWindow(title); if (!window) { - nlwarning("Can't find window named %s", title.toString().c_str()); + nlwarning("Can't find window named %s", title.c_str()); return false; } string sTmp = window->getContainer()->getId(); diff --git a/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp b/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp index cae4b9d77..7744be7eb 100644 --- a/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp +++ b/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp @@ -313,7 +313,7 @@ static DECLARE_INTERFACE_USER_FCT(getSheetName) // if from ctrlSheet, then take the correct ACTUAL name (ie from NAMEID if not 0) if(ctrlSheet) { - result.setString(ctrlSheet->getItemActualName().toUtf8()); + result.setString(ctrlSheet->getItemActualName()); return true; } // Standard (but less accurate) way diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 1b36c91d5..aa38b6dbf 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; i(CWidgetManager::getInstance()->getElementFromId(WIN_TEMPINV)); - pGC->setUCTitle( title ); + pGC->setTitle( title ); } isInUpdateForageQQ = false; @@ -2199,7 +2199,7 @@ bool SBagOptions::parse(xmlNodePtr cur, CInterfaceGroup * /* parentGroup */) } // *************************************************************************** -void SBagOptions::setSearchFilter(const ucstring &s) +void SBagOptions::setSearchFilter(const string &s) { SearchQualityMin = 0; SearchQualityMax = 999; @@ -2208,13 +2208,13 @@ void SBagOptions::setSearchFilter(const ucstring &s) if (!s.empty()) { - std::vector words; - splitUCString(toLower(s), ucstring(" "), words); + std::vector words; + splitString(toLower(s), string(" "), words); size_t pos; for(int i = 0; i 0) { bool match = true; - ucstring lcName = toLower(pCS->getItemActualName()); + string lcName = toLower(pCS->getItemActualName()); // add item quality as a keyword to match if (pCS->getQuality() > 1) { - lcName += ucstring(" " + toString(pCS->getQuality())); + lcName += string(" " + toString(pCS->getQuality())); } for (uint i = 0; i< SearchFilter.size(); ++i) { - if (lcName.find(SearchFilter[i]) == ucstring::npos) + if (lcName.find(SearchFilter[i]) == string::npos) { return false; } @@ -2741,7 +2741,7 @@ class CHandlerInvSearchButton : public IActionHandler return; } - ucstring filter; + string filter; std::string id = btn->getParent()->getId() + ":" + sParams + ":eb"; CGroupEditBox *eb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id)); if (!eb) @@ -2755,7 +2755,7 @@ class CHandlerInvSearchButton : public IActionHandler { CWidgetManager::getInstance()->setCaptureKeyboard(eb); eb->setSelectionAll(); - filter = eb->getInputStringAsUtf16(); + filter = eb->getInputString(); } CDBGroupListSheetBag *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(btn->getParent()->getId() + ":bag_list")); @@ -2805,10 +2805,10 @@ class CHandlerInvSetSearch : public IActionHandler std::string id = pCaller->getParent()->getParent()->getId(); CDBGroupListSheetBag *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id + ":bag_list")); - if (pList != NULL) pList->setSearchFilter(eb->getInputStringAsUtf16()); + if (pList != NULL) pList->setSearchFilter(eb->getInputString()); CDBGroupIconListBag *pIcons = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id + ":bag_icons")); - if (pIcons != NULL) pIcons->setSearchFilter(eb->getInputStringAsUtf16()); + if (pIcons != NULL) pIcons->setSearchFilter(eb->getInputString()); } }; REGISTER_ACTION_HANDLER( CHandlerInvSetSearch, "inv_set_search" ); diff --git a/ryzom/client/src/interface_v3/inventory_manager.h b/ryzom/client/src/interface_v3/inventory_manager.h index 8c365a0be..6af8414de 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.h +++ b/ryzom/client/src/interface_v3/inventory_manager.h @@ -520,7 +520,7 @@ struct SSortStruct { CDBGroupListSheetText::CSheetChild *SheetText; CDBGroupListSheet::CSheetChild *SheetIcon; - ucstring Pos; + std::string Pos; bool operator < (const SSortStruct &o) const { return Pos < o.Pos; } }; @@ -558,7 +558,7 @@ struct SBagOptions bool SearchFilterChanged; uint16 SearchQualityMin; uint16 SearchQualityMax; - std::vector SearchFilter; + std::vector SearchFilter; // ----------------------- SBagOptions() @@ -576,7 +576,7 @@ struct SBagOptions bool isSomethingChanged(); // From last call ? bool isSearchFilterChanged() const { return SearchFilterChanged; } - void setSearchFilter(const ucstring &s); + void setSearchFilter(const std::string &s); bool getFilterArmor() const { @@ -674,7 +674,7 @@ public: // Return true if the sheet can be displayed due to filters bool canDisplay(CDBCtrlSheet *pCS) { return _BO.canDisplay(pCS); } - void setSearchFilter(const ucstring &s) { _BO.setSearchFilter(s); } + void setSearchFilter(const std::string &s) { _BO.setSearchFilter(s); } private: @@ -707,7 +707,7 @@ public: // Return true if the sheet can be displayed due to filters bool canDisplay(CDBCtrlSheet *pCS) const { return _BO.canDisplay(pCS); } - void setSearchFilter(const ucstring &s) { _BO.setSearchFilter(s); } + void setSearchFilter(const std::string &s) { _BO.setSearchFilter(s); } ////////////////////////////////////////////////////////////////////////// diff --git a/ryzom/client/src/interface_v3/item_special_effect.cpp b/ryzom/client/src/interface_v3/item_special_effect.cpp index 7b659fe6d..fdb53a0ec 100644 --- a/ryzom/client/src/interface_v3/item_special_effect.cpp +++ b/ryzom/client/src/interface_v3/item_special_effect.cpp @@ -51,8 +51,8 @@ void CItemSpecialEffectHelper::registerItemSpecialEffect(const string &name) vector params; // get ui string - ucstring ucs = CI18N::get("uiItemFX_" + name); - CSString p, s = ucs.toString(); + string ucs = CI18N::get("uiItemFX_" + name); + CSString p, s = ucs; // locate and store parameters // %p : percent diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index aa6ffe213..21977f0bc 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -87,7 +87,7 @@ using namespace NLMISC; // *************************************************************************** // Add the template key to the parent -void addKeyLine (CGroupList *pParent, const ucstring &keyName, const ucstring &shortcutName, bool grayed) +void addKeyLine (CGroupList *pParent, const string &keyName, const string &shortcutName, bool grayed) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); CMacroCmdManager *pMCM = CMacroCmdManager::getInstance(); @@ -104,14 +104,14 @@ void addKeyLine (CGroupList *pParent, const ucstring &keyName, const ucstring &s CViewText *pViewKeyName = dynamic_cast(pKeysLine->getView(TEMPLATE_KEYS_KEY_NAME)); if (pViewKeyName != NULL) { - pViewKeyName->setText (keyName.toUtf8()); + pViewKeyName->setText (keyName); pViewKeyName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); } CViewText *pViewShortcutName = dynamic_cast(pKeysLine->getView(TEMPLATE_KEYS_SHORTCUT_NAME)); if (pViewShortcutName != NULL) { - pViewShortcutName->setText (shortcutName.toUtf8()); + pViewShortcutName->setText (shortcutName); pViewShortcutName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); } diff --git a/ryzom/client/src/interface_v3/music_player.cpp b/ryzom/client/src/interface_v3/music_player.cpp index 790949352..c7c9e89eb 100644 --- a/ryzom/client/src/interface_v3/music_player.cpp +++ b/ryzom/client/src/interface_v3/music_player.cpp @@ -586,9 +586,17 @@ static void addFromPlaylist(const std::string &playlist, const std::vectorgetTitle().toString()).c_str()); + nlwarning("Window %d : %s", (int) k, (cwm.getChatWindowByIndex(k)->getTitle()).c_str()); } } } @@ -1121,7 +1121,7 @@ void CPeopleInterraction::askAddContact(const string &contactName, CPeopleList * if (pl == &FriendList) list = 0; - ucstring temp = contactName; // TODO: UTF-8 serial + ucstring temp = ucstring::makeFromUtf8(contactName); // TODO: UTF-8 (serial) out.serial(temp); out.serial(list); NetMngr.push(out); @@ -1192,7 +1192,7 @@ void CPeopleInterraction::askMoveContact(uint peopleIndexInSrc, CPeopleList *plS // Fake Local simulation if (ClientCfg.Local) { - ucstring peopleName= plSRC->getName(peopleIndexInSrc); + string peopleName= plSRC->getName(peopleIndexInSrc); plSRC->removePeople(peopleIndexInSrc); sint dstIndex = plDST->addPeople(peopleName); plDST->setOnline(dstIndex, ccs_online); @@ -1252,7 +1252,7 @@ void CPeopleInterraction::askRemoveContact(uint peopleIndex, CPeopleList *pl) //================================================================================================================= void CPeopleInterraction::initContactLists( const std::vector &vFriendListName, const std::vector &vFriendListOnline, - const std::vector &vIgnoreListName ) + const std::vector &vIgnoreListName ) // TODO: UTF-8 (serial) { // clear the current lists if any @@ -1264,18 +1264,18 @@ void CPeopleInterraction::initContactLists( const std::vector &vFriendLi for (uint i = 0; i < vFriendListName.size(); ++i) addContactInList(contactIdPool++, vFriendListName[i], vFriendListOnline[i], 0); for (uint i = 0; i < vIgnoreListName.size(); ++i) - addContactInList(contactIdPool++, vIgnoreListName[i], ccs_offline, 1); + addContactInList(contactIdPool++, vIgnoreListName[i].toUtf8(), ccs_offline, 1); updateAllFreeTellerHeaders(); } //================================================================================================================= -void CPeopleInterraction::addContactInList(uint32 contactId, const ucstring &nameIn, TCharConnectionState online, uint8 nList) +void CPeopleInterraction::addContactInList(uint32 contactId, const string &nameIn, TCharConnectionState online, uint8 nList) { // select correct people list CPeopleList &pl= nList==0?FriendList:IgnoreList; // remove the shard name if possible - string name= CEntityCL::removeShardFromName(nameIn.toUtf8()); + string name= CEntityCL::removeShardFromName(nameIn); // add the contact to this list sint index = pl.getIndexFromName(name); @@ -1321,12 +1321,12 @@ void CPeopleInterraction::addContactInList(uint32 contactId, uint32 nameID, TCha } //================================================================================================================= -bool CPeopleInterraction::isContactInList(const ucstring &nameIn, uint8 nList) const +bool CPeopleInterraction::isContactInList(const string &nameIn, uint8 nList) const { // select correct people list const CPeopleList &pl= nList==0?FriendList:IgnoreList; // remove the shard name if possible - string name= CEntityCL::removeShardFromName(nameIn.toUtf8()); + string name= CEntityCL::removeShardFromName(nameIn); return pl.getIndexFromName(name) != -1; } @@ -1455,12 +1455,14 @@ void CPeopleInterraction::removeContactFromList(uint32 contactId, uint8 nList) } //================================================================================================================= -bool CPeopleInterraction::testValidPartyChatName(const ucstring &title) +bool CPeopleInterraction::testValidPartyChatName(const string &title) { if (title.empty()) return false; // shouldn't begin like 'user chat 1-5' - ucstring userChatStr = CI18N::get("uiUserChat"); - if (title.substr(0, userChatStr.length()) == userChatStr) return false; + const string &userChatStr = CI18N::get("uiUserChat"); + if (NLMISC::startsWith(title, userChatStr)) return false; + // can't match a translation identifier + if (CI18N::hasTranslation(title)) return false; for(uint k = 0; k < PartyChats.size(); ++k) // there shouldn't be that much party chat simultaneously so a linear search is ok { if (PartyChats[k].Window->getTitle() == title) return false; @@ -1471,9 +1473,9 @@ bool CPeopleInterraction::testValidPartyChatName(const ucstring &title) if (GuildChat && title == GuildChat->getTitle()) return false; if (TeamChat && title == TeamChat->getTitle()) return false; sint index; - index = FriendList.getIndexFromName(title.toUtf8()); + index = FriendList.getIndexFromName(title); if (index != -1) return false; - index = IgnoreList.getIndexFromName(title.toUtf8()); + index = IgnoreList.getIndexFromName(title); if (index != -1) return false; // TODO_GAMEDEV server test for the name (not only local), & modify callers of this function // The party chat should NOT have the name of a player @@ -1526,7 +1528,7 @@ void CPeopleInterraction::assignPartyChatMenu(CChatWindow *partyChat) } //================================================================================================================= -bool CPeopleInterraction::createNewPartyChat(const ucstring &title) +bool CPeopleInterraction::createNewPartyChat(const string &title) { // now there are no party chat windows, party chat phrases must be filtered from the main chat @@ -1851,8 +1853,8 @@ void CPeopleInterraction::createUserChat(uint index) return; } CChatWindowDesc chatDesc; - ucstring userChatStr = CI18N::get("uiUserChat"); - userChatStr += ucchar(' ') + ucstring(toString(index + 1)); + string userChatStr = CI18N::get("uiUserChat"); + userChatStr += ' ' + toString(index + 1); //chatDesc.FatherContainer = "ui:interface:communication"; chatDesc.FatherContainer = "ui:interface:contact_list"; chatDesc.Title = userChatStr; @@ -2592,7 +2594,7 @@ public: { for(uint l = 0; l < pl.PartyChats.size(); ++l) { - menu->addLineAtIndex(insertionIndex, pl.PartyChats[l].Window->getTitle().toUtf8(), "chat_target_selected", toString(pl.PartyChats[l].ID)); + menu->addLineAtIndex(insertionIndex, pl.PartyChats[l].Window->getTitle(), "chat_target_selected", toString(pl.PartyChats[l].ID)); ++ insertionIndex; } } @@ -2939,7 +2941,7 @@ class CHandlerSelectChatSource : public IActionHandler { if (pc[l].Filter != NULL) { - menu->addLineAtIndex(insertionIndex, pc[l].Window->getTitle().toUtf8(), FILTER_TOGGLE, toString(pc[l].ID)); + menu->addLineAtIndex(insertionIndex, pc[l].Window->getTitle(), FILTER_TOGGLE, toString(pc[l].ID)); menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, toString(pc[l].ID), pc[l].Filter->isListeningWindow(cw))); ++ insertionIndex; } diff --git a/ryzom/client/src/interface_v3/people_interraction.h b/ryzom/client/src/interface_v3/people_interraction.h index 59230853f..8181c1705 100644 --- a/ryzom/client/src/interface_v3/people_interraction.h +++ b/ryzom/client/src/interface_v3/people_interraction.h @@ -156,12 +156,12 @@ public: CFilteredChat UserChat[MaxNumUserChats]; CFilteredChat TheUserChat; // Id of last people who talked - ucstring LastSenderName; + std::string LastSenderName; // system message struct CSysMsg { - ucstring Str; + std::string Str; std::string Cat; }; // system message buffer @@ -195,13 +195,13 @@ public: */ CFilteredChat *getFilteredChatFromChatWindow(CChatWindow *cw); - bool testValidPartyChatName(const ucstring &name); + bool testValidPartyChatName(const std::string &name); bool removePartyChat(CChatWindow *window); void removeAllPartyChat(); /** * create a named party chat. */ - bool createNewPartyChat(const ucstring &title); + bool createNewPartyChat(const std::string &title); static void assignPartyChatMenu(CChatWindow *partyChat); @@ -215,11 +215,11 @@ public: // init contact list (from server typically) void initContactLists( const std::vector &vFriendListName, const std::vector &vFriendListOnline, - const std::vector &vIgnoreListName ); + const std::vector &vIgnoreListName ); // TODO: UTF-8 (serial) // Friend list == 0 // Ignore list == 1 void addContactInList(uint32 contactId, uint32 nameID, TCharConnectionState Online, uint8 nList); - void addContactInList(uint32 contactId, const ucstring &name, TCharConnectionState Online, uint8 nList); - bool isContactInList(const ucstring &name, uint8 nList) const; + void addContactInList(uint32 contactId, const std::string &name, TCharConnectionState Online, uint8 nList); + bool isContactInList(const std::string &name, uint8 nList) const; // Called each frame to receive name from IOS void updateWaitingContacts(); // server decide to remove a contact (if it does not exists anymore) diff --git a/ryzom/client/src/interface_v3/people_list.cpp b/ryzom/client/src/interface_v3/people_list.cpp index f056f4cc5..6650b7ef2 100644 --- a/ryzom/client/src/interface_v3/people_list.cpp +++ b/ryzom/client/src/interface_v3/people_list.cpp @@ -127,10 +127,7 @@ bool CPeopleList::create(const CPeopleListDesc &desc, const CChatWindowDesc *cha _BaseContainer->setSavable(desc.Savable); _BaseContainer->setLocalize(desc.Localize); - if (desc.Localize) - _BaseContainer->setTitle(desc.PeopleListTitle.toString()); - else - _BaseContainer->setUCTitle(desc.PeopleListTitle); + _BaseContainer->setTitle(desc.PeopleListTitle); //_BaseContainer->setId("ui:interface:" + desc.Id); // create the chat window if there's one @@ -162,7 +159,7 @@ sint CPeopleList::getIndexFromName(const string &name) const string sNameIn = toLower(name); for(uint k = 0; k < _Peoples.size(); ++k) { - string sPeopleName = toLower(_Peoples[k].getName().toUtf8()); + string sPeopleName = toLower(_Peoples[k].getName()); if (sPeopleName == sNameIn) return k; } return -1; @@ -198,8 +195,8 @@ bool CPeopleList::sortExByContactId(const CPeople& a, const CPeople& b) //================================================================== bool CPeopleList::sortExByName(const CPeople& a, const CPeople& b) { - ucstring name_a = toUpper(a.getName()); - ucstring name_b = toUpper(b.getName()); + string name_a = toUpper(a.getName()); + string name_b = toUpper(b.getName()); return (name_a < name_b); } @@ -207,8 +204,8 @@ bool CPeopleList::sortExByName(const CPeople& a, const CPeople& b) //================================================================== bool CPeopleList::sortExByOnline(const CPeople& a, const CPeople& b) { - ucstring name_a = toUpper(a.getName()); - ucstring name_b = toUpper(b.getName()); + string name_a = toUpper(a.getName()); + string name_b = toUpper(b.getName()); // We want order: online/alpha, offworld/alpha, offline/alpha if (a.Online == b.Online) @@ -331,13 +328,13 @@ bool CPeopleList::isPeopleWindowVisible(uint index) const */ //================================================================== -sint CPeopleList::addPeople(const ucstring &name, uint teamMateIndex /*= 0*/) +sint CPeopleList::addPeople(const string &name, uint teamMateIndex /*= 0*/) { if (!_BaseContainer) return - 1; // check if not already inserted - if (getIndexFromName(name.toUtf8()) != -1) + if (getIndexFromName(name) != -1) { - nlwarning(" people %s inserted twice.", name.toString().c_str()); + nlwarning(" people %s inserted twice.", name.c_str()); } vector > properties; @@ -371,11 +368,11 @@ sint CPeopleList::addPeople(const ucstring &name, uint teamMateIndex /*= 0*/) if (!gc) { delete group; - nlwarning(" group is not a container.", name.toString().c_str()); + nlwarning(" group is not a container.", name.c_str()); return -1; } // set title from the name - gc->setUCTitle(name); + gc->setTitle(name); // People inside list are not savable ! gc->setSavable(false); // @@ -694,7 +691,7 @@ std::string CPeopleList::getName(uint index) const nlwarning("bad index"); return "BAD INDEX!"; } - return _Peoples[index].getName().toUtf8(); + return _Peoples[index].getName(); } //================================================================== diff --git a/ryzom/client/src/interface_v3/people_list.h b/ryzom/client/src/interface_v3/people_list.h index 91dbf50d3..ccd8e2f41 100644 --- a/ryzom/client/src/interface_v3/people_list.h +++ b/ryzom/client/src/interface_v3/people_list.h @@ -28,7 +28,6 @@ #include "chat_window.h" #include "interface_pointer.h" // NeL -#include "nel/misc/ucstring.h" #include "nel/misc/rgba.h" @@ -40,7 +39,7 @@ struct CPeopleListDesc { enum TContactType { Team, Contact, Ignore, Unknown }; - ucstring PeopleListTitle; // title of the people list + std::string PeopleListTitle; // title of the people list TContactType ContactType; std::string FatherContainer; // name of the father container std::string BaseContainerTemplateName; // name of the template for the base container @@ -99,7 +98,7 @@ public: /** Add a people to the list, and returns its index or -1 if the creation failed * If this is a team mate, tells its index so that ic can be bound to the database in the right location */ - sint addPeople(const ucstring &name, uint teamMateIndex = 0); + sint addPeople(const std::string &name, uint teamMateIndex = 0); // swap people position between the 2 given indexs void swapPeople(uint index1, uint index2); // Remove the people at the given index @@ -159,7 +158,7 @@ private: bool Blocked; uint32 ContactId; bool operator < (const CPeople &other) const { return getName() < other.getName(); } - ucstring getName() const { return Container->getUCTitle(); } + std::string getName() const { return Container->getTitle(); } }; typedef std::vector TPeopleVect; private: diff --git a/ryzom/client/src/interface_v3/skill_manager.cpp b/ryzom/client/src/interface_v3/skill_manager.cpp index cf35e6bd6..9d10cde0a 100644 --- a/ryzom/client/src/interface_v3/skill_manager.cpp +++ b/ryzom/client/src/interface_v3/skill_manager.cpp @@ -588,8 +588,8 @@ void CSkillManager::checkTitleUnblocked(CHARACTER_TITLE::ECharacterTitle i, bool // This is a new title, send a message string titleStr = CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)i); bool womenTitle = (UserEntity && UserEntity->getGender() == GSGENDER::female); - const ucstring newtitle(CStringManagerClient::getTitleLocalizedName(titleStr, womenTitle)); - CAHManager::getInstance()->runActionHandler("message_popup", NULL, "text1="+newtitle.toUtf8()+"|text0="+CI18N::get("uiNewTitleBold")); + const char *newtitle(CStringManagerClient::getTitleLocalizedName(titleStr, womenTitle)); + CAHManager::getInstance()->runActionHandler("message_popup", NULL, string("text1=") + newtitle + "|text0=" + CI18N::get("uiNewTitleBold")); } else { @@ -1097,8 +1097,8 @@ public: { string titleStr = CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)i); bool womenTitle = (UserEntity && UserEntity->getGender() == GSGENDER::female); - const ucstring s(CStringManagerClient::getTitleLocalizedName(titleStr,womenTitle)); - pCB->addText(s.toUtf8()); + const char *s = CStringManagerClient::getTitleLocalizedName(titleStr, womenTitle); + pCB->addText(s); pSM->_UIUnblockedTitles.push_back((CHARACTER_TITLE::ECharacterTitle)i); } } diff --git a/ryzom/client/src/interface_v3/sphrase_manager.cpp b/ryzom/client/src/interface_v3/sphrase_manager.cpp index c42d544d1..cf4950fdd 100644 --- a/ryzom/client/src/interface_v3/sphrase_manager.cpp +++ b/ryzom/client/src/interface_v3/sphrase_manager.cpp @@ -3632,7 +3632,7 @@ public: bool Castable; uint32 Type; uint32 Icon; - ucstring Text; + string Text; bool operator<(const CPhraseSortEntry &pse) const { @@ -3840,9 +3840,9 @@ void CSPhraseManager::computePhraseProgression() // replace each number with 001 format. toLower for(uint k=0;ksetText(ucstring(toString(_SheetId.getSInt32()))); + _SheetText->setText(toString(_SheetId.getSInt32())); _SheetText->draw(xOffset,yOffset+20); - _QuantityText->setText(ucstring(toString(_Quantity.getSInt32()))); + _QuantityText->setText(toString(_Quantity.getSInt32())); _QuantityText->draw(xOffset,yOffset+10); - _QualityText->setText(ucstring(toString(_Quality.getSInt32()))); + _QualityText->setText(toString(_Quality.getSInt32())); _QualityText->draw(xOffset,yOffset); */ diff --git a/ryzom/client/src/misc.cpp b/ryzom/client/src/misc.cpp index 4e35cfc2a..0432abf1a 100644 --- a/ryzom/client/src/misc.cpp +++ b/ryzom/client/src/misc.cpp @@ -885,7 +885,7 @@ NLMISC::CRGBA interpClientCfgColor(const string &src, string &dest) colorCode.resize(nextPos - 1); for(uint k = 0; k < nextPos - 1; ++k) { - colorCode[k] = tolower((char) src[k + 1]); + colorCode[k] = tolower((char) src[k + 1]); // TODO: toLowerAscii } std::map::const_iterator it = ClientCfg.SystemInfoParams.find(colorCode); if (it != ClientCfg.SystemInfoParams.end()) @@ -953,7 +953,7 @@ std::string getStringCategoryIfAny(const string &src, string &dest) colorCode.resize( codeSize ); for(ptrdiff_t k = 0; k < (ptrdiff_t)codeSize; ++k) { - colorCode[k] = tolower((char) src[k + startPos + 1]); + colorCode[k] = tolower((char) src[k + startPos + 1]); // TODO: toLowerAscii } string destTmp; if ( startPos != 0 ) diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index 6b73acba2..e98d13fe9 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -2494,7 +2494,7 @@ void impulseRemoteAdmin (NLMISC::CBitMemStream &impulse) impulse.serial (cmd); // remove the 2 first rc character if exists, only there to say to the EGS that is a remote command - if (cmd.size()>2 && tolower(cmd[0])=='r' && tolower(cmd[1])=='c') + if (cmd.size()>2 && tolower(cmd[0])=='r' && tolower(cmd[1])=='c') // FIXME: toLowerAscii cmd = cmd.substr(2); mdDisplayVars.clear (); diff --git a/ryzom/client/src/zone_util.cpp b/ryzom/client/src/zone_util.cpp index 33b7fdf68..d7da6810c 100644 --- a/ryzom/client/src/zone_util.cpp +++ b/ryzom/client/src/zone_util.cpp @@ -53,7 +53,7 @@ bool getPosFromZoneName(const std::string &name,NLMISC::CVector2f &dest) while (i < zoneName.size()) { if (!::isalpha(zoneName[i])) return false; - xStr += (char) ::toupper(zoneName[i]); ++i; + xStr += (char) NLMISC::toUpper(zoneName[i]); ++i; } if (xStr.size() != 2) return false; dest.x = 160.f * ((xStr[0] - 'A') * 26 + (xStr[1] - 'A')); @@ -89,7 +89,7 @@ bool getZonePosFromZoneName(const std::string &name, sint &x, sint &y) while (i < zoneName.size()) { if (!::isalpha(zoneName[i])) return false; - xStr += (char) ::toupper(zoneName[i]); ++i; + xStr += (char) NLMISC::toUpper(zoneName[i]); ++i; } if (xStr.size() != 2) return false; x = (xStr[0] - 'A') * 26 + (xStr[1] - 'A');