From c069b70ce8ec156b9a3c1638fee2d6dbc1d321a6 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 1 Nov 2020 05:13:39 +0800 Subject: [PATCH] UTF-8 various, ryzom/ryzomcore#335 --- nel/include/nel/misc/utf_string_view.h | 6 + nel/src/misc/utf_string_view.cpp | 39 +++ ryzom/client/src/actions.cpp | 41 ++- ryzom/client/src/actions.h | 4 +- ryzom/client/src/bg_downloader_access.cpp | 25 +- ryzom/client/src/bg_downloader_access.h | 16 +- ryzom/client/src/candidate.h | 3 +- ryzom/client/src/client_cfg.cpp | 2 +- ryzom/client/src/client_chat_manager.cpp | 10 +- ryzom/client/src/client_chat_manager.h | 14 +- ryzom/client/src/commands.cpp | 60 ++--- ryzom/client/src/commands.h | 2 +- ryzom/client/src/connection.cpp | 123 +++++---- ryzom/client/src/connection.h | 8 +- ryzom/client/src/continent.cpp | 2 + ryzom/client/src/continent_manager_build.h | 2 +- ryzom/client/src/entities.cpp | 2 +- ryzom/client/src/far_tp.cpp | 6 + ryzom/client/src/init.cpp | 20 +- .../src/interface_v3/action_handler_game.cpp | 5 +- .../src/interface_v3/action_handler_help.cpp | 249 +++++++++--------- ryzom/client/src/interface_v3/chat_window.cpp | 35 +-- .../client/src/interface_v3/dbctrl_sheet.cpp | 20 +- .../src/interface_v3/dbgroup_build_phrase.cpp | 4 +- .../interface_v3/dbgroup_list_sheet_trade.cpp | 6 +- .../interface_v3/group_in_scene_bubble.cpp | 2 + .../src/interface_v3/group_modal_get_key.cpp | 4 +- .../src/interface_v3/interface_manager.cpp | 2 + .../interface_v3/item_consumable_effect.cpp | 20 +- .../src/interface_v3/item_consumable_effect.h | 2 +- .../src/interface_v3/item_special_effect.cpp | 8 +- .../src/interface_v3/item_special_effect.h | 4 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 6 + ryzom/client/src/interface_v3/lua_ihm_ryzom.h | 4 +- .../client/src/interface_v3/macrocmd_key.cpp | 16 +- .../src/interface_v3/macrocmd_manager.cpp | 15 +- .../client/src/interface_v3/music_player.cpp | 4 +- .../src/interface_v3/people_interraction.cpp | 28 +- .../src/interface_v3/people_interraction.h | 2 +- ryzom/client/src/interface_v3/people_list.cpp | 14 +- ryzom/client/src/interface_v3/people_list.h | 4 +- .../src/interface_v3/req_skill_formula.cpp | 4 +- .../src/interface_v3/req_skill_formula.h | 2 +- .../src/interface_v3/sphrase_manager.cpp | 50 ++-- .../client/src/interface_v3/sphrase_manager.h | 12 +- ryzom/client/src/login.cpp | 22 +- ryzom/client/src/main_loop.cpp | 4 + ryzom/client/src/net_manager.cpp | 20 +- ryzom/client/src/progress.cpp | 13 +- ryzom/client/src/progress.h | 10 +- ryzom/client/src/release.cpp | 4 + .../common/src/game_share/character_summary.h | 2 +- ryzom/common/src/game_share/item_infos.h | 6 +- .../common/src/game_share/mainland_summary.h | 4 +- .../common/src/game_share/msg_client_server.h | 2 +- ryzom/common/src/game_share/sphrase_com.h | 2 +- 56 files changed, 550 insertions(+), 446 deletions(-) diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index 0aac8d2c3..572d39ac4 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -23,6 +23,8 @@ namespace NLMISC { +class IStream; + /// String view for UTF-8 and UTF-32 iteration as 32-bit codepoints. /// This string view keeps the string as a reference, it does not make a copy. /// Only use this for iterating a string's codepoints. @@ -141,6 +143,10 @@ public: static void append(std::string &str, u32char c); + /// Encode or decode a single UTF-8 character in a stream (also useful for packing unsigned 20-bit integers) + static void append(IStream &s, u32char c); + static u32char get(IStream &s); + 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 17dbaea58..64f2f8e55 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -18,6 +18,7 @@ // Project includes #include +#include // References: // - https://twiserandom.com/unicode/unicode-encoding-utf-8-utf-16-utf-32/ @@ -69,6 +70,44 @@ void CUtfStringView::append(std::string &str, u32char c) appendUtf8(str, c); } +void CUtfStringView::append(IStream &s, u32char c) +{ + nlassert(!s.isReading()); + std::string tmp; + tmp.reserve(4); + append(tmp, c); + s.serialBuffer((uint8_t *)&tmp[0], tmp.size()); +} + +u32char CUtfStringView::get(IStream &s) +{ + nlassert(s.isReading()); + + std::string tmp; + tmp.reserve(4); + uint8_t c; + s.serial(c); + + // Single byte + if (c < 0x80) + return c; + + // Do a fast check of length + tmp += (char)c; + size_t len; + if ((c & 0xF0) == 0xF0) len = 4; + if ((c & 0xE0) == 0xE0) len = 3; + else len = 2; + + // Read from stream + tmp.resize(len); + s.serialBuffer((uint8_t *)&tmp[1], len - 1); + + // Decode + const void *str = tmp.c_str(); + return utf8Iterator(&str); +} + std::string CUtfStringView::toUtf8(bool reEncode) const { // Decode UTF and encode UTF-8 diff --git a/ryzom/client/src/actions.cpp b/ryzom/client/src/actions.cpp index 67695a9d6..604343afd 100644 --- a/ryzom/client/src/actions.cpp +++ b/ryzom/client/src/actions.cpp @@ -42,7 +42,7 @@ extern CEventsListener EventsListener; // Hierarchical timer H_AUTO_DECL ( RZ_Client_Actions_Context_Mngr_Update ) -static bool getParam (CBaseAction::CParameter::TType type, ucstring ¶mName, ucstring ¶mValue, const std::string &argu, uint paramId); +static bool getParam (CBaseAction::CParameter::TType type, string ¶mName, string ¶mValue, const std::string &argu, uint paramId); ///////////////////////////////////////////////////// ///////////////////////////////////////////////////// @@ -243,8 +243,8 @@ bool CActionsManager::isActionPresentInContext(const CAction::CName &name) const const CBaseAction::CParameter ¶meter = baseAction->Parameters[i]; if (parameter.Type == CBaseAction::CParameter::Constant) { - ucstring paramName; - ucstring paramValue = parameter.DefaultValue; + string paramName; + string paramValue = parameter.DefaultValue; // Get the param from the argu getParam (parameter.Type, paramName, paramValue, name.Argu, i); @@ -252,7 +252,7 @@ bool CActionsManager::isActionPresentInContext(const CAction::CName &name) const bool found = true; for (uint k = 0; k < parameter.Values.size(); ++k) { - if (parameter.Values[k].Value == paramValue.toUtf8()) + if (parameter.Values[k].Value == paramValue) { if (!ActionsContext.matchContext(parameter.Values[k].Contexts)) return false; found = true; @@ -631,7 +631,7 @@ CBaseAction::CParameter::CParameter () // *************************************************************************** -static bool getParam (CBaseAction::CParameter::TType type, ucstring ¶mName, ucstring ¶mValue, const std::string &argu, uint paramId) +static bool getParam (CBaseAction::CParameter::TType type, string ¶mName, string ¶mValue, const std::string &argu, uint paramId) { const string separator = "|"; const string equal_separator = "="; @@ -672,10 +672,7 @@ static bool getParam (CBaseAction::CParameter::TType type, ucstring ¶mName, } // Value ? - if(type==CBaseAction::CParameter::User || type==CBaseAction::CParameter::UserName) - paramValue.fromUtf8(argu.substr(pos, end-pos)); - else - paramValue = argu.substr(pos, end-pos); + paramValue = argu.substr(pos, end-pos); // Ok return true; @@ -683,10 +680,10 @@ static bool getParam (CBaseAction::CParameter::TType type, ucstring ¶mName, return false; } -ucstring CBaseAction::getActionLocalizedText (const CAction::CName &name) const +string CBaseAction::getActionLocalizedText(const CAction::CName &name) const { // Action base name - ucstring temp = CI18N::get(LocalizedName); + string temp = CI18N::get(LocalizedName); // Get the parameter uint i; @@ -694,8 +691,8 @@ ucstring CBaseAction::getActionLocalizedText (const CAction::CName &name) const { bool parameterOk = false; const CParameter ¶meter = Parameters[i]; - ucstring paramName; - ucstring paramValue; + string paramName; + string paramValue; // Get the param from the argu if (getParam (parameter.Type, paramName, paramValue, name.Argu, i)) @@ -703,7 +700,7 @@ ucstring CBaseAction::getActionLocalizedText (const CAction::CName &name) const switch (parameter.Type) { case CParameter::Hidden: - if ((ucstring (parameter.DefaultValue) == paramValue) && (ucstring (parameter.Name) == paramName)) + if ((parameter.DefaultValue == paramValue) && (parameter.Name == paramName)) parameterOk = true; break; case CParameter::Constant: @@ -713,7 +710,7 @@ ucstring CBaseAction::getActionLocalizedText (const CAction::CName &name) const { // This value ? const CParameter::CValue &value = parameter.Values[j]; - if (ucstring(value.Value) == paramValue) + if (value.Value == paramValue) { temp += " "; @@ -746,7 +743,7 @@ ucstring CBaseAction::getActionLocalizedText (const CAction::CName &name) const if (i==Parameters.size ()) return temp; - return ucstring(""); + return string(); } // *************************************************************************** @@ -791,8 +788,8 @@ const CActionsManager::CCategoryLocator *CActionsManager::getActionLocator (cons { bool parameterOk = false; const CBaseAction::CParameter ¶meter = baseAction.Parameters[i]; - ucstring paramName; - ucstring paramValue; + string paramName; + string paramValue; // Get the param from the argu if (getParam (parameter.Type, paramName, paramValue, name.Argu, i)) @@ -800,7 +797,7 @@ const CActionsManager::CCategoryLocator *CActionsManager::getActionLocator (cons switch (parameter.Type) { case CBaseAction::CParameter::Hidden: - if ((ucstring (parameter.DefaultValue) == paramValue) && (ucstring (parameter.Name) == paramName)) + if ((parameter.DefaultValue == paramValue) && (parameter.Name == paramName)) parameterOk = true; break; case CBaseAction::CParameter::Constant: @@ -810,7 +807,7 @@ const CActionsManager::CCategoryLocator *CActionsManager::getActionLocator (cons for (j=0; jgetActionLocalizedText(name); } diff --git a/ryzom/client/src/actions.h b/ryzom/client/src/actions.h index f333782f5..df3d794c9 100644 --- a/ryzom/client/src/actions.h +++ b/ryzom/client/src/actions.h @@ -248,7 +248,7 @@ public: std::string Contexts; /// Get an action localized text - ucstring getActionLocalizedText (const CAction::CName &name) const; + std::string getActionLocalizedText (const CAction::CName &name) const; // see if there's at least one set of parameters for which this action is usable in current context bool isUsableInCurrentContext() const; @@ -415,7 +415,7 @@ public: const TActionsForceDisplaySet &getActionsForceDisplaySet() const {return _ActionForceDisplay;} /// Get an action localized text - ucstring getActionLocalizedText (const CAction::CName &name) const; + std::string getActionLocalizedText (const CAction::CName &name) const; //@} diff --git a/ryzom/client/src/bg_downloader_access.cpp b/ryzom/client/src/bg_downloader_access.cpp index e2500eaa6..338b86f9a 100644 --- a/ryzom/client/src/bg_downloader_access.cpp +++ b/ryzom/client/src/bg_downloader_access.cpp @@ -19,6 +19,9 @@ #include "stdpch.h" #include "bg_downloader_access.h" + +#ifdef RYZOM_BG_DOWNLOADER + #include "global.h" #include "login_patch.h" // @@ -84,7 +87,7 @@ CBGDownloaderAccess::CBGDownloaderAccess() //===================================================== void CBGDownloaderAccess::clearCurrentMessage() { - _CurrentMessage = ucstring(); + _CurrentMessage = ucstring(); // OLD _CurrentFilesToGet = 0; _TotalFilesToGet = 0; _PatchingSize = 0; @@ -194,7 +197,7 @@ void CBGDownloaderAccess::startTask(const BGDownloader::CTaskDesc &taskDesc, con } //===================================================== -bool CBGDownloaderAccess::isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const +bool CBGDownloaderAccess::isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const // OLD { if (_State == State_Finished) { @@ -354,7 +357,7 @@ void CBGDownloaderAccess::CDownloadCoTask::run() { shutdownDownloader(); Parent->_TaskResult = TaskResult_Error; - Parent->_ErrorMsg = ucstring(e.what()); + Parent->_ErrorMsg = ucstring(e.what()); // OLD Parent->_DownloadThreadPriority = ThreadPriority_DownloaderError; } catch(const NLMISC::EStream &e) @@ -362,7 +365,7 @@ void CBGDownloaderAccess::CDownloadCoTask::run() shutdownDownloader(); Parent->_TaskResult = TaskResult_Error; nlwarning("BG DOWNLOADER PROTOCOL ERROR ! Stream error"); - Parent->_ErrorMsg = CI18N::get("uiBGD_ProtocolError") + ucstring(" : ") + ucstring(e.what()); + Parent->_ErrorMsg = CI18N::get("uiBGD_ProtocolError") + ucstring(" : ") + ucstring(e.what()); // OLD Parent->_DownloadThreadPriority = ThreadPriority_DownloaderError; } catch (const EWaitMessageTimeoutException &e) @@ -370,7 +373,7 @@ void CBGDownloaderAccess::CDownloadCoTask::run() shutdownDownloader(); Parent->_TaskResult = TaskResult_Error; nlwarning("BG DOWNLOADER PROTOCOL ERROR ! Message timeout"); - Parent->_ErrorMsg = CI18N::get("uiBGD_ProtocolError") + ucstring(" : ") + ucstring(e.what()); + Parent->_ErrorMsg = CI18N::get("uiBGD_ProtocolError") + ucstring(" : ") + ucstring(e.what()); // OLD Parent->_DownloadThreadPriority = ThreadPriority_DownloaderError; } Parent->_State = State_Finished; @@ -614,7 +617,7 @@ TDownloaderMode CBGDownloaderAccess::CDownloadCoTask::getDownloaderMode() void CBGDownloaderAccess::CDownloadCoTask::getTaskResult(TTaskResult &result, uint32 &availablePatchs, bool &mustLaunchBatFile, - ucstring &errorMsg + ucstring &errorMsg // OLD ) { sendSimpleMsg(CL_GetTaskResult); @@ -623,7 +626,7 @@ void CBGDownloaderAccess::CDownloadCoTask::getTaskResult(TTaskResult &result, inMsg.serialEnum(result); inMsg.serial(availablePatchs); inMsg.serial(mustLaunchBatFile); - inMsg.serial(errorMsg); + inMsg.serial(errorMsg); // OLD } //===================================================== @@ -687,7 +690,7 @@ void CBGDownloaderAccess::CDownloadCoTask::shutdownDownloader() } } CWinProcess::terminateProcessFromModuleName(BGDownloaderName); // for safety - Parent->_CurrentMessage = ucstring(); + Parent->_CurrentMessage = ucstring(); // OLD } //===================================================== @@ -795,7 +798,7 @@ bool CBGDownloaderAccess::CDownloadCoTask::defaultMessageHandling(BGDownloader:: case BGD_Error: { Parent->_TaskResult = TaskResult_Error; - ucstring errorMsg; + ucstring errorMsg; // OLD msg.serial(errorMsg); throw EDownloadException(errorMsg.toUtf8()); } @@ -885,7 +888,7 @@ void CBGDownloaderAccess::startTask(const BGDownloader::CTaskDesc &taskDesc, con } //===================================================== -bool CBGDownloaderAccess::isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const +bool CBGDownloaderAccess::isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const // OLD { // TODO for Linux return false; @@ -956,3 +959,5 @@ void unpauseBGDownloader() DownloaderPaused = false; } } + +#endif diff --git a/ryzom/client/src/bg_downloader_access.h b/ryzom/client/src/bg_downloader_access.h index e27cadb3e..5b4e7094b 100644 --- a/ryzom/client/src/bg_downloader_access.h +++ b/ryzom/client/src/bg_downloader_access.h @@ -14,11 +14,12 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#ifdef RYZOM_BG_DOWNLOADER #ifndef CL_BG_DOWNLOADER_ACCESS #define CL_BG_DOWNLOADER_ACCESS #include "nel/misc/singleton.h" -#include "nel/misc/ucstring.h" +#include "nel/misc/ucstring.h" // OLD #include "nel/misc/inter_window_msg_queue.h" #include "nel/misc/co_task.h" // @@ -36,7 +37,7 @@ public: void release(); // jobs void startTask(const BGDownloader::CTaskDesc &taskDesc, const std::string &commandLine, bool showDownloader); - bool isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const; + bool isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const; // OLD // The following flag will be true after a 'patch' task has been completed successfully bool getPatchCompletionFlag(bool clearFlag); // @@ -50,7 +51,7 @@ public: // void update(); // call this at each frame to update the download process // Get last displayed message by the background downloader - const ucstring &getCurrentMessage() const { return _CurrentMessage; } + const ucstring &getCurrentMessage() const { return _CurrentMessage; } // OLD uint32 getCurrentFilesToGet() const { return _CurrentFilesToGet; } uint32 getTotalFilesToGet() const { return _TotalFilesToGet; } // @@ -66,17 +67,17 @@ public: bool isDownloaderUIFrozen() const { return _FrozenUI; } void requestDownloadThreadPriority(BGDownloader::TThreadPriority newPriority, bool freezeUI); - const ucstring &getLastErrorMessage() const { return _ErrorMsg; } + const ucstring &getLastErrorMessage() const { return _ErrorMsg; } // OLD private: enum TState { State_Idle, State_Patching, State_Finished }; TState _State; - ucstring _CurrentMessage; + ucstring _CurrentMessage; // OLD #ifdef NL_OS_WINDOWS NLMISC::CInterWindowMsgQueue _DownloaderMsgQueue; #endif - ucstring _ErrorMsg; + ucstring _ErrorMsg; // OLD std::string _CommandLine; BGDownloader::TTaskResult _TaskResult; uint32 _AvailablePatchs; @@ -122,7 +123,7 @@ private: void getTaskResult(BGDownloader::TTaskResult &result, uint32 &availablePatchs, bool &mustLaunchBatFile, - ucstring &errorMsg + ucstring &errorMsg // OLD ); void getDescFile(); BGDownloader::TDownloaderMode getDownloaderMode(); @@ -146,3 +147,4 @@ void unpauseBGDownloader(); #endif +#endif diff --git a/ryzom/client/src/candidate.h b/ryzom/client/src/candidate.h index 41d04e681..ee169f77d 100644 --- a/ryzom/client/src/candidate.h +++ b/ryzom/client/src/candidate.h @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +// FIXME: Lost code #if 0 #ifndef CL_CANDIDATE_H @@ -33,7 +34,7 @@ struct Candidate NLMISC::CEntityId id; std::string name; std::string surname; - std::list program; + std::list program; uint32 nbVotes; }; diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index 41df9430f..95bc6306b 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -2026,7 +2026,7 @@ void CClientConfig::init(const string &configFileName) } // read the exising config file (don't parse it yet!) - ucstring content; + ucstring content; // UTF-16 and UTF-8 textfile support NLMISC::CI18N::readTextFile(configFileName, content); std::string contentUtf8 = content.toUtf8(); diff --git a/ryzom/client/src/client_chat_manager.cpp b/ryzom/client/src/client_chat_manager.cpp index ec8da3eb1..5515e8580 100644 --- a/ryzom/client/src/client_chat_manager.cpp +++ b/ryzom/client/src/client_chat_manager.cpp @@ -65,7 +65,7 @@ extern CEntityManager EntitiesMngr; //#ifdef OLD_STRING_SYSTEM // -//bool CNetworkString::getString (ucstring &result, CClientChatManager *mng) +//bool CNetworkString::getString (ucstring &result, CClientChatManager *mng) // OLD //{ // result = StaticString + " / "; // for (uint i = 0; i < Args.size(); i++) @@ -86,7 +86,7 @@ extern CEntityManager EntitiesMngr; // return mng->getString (result, Args, StaticString); //} // -//void CNetworkString::setString (const ucstring &staticStringId, CClientChatManager *mng) +//void CNetworkString::setString (const ucstring &staticStringId, CClientChatManager *mng) // OLD //{ // CBitMemStream bms; // mng->getStaticDB().getInfos(staticStringId, StaticString, bms); @@ -96,11 +96,11 @@ extern CEntityManager EntitiesMngr; //// add //// ////----------------------------------------------- -//uint32 CChatDynamicDatabase::add( uint32 index, ucstring& ucstr, vector& code ) +//uint32 CChatDynamicDatabase::add( uint32 index, ucstring& ucstr, vector& code ) // OLD //{ // nlinfo ("receive dynamic string association '%d' '%s'", index, ucstr.toString().c_str()); // -// map::iterator itIdx = _StringToIndex.find( ucstr ); +// map::iterator itIdx = _StringToIndex.find( ucstr ); // OLD // if( itIdx == _StringToIndex.end() ) // { // map::iterator itStr = _Data.find( index ); @@ -162,7 +162,7 @@ extern CEntityManager EntitiesMngr; //// decodeString //// ////----------------------------------------------- -//void CChatDynamicDatabase::decodeString( ucstring& str, CBitMemStream& bms ) +//void CChatDynamicDatabase::decodeString( ucstring& str, CBitMemStream& bms ) // OLD //{ // _Huffman.getId( str, bms ); // diff --git a/ryzom/client/src/client_chat_manager.h b/ryzom/client/src/client_chat_manager.h index 19afcab15..014481c0f 100644 --- a/ryzom/client/src/client_chat_manager.h +++ b/ryzom/client/src/client_chat_manager.h @@ -54,7 +54,7 @@ class CCDBNodeLeaf; struct CDynamicStringInfos { /// string - ucstring Str; + ucstring Str; // OLD /// index in the infos buffer, same as the index in the client dynamic string known buffer uint32 Index; @@ -89,12 +89,12 @@ public : /// \param str the string /// \param huffCode the Huffman code(may be empty) /// \return the index of the string - uint32 add( uint32 index, ucstring& str, std::vector& huffCode ); + uint32 add( uint32 index, ucstring& str, std::vector& huffCode ); // OLD /// Get the string from its Huffman code /// \param str will be filled with the string /// \param bms contains the Huffman code - void decodeString( ucstring& str, NLMISC::CBitMemStream& bms ); + void decodeString( ucstring& str, NLMISC::CBitMemStream& bms ); // OLD /// Get infos on the dynamic string CDynamicStringInfos * getDynamicStringInfos( uint32 index ); @@ -111,7 +111,7 @@ private : std::map< uint32, CDynamicStringInfos *> _Data; /// Map to find index from the string (only for uncoded strings) - std::map< ucstring, uint32> _StringToIndex; + std::map< ucstring, uint32> _StringToIndex; // OLD }; #endif @@ -372,13 +372,13 @@ private : #ifdef OLD_STRING_SYSTEM class CNetworkString { - ucstring StaticString; + ucstring StaticString; // OLD public: std::vector Args; - bool getString (ucstring &result, CClientChatManager *mng); + bool getString (ucstring &result, CClientChatManager *mng); // OLD - void setString (const ucstring &staticStringId, CClientChatManager *mng); + void setString (const ucstring &staticStringId, CClientChatManager *mng); // OLD }; #endif diff --git a/ryzom/client/src/commands.cpp b/ryzom/client/src/commands.cpp index d756c938c..ea14537be 100644 --- a/ryzom/client/src/commands.cpp +++ b/ryzom/client/src/commands.cpp @@ -241,7 +241,7 @@ NLMISC_COMMAND(equipGroup, "equip group ", "name") if(CItemGroupManager::getInstance()->equipGroup(args[0])) { string msg = CI18N::get("cmdEquipGroupSuccess"); - //Use ucstring because group name can contain accentued characters (and stuff like that) + //Use utf-8 string because group name can contain accentued characters (and stuff like that) string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); @@ -250,7 +250,7 @@ NLMISC_COMMAND(equipGroup, "equip group ", "name") else { string msg = CI18N::get("cmdEquipGroupError"); - //Use ucstring because group name can contain accentued characters (and stuff like that) + //Use utf-8 string because group name can contain accentued characters (and stuff like that) string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); @@ -273,7 +273,7 @@ NLMISC_COMMAND(moveGroup, "move group to ", "name dst") if(CItemGroupManager::getInstance()->moveGroup(args[0], INVENTORIES::toInventory(args[1]))) { string msg = CI18N::get("cmdMoveGroupSuccess"); - //Use ucstring because group name can contain accentued characters (and stuff like that) + //Use utf-8 string because group name can contain accentued characters (and stuff like that) string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%inventory", args[1]); @@ -283,7 +283,7 @@ NLMISC_COMMAND(moveGroup, "move group to ", "name dst") else { string msg = CI18N::get("cmdMoveGroupError"); - //Use ucstring because group name can contain accentued characters (and stuff like that) + //Use utf-8 string because group name can contain accentued characters (and stuff like that) string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%inventory", args[1]); @@ -313,7 +313,7 @@ NLMISC_COMMAND(createGroup, "create group [true](create a for ev msg = CI18N::get("cmdCreateGroupSuccess2"); else msg = CI18N::get("cmdCreateGroupSuccess1"); - //Use ucstring because group name can contain accentued characters (and stuff like that) + //Use utf-8 string because group name can contain accentued characters (and stuff like that) string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); @@ -322,7 +322,7 @@ NLMISC_COMMAND(createGroup, "create group [true](create a for ev else { string msg = CI18N::get("cmdCreateGroupError"); - //Use ucstring because group name can contain accentued characters (and stuff like that) + //Use utf-8 string because group name can contain accentued characters (and stuff like that) string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); @@ -345,7 +345,7 @@ NLMISC_COMMAND(deleteGroup, "delete group ", "name") if(CItemGroupManager::getInstance()->deleteGroup(args[0])) { string msg = CI18N::get("cmdDeleteGroupSuccess"); - //Use ucstring because group name can contain accentued characters (and stuff like that) + //Use utf-8 string because group name can contain accentued characters (and stuff like that) string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); @@ -354,7 +354,7 @@ NLMISC_COMMAND(deleteGroup, "delete group ", "name") else { string msg = CI18N::get("cmdDeleteGroupError"); - //Use ucstring because group name can contain accentued characters (and stuff like that) + //Use utf-8 string because group name can contain accentued characters (and stuff like that) string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); @@ -1672,10 +1672,10 @@ NLMISC_COMMAND(missionProgress, "debug"," ") NLMISC_COMMAND( displayDBModifs, "display server database modification in the chat window"," ") { if ( VerboseDatabase ) - CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("the database is already in verbose mode"),CRGBA(255,255,255,255)); + CInterfaceManager::getInstance()->getChatOutput()->addTextChild("the database is already in verbose mode",CRGBA(255,255,255,255)); else { - CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("database is now in verbose mode"),CRGBA(255,255,255,255)); + CInterfaceManager::getInstance()->getChatOutput()->addTextChild("database is now in verbose mode",CRGBA(255,255,255,255)); VerboseDatabase = true; } return true; @@ -1684,10 +1684,10 @@ NLMISC_COMMAND( displayDBModifs, "display server database modification in the ch NLMISC_COMMAND( hideDBModifs, "stop displaying server database modification in the chat window"," ") { if ( !VerboseDatabase ) - CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("the database is already not in verbose mode"),CRGBA(255,255,255,255)); + CInterfaceManager::getInstance()->getChatOutput()->addTextChild("the database is already not in verbose mode",CRGBA(255,255,255,255)); else { - CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("database is not in verbose mode anymore"),CRGBA(255,255,255,255)); + CInterfaceManager::getInstance()->getChatOutput()->addTextChild("database is not in verbose mode anymore",CRGBA(255,255,255,255)); VerboseDatabase = false; } return true; @@ -2297,7 +2297,7 @@ NLMISC_COMMAND(record, "Start Recording", "") // Warning when already recording. if(NetMngr.isRecording()) { - IM->displaySystemInfo(ucstring("Already Recording. Stop the current Record first")); + IM->displaySystemInfo("Already Recording. Stop the current Record first"); return true; } @@ -2641,12 +2641,12 @@ NLMISC_COMMAND(magic, "Cast a spell", "\n" if(args.size() != 6) { // Help -// CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 or 3 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 or 3 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)))); -// 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))); +// CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END)); } else { @@ -2695,7 +2695,7 @@ NLMISC_COMMAND(magic, "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. @@ -2714,12 +2714,12 @@ NLMISC_COMMAND(spell, "Cast a spell", "\n" if(args.size() != 6) { // Help - // CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 or 3 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 or 3 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)))); - // 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))); + // CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END)); } else { @@ -5314,8 +5314,8 @@ void CUserCommand::release() // *************************************************************************** -CUserCommand::CUserCommand(const string &commandName, const ucstring &help, const ucstring &argsHelp) - : ICommand("user", commandName.c_str(), toString(help).c_str(), toString(argsHelp).c_str()) +CUserCommand::CUserCommand(const string &commandName, const string &help, const string &argsHelp) + : ICommand("user", commandName.c_str(), help.c_str(), argsHelp.c_str()) { CommandName = commandName; } @@ -5369,7 +5369,7 @@ bool CUserCommand::execute(const std::string &/* rawCommandString */, const std: else { if (keywords[i] == "$") - finalArgs += /*ucstring(*/args[index++]/*).toUtf8()*/; + finalArgs += args[index++]; else { while (indexLocalizedName); // Build a argument help - ucstring argsHelp; + string argsHelp; if (ab) { @@ -5477,7 +5477,7 @@ void CUserCommand::createCommand (const char *name, const char *action, const ch // Add the string if (!argsHelp.empty()) argsHelp += " "; - argsHelp += ucstring("<") + CI18N::get(ab->Parameters[j].LocalizedName) + ucstring(">"); + argsHelp += "<" + CI18N::get(ab->Parameters[j].LocalizedName) + ">"; bFound = true; } } diff --git a/ryzom/client/src/commands.h b/ryzom/client/src/commands.h index 8a0b8764a..2d724f289 100644 --- a/ryzom/client/src/commands.h +++ b/ryzom/client/src/commands.h @@ -43,7 +43,7 @@ public: std::vector Keywords; }; - CUserCommand (const std::string &commandName, const ucstring &help, const ucstring &argsHelp); + CUserCommand (const std::string &commandName, const std::string &help, const std::string &argsHelp); void addMode (const std::string &action, uint numArg, bool infiniteAgr, const std::vector &keywords); diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 2885ee1ac..63b8a6dd8 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -149,8 +149,8 @@ std::string PlayerSelectedHomeShardName; std::string PlayerSelectedHomeShardNameWithParenthesis; extern std::string CurrentCookie; -ucstring NewKeysCharNameWanted; // name of the character for which a new keyset must be created -ucstring NewKeysCharNameValidated; +std::string NewKeysCharNameWanted; // name of the character for which a new keyset must be created +std::string NewKeysCharNameValidated; std::string GameKeySet = "keys.xml"; std::string RingEditorKeySet = "keys_r2ed.xml"; @@ -520,7 +520,9 @@ bool connection (const string &cookie, const string &fsaddr) if (InterfaceState == GOGOGO_IN_THE_GAME) { // set background downloader to 'paused' to ease loading of client +#ifdef RYZOM_BG_DOWNLOADER pauseBGDownloader(); +#endif return true; } @@ -659,7 +661,9 @@ bool reconnection() if (InterfaceState == GOGOGO_IN_THE_GAME) { +#ifdef RYZOM_BG_DOWNLOADER pauseBGDownloader(); +#endif return true; } if (InterfaceState == QUIT_THE_GAME) @@ -779,12 +783,12 @@ void globalMenuMovieShooter() // ------------------------------------------------------------------------------------------------ // Build a valid PlayerName for file Save selection. -std::string buildPlayerNameForSaveFile(const ucstring &playerNameIn) +std::string buildPlayerNameForSaveFile(const std::string &playerNameIn) { // remove any shard name appended - ucstring playerName = playerNameIn; - ucstring::size_type pos = playerNameIn.find('('); - if(pos!=ucstring::npos && pos>0) + string playerName = playerNameIn; + string::size_type pos = playerNameIn.find('('); + if(pos!=string::npos && pos>0) { playerName.resize(pos); } @@ -809,9 +813,9 @@ std::string buildPlayerNameForSaveFile(const ucstring &playerNameIn) } +#ifdef RYZOM_BG_DOWNLOADER static bool LuaBGDSuccessFlag = true; // tmp, for debug - void updateBGDownloaderUI() { CInterfaceManager *im = CInterfaceManager::getInstance(); @@ -909,11 +913,12 @@ void updateBGDownloaderUI() nlwarning("Some scipt error occurred"); } } - +#endif // compute patcher priority, depending on the presence of one or more mainland characters : in this case, give the patch a boost void updatePatcherPriorityBasedOnCharacters() { +#ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) { if (CBGDownloaderAccess::getInstance().getDownloadThreadPriority() != BGDownloader::ThreadPriority_Paused) @@ -932,6 +937,7 @@ void updatePatcherPriorityBasedOnCharacters() CBGDownloaderAccess::getInstance().requestDownloadThreadPriority(hasMainlandChar ? BGDownloader::ThreadPriority_Normal : BGDownloader::ThreadPriority_Low, false); } } +#endif } // Launch the interface to choose a character @@ -940,6 +946,7 @@ TInterfaceState globalMenu() { CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_CharacterSelection, "login_step_character_selection")); +#ifdef RYZOM_BG_DOWNLOADER CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance(); if (isBGDownloadEnabled()) @@ -950,14 +957,14 @@ TInterfaceState globalMenu() // if a task is already started, then this was a situation where player went back from game to the character selection, // so just unpause BGDownloader::TTaskResult dummyResult; - ucstring dummyMessage; + ucstring dummyMessage; // OLD if (!bgDownloader.isTaskEnded(dummyResult, dummyMessage)) { unpauseBGDownloader(); } } } - +#endif CInterfaceManager *pIM = CInterfaceManager::getInstance(); @@ -1003,8 +1010,9 @@ TInterfaceState globalMenu() } #endif +#ifdef RYZOM_BG_DOWNLOADER updateBGDownloaderUI(); - +#endif // Update network. try @@ -1087,7 +1095,7 @@ TInterfaceState globalMenu() { if (noUserChar || userChar) { - +#ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) { // If there's a need for mainland download, then proceed @@ -1096,7 +1104,7 @@ TInterfaceState globalMenu() // if a task is already started, then this was a situation where player went back from game to the character selection, // so just unpause BGDownloader::TTaskResult dummyResult; - ucstring dummyMessage; + ucstring dummyMessage; // OLD if (bgDownloader.isTaskEnded(dummyResult, dummyMessage)) { // launch mainland patch as a background task @@ -1111,6 +1119,7 @@ TInterfaceState globalMenu() } } } +#endif //nlinfo("impulseCallBack : received userChars list"); noUserChar = userChar = false; @@ -1260,8 +1269,8 @@ TInterfaceState globalMenu() LoginSM.pushEvent(CLoginStateMachine::ev_global_menu_exited); // Init the current Player Name (for interface.cfg and sentence.name save). Make a good File Name. - ucstring &playerName= CharacterSummaries[PlayerSelectedSlot].Name; - PlayerSelectedFileName= buildPlayerNameForSaveFile(playerName); + string playerName = CharacterSummaries[PlayerSelectedSlot].Name.toUtf8(); + PlayerSelectedFileName = buildPlayerNameForSaveFile(playerName); // Init the current Player Home shard Id and name CharacterHomeSessionId = CharacterSummaries[PlayerSelectedSlot].Mainland; @@ -1337,7 +1346,7 @@ public: REGISTER_ACTION_HANDLER (CAHNetInitCharSel, "net_init_char_sel"); // ------------------------------------------------------------------------------------------------ -void setTarget(CCtrlBase *ctrl, const string &targetName, ucstring &value) +void setTarget(CCtrlBase *ctrl, const string &targetName, std::string &value) { std::vector targets; // find first enclosing group @@ -1352,7 +1361,7 @@ void setTarget(CCtrlBase *ctrl, const string &targetName, ucstring &value) if (ig) { CInterfaceExprValue exprValue; - exprValue.setString(value.toUtf8()); + exprValue.setString(value); CInterfaceLink::splitLinkTargets(targetName, ig, targets); for(uint k = 0; k < targets.size(); ++k) @@ -1410,12 +1419,12 @@ public: if (CharacterSummaries[PlayerSelectedSlot].Name.empty()) return; - ucstring sValue(""); + string sValue; uint32 nValue = 0; if (sProp == "name") { - sValue = CharacterSummaries[PlayerSelectedSlot].Name; + sValue = CharacterSummaries[PlayerSelectedSlot].Name.toUtf8(); setTarget (pCaller, sTarget, sValue); } /* else if (sProp == "surname") @@ -1440,10 +1449,10 @@ Deprecated { sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(titleStr, womanTitle); { // Sometimes translation contains another title - ucstring::size_type pos = sValue.find('$'); - if (pos != ucstring::npos) + string::size_type pos = sValue.find('$'); + if (pos != string::npos) { - sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sValue.toUtf8()), womanTitle); + sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sValue), womanTitle); } } setTarget (pCaller, sTarget, sValue); @@ -1684,11 +1693,11 @@ public: // Setup the name string sEditBoxPath = getParam (Params, "name"); - ucstring sFirstName = ucstring("NotSet"); - ucstring sSurName = ucstring("NotSet"); + string sFirstName = "NotSet"; + string sSurName = "NotSet"; CGroupEditBox *pGEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sEditBoxPath)); if (pGEB != NULL) - sFirstName = pGEB->getInputStringAsUtf16(); + sFirstName = pGEB->getInputString(); else nlwarning ("can't get edit box name : %s",sEditBoxPath.c_str()); @@ -1803,8 +1812,8 @@ public: out.serial (nSelectedSlot); // Yoyo: delete the Local files. To avoid problem if recreate a character with same name. - ucstring &playerName= CharacterSummaries[nSelectedSlot].Name; - string playerDeletedFileName= buildPlayerNameForSaveFile(playerName); + string playerName = CharacterSummaries[nSelectedSlot].Name.toUtf8(); + string playerDeletedFileName = buildPlayerNameForSaveFile(playerName); // Delete the 2 Local files pIM->deletePlayerConfig(playerDeletedFileName); pIM->deletePlayerKeys(playerDeletedFileName); @@ -1855,7 +1864,7 @@ string getTarget(CCtrlBase * /* ctrl */, const string &targetName) } // ------------------------------------------------------------------------------------------------ -ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName) +ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName) // TODO: UTF-8 Lua { string sTmp = targetName; std::vector targetsVector; @@ -1867,13 +1876,13 @@ ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName) if (!elem) { nlwarning(" : Element is NULL"); - return ucstring(""); + return ucstring(""); // TODO: UTF-8 Lua } const CReflectedProperty *pRP = elem->getReflectedProperty(rTI.PropertyName); if (pRP->Type == CReflectedProperty::UCString) return ((elem->*(pRP->GetMethod.GetUCString))()); - return ucstring(""); + return ucstring(""); // TODO: UTF-8 Lua } /*// Ask the server to rename a character @@ -1946,7 +1955,7 @@ public: string sDBLink = getParam(Params, "dblink"); CharNameValidDBLink = sDBLink; - ucstring sName = getUCTarget(NULL,sTarget); + string sName = getUCTarget(NULL,sTarget).toUtf8(); // TODO: UTF-8 Lua CInterfaceManager *pIM = CInterfaceManager::getInstance(); if (sName.empty()) @@ -1988,13 +1997,13 @@ public: if (Mainlands[k].Id == MainlandSelected) { // extract name from mainland - /*ucstring::size_type first = Mainlands[k].Name.find('('); - ucstring::size_type last = Mainlands[k].Name.find(')'); - if (first != ucstring::npos && last != ucstring::npos && first < last) + /*ucstring::size_type first = Mainlands[k].Name.find('('); // OLD + ucstring::size_type last = Mainlands[k].Name.find(')');// OLD + if (first != ucstring::npos && last != ucstring::npos && first < last)// OLD { NewKeysCharNameWanted += Mainlands[k].Name.substr(first, last - first + 1); }*/ - NewKeysCharNameWanted += ('(' + Mainlands[k].Name + ')'); + NewKeysCharNameWanted += ('(' + Mainlands[k].Name.toUtf8() + ')'); break; } } @@ -2017,7 +2026,7 @@ public: for (uint i = 0; i < CharacterSummaries.size(); ++i) { - ucstring ls = CharacterSummaries[i].Name.toString(); + string ls = CharacterSummaries[i].Name.toString(); if (ls == sName) CharNameValid = false; } @@ -2304,7 +2313,7 @@ public: } // add a new keyset in the list - void addKeySet(const std::string &filename, const ucstring &name, const ucstring tooltip) + void addKeySet(const std::string &filename, const std::string &name, const std::string tooltip) { nlassert(List); CInterfaceGroup *pNewLine = buildTemplate("t_keyset", toString(filename)); @@ -2313,13 +2322,13 @@ public: CViewText *pVT = dynamic_cast(pNewLine->getView("name")); if (pVT != NULL) { - pVT->setTextLocalized(name.toUtf8(), false); + pVT->setTextLocalized(name, false); } CCtrlBase *pBut = pNewLine->getCtrl("but"); if (pBut != NULL) { - pBut->setDefaultContextHelp(tooltip.toUtf8()); + pBut->setDefaultContextHelp(tooltip); } addGroupInList(pNewLine); } @@ -2355,12 +2364,12 @@ public: std::string strId = "uiCP_KeysetName_" + keySetVar->asString(k); strFindReplace(strId, ".", "_"); - ucstring keySetName = CI18N::get(strId); + const string &keySetName = CI18N::get(strId); strId = "uiCP_KeysetTooltip_" + keySetVar->asString(k); strFindReplace(strId, ".", "_"); if (CI18N::hasTranslation(strId)) { - ucstring keySetTooltip = CI18N::get(strId); + const string &keySetTooltip = CI18N::get(strId); addKeySet(keySetVar->asString(k), keySetName, keySetTooltip); } } @@ -2369,8 +2378,8 @@ public: { nlwarning("'%s' var not found in config file, or list is empty, proposing default keyset only", KeySetVarName); std::string defaultKeySet = "keys"; - ucstring keySetName = CI18N::get("uiCP_KeysetName_" + defaultKeySet); - ucstring keySetTooltip = CI18N::get("uiCP_KeysetTooltip_" + defaultKeySet); + const string &keySetName = CI18N::get("uiCP_KeysetName_" + defaultKeySet); + const string &keySetTooltip = CI18N::get("uiCP_KeysetTooltip_" + defaultKeySet); addKeySet(defaultKeySet, keySetName, keySetTooltip); } @@ -2396,19 +2405,19 @@ public: { for(TKeySetFileMap::iterator it = keySetFiles.begin(); it != keySetFiles.end(); ++it) { - ucstring name; + string name; if (ClientCfg.Local) { - name = ucstring(it->first); + name = it->first; } else { - // search matching ucstring name from character summaries + // search matching utf-8 string name from character summaries for (uint k = 0; k < CharacterSummaries.size(); ++k) { - if (it->first == buildPlayerNameForSaveFile(CharacterSummaries[k].Name)) + if (it->first == buildPlayerNameForSaveFile(CharacterSummaries[k].Name.toUtf8())) { - name = CharacterSummaries[k].Name; + name = CharacterSummaries[k].Name.toUtf8(); } } } @@ -2419,7 +2428,7 @@ public: addSeparator(); separatorAdded = true; } - addKeySet(it->first, ucstring(it->first), CI18N::get(std::string("uiCP_KeysetImport") + (it->second & GameKeys ? "_Game" : "") + addKeySet(it->first, it->first, CI18N::get(std::string("uiCP_KeysetImport") + (it->second & GameKeys ? "_Game" : "") + (it->second & EditorKeys ? "_Editor" : ""))); } } @@ -2554,26 +2563,24 @@ REGISTER_ACTION_HANDLER (CAHResetKeysetSelect, "keyset_select"); // *************************** SCENARIO CONTROL WINDOW *********************** // *************************************************************************** // helper function for "setScenarioInformation" -static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName, const ucstring &text) +static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName, const std::string &text) { CInterfaceElement *result = scenarioWnd->findFromShortId(uiName); if(result) { CViewText* viewText = dynamic_cast(result); if(viewText) - viewText->setTextLocalized(text.toUtf8(), false); + viewText->setTextLocalized(text, false); CGroupEditBox* editBox = dynamic_cast(result); if(editBox) - editBox->setInputStringAsUtf16(text); + editBox->setInputString(text); } } // helper function for "setScenarioInformation" -static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName, const std::string &utf8Text) +static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName, const ucstring &text) // TODO: UTF-8 Lua { - ucstring ucText; - ucText.fromUtf8(utf8Text); - setTextField(scenarioWnd, uiName, ucText); + setTextField(scenarioWnd, uiName, text.toUtf8()); } // helper function for "setScenarioInformation" static std::string fieldLookup(const vector< pair< string, string > > &values, const std::string &id) @@ -3455,7 +3462,7 @@ class CAHInitImportCharacter : public IActionHandler CPath::getPathContent("save/", false, false, true, savedCharacters); CInterfaceGroup *newLine; - CInterfaceGroup *prevLine; + CInterfaceGroup *prevLine = NULL; for (uint i = 0; i < savedCharacters.size(); ++i) { @@ -3644,7 +3651,7 @@ class CAHExportCharacter : public IActionHandler return; // extract name - const std::string name = buildPlayerNameForSaveFile(CS.Name.toString()); + const std::string name = buildPlayerNameForSaveFile(CS.Name.toUtf8()); COFile fd; bool success = false; diff --git a/ryzom/client/src/connection.h b/ryzom/client/src/connection.h index bb6f4cd24..7c81b0c80 100644 --- a/ryzom/client/src/connection.h +++ b/ryzom/client/src/connection.h @@ -36,8 +36,8 @@ extern std::vector CharacterSummaries; extern std::string UserPrivileges; extern sint LoginCharsel; -extern ucstring NewKeysCharNameWanted; -extern ucstring NewKeysCharNameValidated; +extern std::string NewKeysCharNameWanted; +extern std::string NewKeysCharNameValidated; extern std::string GameKeySet; extern std::string RingEditorKeySet; @@ -71,12 +71,14 @@ enum TInterfaceState TInterfaceState autoLogin (const std::string &cookie, const std::string &fsaddr, bool firstConnection); -std::string buildPlayerNameForSaveFile(const ucstring &playerNameIn); +std::string buildPlayerNameForSaveFile(const std::string &playerNameIn); void globalMenuMovieShooter(); +#ifdef RYZOM_BG_DOWNLOADER void updateBGDownloaderUI(); +#endif // compute patcher priority, depending on the presence of one or more mainland characters : in this case, give the patch a boost void updatePatcherPriorityBasedOnCharacters(); diff --git a/ryzom/client/src/continent.cpp b/ryzom/client/src/continent.cpp index 3a7dff52d..07fd6155a 100644 --- a/ryzom/client/src/continent.cpp +++ b/ryzom/client/src/continent.cpp @@ -413,7 +413,9 @@ static uint16 getZoneIdFromName(const string &zoneName) //----------------------------------------------- void CContinent::select(const CVectorD &pos, NLMISC::IProgressCallback &progress, bool complete, bool unhibernate, EGSPD::CSeason::TSeason season) { +#ifdef RYZOM_BG_DOWNLOADER pauseBGDownloader(); +#endif CNiceInputAuto niceInputs; // Season has changed ? Season = season; diff --git a/ryzom/client/src/continent_manager_build.h b/ryzom/client/src/continent_manager_build.h index 52719f9ad..b8d7a7e82 100644 --- a/ryzom/client/src/continent_manager_build.h +++ b/ryzom/client/src/continent_manager_build.h @@ -43,7 +43,7 @@ public: TContLMType Type; NLMISC::CVector2f Pos; // Center of the zone NLLIGO::CPrimZone Zone; // Region & Place - std::string TitleTextID; // should be converted with CStringManagerClient::getPlaceLocalizedName() to get the actual title in ucstring + std::string TitleTextID; // should be converted with CStringManagerClient::getPlaceLocalizedName() to get the actual title in utf-8 string CContLandMark() { diff --git a/ryzom/client/src/entities.cpp b/ryzom/client/src/entities.cpp index 80d64c35a..11c403403 100644 --- a/ryzom/client/src/entities.cpp +++ b/ryzom/client/src/entities.cpp @@ -246,7 +246,7 @@ public : } private: std::list _PendingMissionTitle; -// std::set _AlreadyReceived; +// std::set _AlreadyReceived; }; //----------------------------------------------- diff --git a/ryzom/client/src/far_tp.cpp b/ryzom/client/src/far_tp.cpp index fa3d9720d..7f98d8b82 100644 --- a/ryzom/client/src/far_tp.cpp +++ b/ryzom/client/src/far_tp.cpp @@ -422,11 +422,13 @@ void CLoginStateMachine::run() bool mustReboot = false; +#ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) { mustReboot = CBGDownloaderAccess::getInstance().mustLaunchBatFile(); } else +#endif { mustReboot = CPatchManager::getInstance()->mustLaunchBatFile(); } @@ -470,11 +472,13 @@ void CLoginStateMachine::run() } initPatchCheck(); SM_BEGIN_EVENT_TABLE +#ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) { SM_EVENT(ev_patch_needed, st_patch); // no choice for patch content when background downloader is used } else +#endif { SM_EVENT(ev_patch_needed, st_display_cat); } @@ -600,7 +604,9 @@ void CLoginStateMachine::run() break; case st_enter_far_tp_main_loop: // if bgdownloader is used, then pause it +#ifdef RYZOM_BG_DOWNLOADER pauseBGDownloader(); +#endif // Far TP part 1.2: let the main loop finish the current frame. diff --git a/ryzom/client/src/init.cpp b/ryzom/client/src/init.cpp index b9e701e92..dbaa9a5c8 100644 --- a/ryzom/client/src/init.cpp +++ b/ryzom/client/src/init.cpp @@ -341,9 +341,7 @@ void ExitClientError (const char *format, ...) CurrentErrorMessage = NLMISC::utf8ToWide(str); DialogBox(HInstance, MAKEINTRESOURCE(IDD_ERROR_HELP_MESSAGE_BOX), NULL, ExitClientErrorDialogProc); /* - ucstring ucstr; - ucstr.fromUtf8 (str); - MessageBoxW (NULL, (WCHAR *)ucstr.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONERROR); + MessageBoxW (NULL, nlUtf8ToWide(str.c_str()), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONERROR); */ #else fprintf (stderr, "%s\n", str); @@ -357,18 +355,18 @@ void ExitClientError (const char *format, ...) } // Use this function to return an information to the final user -void ClientInfo (const ucstring &message) +void ClientInfo (const std::string &message) { #ifdef NL_OS_WINDOWS - MessageBoxW(NULL, (WCHAR *)message.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONINFORMATION); + MessageBoxW(NULL, nlUtf8ToWide(message.c_str()), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONINFORMATION); #endif } // Use this function to ask a question to the final user -bool ClientQuestion (const ucstring &message) +bool ClientQuestion (const std::string &message) { #ifdef NL_OS_WINDOWS - return MessageBoxW(NULL, (WCHAR *)message.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_YESNO|MB_ICONQUESTION) != IDNO; + return MessageBoxW(NULL, nlUtf8ToWide(message.c_str()), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_YESNO|MB_ICONQUESTION) != IDNO; #else return false; #endif @@ -379,7 +377,7 @@ void selectTipsOfTheDay (uint /* tips */) /* todo tips of the day uncomment tips %= RZ_NUM_TIPS; TipsOfTheDayIndex = tips; - ucstring title = CI18N::get ("uiTipsTitle"); + string title = CI18N::get ("uiTipsTitle"); title += toString (tips+1); title += " : "; TipsOfTheDay = title+CI18N::get ("uiTips"+toString (tips));*/ @@ -541,7 +539,7 @@ void checkDriverVersion() { if (driverVersion < driversVersion[i]) { - ucstring message = CI18N::get ("uiUpdateDisplayDriversNotUpToDate") + "\n\n"; + string message = CI18N::get ("uiUpdateDisplayDriversNotUpToDate") + "\n\n"; // message += CI18N::get ("uiUpdateDisplayDriversVendor") + driversVendor[i] + "\n"; message += CI18N::get ("uiUpdateDisplayDriversCard") + deviceName + "\n"; message += CI18N::get ("uiUpdateDisplayDriversCurrent") + getVersionString (driverVersion) + "\n"; @@ -999,7 +997,7 @@ void prelogInit() FPU_CHECKER_ONCE // Set the data path for the localisation. - const ucstring nmsg("Loading I18N..."); + const string nmsg("Loading I18N..."); ProgressBar.newMessage ( nmsg ); FPU_CHECKER_ONCE @@ -1177,7 +1175,9 @@ void prelogInit() #ifdef NL_OS_WINDOWS +#ifdef RYZOM_BG_DOWNLOADER CBGDownloaderAccess::getInstance().init(); +#endif if (SlashScreen) DestroyWindow (SlashScreen); diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index ee243a5a2..b43e8e19a 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -732,7 +732,7 @@ public: CEntityCL *entity = EntitiesMngr.entity(trader); if (entity) { - ucstring playerName = entity->getEntityName(); + string playerName = entity->getEntityName(); if (!playerName.empty()) { PeopleInterraction.askAddContact(playerName, &PeopleInterraction.FriendList); @@ -4023,7 +4023,6 @@ REGISTER_ACTION_HANDLER(CHandlerSelectProtectedSlot, "select_protected_slot"); // *************************************************************************** // Common code -//static void fillPlayerBarText(ucstring &str, const string &dbScore, const string &dbScoreMax, const string &ttFormat) static void fillPlayerBarText(std::string &str, const string &dbScore, SCORES::TScores score, const string &ttFormat) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); @@ -4567,7 +4566,7 @@ public: } else { - ucstr = ucstring("&EMT&") + UserEntity->getDisplayName() + ucstring(" ") + ucstr; + ucstr = ucstring("&EMT&") + UserEntity->getDisplayName() + ucstring(" ") + ucstr; // FIXME: UTF-8 (serial) } out.serialEnum(behavToSend); diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index e8c36809f..3ba05a570 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -89,14 +89,14 @@ using namespace STRING_MANAGER; // STATIC FUNCTIONS DECLARATIONS // /////////////////////////////////// static void setupCreatorName(CSheetHelpSetup &setup); -static void setHelpText(CSheetHelpSetup &setup, const ucstring &text); +static void setHelpText(CSheetHelpSetup &setup, const string &text); static void setHelpTextID(CSheetHelpSetup &setup, sint32 id); static void fillSabrinaPhraseListBrick(const CSPhraseCom &phrase, IListSheetBase *listBrick); static void setupListBrickHeader(CSheetHelpSetup &setup); static void hideListBrickHeader(CSheetHelpSetup &setup); static void setupHelpPage(CInterfaceGroup *window, const string &url); -static void setupHelpTitle(CInterfaceGroup *group, const ucstring &title); +static void setupHelpTitle(CInterfaceGroup *group, const string &title); static void setHelpCtrlSheet(CSheetHelpSetup &setup, uint32 sheetId); // Setup help for an item in a window (type is known) @@ -187,7 +187,7 @@ void CInterfaceHelp::initWindows() // add observers for the update of phrase help texts (depends of weight of equipped weapons) for (uint i = 0; i < MAX_HANDINV_ENTRIES; ++i) { - CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp(std::string(LOCAL_INVENTORY) + ":HAND:" + toString(i), false); + CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp(string(LOCAL_INVENTORY) + ":HAND:" + toString(i), false); if(pNodeLeaf) { ICDBNode::CTextId textId; @@ -210,7 +210,7 @@ void CInterfaceHelp::release() // add observers for the update of phrase help texts (depends of weight of equipped weapons) for (uint i = 0; i < MAX_HANDINV_ENTRIES; ++i) { - CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp(std::string(LOCAL_INVENTORY) + ":HAND:" + toString(i), false); + CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp(string(LOCAL_INVENTORY) + ":HAND:" + toString(i), false); if(pNodeLeaf) { ICDBNode::CTextId textId; @@ -565,7 +565,7 @@ void CInterfaceHelp::updateWindowSPhraseTexts() */ class CHandlerCloseHelp : public IActionHandler { - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { CInterfaceHelp::closeAll(); } @@ -578,7 +578,7 @@ REGISTER_ACTION_HANDLER( CHandlerCloseHelp, "close_help"); */ class CHandlerOpenItemHelp : public IActionHandler { - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { CDBCtrlSheet *cs = dynamic_cast(pCaller); if (cs != NULL && cs->getSheetId()!=0 ) @@ -609,7 +609,7 @@ REGISTER_ACTION_HANDLER( CHandlerOpenItemHelp, "open_item_help"); */ class CHandlerOpenPactHelp : public IActionHandler { - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { CDBCtrlSheet *cs = dynamic_cast(pCaller); if (cs != NULL && cs->getSheetId()!=0 ) @@ -633,7 +633,7 @@ REGISTER_ACTION_HANDLER( CHandlerOpenPactHelp, "open_pact_help"); */ class CHandlerOpenTitleHelp : public IActionHandler { - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { // display web profile if necessary if (getParam(sParams, "from") == "contact") @@ -656,10 +656,10 @@ class CHandlerOpenTitleHelp : public IActionHandler sint index = peopleList->getIndexFromContainerID(fatherGC->getId()); if (index == -1) return; - ucstring name = peopleList->getName(index); + string name = peopleList->getName(index); if ( ! name.empty()) { - CAHManager::getInstance()->runActionHandler("show_hide", pCaller, "profile|pname="+name.toUtf8()+"|ptype="+toString((int)CEntityCL::Player)); + CAHManager::getInstance()->runActionHandler("show_hide", pCaller, "profile|pname="+name+"|ptype="+toString((int)CEntityCL::Player)); } return; } @@ -670,7 +670,7 @@ class CHandlerOpenTitleHelp : public IActionHandler if (selection == NULL) return; //if(selection->isNPC()) { - std::string name = selection->getEntityName(); + string name = selection->getEntityName(); if(name.empty()) { // try to get the name from the string manager (for npc) @@ -679,7 +679,7 @@ class CHandlerOpenTitleHelp : public IActionHandler { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); pSMC->getString (nDBid, name); - std::string copyName = name; + string copyName = name; name = CEntityCL::removeTitleAndShardFromName(name); if (name.empty()) { @@ -689,7 +689,7 @@ class CHandlerOpenTitleHelp : public IActionHandler woman = pChar->getGender() == GSGENDER::female; // extract the replacement id - std::string strNewTitle = CEntityCL::getTitleFromName(copyName); + string strNewTitle = CEntityCL::getTitleFromName(copyName); // retrieve the translated string if (!strNewTitle.empty()) @@ -716,8 +716,8 @@ class CHandlerOpenTitleHelp : public IActionHandler // Get name and title // ------------------ - ucstring name; - ucstring title; + string name; + string title; bool reservedTitle = false; string sFrom = getParam(sParams, "from"); if (sFrom == "target") @@ -752,7 +752,7 @@ class CHandlerOpenTitleHelp : public IActionHandler for (titleIDnb = 0; titleIDnb < CHARACTER_TITLE::NB_CHARACTER_TITLE; ++titleIDnb) { bool women = UserEntity && UserEntity->getGender()==GSGENDER::female; - if (CStringManagerClient::getTitleLocalizedName(CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)titleIDnb),women) == title.toUtf8()) + if (CStringManagerClient::getTitleLocalizedName(CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)titleIDnb),women) == title) break; } @@ -764,21 +764,21 @@ class CHandlerOpenTitleHelp : public IActionHandler // Display all infos found // ----------------------- - ucstring titleText = CI18N::get("uihelpTitleFormat"); - strFindReplace(titleText, "%name", name.toString()); + string titleText = CI18N::get("uihelpTitleFormat"); + strFindReplace(titleText, "%name", name); // Display title - ucstring::size_type p1 = title.find('('); - if (p1 != ucstring::npos) + string::size_type p1 = title.find('('); + if (p1 != string::npos) { - ucstring::size_type p2 = title.find(')', p1+1); - if (p2 != ucstring::npos) + string::size_type p2 = title.find(')', p1+1); + if (p2 != string::npos) title = title.substr(p1+1, p2-p1-1); } strFindReplace(titleText, "%title", title); // Display all skills needed to obtain this title - ucstring sSkillsNeeded; + string sSkillsNeeded; if (!title.empty() && pTU == NULL) sSkillsNeeded = CI18N::get("uiTitleCantObtain"); @@ -822,7 +822,7 @@ class CHandlerOpenTitleHelp : public IActionHandler strFindReplace(titleText, "%skills", sSkillsNeeded); // Display all bricks needed to obtain this title - ucstring sBricksNeeded; + string sBricksNeeded; if (pTU != NULL) { sBricksNeeded = CI18N::get("uiTitleBrickHeader"); @@ -861,7 +861,7 @@ REGISTER_ACTION_HANDLER( CHandlerOpenTitleHelp, "open_title_help"); */ class CHandlerOpenSkillToTradeHelp : public IActionHandler { - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { CDBCtrlSheet *cs = dynamic_cast(pCaller); if (cs != NULL) @@ -884,7 +884,7 @@ REGISTER_ACTION_HANDLER( CHandlerOpenSkillToTradeHelp, "open_skill_to_trade_help */ class CHandlerOpenHelpAuto : public IActionHandler { - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { CDBCtrlSheet *cs = dynamic_cast(pCaller); if (!cs) @@ -914,7 +914,7 @@ REGISTER_ACTION_HANDLER( CHandlerOpenHelpAuto, "open_help_auto"); */ class CHandlerBrowse : public IActionHandler { - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { string container = getParam (sParams, "name"); CInterfaceElement *element = CWidgetManager::getInstance()->getElementFromId(container); @@ -1052,7 +1052,7 @@ REGISTER_ACTION_HANDLER( CHandlerBrowse, "browse"); class CHandlerBrowseUndo : public IActionHandler { public: - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); string container = getParam (sParams, "name"); @@ -1071,7 +1071,7 @@ REGISTER_ACTION_HANDLER( CHandlerBrowseUndo, "browse_undo"); class CHandlerBrowseRedo : public IActionHandler { public: - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); string container = getParam (sParams, "name"); @@ -1090,7 +1090,7 @@ REGISTER_ACTION_HANDLER( CHandlerBrowseRedo, "browse_redo"); class CHandlerBrowseRefresh : public IActionHandler { public: - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); string container = getParam (sParams, "name"); @@ -1108,7 +1108,7 @@ REGISTER_ACTION_HANDLER( CHandlerBrowseRefresh, "browse_refresh"); // *************************************************************************** class CHandlerHTMLSubmitForm : public IActionHandler { - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { string container = getParam (sParams, "name"); @@ -1153,9 +1153,9 @@ static void setupHelpPage(CInterfaceGroup *window, const string &url) } // *************************************************************************** -void setHelpText(CSheetHelpSetup &setup, const ucstring &text) +void setHelpText(CSheetHelpSetup &setup, const string &text) { - ucstring copyStr= text; + string copyStr= text; // remove trailing \n while(!copyStr.empty() && copyStr[copyStr.size()-1]=='\n') { @@ -1166,7 +1166,7 @@ void setHelpText(CSheetHelpSetup &setup, const ucstring &text) CViewText *viewText= dynamic_cast(setup.HelpWindow->getView(setup.ViewText)); if(viewText) { - viewText->setTextFormatTaged(copyStr.toUtf8()); + viewText->setTextFormatTaged(copyStr); } CInterfaceGroup *viewTextGroup = setup.HelpWindow->getGroup(setup.ScrollTextGroup); if (viewTextGroup) viewTextGroup->setActive(true); @@ -1203,12 +1203,12 @@ void setHelpTextID(CSheetHelpSetup &setup, sint32 id) } // *************************************************************************** -static void setupHelpTitle(CInterfaceGroup *group, const ucstring &title) +static void setupHelpTitle(CInterfaceGroup *group, const string &title) { CGroupContainer *pGC= dynamic_cast(group); if(!group) return; - pGC->setUCTitle(title); + pGC->setTitle(title); } // *************************************************************************** @@ -1237,10 +1237,10 @@ static void setupSkillToTradeHelp(CSheetHelpSetup &setup) setup.DestSheet->setActive(true); } - ucstring skillText; + string skillText; // Name in title - const ucstring title(CStringManagerClient::getSkillLocalizedName(skill)); + const char *title = CStringManagerClient::getSkillLocalizedName(skill); setupHelpTitle(setup.HelpWindow, title); // search all job that have minimum required level for that skill @@ -1249,7 +1249,7 @@ static void setupSkillToTradeHelp(CSheetHelpSetup &setup) // { // for (uint job = 0; job < 8; ++job) // { -// std::string dbPath = toString("CHARACTER_INFO:CAREER%d:JOB%d:JOB_CAP", (int) career, (int) job); +// string dbPath = toString("CHARACTER_INFO:CAREER%d:JOB%d:JOB_CAP", (int) career, (int) job); // uint level = (uint) NLGUI::CDBManager::getInstance()->getDbProp(dbPath)->getValue32(); // if (level != 0) // has the player this job ? // { @@ -1265,10 +1265,11 @@ static void setupSkillToTradeHelp(CSheetHelpSetup &setup) // } // setup skill desc if available. - const ucstring desc(CStringManagerClient::getSkillLocalizedDescription(skill)); - if( !desc.empty() ) + const char *desc = CStringManagerClient::getSkillLocalizedDescription(skill); + if (*desc) { - skillText+= "\n" + desc; + skillText += "\n"; + skillText += desc; } setHelpText(setup, skillText); @@ -1305,7 +1306,7 @@ static string toPercentageText(float val) } // *************************************************************************** -void getItemDefenseText(CDBCtrlSheet *item, ucstring &itemText) +void getItemDefenseText(CDBCtrlSheet *item, string &itemText) { // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); @@ -1322,7 +1323,7 @@ void getItemDefenseText(CDBCtrlSheet *item, ucstring &itemText) } -void getDamageText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText, bool displayAsMod) +void getDamageText(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText, bool displayAsMod) { // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); @@ -1347,7 +1348,7 @@ void getDamageText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText, } } -void getSpeedText(CDBCtrlSheet *item, ucstring &itemText, bool displayAsMod) +void getSpeedText(CDBCtrlSheet *item, string &itemText, bool displayAsMod) { // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); @@ -1358,7 +1359,7 @@ void getSpeedText(CDBCtrlSheet *item, ucstring &itemText, bool displayAsMod) strFindReplace(itemText, "%speed", strMod + toReadableFloat(itemInfo.HitRate)); } -void getRangeText(CDBCtrlSheet *item, ucstring &itemText, bool displayAsMod) +void getRangeText(CDBCtrlSheet *item, string &itemText, bool displayAsMod) { // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); @@ -1369,7 +1370,7 @@ void getRangeText(CDBCtrlSheet *item, ucstring &itemText, bool displayAsMod) strFindReplace(itemText, "%range", strMod + toReadableFloat(itemInfo.Range/1000.f)); } -void getHPAndSapLoadText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText) +void getHPAndSapLoadText(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText) { // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); @@ -1386,7 +1387,7 @@ void getHPAndSapLoadText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &ite } -void getBuffText(CDBCtrlSheet *item, ucstring &itemText) +void getBuffText(CDBCtrlSheet *item, string &itemText) { // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); @@ -1394,7 +1395,7 @@ void getBuffText(CDBCtrlSheet *item, ucstring &itemText) const string valIds[]={"Hp", "Sap", "Sta", "Focus"}; sint32 vals[]= {itemInfo.HpBuff, itemInfo.SapBuff, itemInfo.StaBuff, itemInfo.FocusBuff}; uint numVals= sizeof(vals) / sizeof(vals[0]); - ucstring bufInfo; + string bufInfo; // For each buf, append a line if !=0 for(uint i=0;i0?"Bonus":"Malus") ); + string line= CI18N::get( "uihelpItem" + valIds[i] + (modifier>0?"Bonus":"Malus") ); strFindReplace(line, "%val", toString(modifier) ); bufInfo+= line; } @@ -1416,13 +1417,13 @@ void getBuffText(CDBCtrlSheet *item, ucstring &itemText) strFindReplace(itemText, "%buffs", bufInfo); } -void getMagicProtection(CDBCtrlSheet *item, ucstring &itemText) +void getMagicProtection(CDBCtrlSheet *item, string &itemText) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); - ucstring mProtInfo; + string mProtInfo; // Header (always here, because at least max absorb) mProtInfo= CI18N::get("uihelpMagicProtectFormatHeader"); @@ -1433,7 +1434,7 @@ void getMagicProtection(CDBCtrlSheet *item, ucstring &itemText) if(itemInfo.MagicProtection[i] != PROTECTION_TYPE::None) { // Protection info - ucstring str= CI18N::get("uihelpMagicProtectFormat"); + string str= CI18N::get("uihelpMagicProtectFormat"); strFindReplace(str, "%t", CI18N::get("pt"+PROTECTION_TYPE::toString(itemInfo.MagicProtection[i])) ); strFindReplace(str, "%v", toString(itemInfo.MagicProtectionFactor[i]) ); mProtInfo+= str; @@ -1449,7 +1450,7 @@ void getMagicProtection(CDBCtrlSheet *item, ucstring &itemText) maxAbsorb= maxAbsorb*nodeFactor->getValue32()/100; // Add to text - ucstring str= CI18N::get("uihelpMagicProtectMaxAbsorbFormat"); + string str= CI18N::get("uihelpMagicProtectMaxAbsorbFormat"); strFindReplace(str, "%v", toString(maxAbsorb) ); mProtInfo+= str; } @@ -1458,12 +1459,12 @@ void getMagicProtection(CDBCtrlSheet *item, ucstring &itemText) strFindReplace(itemText, "%magic_protection", mProtInfo); } -void getMagicResistance(CDBCtrlSheet *item, ucstring &itemText) +void getMagicResistance(CDBCtrlSheet *item, string &itemText) { // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); - ucstring mResistInfo; + string mResistInfo; // Header (always here, because at least max absorb) mResistInfo= CI18N::get("uihelpMagicResistFormatHeader"); @@ -1481,7 +1482,7 @@ void getMagicResistance(CDBCtrlSheet *item, ucstring &itemText) if(resist[i] != 0) { // Resist info - ucstring str= CI18N::get("uihelpMagicResistFormat"); + string str= CI18N::get("uihelpMagicResistFormat"); strFindReplace(str, "%t", CI18N::get("rs"+RESISTANCE_TYPE::toString((RESISTANCE_TYPE::TResistanceType)i) )); strFindReplace(str, "%v", toReadableFloat(float(resist[i])/100) ); mResistInfo+= str; @@ -1492,7 +1493,7 @@ void getMagicResistance(CDBCtrlSheet *item, ucstring &itemText) strFindReplace(itemText, "%magic_resistance", mResistInfo); } -void getActionMalus(CDBCtrlSheet *item, ucstring &itemText) +void getActionMalus(CDBCtrlSheet *item, string &itemText) { // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); @@ -1500,7 +1501,7 @@ void getActionMalus(CDBCtrlSheet *item, ucstring &itemText) strFindReplace(itemText, "%actmalus", toPercentageText(itemInfo.WearEquipmentMalus) ); } -void getBulkText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText) +void getBulkText(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText) { // Display direct value: because cannot know where this item will be drop!! (bag, mektoub etc...) float slotBulkTotal= max((sint32)1, item->getQuantity()) * pIS->Bulk; @@ -1513,7 +1514,7 @@ void getBulkText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText) strFindReplace(itemText, "%bulk", toString("%.2f", slotBulkTotal) ); } -void getWeightText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText) +void getWeightText(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); @@ -1550,14 +1551,14 @@ void getWeightText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText) strFindReplace(itemText, "%weight", "???" ); } -void getMagicBonus(CDBCtrlSheet *item, ucstring &itemText) +void getMagicBonus(CDBCtrlSheet *item, string &itemText) { // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); nlctassert(CClientItemInfo::NumMagicFactorType==4); const string valIds[CClientItemInfo::NumMagicFactorType]={"OffElemental", "OffAffliction", "DefHeal", "DefAffliction"}; - ucstring mbInfo; + string mbInfo; // For each magic bonus, test first if equal sint32 allCastSpeedFactor= sint(itemInfo.CastingSpeedFactor[0]*100); @@ -1582,7 +1583,7 @@ void getMagicBonus(CDBCtrlSheet *item, ucstring &itemText) if(allCastSpeedFactor!=0 || allMagicPowerFactor!=0) { // else display "all" - ucstring line= CI18N::get( "uihelpItemMagicBonusAll"); + string line= CI18N::get( "uihelpItemMagicBonusAll"); strFindReplace(line, "%cs", toString("%+d", allCastSpeedFactor) ); strFindReplace(line, "%mp", toString("%+d", allMagicPowerFactor) ); mbInfo+= line; @@ -1597,7 +1598,7 @@ void getMagicBonus(CDBCtrlSheet *item, ucstring &itemText) sint32 mp= sint(itemInfo.MagicPowerFactor[i]*100); if(cs!=0 || mp!=0) { - ucstring line= CI18N::get( string("uihelpItemMagicBonus") + valIds[i] ); + string line= CI18N::get( string("uihelpItemMagicBonus") + valIds[i] ); strFindReplace(line, "%cs", toString("%+d", cs) ); strFindReplace(line, "%mp", toString("%+d", mp) ); mbInfo+= line; @@ -1609,7 +1610,7 @@ void getMagicBonus(CDBCtrlSheet *item, ucstring &itemText) if(!mbInfo.empty()) { // add spell level header - ucstring spellRuleFmt= CI18N::get("uihelpItemMagicBonusHeader"); + string spellRuleFmt= CI18N::get("uihelpItemMagicBonusHeader"); strFindReplace(spellRuleFmt, "%mglvl", toString(item->getQuality())); mbInfo= spellRuleFmt + mbInfo; } @@ -1618,11 +1619,11 @@ void getMagicBonus(CDBCtrlSheet *item, ucstring &itemText) strFindReplace(itemText, "%magic_bonus", mbInfo); } -void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText) +void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); bool requiredNeeded= false; - ucstring fmt, fmtc; + string fmt, fmtc; // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); @@ -1655,7 +1656,7 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring & fmt = CI18N::get("uihelpItemSkillReqNotMetFmt"); strFindReplace(fmt, "%d", toString((uint)itemInfo.RequiredSkillLevel)); - const ucstring skillName(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill)); + const char *skillName = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill); strFindReplace(fmt, "%s", skillName); } else @@ -1686,7 +1687,7 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring & fmt = CI18N::get("uihelpItemSkillReqNotMetFmt"); strFindReplace(fmt, "%d", toString((uint)itemInfo.RequiredSkillLevel2)); - const ucstring skillName(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill2)); + const char *skillName = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill2); strFindReplace(fmt, "%s", skillName); } else @@ -1749,7 +1750,7 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring & if(req) { // Build the req string - ucstring fmt; + string fmt; if(pIM->isItemCaracRequirementMet(caracType, (sint32)caracValue)) fmt= CI18N::get("uihelpItemCaracReqMetFmt"); else @@ -1784,7 +1785,7 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring & if (skillReq) { // Build the req string - ucstring fmt; + string fmt; if (req) fmt = CI18N::get("uihelpItemCaracReqAnd"); @@ -1793,7 +1794,7 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring & else fmt += CI18N::get("uihelpItemSkillReqNotMetFmt"); strFindReplace(fmt, "%d", toString((uint)itemInfo.MinRequiredSkillLevel)); - const ucstring skillName = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill); + const char *skillName = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill); strFindReplace(fmt, "%s", skillName); strFindReplace(itemText, "%skillreq", fmt ); @@ -1805,12 +1806,12 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring & #endif } -void getSkillModVsType(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText) +void getSkillModVsType(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText) { // retrieve the current itemInfo const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) ); - ucstring sMod; + string sMod; // check skill mod if(!itemInfo.TypeSkillMods.empty()) { @@ -1831,9 +1832,9 @@ void getSkillModVsType(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemT strFindReplace(itemText, "%skill_mod_vs_type", sMod); } -void getArmorBonus(CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS) +void getArmorBonus(CDBCtrlSheet *item, string &itemText, const CItemSheet*pIS) { - ucstring armor_bonus(""); + string armor_bonus; sint32 level = 0; if (pIS->Armor.ArmorType == ARMORTYPE::HEAVY) @@ -1848,7 +1849,7 @@ void getArmorBonus(CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS) } // *************************************************************************** -void getItemText (CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS) +void getItemText (CDBCtrlSheet *item, string &itemText, const CItemSheet*pIS) { if ((item == NULL) || (pIS == NULL)) return; @@ -1894,24 +1895,24 @@ void getItemText (CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS) CItemSpecialEffectHelper::getInstance()->getItemSpecialEffectText(pIS, itemText); // Description - const ucstring desc(CStringManagerClient::getItemLocalizedDescription(pIS->Id)); - if(!desc.empty()) + const char *desc = CStringManagerClient::getItemLocalizedDescription(pIS->Id); + if (*desc) { strFindReplace(itemText, "%desc", "@{FFF9}" + CI18N::get("uiMissionDesc") + "\n@{FFFF}" + desc + "\n" ); } else - strFindReplace(itemText, "%desc", ucstring() ); + strFindReplace(itemText, "%desc", string() ); // Custom text const CClientItemInfo &itemInfo = getInventory().getItemInfo(getInventory().getItemSlotId(item) ); if (!itemInfo.CustomText.empty()) { - strFindReplace(itemText, "%custom_text", "\n@{FFFF}" + itemInfo.CustomText + "\n"); - ucstring itemMFC = CI18N::get("uiItemTextMessageFromCrafter"); + strFindReplace(itemText, "%custom_text", "\n@{FFFF}" + itemInfo.CustomText.toUtf8() + "\n"); + string itemMFC = CI18N::get("uiItemTextMessageFromCrafter"); strFindReplace(itemText, "%mfc", itemMFC); } else - strFindReplace(itemText, "%custom_text", ucstring() ); + strFindReplace(itemText, "%custom_text", string() ); if ( pIS->Family == ITEMFAMILY::COSMETIC ) { @@ -1919,10 +1920,10 @@ void getItemText (CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS) if ( UserEntity->getGender() != pIS->Cosmetic.Gender || UserEntity->people() != people ) strFindReplace(itemText, "%cansell", CI18N::get("uihelpItemCosmeticDontFit") ); else - strFindReplace(itemText, "%cansell", ucstring() ); + strFindReplace(itemText, "%cansell", string() ); } else if(pIS->DropOrSell ) - strFindReplace(itemText, "%cansell", ucstring() ); + strFindReplace(itemText, "%cansell", string() ); else strFindReplace(itemText, "%cansell", CI18N::get("uihelpItemCantSell") ); @@ -2012,8 +2013,8 @@ void getItemText (CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS) // Craft some part? if(pIS->canBuildSomeItemPart()) { - ucstring fmt= CI18N::get("uihelpItemMPCraft"); - std::string ipList; + string fmt= CI18N::get("uihelpItemMPCraft"); + string ipList; pIS->getItemPartListAsText(ipList); strFindReplace(fmt, "%ip", ipList); strFindReplace(itemText, "%craft", fmt); @@ -2111,11 +2112,11 @@ void getItemText (CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS) // *************************************************************************** -static void setupEnchantedItem(CSheetHelpSetup &setup, ucstring &itemText) +static void setupEnchantedItem(CSheetHelpSetup &setup, string &itemText) { // if don't find the tag in the text (eg: if not useful), no-op - static const ucstring enchantTag("%enchantment"); - if( itemText.find(enchantTag) == ucstring::npos ) + static const string enchantTag("%enchantment"); + if( itemText.find(enchantTag) == string::npos ) return; // retrieve the current itemInfo @@ -2132,7 +2133,7 @@ static void setupEnchantedItem(CSheetHelpSetup &setup, ucstring &itemText) CSPhraseManager *pPM= CSPhraseManager::getInstance(); // fill the enchantement info - ucstring enchantInfo; + string enchantInfo; const CItemSheet *pIS= ctrl->asItemSheet(); if(pIS && pIS->Family == ITEMFAMILY::CRYSTALLIZED_SPELL) pPM->buildPhraseDesc(enchantInfo, itemInfo.Enchantment, 0, false, "uihelpPhraseCrystalSpellFormat"); @@ -2159,7 +2160,7 @@ static void setupEnchantedItem(CSheetHelpSetup &setup, ucstring &itemText) hideListBrickHeader(setup); // hide the text - strFindReplace(itemText, enchantTag, ucstring()); + strFindReplace(itemText, enchantTag, string()); } } @@ -2500,14 +2501,14 @@ void refreshItemHelp(CSheetHelpSetup &setup) setupCreatorName(setup); // **** setup the item Text info - ucstring itemText; + string itemText; CEntitySheet *pES = SheetMngr.get ( CSheetId(setup.SrcSheet->getSheetId()) ); if ((pES != NULL) && (pES->type() == CEntitySheet::ITEM)) { CItemSheet *pIS = (CItemSheet*)pES; // ---- Common - ucstring title = setup.SrcSheet->getItemActualName(); + string title = setup.SrcSheet->getItemActualName().toUtf8(); setupHelpTitle(setup.HelpWindow, title ); getItemText (setup.SrcSheet, itemText, pIS); @@ -2591,7 +2592,7 @@ static void setupPactHelp(CSheetHelpSetup &setup) const CPactSheet::SPact &pactLose = pact->PactLose[pactLevel]; // **** setup the brick Text info - ucstring pactText; + string pactText; // TODO Localisation setupHelpTitle(setup.HelpWindow, pactLose.Name); @@ -2698,7 +2699,7 @@ void refreshMissionHelp(CSheetHelpSetup &setup, const CPrerequisitInfos &infos) // fill text, choose color according to conditions and block for (uint j = i ; j < orIndexMax ; ++j ) { - const std::string text = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_%u",j+1); + const string text = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_%u",j+1); CViewText *viewText = dynamic_cast(setup.HelpWindow->getElement(text)); if (viewText) { @@ -2709,7 +2710,7 @@ void refreshMissionHelp(CSheetHelpSetup &setup, const CPrerequisitInfos &infos) viewText->setHardText("uiMissionOr"); } - const std::string textId = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_id_prereq_%u",j+1); + const string textId = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_id_prereq_%u",j+1); CViewTextID *viewTextID = dynamic_cast(setup.HelpWindow->getElement(textId)); if(viewTextID) @@ -2737,12 +2738,12 @@ void refreshMissionHelp(CSheetHelpSetup &setup, const CPrerequisitInfos &infos) // inactivate other lines for (uint i = (uint)infos.Prerequisits.size(); i < 15 ; ++i) { - const std::string text = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_%u",i+1); + const string text = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_%u",i+1); CViewText *viewText = dynamic_cast(setup.HelpWindow->getElement(text)); if (viewText) viewText->setActive(false); - const std::string textId = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_id_prereq_%u",i+1); + const string textId = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_id_prereq_%u",i+1); CViewTextID *viewTextID = dynamic_cast(setup.HelpWindow->getElement(textId)); if(viewTextID) viewTextID->setActive(false); @@ -2873,12 +2874,12 @@ void setupOutpostBuildingHelp(CSheetHelpSetup &setup) setupHelpTitle(setup.HelpWindow, CI18N::get("uihelpOutpostBuilding")); - ucstring sOBText; + string sOBText; sOBText = CI18N::get("uihelpOBFormat_"+COutpostBuildingSheet::toString(pOBS->OBType)); { - ucstring timeText; + string timeText; timeText = toString(pOBS->CostTime/60) + CI18N::get("uiBotChatTimeMinute"); if ((pOBS->CostTime % 60) != 0) timeText += toString(pOBS->CostTime%60) + CI18N::get("uiBotChatTimeSecond"); @@ -2944,7 +2945,7 @@ static sint getBonusMalusSpecialTT(CDBCtrlSheet *cs) // *************************************************************************** -void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText) +void getSabrinaBrickText(CSBrickSheet *pBR, string &brickText) { if(!pBR) return; @@ -2963,15 +2964,15 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText) // Level strFindReplace(brickText, "%lvl", toString(pBR->Level)); // Kill the whole text between %ks, if the skill is unknown - const ucstring killSkill("%ks"); + const string killSkill("%ks"); if( pBR->getSkill()==SKILLS::unknown ) { - ucstring::size_type pos0= brickText.find(killSkill); + string::size_type pos0= brickText.find(killSkill); if(pos0 != ucstring::npos) { - ucstring::size_type pos1= brickText.find(killSkill, pos0 + killSkill.size() ); - if(pos1 != ucstring::npos) - brickText.replace(pos0, pos1+killSkill.size()-pos0, ucstring() ); + string::size_type pos1= brickText.find(killSkill, pos0 + killSkill.size() ); + if(pos1 != string::npos) + brickText.replace(pos0, pos1+killSkill.size()-pos0, string() ); } } else @@ -2984,7 +2985,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText) strFindReplace(brickText, "%skill", CStringManagerClient::getSkillLocalizedName(pBR->getSkill())); else { - ucstring fullSkillText; + string fullSkillText; bool first= true; for(uint i=0;iUsedSkills.size();i++) { @@ -3014,13 +3015,13 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText) // Kill the whole text between %krc, if the relative cost is 0 if(pBR->SabrinaRelativeCost==0.f) { - const ucstring killRC("%krc"); - ucstring::size_type pos0= brickText.find(killRC); - if(pos0 != ucstring::npos) + const string killRC("%krc"); + string::size_type pos0= brickText.find(killRC); + if(pos0 != string::npos) { - ucstring::size_type pos1= brickText.find(killRC, pos0 + killRC.size() ); - if(pos1 != ucstring::npos) - brickText.replace(pos0, pos1+killRC.size()-pos0, ucstring() ); + string::size_type pos1= brickText.find(killRC, pos0 + killRC.size() ); + if(pos1 != string::npos) + brickText.replace(pos0, pos1+killRC.size()-pos0, string() ); } } else @@ -3053,7 +3054,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText) } else { - ucstring mpInfo; + string mpInfo; for(uint i=0;iFaberPlan.ItemPartMps.size();i++) { CSBrickSheet::CFaberPlan::CItemPartMP &mpSlot= pBR->FaberPlan.ItemPartMps[i]; @@ -3074,7 +3075,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText) } else { - ucstring mpInfo; + string mpInfo; for(uint i=0;iFaberPlan.FormulaMps.size();i++) { CSBrickSheet::CFaberPlan::CFormulaMP &mpSlot= pBR->FaberPlan.FormulaMps[i]; @@ -3090,7 +3091,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText) } // *** Magic - ucstring magicResistStr; + string magicResistStr; // Has Some Magic Resistance setuped? if( pBR->isMagic() && pBR->MagicResistType!=RESISTANCE_TYPE::None) { @@ -3190,10 +3191,10 @@ void setupSabrinaPhraseHelp(CSheetHelpSetup &setup, const CSPhraseCom &phrase, u } // **** setup the phrase Text info - setupHelpTitle(setup.HelpWindow, phrase.Name); + setupHelpTitle(setup.HelpWindow, phrase.Name.toUtf8()); // get the phraseText - ucstring phraseText; + string phraseText; // if required, add the .sphrase requirements. // NB: don't add if from bot chat validation (useless cause already filtered by server) pPM->buildPhraseDesc(phraseText, phrase, phraseSheetId, !setup.FromBotChat); @@ -3261,12 +3262,12 @@ static void setupSabrinaBrickHelp(CSheetHelpSetup &setup, bool auraDisabled) // **** setup the brick Text info - ucstring brickText; + string brickText; CSBrickManager *pBM= CSBrickManager::getInstance(); CSBrickSheet *pBR= pBM->getBrick(CSheetId(setup.SrcSheet->getSheetId())); if(pBR) { - const ucstring title(CStringManagerClient::getSBrickLocalizedName(pBR->Id)); + const char *title = CStringManagerClient::getSBrickLocalizedName(pBR->Id); setupHelpTitle(setup.HelpWindow, title); // add brick info @@ -3596,7 +3597,7 @@ public: else if( getAuraDisabledState(cs) ) { // get the normal string, and append a short info. - std::string str; + string str; cs->getContextHelp(str); str+= CI18N::get("uittAuraDisabled"); @@ -3735,7 +3736,7 @@ REGISTER_ACTION_HANDLER( CAHMilkoKick, "milko_kick"); // *************************************************************************** -static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const std::string &statPrefixId) +static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const string &statPrefixId) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); @@ -3939,7 +3940,7 @@ public: s += getSystemInformation(); string progname; - std::string moduleName; + string moduleName; #ifdef NL_OS_WINDOWS wchar_t name[1024]; GetModuleFileNameW(NULL, name, 1023); diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index eef48509e..58dc5d52a 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -932,7 +932,7 @@ void CChatGroupWindow::removeAllFreeTellers() //================================================================================= void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f) { - f.serialVersion(2); + f.serialVersion(3); // Save the free teller only if it is present in the friend list to avoid the only-growing situation // because free tellers are never deleted in game if we save/load all the free tellers, we just create more @@ -940,7 +940,7 @@ void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f) uint32 i, nNbFreeTellerSaved = 0; for (i = 0; i < _FreeTellers.size(); ++i) - if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getUCTitle()) != -1) + if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getTitle()) != -1) nNbFreeTellerSaved++; f.serial(nNbFreeTellerSaved); @@ -949,9 +949,9 @@ void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f) { CGroupContainer *pGC = _FreeTellers[i]; - if (PeopleInterraction.FriendList.getIndexFromName(pGC->getUCTitle()) != -1) + if (PeopleInterraction.FriendList.getIndexFromName(pGC->getTitle()) != -1) { - ucstring sTitle = pGC->getUCTitle(); + string sTitle = pGC->getTitle(); f.serial(sTitle); } } @@ -960,7 +960,7 @@ void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f) //================================================================================= void CChatGroupWindow::loadFreeTeller(NLMISC::IStream &f) { - sint ver = f.serialVersion(2); + sint ver = f.serialVersion(3); if (ver == 1) { @@ -980,10 +980,15 @@ void CChatGroupWindow::loadFreeTeller(NLMISC::IStream &f) string sID; f.serial(sID); } - ucstring sTitle; - f.serial(sTitle); + string title; + if (ver < 3) + { + ucstring sTitle; // Old UTF-16 serial + f.serial(sTitle); + title = sTitle.toUtf8(); + } - CGroupContainer *pGC = createFreeTeller(sTitle, ""); + CGroupContainer *pGC = createFreeTeller(title, ""); // With version 1 all tells are active because windows information have "title based" ids and no "sID based". if ((ver == 1) && (pGC != NULL)) @@ -1334,13 +1339,13 @@ REGISTER_ACTION_HANDLER(CHandlerChatBoxEntry, "chat_box_entry"); -static ucstring getFreeTellerName(CInterfaceElement *pCaller) +static string getFreeTellerName(CInterfaceElement *pCaller) { - if (!pCaller) return ucstring(); + if (!pCaller) return string(); CChatGroupWindow *cgw = PeopleInterraction.getChatGroupWindow(); - if (!cgw) return ucstring(); + if (!cgw) return string(); CInterfaceGroup *freeTeller = pCaller->getParentContainer(); - if (!freeTeller) return ucstring(); + if (!freeTeller) return string(); return cgw->getFreeTellerName( freeTeller->getId() ); } @@ -1350,7 +1355,7 @@ class CHandlerAddTellerToFriendList : public IActionHandler public: void execute (CCtrlBase *pCaller, const std::string &/* sParams */) { - ucstring playerName = ::getFreeTellerName(pCaller); + string playerName = ::getFreeTellerName(pCaller); if (!playerName.empty()) { sint playerIndex = PeopleInterraction.IgnoreList.getIndexFromName(playerName); @@ -1378,7 +1383,7 @@ public: CInterfaceManager *im = CInterfaceManager::getInstance(); std::string callerId = getParam(sParams, "id"); CInterfaceElement *prevCaller = CWidgetManager::getInstance()->getElementFromId(callerId); - ucstring playerName = ::getFreeTellerName(prevCaller); + string playerName = ::getFreeTellerName(prevCaller); if (!playerName.empty()) { // if already in friend list, ask to move rather than add @@ -1410,7 +1415,7 @@ class CHandlerInviteToRingSession : public IActionHandler public: void execute (CCtrlBase *pCaller, const std::string &/* sParams */) { - string playerName = ::getFreeTellerName(pCaller).toUtf8(); + string playerName = ::getFreeTellerName(pCaller); if (!playerName.empty()) { // ask the SBS to invite the character in the session diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 7196bdac9..63392c583 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -3394,22 +3394,22 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const if (!macro) return; - ucstring macroName = macro->Name; + string macroName = macro->Name; if (macroName.empty()) macroName = CI18N::get("uiNotAssigned"); - ucstring assignedTo = macro->Combo.toString(); + string assignedTo = macro->Combo.toString(); if (assignedTo.empty()) assignedTo = CI18N::get("uiNotAssigned"); - ucstring dispText; - ucstring dispCommands; + string dispText; + string dispCommands; const CMacroCmdManager *pMCM = CMacroCmdManager::getInstance(); uint nb = 0; for (uint i = 0; i < macro->Commands.size(); ++i) { - ucstring commandName; + string commandName; for (uint j = 0; j < pMCM->ActionManagers.size(); ++j) { CAction::CName c(macro->Commands[i].Name.c_str(), macro->Commands[i].Params.c_str()); @@ -3425,14 +3425,14 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const } } // formats - dispText = ucstring("%n (@{6F6F}%k@{FFFF})\n%c"); + dispText = "%n (@{6F6F}%k@{FFFF})\n%c"; if (nb > 5) // more? dispCommands += toString(" ... @{6F6F}%i@{FFFF}+", nb-5); - strFindReplace(dispText, ucstring("%n"), macroName); - strFindReplace(dispText, ucstring("%k"), assignedTo); - strFindReplace(dispText, ucstring("%c"), dispCommands); - help = dispText.toUtf8(); + strFindReplace(dispText, "%n", macroName); + strFindReplace(dispText, "%k", assignedTo); + strFindReplace(dispText, "%c", dispCommands); + help = dispText; } else if(getType() == CCtrlSheetInfo::SheetType_Item) { diff --git a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp index be0df19ad..4f173088d 100644 --- a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp @@ -1242,9 +1242,9 @@ void CDBGroupBuildPhrase::updateAllDisplay(const CSPhraseCom &phrase) // **** Setup the phrase Desc if(_TextPhraseDesc) { - ucstring text; + string text; pPM->buildPhraseDesc(text, phrase, 0, false, "composition"); - _TextPhraseDesc->setTextFormatTaged(text.toUtf8()); + _TextPhraseDesc->setTextFormatTaged(text); } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp index 21a56ec4f..f8b5d4b56 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -281,15 +281,15 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if(Ctrl->getSheetCategory() == CDBCtrlSheet::Phrase) { // For combat action, Append weapon restriction - ucstring weaponRestriction; + string weaponRestriction; CSPhraseManager *pPM= CSPhraseManager::getInstance(); bool melee,range; pPM->getCombatWeaponRestriction(weaponRestriction, Ctrl->getSheetId(),melee,range); // don't add also if no combat restriction - if(!weaponRestriction.empty() && weaponRestriction!=CI18N::getAsUtf16("uiawrSF")) + if(!weaponRestriction.empty() && weaponRestriction!=CI18N::get("uiawrSF")) { weaponRestriction= CI18N::get("uiPhraseWRHeader") + weaponRestriction; - text+= "\n" + weaponRestriction.toUtf8(); + text+= "\n" + weaponRestriction; } } diff --git a/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp b/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp index 35cc56ebe..9f03834c8 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -1311,6 +1311,7 @@ class CAHDynChatClickOption : public IActionHandler uint32 optStrId = InSceneBubbleManager.dynChatGetOptionStringId(nBubbleNb, nOpt); if (!optStrId) return; +#ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); @@ -1330,6 +1331,7 @@ class CAHDynChatClickOption : public IActionHandler } } } +#endif static const string sMsg = "BOTCHAT:DYNCHAT_SEND"; CBitMemStream out; diff --git a/ryzom/client/src/interface_v3/group_modal_get_key.cpp b/ryzom/client/src/interface_v3/group_modal_get_key.cpp index b79f6c38a..1bd1f0936 100644 --- a/ryzom/client/src/interface_v3/group_modal_get_key.cpp +++ b/ryzom/client/src/interface_v3/group_modal_get_key.cpp @@ -111,8 +111,8 @@ bool CGroupModalGetKey::handleEvent (const NLGUI::CEventDescriptor &event) const CBaseAction *baseAction = pCurAM->getBaseAction(it->second); if (baseAction && pCurAM->isActionPresentInContext(it->second)) { - ucstring shortcutName = baseAction->getActionLocalizedText(it->second); - if (pVT != NULL) pVT->setText(shortcutName.toUtf8()); + string shortcutName = baseAction->getActionLocalizedText(it->second); + if (pVT != NULL) pVT->setText(shortcutName); } } else diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 0fa12432b..963093235 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1605,7 +1605,9 @@ void CInterfaceManager::updateFrameEvents() // handle gc for lua CLuaManager::getInstance().getLuaState()->handleGC(); +#ifdef RYZOM_BG_DOWNLOADER CBGDownloaderAccess::getInstance().update(); +#endif CItemGroupManager::getInstance()->update(); diff --git a/ryzom/client/src/interface_v3/item_consumable_effect.cpp b/ryzom/client/src/interface_v3/item_consumable_effect.cpp index a91394390..38b22a3e4 100644 --- a/ryzom/client/src/interface_v3/item_consumable_effect.cpp +++ b/ryzom/client/src/interface_v3/item_consumable_effect.cpp @@ -33,10 +33,10 @@ CItemConsumableEffectHelper* CItemConsumableEffectHelper::getInstance() return instance; } -void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *pIS, ucstring &itemText, sint32 itemQuality) +void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *pIS, string &itemText, sint32 itemQuality) { // check if some effects are present on this item - ucstring effects(""); + string effects(""); uint i; for( i=0; iConsumable.Properties.size(); ++i ) @@ -71,7 +71,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * uint32 timeInSec; fromString(params[3].c_str(), timeInSec); - ucstring result; + string result; if (bonus >= 0) result = CI18N::get("uiItemConsumableEffectUpCharac"); @@ -101,7 +101,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * uint32 userDisableTime; fromString(params[4].c_str(), userDisableTime); - ucstring result = CI18N::get("uiItemConsumableEffectLifeAura"); + string result = CI18N::get("uiItemConsumableEffectLifeAura"); strFindReplace(result, "%modifier", toString(regenMod)); strFindReplace(result, "%minutes", toString(duration/60)); strFindReplace(result, "%secondes", toString(duration%60)); @@ -128,7 +128,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * uint32 userDisableTime; fromString(params[4].c_str(), userDisableTime); - ucstring result = CI18N::get("uiItemConsumableEffectLifeAura"); + string result = CI18N::get("uiItemConsumableEffectLifeAura"); strFindReplace(result, "%modifier", toString(bonus)); strFindReplace(result, "%minutes", toString(duration/60)); strFindReplace(result, "%secondes", toString(duration%60)); @@ -154,7 +154,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * uint32 userDisableTime; fromString(params[4].c_str(), userDisableTime); - ucstring result = CI18N::get("uiItemConsumableEffectStaminaAura"); + string result = CI18N::get("uiItemConsumableEffectStaminaAura"); strFindReplace(result, "%modifier", toString(regenMod)); strFindReplace(result, "%minutes", toString(duration/60)); strFindReplace(result, "%secondes", toString(duration%60)); @@ -182,7 +182,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * uint32 userDisableTime; fromString(params[4].c_str(), userDisableTime); - ucstring result = CI18N::get("uiItemConsumableEffectStaminaAura"); + string result = CI18N::get("uiItemConsumableEffectStaminaAura"); strFindReplace(result, "%modifier", toString(bonus)); strFindReplace(result, "%minutes", toString(duration/60)); strFindReplace(result, "%secondes", toString(duration%60)); @@ -208,7 +208,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * uint32 userDisableTime; fromString(params[4].c_str(), userDisableTime); - ucstring result = CI18N::get("uiItemConsumableEffectSapAura"); + string result = CI18N::get("uiItemConsumableEffectSapAura"); strFindReplace(result, "%modifier", toString(regenMod)); strFindReplace(result, "%minutes", toString(duration/60)); strFindReplace(result, "%secondes", toString(duration%60)); @@ -235,7 +235,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * uint32 userDisableTime; fromString(params[4].c_str(), userDisableTime); - ucstring result = CI18N::get("uiItemConsumableEffectSapAura"); + string result = CI18N::get("uiItemConsumableEffectSapAura"); strFindReplace(result, "%modifier", toString(bonus)); strFindReplace(result, "%minutes", toString(duration/60)); strFindReplace(result, "%secondes", toString(duration%60)); @@ -249,7 +249,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * // skill modifier consumables //--------------------------- - ucstring result(""); + string result(""); uint8 paramIdx = 0; if( name == "SP_MOD_DEFENSE" ) { diff --git a/ryzom/client/src/interface_v3/item_consumable_effect.h b/ryzom/client/src/interface_v3/item_consumable_effect.h index 69a0472ad..a6150204a 100644 --- a/ryzom/client/src/interface_v3/item_consumable_effect.h +++ b/ryzom/client/src/interface_v3/item_consumable_effect.h @@ -32,7 +32,7 @@ public: static CItemConsumableEffectHelper* getInstance(); // Fill itemText with consumable effects from item sheet - void getItemConsumableEffectText(const CItemSheet *pIS, ucstring &itemText, sint32 itemQuality); + void getItemConsumableEffectText(const CItemSheet *pIS, std::string &itemText, sint32 itemQuality); private: CItemConsumableEffectHelper() {} diff --git a/ryzom/client/src/interface_v3/item_special_effect.cpp b/ryzom/client/src/interface_v3/item_special_effect.cpp index 5d696738a..7b659fe6d 100644 --- a/ryzom/client/src/interface_v3/item_special_effect.cpp +++ b/ryzom/client/src/interface_v3/item_special_effect.cpp @@ -76,11 +76,11 @@ void CItemSpecialEffectHelper::registerItemSpecialEffect(const string &name) effectMap.insert(make_pair(name, params)); } -void CItemSpecialEffectHelper::getItemSpecialEffectText(const CItemSheet *pIS, ucstring &itemText) +void CItemSpecialEffectHelper::getItemSpecialEffectText(const CItemSheet *pIS, string &itemText) { // check if some effects are present on this item bool firstEffect = false; - ucstring effects; + string effects; effects += getEffect(pIS->getEffect1(), firstEffect); effects += getEffect(pIS->getEffect2(), firstEffect); effects += getEffect(pIS->getEffect3(), firstEffect); @@ -92,9 +92,9 @@ void CItemSpecialEffectHelper::getItemSpecialEffectText(const CItemSheet *pIS, u strFindReplace(itemText, "%special_effects", effects); } -ucstring CItemSpecialEffectHelper::getEffect(const std::string &effect, bool &first) +string CItemSpecialEffectHelper::getEffect(const std::string &effect, bool &first) { - ucstring result; + string result; CSString eff = effect; if (eff.empty()) diff --git a/ryzom/client/src/interface_v3/item_special_effect.h b/ryzom/client/src/interface_v3/item_special_effect.h index a97437958..201c83927 100644 --- a/ryzom/client/src/interface_v3/item_special_effect.h +++ b/ryzom/client/src/interface_v3/item_special_effect.h @@ -32,7 +32,7 @@ public: static CItemSpecialEffectHelper* getInstance(); // Fill itemText with special effects from item sheet - void getItemSpecialEffectText(const CItemSheet *pIS, ucstring &itemText); + void getItemSpecialEffectText(const CItemSheet *pIS, std::string &itemText); // Register a new item special effect void registerItemSpecialEffect(const std::string &name); @@ -42,7 +42,7 @@ private: CItemSpecialEffectHelper(const CItemSpecialEffectHelper&); // Get UI text with values filled from 'effect' string - ucstring getEffect(const std::string &effect, bool &first); + std::string getEffect(const std::string &effect, bool &first); // Map effects name with parameters typedef std::vector stringVector; diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 55d31bf54..4e6599fa1 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -533,10 +533,12 @@ void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls) luabind::def("messageBoxWithHelp", (void(*)(const std::string &)) &messageBoxWithHelp), LUABIND_FUNC(replacePvpEffectParam), LUABIND_FUNC(secondsSince1970ToHour), +#ifdef RYZOM_BG_DOWNLOADER LUABIND_FUNC(pauseBGDownloader), LUABIND_FUNC(unpauseBGDownloader), LUABIND_FUNC(requestBGDownloaderPriority), LUABIND_FUNC(getBGDownloaderPriority), +#endif LUABIND_FUNC(loadBackground), LUABIND_FUNC(getPatchLastErrorMessage), LUABIND_FUNC(getPlayerSelectedSlot), @@ -3080,6 +3082,7 @@ sint32 CLuaIHMRyzom::secondsSince1970ToHour(sint32 seconds) return tstruct->tm_hour; // 0-23 } +#ifdef RYZOM_BG_DOWNLOADER // *************************************************************************** void CLuaIHMRyzom::pauseBGDownloader() { @@ -3108,6 +3111,7 @@ sint CLuaIHMRyzom::getBGDownloaderPriority() { return CBGDownloaderAccess::getInstance().getDownloadThreadPriority(); } +#endif // *************************************************************************** void CLuaIHMRyzom::loadBackground(const std::string &bg) @@ -3120,11 +3124,13 @@ void CLuaIHMRyzom::loadBackground(const std::string &bg) // *************************************************************************** ucstring CLuaIHMRyzom::getPatchLastErrorMessage() { +#ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) { return CBGDownloaderAccess::getInstance().getLastErrorMessage(); } else +#endif { CPatchManager *pPM = CPatchManager::getInstance(); return pPM->getLastErrorMessage(); diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.h b/ryzom/client/src/interface_v3/lua_ihm_ryzom.h index abf09594e..44e841636 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.h +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.h @@ -174,12 +174,14 @@ private: static void messageBoxWithHelp(const ucstring &text, const std::string &masterGroup, int caseMode); static void messageBoxWithHelp(const std::string &text); - static ucstring replacePvpEffectParam(const ucstring &str, sint32 parameter); + static ucstring replacePvpEffectParam(const ucstring &str, sint32 parameter); // TODO: UTF-8 Lua static sint32 secondsSince1970ToHour(sint32 seconds); +#ifdef RYZOM_BG_DOWNLOADER static void pauseBGDownloader(); static void unpauseBGDownloader(); static void requestBGDownloaderPriority(uint priority); static sint getBGDownloaderPriority(); +#endif static void loadBackground(const std::string &bg); static ucstring getPatchLastErrorMessage(); static bool isInGame(); diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index 81033f5aa..aa6ffe213 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -125,7 +125,7 @@ struct CComboActionName CCombo Combo; // KeyCount <=> action name unbound CAction::CName ActionName; }; -void buildActionToComboMap(uint8 nAM, CGroupList * /* pList */, string catName, map &remaped) +void buildActionToComboMap(uint8 nAM, CGroupList * /* pList */, string catName, map &remaped) { CMacroCmdManager *pMCM = CMacroCmdManager::getInstance(); CActionsManager *pAM = pMCM->ActionManagers[nAM]; @@ -148,7 +148,7 @@ void buildActionToComboMap(uint8 nAM, CGroupList * /* pList */, string catName, // see if action active in current context if (pAM->isActionPresentInContext(it->second)) { - pair value; + pair value; // Don't take any risk: avoid any bug if the localisation is buggy and give same text for 2 differents CAction::CName // Use the localized text first, to have correct sort according to language value.first= pAM->getActionLocalizedText(rName) + rName.Name + rName.Argu; @@ -177,7 +177,7 @@ void buildActionToComboMap(uint8 nAM, CGroupList * /* pList */, string catName, // see if action active in current context if (pAM->isActionPresentInContext(rName)) { - pair value; + pair value; // Don't take any risk: avoid any bug if the localisation is buggy and give same text for 2 differents CAction::CName // Use the localized text first, to have correct sort according to language value.first= pAM->getActionLocalizedText(rName) + rName.Name + rName.Argu; @@ -197,15 +197,15 @@ void buildActionToComboMap(uint8 nAM, CGroupList * /* pList */, string catName, // Get all the couple (combo,action) from the action manager nAM and insert them into pList (with the template) -void getAllComboAction(uint8 nAM, CGroupList *pList, const map &remaped) +void getAllComboAction(uint8 nAM, CGroupList *pList, const map &remaped) { CMacroCmdManager *pMCM = CMacroCmdManager::getInstance(); CActionsManager *pAM = pMCM->ActionManagers[nAM]; // *** Fill Actions - map::const_iterator remapIT = remaped.begin(); + map::const_iterator remapIT = remaped.begin(); while (remapIT != remaped.end()) { - ucstring keyName; + string keyName; if(remapIT->second.Combo.Key==KeyCount) keyName= CI18N::get("uiNotAssigned"); else @@ -213,7 +213,7 @@ void getAllComboAction(uint8 nAM, CGroupList *pList, const mapgetBaseAction(remapIT->second.ActionName); if (baseAction) { - ucstring shortcutName = baseAction->getActionLocalizedText(remapIT->second.ActionName); + string shortcutName = baseAction->getActionLocalizedText(remapIT->second.ActionName); addKeyLine(pList, keyName, shortcutName, remapIT->second.Combo.Key==KeyCount); CModalContainerEditCmd::CLine line; @@ -274,7 +274,7 @@ public: pList->clearGroups(); pList->setDynamicDisplaySize(true); - map remaped; + map remaped; buildActionToComboMap(nAM, pList, rCats[i].Name, remaped); if (!remaped.empty()) { diff --git a/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/ryzom/client/src/interface_v3/macrocmd_manager.cpp index 03e53c06b..54bc39d29 100644 --- a/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -65,7 +65,7 @@ void CMacroCmd::writeTo (xmlNodePtr node) const xmlNodePtr macroNode = xmlNewChild ( node, NULL, (const xmlChar*)"macro", NULL ); // Props - xmlSetProp (macroNode, (const xmlChar*)"name", (const xmlChar*)ucstring(Name).toUtf8().c_str()); + xmlSetProp (macroNode, (const xmlChar*)"name", (const xmlChar*)Name.c_str()); xmlSetProp (macroNode, (const xmlChar*)"id", (const xmlChar*)toString(ID).c_str()); xmlSetProp (macroNode, (const xmlChar*)"back", (const xmlChar*)toString(BitmapBack).c_str()); xmlSetProp (macroNode, (const xmlChar*)"icon", (const xmlChar*)toString(BitmapIcon).c_str()); @@ -86,12 +86,7 @@ bool CMacroCmd::readFrom (xmlNodePtr node) CXMLAutoPtr ptrName; ptrName = (char*) xmlGetProp( node, (xmlChar*)"name" ); - if (ptrName) - { - ucstring ucName; - ucName.fromUtf8((const char*)ptrName); - Name = ucName.toString(); - } + if (ptrName) Name = (const char *)ptrName; ptrName = (char*) xmlGetProp( node, (xmlChar*)"id" ); if (ptrName) fromString((const char*)ptrName, ID); @@ -818,7 +813,7 @@ public: REGISTER_ACTION_HANDLER( CHandlerNewMacroCmdDelete, "new_macro_cmd_delete"); // *************************************************************************** -void addCommandLine (CGroupList *pParent, uint cmdNb, const ucstring &cmdName) +void addCommandLine (CGroupList *pParent, uint cmdNb, const string &cmdName) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); @@ -828,7 +823,7 @@ void addCommandLine (CGroupList *pParent, uint cmdNb, const ucstring &cmdName) if (pNewCmd == NULL) return; CViewText *pVT = dynamic_cast(pNewCmd->getView(TEMPLATE_NEWMACRO_COMMAND_TEXT)); - if (pVT != NULL) pVT->setText(cmdName.toUtf8()); + if (pVT != NULL) pVT->setText(cmdName); pNewCmd->setParent (pParent); pParent->addChild (pNewCmd); @@ -906,7 +901,7 @@ public: for (uint i = 0; i < pMCM->CurrentEditMacro.Commands.size(); ++i) { - ucstring commandName; + string commandName; for (uint j = 0; j < pMCM->ActionManagers.size(); ++j) { CAction::CName c(pMCM->CurrentEditMacro.Commands[i].Name.c_str(), pMCM->CurrentEditMacro.Commands[i].Params.c_str()); diff --git a/ryzom/client/src/interface_v3/music_player.cpp b/ryzom/client/src/interface_v3/music_player.cpp index b45af6c7b..790949352 100644 --- a/ryzom/client/src/interface_v3/music_player.cpp +++ b/ryzom/client/src/interface_v3/music_player.cpp @@ -327,9 +327,7 @@ void CMusicPlayer::rebuildPlaylist() CViewText *pVT = dynamic_cast(pNew->getView(TEMPLATE_PLAYLIST_SONG_TITLE)); if (pVT) { - ucstring title; - title.fromUtf8(_Songs[i].Title); - pVT->setText(title.toUtf8()); + pVT->setText(_Songs[i].Title); } pVT = dynamic_cast(pNew->getView(TEMPLATE_PLAYLIST_SONG_DURATION)); diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index e1a01400d..e2f880744 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -1089,7 +1089,7 @@ CFilteredChat *CPeopleInterraction::getFilteredChatFromChatWindow(CChatWindow *c } //=========================================================================================================== -void CPeopleInterraction::askAddContact(const ucstring &contactName, CPeopleList *pl) +void CPeopleInterraction::askAddContact(const string &contactName, CPeopleList *pl) { if (pl == NULL) return; @@ -1109,7 +1109,7 @@ void CPeopleInterraction::askAddContact(const ucstring &contactName, CPeopleList } // add into server (NB: will be added by the server response later) - const std::string sMsg = "TEAM:CONTACT_ADD"; + const char *sMsg = "TEAM:CONTACT_ADD"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) { @@ -1121,14 +1121,14 @@ void CPeopleInterraction::askAddContact(const ucstring &contactName, CPeopleList if (pl == &FriendList) list = 0; - ucstring temp = contactName; + ucstring temp = contactName; // TODO: UTF-8 serial out.serial(temp); out.serial(list); NetMngr.push(out); //nlinfo("impulseCallBack : %s %s %d sent", sMsg.c_str(), contactName.toString().c_str(), list); } else - nlwarning("impulseCallBack : unknown message name : '%s'.", sMsg.c_str()); + nlwarning("impulseCallBack : unknown message name : '%s'.", sMsg); // NB: no client prediction, will be added by server later @@ -1275,7 +1275,7 @@ void CPeopleInterraction::addContactInList(uint32 contactId, const ucstring &nam CPeopleList &pl= nList==0?FriendList:IgnoreList; // remove the shard name if possible - ucstring name= CEntityCL::removeShardFromName(nameIn.toUtf8()); + string name= CEntityCL::removeShardFromName(nameIn.toUtf8()); // add the contact to this list sint index = pl.getIndexFromName(name); @@ -1326,7 +1326,7 @@ bool CPeopleInterraction::isContactInList(const ucstring &nameIn, uint8 nList) c // select correct people list const CPeopleList &pl= nList==0?FriendList:IgnoreList; // remove the shard name if possible - ucstring name= CEntityCL::removeShardFromName(nameIn.toUtf8()); + string name= CEntityCL::removeShardFromName(nameIn.toUtf8()); return pl.getIndexFromName(name) != -1; } @@ -1393,7 +1393,7 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS // Only show the message if this player is not in my guild (because then the guild manager will show a message) std::vector GuildMembers = CGuildManager::getInstance()->getGuildMembers(); bool bOnlyFriend = true; - string name = toLower(FriendList.getName(index).toUtf8()); + string name = toLower(FriendList.getName(index)); for (uint i = 0; i < GuildMembers.size(); ++i) { if (toLower(GuildMembers[i].Name) == name) @@ -1410,7 +1410,7 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS if (showMsg) { string msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline"); - strFindReplace(msg, "%s", FriendList.getName(index).toUtf8()); + strFindReplace(msg, "%s", FriendList.getName(index)); string cat = getStringCategory(msg, msg); map::const_iterator it; NLMISC::CRGBA col = CRGBA::Yellow; @@ -1471,9 +1471,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); + index = FriendList.getIndexFromName(title.toUtf8()); if (index != -1) return false; - index = IgnoreList.getIndexFromName(title); + index = IgnoreList.getIndexFromName(title.toUtf8()); 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 @@ -2137,7 +2137,7 @@ public: uint peopleIndex; if (PeopleInterraction.getPeopleFromCurrentMenu(list, peopleIndex)) { - CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8()); + CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex)); } } }; @@ -2159,7 +2159,7 @@ class CHandlerTellContact : public IActionHandler uint peopleIndex; if (PeopleInterraction.getPeopleFromContainerID(gc->getId(), list, peopleIndex)) { - CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8()); + CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex)); } } @@ -2255,7 +2255,7 @@ public: } else { - PeopleInterraction.askAddContact(geb->getInputStringAsUtf16(), peopleList); + PeopleInterraction.askAddContact(geb->getInputString(), peopleList); geb->setInputString(std::string()); } } @@ -3176,7 +3176,7 @@ NLMISC_COMMAND(ignore, "add or remove a player from the ignore list", " people %s inserted twice.", name.toString().c_str()); } @@ -687,14 +687,14 @@ void CPeopleList::updatePeopleMenu(uint index) } //================================================================== -ucstring CPeopleList::getName(uint index) const +std::string CPeopleList::getName(uint index) const { if (index >= _Peoples.size()) { nlwarning("bad index"); - return ucstring("BAD INDEX!"); + return "BAD INDEX!"; } - return _Peoples[index].getName(); + return _Peoples[index].getName().toUtf8(); } //================================================================== diff --git a/ryzom/client/src/interface_v3/people_list.h b/ryzom/client/src/interface_v3/people_list.h index da7556aa5..91dbf50d3 100644 --- a/ryzom/client/src/interface_v3/people_list.h +++ b/ryzom/client/src/interface_v3/people_list.h @@ -75,13 +75,13 @@ public: */ bool create(const CPeopleListDesc &desc, const CChatWindowDesc *chat = NULL); // Get index from the name of a people, or -1 if not found - sint getIndexFromName(const ucstring &name) const; + sint getIndexFromName(const std::string &name) const; // Get index from the id of the container that represent the people sint getIndexFromContainerID(const std::string &id) const; // Get the number of people in this list uint getNumPeople() const { return (uint)_Peoples.size(); } // Get name of a people - ucstring getName(uint index) const; + std::string getName(uint index) const; // Sort people alphabetically void sort(); diff --git a/ryzom/client/src/interface_v3/req_skill_formula.cpp b/ryzom/client/src/interface_v3/req_skill_formula.cpp index 1165dccc5..5099d325f 100644 --- a/ryzom/client/src/interface_v3/req_skill_formula.cpp +++ b/ryzom/client/src/interface_v3/req_skill_formula.cpp @@ -343,7 +343,7 @@ void CReqSkillFormula::log(const char *prefix) const } // *************************************************************************** -void CReqSkillFormula::getInfoText(ucstring &info) const +void CReqSkillFormula::getInfoText(string &info) const { info.clear(); @@ -363,7 +363,7 @@ void CReqSkillFormula::getInfoText(ucstring &info) const { const CSkillValue &sv= *itSv; // get the colored line if the skill don't reach the req level - ucstring line; + string line; if(!isSkillValueTrained(sv)) line= CI18N::get("uihelpPhraseRequirementNotMetLine"); else diff --git a/ryzom/client/src/interface_v3/req_skill_formula.h b/ryzom/client/src/interface_v3/req_skill_formula.h index 7286172ce..bf0ef5dc0 100644 --- a/ryzom/client/src/interface_v3/req_skill_formula.h +++ b/ryzom/client/src/interface_v3/req_skill_formula.h @@ -101,7 +101,7 @@ public: void log(const char *prefix) const; // For SPhrase Info - void getInfoText(ucstring &info) const; + void getInfoText(std::string &info) const; // return true if the requirement formula completes regarding the actual player state (through CSkillMananger). return true if empty() bool evaluate() const; diff --git a/ryzom/client/src/interface_v3/sphrase_manager.cpp b/ryzom/client/src/interface_v3/sphrase_manager.cpp index f6a89df7a..c42d544d1 100644 --- a/ryzom/client/src/interface_v3/sphrase_manager.cpp +++ b/ryzom/client/src/interface_v3/sphrase_manager.cpp @@ -960,7 +960,7 @@ bool CSPhraseManager::isPhraseKnown(const CSPhraseCom &phrase) const } // *************************************************************************** -ucstring CSPhraseManager::formatMalus(sint base, sint malus) +string CSPhraseManager::formatMalus(sint base, sint malus) { if(malus) return toString("@{F80F}%d@{FFFF} (%d)", base+malus, base); @@ -969,7 +969,7 @@ ucstring CSPhraseManager::formatMalus(sint base, sint malus) } // *************************************************************************** -ucstring CSPhraseManager::formatMalus(float base, float malus) +string CSPhraseManager::formatMalus(float base, float malus) { if(malus) return toString("@{F80F}%.1f@{FFFF} (%.1f)", base+malus, base); @@ -1008,7 +1008,7 @@ string CSPhraseManager::formatBonusMalus(sint32 base, sint32 mod) } // *************************************************************************** -void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, uint32 phraseSheetId, bool wantRequirement, const std::string &specialPhraseFormat) +void CSPhraseManager::buildPhraseDesc(string &text, const CSPhraseCom &phrase, uint32 phraseSheetId, bool wantRequirement, const std::string &specialPhraseFormat) { CSBrickManager *pBM= CSBrickManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance(); @@ -1029,7 +1029,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, if(rootBrick) { static const string compoId= "composition"; - static const ucstring compoTag("%compostart"); + static const string compoTag("%compostart"); bool isComposition= specialPhraseFormat==compoId; // if format not given by user, auto select it. @@ -1053,14 +1053,14 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, // if composition, cut the text before the tag (including) if(isComposition) { - ucstring::size_type pos= text.find(compoTag); - if(pos!=ucstring::npos) + string::size_type pos= text.find(compoTag); + if(pos!=string::npos) text.erase(0, pos+compoTag.size()); } // else just clear the tag else { - strFindReplace(text, compoTag, ucstring() ); + strFindReplace(text, compoTag, string() ); } } else @@ -1071,7 +1071,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, // **** Phrase info basics // replace name - strFindReplace(text, "%name", phrase.Name); + strFindReplace(text, "%name", phrase.Name.toUtf8()); // replace Sabrina Cost and credit. uint32 cost, credit; pBM->getSabrinaCom().getPhraseCost(phrase.Bricks, cost, credit); @@ -1079,7 +1079,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, strFindReplace(text, "%credit", toString(credit)); // for combat, fill weapon compatibility - ucstring weaponRestriction; + string weaponRestriction; bool usableWithMelee; bool usableWithRange; if(rootBrick && rootBrick->isCombat()) @@ -1099,7 +1099,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, bool resistMagic[RESISTANCE_TYPE::NB_RESISTANCE_TYPE]; getResistMagic(resistMagic, phrase.Bricks); bool first= true; - ucstring resList; + string resList; for(uint i=0;iisForageExtraction()) { // Choose the fmt text - ucstring fmt= getForageExtractionPhraseEcotypeFmt(phrase); + string fmt= getForageExtractionPhraseEcotypeFmt(phrase); // Replace forage success rate in any ecotype successModifier = 0; @@ -1292,16 +1292,16 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, } // **** Special .sphrase description - if(phraseSheetId) + if (phraseSheetId) { // get the text - ucstring desc(STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(CSheetId(phraseSheetId))); - if(desc.empty()) - strFindReplace(text, "%desc", ucstring()); + string desc = STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(CSheetId(phraseSheetId)); + if (desc.empty()) + strFindReplace(text, "%desc", string()); else { // append an \n before, for clearness - desc= ucstring("\n") + desc; + desc= string("\n") + desc; // append \n at end if not done if(desc[desc.size()-1]!='\n') desc+= '\n'; @@ -1311,13 +1311,13 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, } else { - strFindReplace(text, "%desc", ucstring()); + strFindReplace(text, "%desc", string()); } // **** Special .sphrase requirement if(phraseSheetId && wantRequirement) { - ucstring reqText; + string reqText; reqText= CI18N::get("uihelpPhraseRequirementHeader"); // replace the skill point cost @@ -1331,7 +1331,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, const CReqSkillFormula &formula= it->second; // from this formula, build the requirement tex - ucstring textForm; + string textForm; formula.getInfoText(textForm); reqText+= textForm; } @@ -4089,7 +4089,7 @@ bool CSPhraseManager::allowListBrickInHelp(const CSPhraseCom &phrase) const } // *************************************************************************** -void CSPhraseManager::getCombatWeaponRestriction(ucstring &text, const CSPhraseCom &phrase, bool& usableWithMelee, bool& usableWithRange) +void CSPhraseManager::getCombatWeaponRestriction(string &text, const CSPhraseCom &phrase, bool& usableWithMelee, bool& usableWithRange) { text.clear(); @@ -4165,7 +4165,7 @@ void CSPhraseManager::getCombatWeaponRestriction(ucstring &text, const CSPhra } // *************************************************************************** -void CSPhraseManager::getCombatWeaponRestriction(ucstring &text, sint32 phraseSheetId, bool& usableWithMelee, bool& usableWithRange) +void CSPhraseManager::getCombatWeaponRestriction(string &text, sint32 phraseSheetId, bool& usableWithMelee, bool& usableWithRange) { CSPhraseCom phrase; buildPhraseFromSheet(phrase, phraseSheetId); @@ -4279,7 +4279,7 @@ void CSPhraseManager::fullDeletePhraseIfLast(uint32 memoryLine, uint32 memorySl // *************************************************************************** -ucstring CSPhraseManager::getForageExtractionPhraseEcotypeFmt(const CSPhraseCom &phrase) +string CSPhraseManager::getForageExtractionPhraseEcotypeFmt(const CSPhraseCom &phrase) { CSBrickManager *pBM= CSBrickManager::getInstance(); diff --git a/ryzom/client/src/interface_v3/sphrase_manager.h b/ryzom/client/src/interface_v3/sphrase_manager.h index 03c0f1718..59150927e 100644 --- a/ryzom/client/src/interface_v3/sphrase_manager.h +++ b/ryzom/client/src/interface_v3/sphrase_manager.h @@ -338,7 +338,7 @@ public: * \specialPhraseFormat if empty, format is auto selected. if "composition", same but the text is cut under the %compostart tag. * else take directly this format. */ - void buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, uint32 phraseSheetId, bool wantRequirement, const std::string &specialPhraseFormat= std::string()); + void buildPhraseDesc(std::string &text, const CSPhraseCom &phrase, uint32 phraseSheetId, bool wantRequirement, const std::string &specialPhraseFormat= std::string()); // Get the Phrase Success Rate % sint getPhraseSuccessRate(const CSPhraseCom &phrase); // Get the Phrase Success Rate %. Manually gives the Skill to do the comparison (for craft) @@ -346,7 +346,7 @@ public: // Get the Phrase Success Rate %. Manually gives the Skill to do the comparison (for Forage Extraction) sint getForageExtractionPhraseSuccessRate(const CSPhraseCom &phrase, SKILLS::ESkills skill); // return the fmt according to forage terrain specializing - ucstring getForageExtractionPhraseEcotypeFmt(const CSPhraseCom &phrase); + std::string getForageExtractionPhraseEcotypeFmt(const CSPhraseCom &phrase); // Get the Phrase Sap Cost void getPhraseSapCost(const CSPhraseCom &phrase, uint32 totalActionMalus, sint &cost, sint &costMalus); // Get the Phrase Sta Cost @@ -370,8 +370,8 @@ public: /// true if interesting to list the bricks of this phrase in help bool allowListBrickInHelp(const CSPhraseCom &phrase) const; /// return the combat restriction text (empty if not combat) - void getCombatWeaponRestriction(ucstring &text, const CSPhraseCom &phrase, bool& usableWithMelee, bool& usableWithRange); - void getCombatWeaponRestriction(ucstring &text, sint32 phraseSheetId, bool& usableWithMelee, bool& usableWithRange); + void getCombatWeaponRestriction(std::string &text, const CSPhraseCom &phrase, bool& usableWithMelee, bool& usableWithRange); + void getCombatWeaponRestriction(std::string &text, sint32 phraseSheetId, bool& usableWithMelee, bool& usableWithRange); // return true if any of the Bricks contains AvoidCyclic==true (the phrase cannot be cyclic) bool avoidCyclicForPhrase(const CSPhraseCom &phrase) const; bool avoidCyclicForPhrase(sint32 phraseSheetId) const; @@ -693,8 +693,8 @@ private: // @} - ucstring formatMalus(sint base, sint malus); - ucstring formatMalus(float base, float malus); + std::string formatMalus(sint base, sint malus); + std::string formatMalus(float base, float malus); std::string formatBonusMalus(sint32 base, sint32 mod); // Special for combat: Build the "phrase skill compatible" formula diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index a5b94c879..e39d406ff 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -357,6 +357,7 @@ static void setPatcherProgressText(const std::string &baseUIPath, const ucstring static void updatePatchingInfoText(const std::string &baseUIPath) { CPatchManager *pPM = CPatchManager::getInstance(); +#ifdef RYZOM_BG_DOWNLOADER CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance(); if (isBGDownloadEnabled()) { @@ -380,6 +381,7 @@ static void updatePatchingInfoText(const std::string &baseUIPath) } } else +#endif { ucstring state; vector log; @@ -406,7 +408,9 @@ void loginMainLoop() CInterfaceManager *pIM = CInterfaceManager::getInstance(); CPatchManager *pPM = CPatchManager::getInstance(); +#ifdef RYZOM_BG_DOWNLOADER CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance(); +#endif bool windowBlinkDone = false; bool fatalMessageBoxShown = false; @@ -464,11 +468,13 @@ void loginMainLoop() BGDownloader::TTaskResult taskResult = BGDownloader::TaskResult_Unknown; bool finished = false; ucstring bgDownloaderError; +#ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) { finished = bgDownloader.isTaskEnded(taskResult, bgDownloaderError); } else +#endif { finished = pPM->isCheckThreadEnded(res); } @@ -478,6 +484,7 @@ void loginMainLoop() setPatcherStateText("ui:login:checking", ucstring()); setPatcherProgressText("ui:login:checking", ucstring()); +#ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) { AvailablePatchs = bgDownloader.getAvailablePatchs(); @@ -529,6 +536,7 @@ void loginMainLoop() } else +#endif { if(res) { @@ -642,7 +650,7 @@ void loginMainLoop() int currentPatchingSize; int totalPatchSize; - +#ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) { currentPatchingSize = bgDownloader.getPatchingSize(); @@ -683,6 +691,7 @@ void loginMainLoop() } } else +#endif { totalPatchSize = TotalPatchSize; currentPatchingSize = pPM->getPatchingSize(); @@ -1130,18 +1139,22 @@ void initPatchCheck() LoginShardId = Shards[ShardSelected].ShardId; } +#ifdef RYZOM_BG_DOWNLOADER if (!isBGDownloadEnabled()) +#endif { getPatchParameters(url, ver, patchURIs); pPM->init(patchURIs, url, ver); pPM->startCheckThread(true /* include background patchs */); } +#ifdef RYZOM_BG_DOWNLOADER else { BGDownloader::CTaskDesc taskDesc(BGDownloader::DLState_CheckPatch); CBGDownloaderAccess::getInstance().requestDownloadThreadPriority(BGDownloader::ThreadPriority_Normal, false); CBGDownloaderAccess::getInstance().startTask(taskDesc, getBGDownloaderCommandLine(), true /* showDownloader */); } +#endif NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKING); setPatcherStateText("ui:login:checking", ucstring()); @@ -1650,8 +1663,9 @@ void initPatch() CInterfaceManager *pIM = CInterfaceManager::getInstance(); CPatchManager *pPM = CPatchManager::getInstance(); - +#ifdef RYZOM_BG_DOWNLOADER if (!isBGDownloadEnabled()) +#endif { // Get the list of optional categories to patch vector vCategories; @@ -1686,6 +1700,7 @@ void initPatch() } pPM->startPatchThread(vCategories, true); } +#ifdef RYZOM_BG_DOWNLOADER else { // NB : here we only do a part of the download each time @@ -1695,6 +1710,7 @@ void initPatch() NLMISC::CBigFile::getInstance().removeAll(); NLMISC::CStreamedPackageManager::getInstance().unloadAll(); } +#endif NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_PATCHING); CInterfaceElement *closeBtn = CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_CLOSE_PATCH); @@ -1840,11 +1856,13 @@ class CAHReboot : public IActionHandler CInterfaceManager *im = CInterfaceManager::getInstance(); try { +#ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) { CBGDownloaderAccess::getInstance().reboot(); } else +#endif { CPatchManager::getInstance()->reboot(); } diff --git a/ryzom/client/src/main_loop.cpp b/ryzom/client/src/main_loop.cpp index 299972b15..bab17a7b6 100644 --- a/ryzom/client/src/main_loop.cpp +++ b/ryzom/client/src/main_loop.cpp @@ -1100,6 +1100,7 @@ bool mainLoop() // Start Bench H_AUTO_USE ( RZ_Client_Main_Loop ) +#ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) { CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance(); @@ -1110,6 +1111,7 @@ bool mainLoop() unpauseBGDownloader(); } } +#endif FPU_CHECKER_ONCE @@ -1281,7 +1283,9 @@ bool mainLoop() // Get Mouse Position. OldMouseX = MouseX; OldMouseY = MouseY; +#ifdef RYZOM_BG_DOWNLOADER updateBGDownloaderUI(); +#endif } // Get the pointer pos diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index d412fa7c8..c06389f0c 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -404,7 +404,7 @@ void impulseUserChars(NLMISC::CBitMemStream &impulse) // if there's a new char for which a key set was wanted, create it now for (uint k = 0; k < CharacterSummaries.size(); ++k) { - if (toLower(CharacterSummaries[k].Name) == toLower(NewKeysCharNameValidated)) + if (toLower(CharacterSummaries[k].Name.toUtf8()) == toLower(NewKeysCharNameValidated)) { // first, stripes server name copyKeySet(lookupSrcKeyFile(GameKeySet), "save/keys_" + buildPlayerNameForSaveFile(NewKeysCharNameValidated) + ".xml"); @@ -1582,8 +1582,8 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason) R2::TTeleportContext tpContext = R2::TPContext_Unknown; - ucstring tpReason; - ucstring tpCancelText; + string tpReason; + string tpCancelText; try { @@ -1597,14 +1597,14 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason) uint32 size = (uint32)tpInfos.TpReasonParams.size(); uint32 first = 0; - CSString str(tpReason.toString()); + CSString str(tpReason); for (;first != size ; ++first) { std::string value = tpInfos.TpReasonParams[first]; std::string key = NLMISC::toString("%%%u", first +1); str = str.replace( key.c_str(), value.c_str()); } - tpReason = ucstring(str); + tpReason = string(str); tpCancelText = CI18N::get(tpInfos.TpCancelTextId); tpContext = tpInfos.TpContext; } @@ -1612,16 +1612,16 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason) } catch (const EStream &) { - tpReason = ucstring("TP Reason"); - tpCancelText = ucstring("Cancel TP"); // for test + tpReason = "TP Reason"; + tpCancelText = "Cancel TP"; // for test // try to deduce tp context from current editor mode switch (R2::getEditor().getMode()) { case R2::CEditor::EditionMode: case R2::CEditor::NotInitialized: tpContext = R2::TPContext_Unknown; - tpReason = ucstring(); - tpCancelText = ucstring(); + tpReason = string(); + tpCancelText = string(); break; case R2::CEditor::GoingToDMMode: case R2::CEditor::TestMode: @@ -1667,7 +1667,7 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason) //InitMouseWithCursor(oldHardwareCursor); // reset 'cancel' button - ProgressBar.setTPMessages(ucstring(), ucstring(), ""); + ProgressBar.setTPMessages(string(), string(), ""); // ProgressBar.enableQuitButton(false); // TMP TMP diff --git a/ryzom/client/src/progress.cpp b/ryzom/client/src/progress.cpp index c27e285e1..534ae46e9 100644 --- a/ryzom/client/src/progress.cpp +++ b/ryzom/client/src/progress.cpp @@ -71,7 +71,7 @@ void CProgress::setFontFactor(float temp) _FontFactor = temp; } -void CProgress::newMessage (const ucstring& message) +void CProgress::newMessage (const string& message) { popCropedValues (); _CurrentRootStep++; @@ -249,7 +249,7 @@ void CProgress::internalProgress (float value) for(uint i = 0; i < ClientCfg.Logos.size(); i++) { std::vector res; - explode(ClientCfg.Logos[i], std::string(":"), res); + explode(ClientCfg.Logos[i], string(":"), res); if(res.size()==9 && isetFontSize((uint)(15.f * fontFactor)); TextContext->setHotSpot(UTextContext::BottomLeft); - string uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText.toUtf8() + ") - " + CI18N::get("uiDelayedTPCancel"); + string uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText + ") - " + CI18N::get("uiDelayedTPCancel"); UTextContext::CStringInfo info = TextContext->getStringInfo(uc); float stringX = 0.5f - info.StringWidth/(ClientCfg.Width*2); TextContext->printAt(stringX, 7.f / ClientCfg.Height, uc); @@ -452,8 +452,9 @@ void CProgress::internalProgress (float value) _TPCancelFlag = true; } - +#ifdef RYZOM_BG_DOWNLOADER CBGDownloaderAccess::getInstance().update(); +#endif // Display to screen. Driver->swapBuffers(); @@ -474,7 +475,7 @@ void CProgress::internalProgress (float value) } -void CProgress::setTPMessages(const ucstring &tpReason,const ucstring &tpCancelText, const std::string &/* iconName */) +void CProgress::setTPMessages(const string &tpReason,const string &tpCancelText, const string &/* iconName */) { _TPReason = tpReason; _TPCancelText = tpCancelText; @@ -497,7 +498,7 @@ bool CProgress::getTPCancelFlag(bool clearFlag /*=true*/) void CProgress::release() { - setTPMessages(ucstring(), ucstring(), ""); + setTPMessages(string(), string(), string()); _TPCancelFlag = false; } diff --git a/ryzom/client/src/progress.h b/ryzom/client/src/progress.h index 2d50b573f..ee9495028 100644 --- a/ryzom/client/src/progress.h +++ b/ryzom/client/src/progress.h @@ -64,7 +64,7 @@ public: void finish (); // New message - void newMessage (const ucstring& message); + void newMessage (const std::string& message); void setFontFactor(float f); @@ -72,7 +72,7 @@ public: bool ApplyTextCommands; // Set teleport specific message - void setTPMessages(const ucstring &tpReason, const ucstring &tpCancelText, const std::string &iconName); + void setTPMessages(const std::string &tpReason, const std::string &tpCancelText, const std::string &iconName); bool getTPCancelFlag(bool clearFlag = true); @@ -83,7 +83,7 @@ private: // Display a text to describe what is the application going to do. // this function can be call even if texture is NULL, driver or textcontext not initialised - ucstring _ProgressMessage; + std::string _ProgressMessage; // Time since last update sint64 _LastUpdate; @@ -92,8 +92,8 @@ private: uint _CurrentRootStep; uint _RootStepCount; - ucstring _TPReason; - ucstring _TPCancelText; + std::string _TPReason; + std::string _TPCancelText; bool _TPCancelFlag; diff --git a/ryzom/client/src/release.cpp b/ryzom/client/src/release.cpp index 7a7cc91eb..bcbf7259f 100644 --- a/ryzom/client/src/release.cpp +++ b/ryzom/client/src/release.cpp @@ -489,7 +489,9 @@ void releaseMainLoop(bool closeConnection) // Called when Quit from OutGame void releaseOutGame() { +#ifdef RYZOM_BG_DOWNLOADER CBGDownloaderAccess::getInstance().release(); +#endif ProgressBar.release(); @@ -571,7 +573,9 @@ void release() CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_GameExit, "login_step_game_exit&play_time=" + toString((NLMISC::CTime::getLocalTime() - StartPlayTime) / 1000))); } +#ifdef RYZOM_BG_DOWNLOADER CBGDownloaderAccess::getInstance().release(); +#endif ProgressBar.release(); diff --git a/ryzom/common/src/game_share/character_summary.h b/ryzom/common/src/game_share/character_summary.h index 34b0f2a86..4397d1146 100644 --- a/ryzom/common/src/game_share/character_summary.h +++ b/ryzom/common/src/game_share/character_summary.h @@ -54,7 +54,7 @@ struct CCharacterSummary TSessionId Mainland; /// name - ucstring Name; + ucstring Name; // TODO: UTF-8 (serial) /// Localisation uint32 Location; diff --git a/ryzom/common/src/game_share/item_infos.h b/ryzom/common/src/game_share/item_infos.h index 1cb32ae41..1a0746f3b 100644 --- a/ryzom/common/src/game_share/item_infos.h +++ b/ryzom/common/src/game_share/item_infos.h @@ -136,9 +136,9 @@ public: CSPhraseCom Enchantment; float WearEquipmentMalus; // Malus for wearing this equipment (malus is used when execute an magic, forage action, craft action...), malus is only applicable for weapon and armor pieces - ucstring CustomText; - ucstring R2ItemDescription; - ucstring R2ItemComment; + ucstring CustomText; // TODO: UTF-8 (serial) + ucstring R2ItemDescription; // TODO: UTF-8 (serial) + ucstring R2ItemComment; // TODO: UTF-8 (serial) uint8 PetNumber; // 1 based pet index //@} }; diff --git a/ryzom/common/src/game_share/mainland_summary.h b/ryzom/common/src/game_share/mainland_summary.h index 81c001caa..98f73439a 100644 --- a/ryzom/common/src/game_share/mainland_summary.h +++ b/ryzom/common/src/game_share/mainland_summary.h @@ -41,10 +41,10 @@ struct CMainlandSummary TSessionId Id; /// description - ucstring Name; + ucstring Name; // TODO: UTF-8 (serial) /// description - ucstring Description; + ucstring Description; // TODO: UTF-8 (serial) /// language code std::string LanguageCode; diff --git a/ryzom/common/src/game_share/msg_client_server.h b/ryzom/common/src/game_share/msg_client_server.h index c66e7856a..ce942291e 100644 --- a/ryzom/common/src/game_share/msg_client_server.h +++ b/ryzom/common/src/game_share/msg_client_server.h @@ -88,7 +88,7 @@ public: class CCheckNameMsg { public: - ucstring Name; + ucstring Name; // TODO: UTF-8 (serial) TSessionId HomeSessionId; void serialBitMemStream(NLMISC::CBitMemStream &f) diff --git a/ryzom/common/src/game_share/sphrase_com.h b/ryzom/common/src/game_share/sphrase_com.h index 476034b2f..dd2c053ae 100644 --- a/ryzom/common/src/game_share/sphrase_com.h +++ b/ryzom/common/src/game_share/sphrase_com.h @@ -63,7 +63,7 @@ public: std::vector Bricks; // Name Of the Phrase. Saved on server, read on client. - ucstring Name; + ucstring Name; // FIXME: UTF-8 (serial) /// The comparison is made only on Bricks bool operator==(const CSPhraseCom &p) const;