From 14a0c5d471d1facf279a43be2d0661015182f5c0 Mon Sep 17 00:00:00 2001 From: Xtarsia <69606701+Xtarsia@users.noreply.github.com> Date: Sat, 22 Aug 2020 22:46:24 +0100 Subject: [PATCH 001/205] Update inventory.xml Remove Special items from inventory. --- .../data/gamedev/interfaces_v3/inventory.xml | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/ryzom/client/data/gamedev/interfaces_v3/inventory.xml b/ryzom/client/data/gamedev/interfaces_v3/inventory.xml index 9d59a3ea0..22b6ad7ed 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/inventory.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/inventory.xml @@ -23,16 +23,6 @@ - - - - - - - - - - @@ -122,7 +112,6 @@ @@ -272,19 +260,6 @@ - - - - - - - - - - - - From e3ec67a69809561152d9bed30668e12f18dab732 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 22 Oct 2020 06:14:46 +0800 Subject: [PATCH 002/205] Disable R2 MD5 check, it's useless now, fix kaetemi/ryzomclassic#147 --- ryzom/client/client_default.cfg | 2 +- ryzom/client/src/client_cfg.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ryzom/client/client_default.cfg b/ryzom/client/client_default.cfg index 3241fdae1..82709677a 100644 --- a/ryzom/client/client_default.cfg +++ b/ryzom/client/client_default.cfg @@ -466,7 +466,7 @@ R2EDExtendedDebug = 0; R2EDLightPalette = 0; R2ClientGw = "r2linux01"; LoadLuaDebugger = 0; -CheckR2ScenarioMD5 = 1; +CheckR2ScenarioMD5 = 0; LevelDesignEnabled = 0; DmCameraDistMax = 25; diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index 011efb01e..e12f8f1e8 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -721,7 +721,7 @@ CClientConfig::CClientConfig() R2EDLoadDynamicFeatures = 0; - CheckR2ScenarioMD5 = true; + CheckR2ScenarioMD5 = false; DisplayTPReason = false; From 4a7a153a3edc7ebdb40cf3066852dfb07618d2ce Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 22 Oct 2020 08:00:38 +0800 Subject: [PATCH 003/205] Disable check for OtherCharAccess if CheckR2ScenarioMD5 is false, kaetemi/ryzomclassic#151 --- ryzom/client/src/r2/dmc/client_edition_module.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/src/r2/dmc/client_edition_module.cpp b/ryzom/client/src/r2/dmc/client_edition_module.cpp index f58a9f669..5f7aa9a43 100644 --- a/ryzom/client/src/r2/dmc/client_edition_module.cpp +++ b/ryzom/client/src/r2/dmc/client_edition_module.cpp @@ -2455,7 +2455,7 @@ void CClientEditionModule::loadScenarioSucceded(const std::string& filename, con } - if (!modifiedByMD5.empty() && !locked.empty() && locked == "RunOnly") + if (ClientCfg.CheckR2ScenarioMD5 && !modifiedByMD5.empty() && !locked.empty() && locked == "RunOnly") { bool ok = hasCharacterSameCharacterIdMd5(modifiedByMD5); if (!ok) From ccb141672f32348593c6f6654d6ea5c2952ce64f Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 22 Oct 2020 20:23:18 +0800 Subject: [PATCH 004/205] Avoid some unnecessary string operations when not recording history, cleanup, debug crash in `fullName` kaetemi/ryzomclassic#152 --- ryzom/server/src/ai_service/debug_history.h | 25 ++++++++++---------- ryzom/server/src/ai_service/state_instance.h | 16 +++++++++---- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/ryzom/server/src/ai_service/debug_history.h b/ryzom/server/src/ai_service/debug_history.h index e5553bae1..a86763484 100644 --- a/ryzom/server/src/ai_service/debug_history.h +++ b/ryzom/server/src/ai_service/debug_history.h @@ -23,36 +23,37 @@ private: typedef std::deque THistoryContainer; public: explicit CDebugHistory() - : _Recording(false) + : m_Recording(false) { } virtual ~CDebugHistory() { } void addHistory(std::string const& txt) { - if (_Recording) - _History.push_back(txt); + if (m_Recording) + m_History.push_back(txt); } void addHistory(char const* txt) { - if (_Recording) + if (m_Recording) addHistory(NLMISC::toString(txt)); } template - void addHistory(char const* txt, A a) { if (_Recording) addHistory(NLMISC::toString(txt, a)); } + void addHistory(char const* txt, A a) { if (m_Recording) addHistory(NLMISC::toString(txt, a)); } template - void addHistory(char const* txt, A a, B b) { if (_Recording) addHistory(NLMISC::toString(txt, a, b)); } + void addHistory(char const* txt, A a, B b) { if (m_Recording) addHistory(NLMISC::toString(txt, a, b)); } template - void addHistory(char const* txt, A a, B b, C c) { if (_Recording) addHistory(NLMISC::toString(txt, a, b, c)); } + void addHistory(char const* txt, A a, B b, C c) { if (m_Recording) addHistory(NLMISC::toString(txt, a, b, c)); } template - void addHistory(char const* txt, A a, B b, C c, D d) { if (_Recording) addHistory(NLMISC::toString(txt, a, b, c, d)); } + void addHistory(char const* txt, A a, B b, C c, D d) { if (m_Recording) addHistory(NLMISC::toString(txt, a, b, c, d)); } - void setRecording(bool val) { _Recording = val; } + void setRecording(bool val) { m_Recording = val; } + inline bool isRecording() { return m_Recording; } void writeAsInfo() { int j = 0; - FOREACH(itHistory, THistoryContainer, _History) + FOREACH(itHistory, THistoryContainer, m_History) { nlinfo("HIST %3i: %s", j, itHistory->c_str()); ++j; @@ -60,8 +61,8 @@ public: } private: - bool _Recording; - THistoryContainer _History; + bool m_Recording; + THistoryContainer m_History; }; #endif diff --git a/ryzom/server/src/ai_service/state_instance.h b/ryzom/server/src/ai_service/state_instance.h index 916b6bc47..cdb13f391 100644 --- a/ryzom/server/src/ai_service/state_instance.h +++ b/ryzom/server/src/ai_service/state_instance.h @@ -503,18 +503,23 @@ void CStateInstance::processStateEvent(CAIEvent const& stateEvent, CAIState cons if (!reaction.testCompatibility(this,state)) continue; - getDebugHistory()->addHistory("STATE: '%s' EVENT: '%s' REACTION: '%s'", state->getAliasNode()->fullName().c_str(), - stateEvent.getName().c_str(), reaction.getAliasNode()->fullName().c_str()); + if (getDebugHistory()->isRecording()) + { + getDebugHistory()->addHistory("STATE: '%s' EVENT: '%s' REACTION: '%s'", state->getAliasNode()->fullName().c_str(), + stateEvent.getName().c_str(), reaction.getAliasNode()->fullName().c_str()); + } foundReaction=true; if (!reaction.getAction()) { + nldebug("Failed to find action for event"); nlwarning("Failed to find action for event: %s",reaction.getAliasNode()->fullName().c_str()); continue; } if (!reaction.getAction()->executeAction(this, NULL)) { + nldebug("Failed to execute action for event"); nlwarning("Failed to execute action for event '%s': for stateInstance:'%s' in state:'%s'", stateEvent.getName().c_str(), aliasTreeOwner()->getAliasNode()->fullName().c_str(), state->getAliasNode()->fullName().c_str()); continue; @@ -523,8 +528,11 @@ void CStateInstance::processStateEvent(CAIEvent const& stateEvent, CAIState cons } if (!foundReaction) { - getDebugHistory()->addHistory("STATE: '%s' EVENT: '%s' NO REACTION", state->getAliasNode()->fullName().c_str(), - stateEvent.getName().c_str()); + if (getDebugHistory()->isRecording()) + { + getDebugHistory()->addHistory("STATE: '%s' EVENT: '%s' NO REACTION", state->getAliasNode()->fullName().c_str(), + stateEvent.getName().c_str()); + } } } From c71f516ed2249761a3fdafb1a096050ecdf1473a Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 22 Oct 2020 20:25:49 +0800 Subject: [PATCH 005/205] Avoid more useless `fullName` calls, kaetemi/ryzomclassic#152 --- .../src/ai_service/generic_logic_action.cpp | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/ryzom/server/src/ai_service/generic_logic_action.cpp b/ryzom/server/src/ai_service/generic_logic_action.cpp index 30edfb460..947da6400 100644 --- a/ryzom/server/src/ai_service/generic_logic_action.cpp +++ b/ryzom/server/src/ai_service/generic_logic_action.cpp @@ -131,9 +131,12 @@ public: nlassert(randVal<=_weights[i]); // "BUG: Random value outside random range!" #endif - entity->getDebugHistory()->addHistory("GRP State Change: %s => %s", - entity->getState()->getAliasNode()->fullName().c_str(), - _states[i]->getAliasNode()->fullName().c_str()); + if (entity->getDebugHistory()->isRecording()) + { + entity->getDebugHistory()->addHistory("GRP State Change: %s => %s", + entity->getState()->getAliasNode()->fullName().c_str(), + _states[i]->getAliasNode()->fullName().c_str()); + } entity->setNextState(_states[i]); return true; @@ -198,9 +201,12 @@ public: } uint i=CAIS::rand16((uint32)_states.size()); - entity->getDebugHistory()->addHistory("GRP State Change: %s => %s", - entity->getState()->getAliasNode()->fullName().c_str(), - _states[i]->getAliasNode()->fullName().c_str()); + if (entity->getDebugHistory()->isRecording()) + { + entity->getDebugHistory()->addHistory("GRP State Change: %s => %s", + entity->getState()->getAliasNode()->fullName().c_str(), + _states[i]->getAliasNode()->fullName().c_str()); + } entity->setNextState(_states[i]); return true; @@ -514,9 +520,12 @@ public: nlwarning("begin_punctual_state failed because state list is empty"); return false; } - entity->setNextPunctualState(_states[CAIS::rand16((uint32)_states.size())]); - entity->getDebugHistory()->addHistory("GRP BeginPunctual State: %s", - entity->getNextPunctualState()->getAliasNode()->fullName().c_str()); + entity->setNextPunctualState(_states[CAIS::rand16((uint32)_states.size())]); + if (entity->getDebugHistory()->isRecording()) + { + entity->getDebugHistory()->addHistory("GRP BeginPunctual State: %s", + entity->getNextPunctualState()->getAliasNode()->fullName().c_str()); + } return true; } @@ -548,8 +557,11 @@ public: // depending on the whim of the level designers virtual bool executeAction(CStateInstance *entity,const IAIEvent *event) { - entity->getDebugHistory()->addHistory("GRP End Punctual State: %s", - entity->getPunctualState()->getAliasNode()->fullName().c_str()); + if (entity->getDebugHistory()->isRecording()) + { + entity->getDebugHistory()->addHistory("GRP End Punctual State: %s", + entity->getPunctualState()->getAliasNode()->fullName().c_str()); + } entity->cancelPunctualState(); return true; From 6853098df996d4b3a7ccb23a371b2ccd782e113f Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 22 Oct 2020 20:34:06 +0800 Subject: [PATCH 006/205] Additional debugging, kaetemi/ryzomclassic#152 --- ryzom/server/src/ai_service/ai_outpost.cpp | 1 + ryzom/server/src/ai_service/state_instance.h | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ryzom/server/src/ai_service/ai_outpost.cpp b/ryzom/server/src/ai_service/ai_outpost.cpp index 43994c245..eb3a7661e 100644 --- a/ryzom/server/src/ai_service/ai_outpost.cpp +++ b/ryzom/server/src/ai_service/ai_outpost.cpp @@ -880,6 +880,7 @@ void COutpost::createSquad(CGroupDesc const* groupDesc, COu grp->_UpdateNbTicks = 10; grp->respawnTime() = respawTimeGC; + grp->getDebugHistory()->setRecording(true); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 grp->updateStateInstance(); // Directly call his first state (to retrieve associated params). if (createOrder!=0) diff --git a/ryzom/server/src/ai_service/state_instance.h b/ryzom/server/src/ai_service/state_instance.h index cdb13f391..8f472702b 100644 --- a/ryzom/server/src/ai_service/state_instance.h +++ b/ryzom/server/src/ai_service/state_instance.h @@ -505,6 +505,7 @@ void CStateInstance::processStateEvent(CAIEvent const& stateEvent, CAIState cons if (getDebugHistory()->isRecording()) { + nldebug("Reaction for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 getDebugHistory()->addHistory("STATE: '%s' EVENT: '%s' REACTION: '%s'", state->getAliasNode()->fullName().c_str(), stateEvent.getName().c_str(), reaction.getAliasNode()->fullName().c_str()); } @@ -513,13 +514,13 @@ void CStateInstance::processStateEvent(CAIEvent const& stateEvent, CAIState cons if (!reaction.getAction()) { - nldebug("Failed to find action for event"); + nldebug("Failed to find action for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 nlwarning("Failed to find action for event: %s",reaction.getAliasNode()->fullName().c_str()); continue; } if (!reaction.getAction()->executeAction(this, NULL)) { - nldebug("Failed to execute action for event"); + nldebug("Failed to execute action for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 nlwarning("Failed to execute action for event '%s': for stateInstance:'%s' in state:'%s'", stateEvent.getName().c_str(), aliasTreeOwner()->getAliasNode()->fullName().c_str(), state->getAliasNode()->fullName().c_str()); continue; @@ -530,6 +531,7 @@ void CStateInstance::processStateEvent(CAIEvent const& stateEvent, CAIState cons { if (getDebugHistory()->isRecording()) { + nldebug("No reaction for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 getDebugHistory()->addHistory("STATE: '%s' EVENT: '%s' NO REACTION", state->getAliasNode()->fullName().c_str(), stateEvent.getName().c_str()); } From 2859693c1e30cb1ff418eb95c071551080f3b3b9 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 22 Oct 2020 20:56:07 +0800 Subject: [PATCH 007/205] Remove OtherCharAccess toggle from Scenario window when MD5 checks are disabled, close kaetemi/ryzomclassic#151 --- nel/include/nel/gui/interface_element.h | 4 +++- nel/src/gui/interface_element.cpp | 8 ++++++++ ryzom/common/data_common/r2/r2_ui_scenario.lua | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/nel/include/nel/gui/interface_element.h b/nel/include/nel/gui/interface_element.h index 47025f155..60f6ae7b8 100644 --- a/nel/include/nel/gui/interface_element.h +++ b/nel/include/nel/gui/interface_element.h @@ -382,7 +382,6 @@ namespace NLGUI void dummySet(const std::string &value); public: - // export some properties REFLECT_EXPORT_START(CInterfaceElement, CReflectable) REFLECT_BOOL ("active", getActive, setActive); @@ -397,6 +396,7 @@ namespace NLGUI REFLECT_SINT32 ("h_real", getHReal, dummySet); REFLECT_STRING ("id", getIdByValue, dummySet); REFLECT_STRING ("sizeref", getSizeRefAsString, setSizeRef); + REFLECT_STRING ("posparent", getPosParent, setPosParent); REFLECT_LUA_METHOD("updateCoords", luaUpdateCoords); REFLECT_LUA_METHOD("invalidateCoords", luaInvalidateCoords); REFLECT_LUA_METHOD("invalidateContent", luaInvalidateContent); @@ -523,6 +523,8 @@ namespace NLGUI void parseSizeParent( const std::string &id ); void setSizeParent( const std::string &id ); void getSizeParent( std::string &id ) const; + + std::string getPosParent() const; void setSerializable( bool b ){ serializable = b; } bool IsSerializable() const{ return serializable; } diff --git a/nel/src/gui/interface_element.cpp b/nel/src/gui/interface_element.cpp index cf5646077..4d21555e7 100644 --- a/nel/src/gui/interface_element.cpp +++ b/nel/src/gui/interface_element.cpp @@ -437,6 +437,14 @@ namespace NLGUI parseSizeRef(sizeref.c_str()); } + // ------------------------------------------------------------------------------------------------ + std::string CInterfaceElement::getPosParent() const + { + std::string id; + getPosParent(id); + return id; + } + // ------------------------------------------------------------------------------------------------ std::string CInterfaceElement::getSizeRefAsString() const { diff --git a/ryzom/common/data_common/r2/r2_ui_scenario.lua b/ryzom/common/data_common/r2/r2_ui_scenario.lua index d627ab7b7..5a925d9a4 100644 --- a/ryzom/common/data_common/r2/r2_ui_scenario.lua +++ b/ryzom/common/data_common/r2/r2_ui_scenario.lua @@ -78,6 +78,13 @@ function r2.ScenarioWindow:initScenarioWindow() for k, type in pairs(tmp) do lockCB:addText(type) end + + if config.CheckR2ScenarioMD5 == 0 then + local lockGrp = scenarioWnd:find("locked") + local titleGrp = scenarioWnd:find("title") + lockGrp.active = false -- Hide lock group + titleGrp.posparent = lockGrp.posparent -- Rearrange + end end From b4dc60f1632121ff4b96012bdc77146d8cd306af Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 23 Oct 2020 00:19:07 +0800 Subject: [PATCH 008/205] Fix double undo stack actions, kaetemi/ryzomclassic#87 --- .../data_common/r2/r2_features_default.lua | 4 ++-- .../data_common/r2/r2_ui_displayer_npc.lua | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ryzom/common/data_common/r2/r2_features_default.lua b/ryzom/common/data_common/r2/r2_features_default.lua index d94e2f656..44afdc6c2 100644 --- a/ryzom/common/data_common/r2/r2_features_default.lua +++ b/ryzom/common/data_common/r2/r2_features_default.lua @@ -405,7 +405,7 @@ local registerFeature = function () {Name="Aggro", Type="Number", Min="0", Max="120", DefaultValue="30", DefaultInBase=1, Visible=function(this) return this:isGroupedAndLeader() or not this:isGrouped() and not this:isBotObject() end }, - {Name="TypeNPC", Type="Number", WidgetStyle="EnumDropDown", SecondRequestFunc=r2.updateType, + {Name="TypeNPC", Type="Number", WidgetStyle="EnumDropDown", SecondRequestFunc=function(value) r2:updateType(true) end, Enum= {}, Visible=true, DefaultValue="-1", }, @@ -858,7 +858,7 @@ local registerFeature = function () Visible=true }, {Name="Level", Type="Number", WidgetStyle="EnumDropDown", Category="uiR2EDRollout_NpcCustom", - Enum= { "uiR2EDLowLevel", "uiR2EDAverageLevel", "uiR2EDHighLevel", "uiR2EDVeryHighLevel"}, SecondRequestFunc=r2.updateLevel, + Enum= { "uiR2EDLowLevel", "uiR2EDAverageLevel", "uiR2EDHighLevel", "uiR2EDVeryHighLevel"}, SecondRequestFunc=function(value) r2.updateLevel(value, true) end, Visible=function(this) return this:isGroupedAndLeader() or not this:isGrouped() and not this:isBotObject() end }, }, diff --git a/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua b/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua index 0f625e24e..2d0bbb70a 100644 --- a/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua +++ b/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua @@ -401,7 +401,8 @@ function r2:initTypeUI(instance) if tostring(instance.TypeNPC)=="-1" then -- TypeNPC - r2:setNpcAttribute(instance.InstanceId, "TypeNPC", place) + debugInfo("FIXME: TypeNPC is not initialized, it should be a local value only as it's a convenience switch, verify against older versions"); + r2.requestSetGhostNode(instance.InstanceId, "TypeNPC", place) end end end @@ -1245,7 +1246,7 @@ function r2:updateSex() end -- UPDATE SEX --------------------------------------------------------------------------------- -function r2:updateType() +function r2:updateType(existingAction) local selection = r2:getSelectedInstance() if selection == nil then return end @@ -1256,7 +1257,9 @@ function r2:updateType() local base = r2.sheetTypeCB[typeNPC].Id local typeElement = r2.getPaletteElement(base) - r2.requestNewAction(i18n.get("uiR2EDUpdateNpcTypeAction")) + if not existingAction then + r2.requestNewAction(i18n.get("uiR2EDUpdateNpcTypeAction")) + end -- TypeNPC r2:setNpcAttribute(selection.InstanceId, "TypeNPC", typeNPC) @@ -1350,7 +1353,9 @@ function r2:updateType() end end - r2.requestEndAction() + if not existingAction then + r2.requestEndAction() + end end -- UPDATE FUCNTION ---------------------------------------------------------------------------- @@ -1368,7 +1373,7 @@ function r2:updateFunction() end -- UPDATE LEVEL ------------------------------------------------------------------------------ -r2.updateLevel = function(value) +r2.updateLevel = function(value, existingAction) local selection = r2:getSelectedInstance() assert(selection) @@ -1380,7 +1385,9 @@ r2.updateLevel = function(value) local firstPart = string.sub(sheet, 1, s-2) local newSheet = firstPart .. level .. ".creature" - r2.requestNewAction(i18n.get("uiR2EDUpdateNpcLevelAction")) + if not existingAction then + r2.requestNewAction(i18n.get("uiR2EDUpdateNpcLevelAction")) + end r2:setNpcAttribute(selection.InstanceId, "Sheet", newSheet) end From f5553dfb59b9a3076c2d39b8c4355ae11aa6cb05 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 23 Oct 2020 00:38:22 +0800 Subject: [PATCH 009/205] Better handling of TypeNPC initialization, kaetemi/ryzomclassic#87 --- ryzom/common/data_common/r2/r2_ui_displayer_npc.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua b/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua index 2d0bbb70a..cc4b12c33 100644 --- a/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua +++ b/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua @@ -399,9 +399,9 @@ function r2:initTypeUI(instance) end end - if tostring(instance.TypeNPC)=="-1" then - -- TypeNPC - debugInfo("FIXME: TypeNPC is not initialized, it should be a local value only as it's a convenience switch, verify against older versions"); + if instance.TypeNPC != place then + -- TypeNPC does not remain valid between versions, it actually shouldn't be saved... + debugInfo("Initialize or update TypeNPC"); r2.requestSetGhostNode(instance.InstanceId, "TypeNPC", place) end end From a51597cf0ba59f8464bf8f2f0507a645e0efcfe1 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 23 Oct 2020 00:54:24 +0800 Subject: [PATCH 010/205] Typo, kaetemi/ryzomclassic#87 --- ryzom/common/data_common/r2/r2_ui_displayer_npc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua b/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua index cc4b12c33..43b549b72 100644 --- a/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua +++ b/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua @@ -399,7 +399,7 @@ function r2:initTypeUI(instance) end end - if instance.TypeNPC != place then + if instance.TypeNPC ~= place then -- TypeNPC does not remain valid between versions, it actually shouldn't be saved... debugInfo("Initialize or update TypeNPC"); r2.requestSetGhostNode(instance.InstanceId, "TypeNPC", place) From 91a44fd5b5ff6e5f73b6a9bc3f4683f9e6fe1819 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 23 Oct 2020 03:32:55 +0800 Subject: [PATCH 011/205] Disable TypeNPC for now, kaetemi/ryzomclassic#154 --- ryzom/common/data_common/r2/r2_features_default.lua | 8 +++++--- ryzom/common/data_common/r2/r2_ui_displayer_npc.lua | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ryzom/common/data_common/r2/r2_features_default.lua b/ryzom/common/data_common/r2/r2_features_default.lua index 44afdc6c2..e1de396d2 100644 --- a/ryzom/common/data_common/r2/r2_features_default.lua +++ b/ryzom/common/data_common/r2/r2_features_default.lua @@ -405,9 +405,11 @@ local registerFeature = function () {Name="Aggro", Type="Number", Min="0", Max="120", DefaultValue="30", DefaultInBase=1, Visible=function(this) return this:isGroupedAndLeader() or not this:isGrouped() and not this:isBotObject() end }, - {Name="TypeNPC", Type="Number", WidgetStyle="EnumDropDown", SecondRequestFunc=function(value) r2:updateType(true) end, - Enum= {}, Visible=true, DefaultValue="-1", - }, + + -- FIXME: https://github.com/kaetemi/ryzomclassic/issues/154 + --{Name="TypeNPC", Type="Number", WidgetStyle="EnumDropDown", SecondRequestFunc=function(value) r2:updateType(true) end, + -- Enum= {}, Visible=true, DefaultValue="-1", + --}, -- -- diff --git a/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua b/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua index 43b549b72..5bc08e502 100644 --- a/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua +++ b/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua @@ -692,7 +692,8 @@ function npcPropertySheetDisplayerTable:onSelect(instance, isSelected) r2:activeLogicEntityPropertySheetDisplayer():onSelect(instance, isSelected) - r2:initTypeUI(instance) + -- FIXME: https://github.com/kaetemi/ryzomclassic/issues/154 + -- r2:initTypeUI(instance) end ------------------------------------------------ @@ -1262,7 +1263,8 @@ function r2:updateType(existingAction) end -- TypeNPC - r2:setNpcAttribute(selection.InstanceId, "TypeNPC", typeNPC) + -- FIXME: https://github.com/kaetemi/ryzomclassic/issues/154 + -- r2:setNpcAttribute(selection.InstanceId, "TypeNPC", typeNPC) -- RingAccess r2:setNpcAttribute(selection.InstanceId, "RingAccess", typeElement.RingAccess) From 5056d3a72a063e1fd120efe9185c97e2ade4e88a Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 23 Oct 2020 03:39:06 +0800 Subject: [PATCH 012/205] Disable CustomNpc Level prop for now, kaetemi/ryzomclassic#154 --- ryzom/common/data_common/r2/r2_features_default.lua | 8 ++++---- ryzom/common/src/game_share/object.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ryzom/common/data_common/r2/r2_features_default.lua b/ryzom/common/data_common/r2/r2_features_default.lua index e1de396d2..d6cbd7bda 100644 --- a/ryzom/common/data_common/r2/r2_features_default.lua +++ b/ryzom/common/data_common/r2/r2_features_default.lua @@ -859,10 +859,10 @@ local registerFeature = function () Enum= { "uiR2EDWalk", "uiR2EDRun"}, Visible=true }, - {Name="Level", Type="Number", WidgetStyle="EnumDropDown", Category="uiR2EDRollout_NpcCustom", - Enum= { "uiR2EDLowLevel", "uiR2EDAverageLevel", "uiR2EDHighLevel", "uiR2EDVeryHighLevel"}, SecondRequestFunc=function(value) r2.updateLevel(value, true) end, - Visible=function(this) return this:isGroupedAndLeader() or not this:isGrouped() and not this:isBotObject() end - }, + --{Name="Level", Type="Number", WidgetStyle="EnumDropDown", Category="uiR2EDRollout_NpcCustom", + -- Enum= { "uiR2EDLowLevel", "uiR2EDAverageLevel", "uiR2EDHighLevel", "uiR2EDVeryHighLevel"}, SecondRequestFunc=function(value) r2.updateLevel(value, true) end, + -- Visible=function(this) return this:isGroupedAndLeader() or not this:isGrouped() and not this:isBotObject() end + --}, }, -- from "BaseClass" getAvailableCommands = function(this, dest) diff --git a/ryzom/common/src/game_share/object.cpp b/ryzom/common/src/game_share/object.cpp index bb92c4936..bed87409e 100644 --- a/ryzom/common/src/game_share/object.cpp +++ b/ryzom/common/src/game_share/object.cpp @@ -2618,7 +2618,7 @@ CNpcSerializer::CNpcSerializer() static const char* optionalProp[] = { "GabaritHeight", "GabaritTorsoWidth","GabaritArmsWidth", "GabaritLegsWidth", "GabaritBreastSize", "HairType", "HairColor", "Tattoo", "EyesColor", "MorphTarget1", "MorphTarget2", "MorphTarget3", "MorphTarget4", "MorphTarget5", "MorphTarget6", "MorphTarget7", "MorphTarget8", "Sex", "JacketModel", "TrouserModel", "FeetModel", "HandsModel", "ArmModel", - "WeaponRightHand", "WeaponLeftHand", "JacketColor", "ArmColor", "HandsColor", "TrouserColor", "FeetColor", "Function","Level", + "WeaponRightHand", "WeaponLeftHand", "JacketColor", "ArmColor", "HandsColor", "TrouserColor", "FeetColor", "Function", "Profile", "Speed", "Aggro", "PlayerAttackable", "BotAttackable" }; _ClassName = "Npc"; @@ -2654,7 +2654,7 @@ CNpcCustomSerializer::CNpcCustomSerializer() "MorphTarget6", "MorphTarget7", "MorphTarget8", "JacketModel", "TrouserModel", "FeetModel", "HandsModel", "ArmModel", "JacketColor", "ArmColor", "HandsColor", "TrouserColor", "FeetColor" }; static const char* optionalProp[] = { - "Name", "Profile", "Speed", "Aggro", "PlayerAttackable", "BotAttackable", "Function", "Level", "WeaponRightHand", "WeaponLeftHand", "Sex" }; + "Name", "Profile", "Speed", "Aggro", "PlayerAttackable", "BotAttackable", "Function", "WeaponRightHand", "WeaponLeftHand", "Sex" }; _ClassName = "NpcCustom"; _Type = ObjectTableNpcCustom; From 8bf18d2e1da6ee7c57383bbf57d10326d5a6bfb4 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 23 Oct 2020 05:07:09 +0800 Subject: [PATCH 013/205] Improve error message, kaetemi/ryzomclassic#120 --- nel/include/nel/gui/lua_helper_inline.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nel/include/nel/gui/lua_helper_inline.h b/nel/include/nel/gui/lua_helper_inline.h index 0d380bbf1..5dbc3cef4 100644 --- a/nel/include/nel/gui/lua_helper_inline.h +++ b/nel/include/nel/gui/lua_helper_inline.h @@ -263,8 +263,8 @@ inline lua_Integer CLuaState::toInteger(int index) if (!isnum) { lua_Number d = lua_tonumber(_State, index); - nlwarning("Lua: Unable to convert Lua number %lf to integer", d); res = (lua_Integer)d; + nlwarning("Lua: Converting lua_Number %lf to lua_Integer %i", d, (int)res); } return res; #else From 357bb28ef28ac24444fe2e8ee44cb5eeffa276d0 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 23 Oct 2020 05:37:46 +0800 Subject: [PATCH 014/205] Recycling an ucstring from i18n.get is not allowed, it's const, fix kaetemi/ryzomclassic#134 --- ryzom/common/data_common/r2/r2_dialogs.lua | 6 ++++-- ryzom/common/data_common/r2/r2_ui_scenario.lua | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ryzom/common/data_common/r2/r2_dialogs.lua b/ryzom/common/data_common/r2/r2_dialogs.lua index 286cf2a34..06d72d258 100644 --- a/ryzom/common/data_common/r2/r2_dialogs.lua +++ b/ryzom/common/data_common/r2/r2_dialogs.lua @@ -449,6 +449,7 @@ function r2.dialogs:updateElementEditor() -- to who local toWhoInst = r2:getInstanceFromId(tostring(instanceChat.Actions[0].Facing)) if toWhoInst then + uc_chat = ucstring() uc_chat:fromUtf8(toWhoInst.Name) else uc_chat = i18n.get("uiR2EdNobody") @@ -458,6 +459,7 @@ function r2.dialogs:updateElementEditor() -- emote local emoteName = self.fromEmoteIdToName[instanceChat.Actions[0].Emote] if emoteName then + uc_chat = ucstring() uc_chat:fromUtf8(emoteName) else uc_chat = i18n.get("uiR2EdNoElt") @@ -469,8 +471,8 @@ function r2.dialogs:updateElementEditor() uc_chat:fromUtf8(self.elementInitialName.." : ") chatName.uc_hardtext = uc_chat - minutesText.uc_hardtext = tostring(0) - secondsText.uc_hardtext = tostring(0) + minutesText.uc_hardtext = "0" + secondsText.uc_hardtext = "0" whoMenuText.uc_hardtext = "" diff --git a/ryzom/common/data_common/r2/r2_ui_scenario.lua b/ryzom/common/data_common/r2/r2_ui_scenario.lua index 5a925d9a4..4ed11ec63 100644 --- a/ryzom/common/data_common/r2/r2_ui_scenario.lua +++ b/ryzom/common/data_common/r2/r2_ui_scenario.lua @@ -598,9 +598,8 @@ function r2.ScenarioWindow:updateActProperties() } local season = actGr:find("season_name") assert(season) - local uc_season = ucstring() local seasonStr = seasons[location.Season] - uc_season:fromUtf8(i18n.get(seasonStr):toUtf8()) + local uc_season = i18n.get(seasonStr) season.uc_hardtext = uc_season -- manual weather From 8594b479e25cf3719754421fa407e5fda2b920bd Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 23 Oct 2020 23:56:23 +0800 Subject: [PATCH 015/205] Fix bad escaping of < and >, fix kaetemi/ryzomclassic#150 --- ryzom/common/data_common/r2/r2_misc.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ryzom/common/data_common/r2/r2_misc.lua b/ryzom/common/data_common/r2/r2_misc.lua index 2402ff1fd..293e9b33c 100644 --- a/ryzom/common/data_common/r2/r2_misc.lua +++ b/ryzom/common/data_common/r2/r2_misc.lua @@ -191,9 +191,9 @@ end ------------------------------------------------------------------------------------------------- -- enclose a string by double quotes function strifyXml(str) - local strxml = string.gsub(tostring(str), ">", ">") + local strxml = string.gsub(tostring(str), "&", "&") strxml = string.gsub(strxml, "<", "<") - strxml = string.gsub(strxml, "&", "&") + strxml = string.gsub(strxml, ">", ">") strxml = string.gsub(strxml, "'", "'") strxml = string.gsub(strxml, '"', """) return [["]] .. strxml .. [["]] From c4b142f770df2cbc4c2319c141f230708686aec2 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 23 Oct 2020 22:27:36 +0800 Subject: [PATCH 016/205] Load the Lua socket library dynamically if it's available, necessary for MobDebug --- nel/include/nel/gui/lua_helper.h | 4 +++ nel/src/gui/lua_helper.cpp | 53 ++++++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/nel/include/nel/gui/lua_helper.h b/nel/include/nel/gui/lua_helper.h index da5c33e6a..8a0f985a6 100644 --- a/nel/include/nel/gui/lua_helper.h +++ b/nel/include/nel/gui/lua_helper.h @@ -379,6 +379,10 @@ namespace NLGUI TSmallScriptCache _SmallScriptCache; static const char * _NELSmallScriptTableName; +#ifdef _WIN32 + HMODULE m_LuaSocket; +#endif + private: // this object isn't intended to be copied CLuaState(const CLuaState &/* other */):NLMISC::CRefCount() { nlassert(0); } diff --git a/nel/src/gui/lua_helper.cpp b/nel/src/gui/lua_helper.cpp index d2b6a68d3..c27c6aeba 100644 --- a/nel/src/gui/lua_helper.cpp +++ b/nel/src/gui/lua_helper.cpp @@ -216,16 +216,55 @@ namespace NLGUI // *** Load base libs { CLuaStackChecker lsc(this); - #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 +#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 luaL_openlibs(_State); - #else +#else luaopen_base (_State); luaopen_table (_State); luaopen_io (_State); luaopen_string (_State); luaopen_math (_State); luaopen_debug (_State); - #endif +#endif + +#ifdef _WIN32 + // Lua socket library for MobDebug, optional + if (NLMISC::CFile::fileExists("socket\\core.dll")) + { + // Load socket\core.dll dynamically + m_LuaSocket = LoadLibraryW(L"socket\\core.dll"); + if (!m_LuaSocket) + { + nlwarning("Lua socket library found, but failed to load"); + } + else + { + void *luaopen_socket_core = (void *)GetProcAddress(m_LuaSocket, "luaopen_socket_core"); + if (!luaopen_socket_core) + { + nlwarning("Lua socket library loaded, but `luaopen_socket_core` not found"); + FreeLibrary(m_LuaSocket); + m_LuaSocket = NULL; + } + else + { + // preload['socket.core'] = luaopen_socket_core +#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 + lua_getglobal(_State, "package"); + lua_getfield(_State, -1, "preload"); + lua_pushcfunction(_State, (lua_CFunction)luaopen_socket_core); + lua_setfield(_State, -2, "socket.core"); + lua_pop(_State, 2); + nlinfo("Lua socket library preloaded"); +#endif + } + } + } + else + { + m_LuaSocket = NULL; + } +#endif // open are buggy???? clear(); @@ -313,6 +352,14 @@ namespace NLGUI // Clear Small Script Cache _SmallScriptPool= 0; _SmallScriptCache.clear(); + +#ifdef _WIN32 + if (m_LuaSocket) + { + FreeLibrary(m_LuaSocket); + m_LuaSocket = NULL; + } +#endif } // *************************************************************************** From 6531fb0a2eb1e40f4cd792de0916b8203ae1b8b2 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 23 Oct 2020 23:18:20 +0800 Subject: [PATCH 017/205] Lua debugger requires properly standardized paths --- nel/src/gui/lua_helper.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/nel/src/gui/lua_helper.cpp b/nel/src/gui/lua_helper.cpp index c27c6aeba..a07ba3b71 100644 --- a/nel/src/gui/lua_helper.cpp +++ b/nel/src/gui/lua_helper.cpp @@ -511,7 +511,23 @@ namespace NLGUI // execute the script text, with dbgSrc==filename (use @ for lua internal purpose) - executeScriptInternal(script, string("@") + CFile::getFilename(pathName)); +#ifdef _WIN32 + // Paths need to be correct for debugging to work + std::string pathNameStandardized = pathName; + if (pathNameStandardized.size() > 1) + { + if (pathNameStandardized[1] == ':' && pathNameStandardized[0] >= 'a' && pathNameStandardized[0] <= 'z') + pathNameStandardized[0] -= 'a' - 'A'; + for (ptrdiff_t i = 0; i < (ptrdiff_t)pathNameStandardized.size(); ++i) + { + if (pathNameStandardized[i] == '/') + pathNameStandardized[i] = '\\'; + } + } +#else + const std::string &pathNameStandardized = pathName; +#endif + executeScriptInternal(script, string("@") + pathNameStandardized); return true; } From d2900df0f6d8f1636cc18d59935ef86f118090c7 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 00:32:47 +0800 Subject: [PATCH 018/205] Add debug break hook for Lua --- ryzom/common/data_common/r2/r2_debug.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ryzom/common/data_common/r2/r2_debug.lua b/ryzom/common/data_common/r2/r2_debug.lua index 78501dcab..f32a75017 100644 --- a/ryzom/common/data_common/r2/r2_debug.lua +++ b/ryzom/common/data_common/r2/r2_debug.lua @@ -132,6 +132,11 @@ end -- INIT -- ---------- +if debugBreak == nil then + -- replace this at runtime with the debugger break functions + debugBreak = function() + end +end -- replace the assert function with a more verbose one if oldAssert == nil then @@ -142,7 +147,8 @@ function assert(cond) if not cond then -- rawDebugInfo(colorTag(255, 0, 255) .. "ASSERTION FAILED !! ") rawDebugInfo("@{FOFF}ASSERTION FAILED !! ") - dumpCallStack(2); + dumpCallStack(2) + debugBreak() error("") end end From 9580bd5ec07433de1a07022ab1dfed7d0a2dbcb4 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 01:27:02 +0800 Subject: [PATCH 019/205] Failed to detect ecosystem of selected island, fix missing plants in palette, kaetemi/ryzomclassic#132 --- ryzom/common/data_common/r2/r2_ui_acts.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ryzom/common/data_common/r2/r2_ui_acts.lua b/ryzom/common/data_common/r2/r2_ui_acts.lua index 51b7675df..37edb9325 100644 --- a/ryzom/common/data_common/r2/r2_ui_acts.lua +++ b/ryzom/common/data_common/r2/r2_ui_acts.lua @@ -1240,9 +1240,11 @@ function r2.acts:updatePaletteFromEcosystem() -- search for ecosystem of current location local islandEcosystem for ecoName, v in pairs(self.islands) do - if self.islands[ecoName][self:getIslandNb(currentLocation.IslandName)].name==currentLocation.IslandName then - islandEcosystem = ecoName - break + if self.islands[ecoName][self:getIslandNb(currentLocation.IslandName)] then + if self.islands[ecoName][self:getIslandNb(currentLocation.IslandName)].name==currentLocation.IslandName then + islandEcosystem = ecoName + break + end end end From bbf4a0ac8a0eb676f87de8a04b97e4986fc1d399 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 01:25:20 +0800 Subject: [PATCH 020/205] Fix editor not returning to initial act, kaetemi/ryzomclassic#80 --- ryzom/client/src/r2/editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/src/r2/editor.cpp b/ryzom/client/src/r2/editor.cpp index 457cee562..8e146e9ad 100644 --- a/ryzom/client/src/r2/editor.cpp +++ b/ryzom/client/src/r2/editor.cpp @@ -5785,7 +5785,7 @@ void CEditor::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialAct } // projectInLua(_Scenario); // push on the lua stack - getLua().push(float(initialActIndex)); // example reconnect after test in act4 + getLua().push(initialActIndex); // example reconnect after test in act4 // update value in the framework callEnvFunc("onScenarioUpdated", 2); //nlwarning("Instance list now is :"); From a2b68113ecf63e241216c5f159bbb318f9632d86 Mon Sep 17 00:00:00 2001 From: Xtarsia <69606701+Xtarsia@users.noreply.github.com> Date: Fri, 23 Oct 2020 21:54:17 +0100 Subject: [PATCH 021/205] Remove Patcher UI elements Remove Patcher UI elements --- ryzom/client/data/gamedev/interfaces_v3/actions.xml | 1 - ryzom/client/data/gamedev/interfaces_v3/config.xml | 1 - ryzom/client/data/gamedev/interfaces_v3/taskbar.xml | 8 -------- 3 files changed, 10 deletions(-) diff --git a/ryzom/client/data/gamedev/interfaces_v3/actions.xml b/ryzom/client/data/gamedev/interfaces_v3/actions.xml index 42c931e29..c74007a79 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/actions.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/actions.xml @@ -58,7 +58,6 @@ - diff --git a/ryzom/client/data/gamedev/interfaces_v3/config.xml b/ryzom/client/data/gamedev/interfaces_v3/config.xml index 2f7b6d0f4..d14d799ef 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/config.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/config.xml @@ -1639,7 +1639,6 @@ This MUST follow the Enum MISSION_DESC::TIconId - diff --git a/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml b/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml index 7c23dd607..4d30e0be4 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml @@ -818,11 +818,6 @@ - - - @@ -1158,9 +1153,6 @@ - - From 3dddc5ab4062b89c55cfbf6c35eb456a7fc54ff6 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 03:57:15 +0800 Subject: [PATCH 022/205] Move ucstring utf8 implementation to header --- nel/include/nel/misc/ucstring.h | 132 +-------------------------- nel/src/misc/ucstring.cpp | 152 ++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+), 129 deletions(-) create mode 100644 nel/src/misc/ucstring.cpp diff --git a/nel/include/nel/misc/ucstring.h b/nel/include/nel/misc/ucstring.h index b3dc1294f..8cedb04ec 100644 --- a/nel/include/nel/misc/ucstring.h +++ b/nel/include/nel/misc/ucstring.h @@ -149,43 +149,7 @@ public: } /// Convert this ucstring (16bits char) into a utf8 string - std::string toUtf8() const - { - std::string res; - ucstring::const_iterator first(begin()), last(end()); - for (; first != last; ++first) - { - //ucchar c = *first; - uint nbLoop = 0; - if (*first < 0x80) - res += char(*first); - else if (*first < 0x800) - { - ucchar c = *first; - c = c >> 6; - c = c & 0x1F; - res += char(c) | 0xC0; - nbLoop = 1; - } - else /*if (*first < 0x10000)*/ - { - ucchar c = *first; - c = c >> 12; - c = c & 0x0F; - res += char(c) | 0xE0; - nbLoop = 2; - } - - for (uint i=0; i> ((nbLoop - i - 1) * 6); - c = c & 0x3F; - res += char(c) | 0x80; - } - } - return res; - } + std::string toUtf8() const; ucstring substr(size_type pos = 0, size_type n = npos) const { @@ -199,86 +163,7 @@ public: } /// Convert the utf8 string into this ucstring (16 bits char) - void fromUtf8(const std::string &stringUtf8) - { - // clear the string - erase(); - - uint8 c; - ucchar code; - sint iterations = 0; - - std::string::const_iterator first(stringUtf8.begin()), last(stringUtf8.end()); - for (; first != last; ) - { - c = *first++; - code = c; - - if ((code & 0xFE) == 0xFC) - { - code &= 0x01; - iterations = 5; - } - else if ((code & 0xFC) == 0xF8) - { - code &= 0x03; - iterations = 4; - } - else if ((code & 0xF8) == 0xF0) - { - code &= 0x07; - iterations = 3; - } - else if ((code & 0xF0) == 0xE0) - { - code &= 0x0F; - iterations = 2; - } - else if ((code & 0xE0) == 0xC0) - { - code &= 0x1F; - iterations = 1; - } - else if ((code & 0x80) == 0x80) - { - // If it's not a valid UTF8 string, just copy the line without utf8 conversion - rawCopy(stringUtf8); - return; - } - else - { - push_back(code); - iterations = 0; - } - - if (iterations) - { - for (sint i = 0; i < iterations; i++) - { - if (first == last) - { - // If it's not a valid UTF8 string, just copy the line without utf8 conversion - rawCopy(stringUtf8); - return; - } - - uint8 ch; - ch = *first ++; - - if ((ch & 0xC0) != 0x80) - { - // If it's not a valid UTF8 string, just copy the line without utf8 conversion - rawCopy(stringUtf8); - return; - } - - code <<= 6; - code |= (ucchar)(ch & 0x3F); - } - push_back(code); - } - } - } + void fromUtf8(const std::string &stringUtf8); static ucstring makeFromUtf8(const std::string &stringUtf8) { @@ -289,19 +174,8 @@ public: } private: + void rawCopy(const std::string &str); - void rawCopy(const std::string &str) - { - // We need to convert the char into 8bits unsigned int before promotion to 16 bits - // otherwise, as char are signed on some compiler (MSCV for ex), the sign bit is extended to 16 bits. - resize(str.size()); - std::string::const_iterator first(str.begin()), last(str.end()); - iterator dest(begin()); - for (;first != last; ++first, ++dest) - { - *dest = uint8(*first); - } - } }; inline ucstring operator+(const ucstringbase &ucstr, ucchar c) diff --git a/nel/src/misc/ucstring.cpp b/nel/src/misc/ucstring.cpp new file mode 100644 index 000000000..5d7112114 --- /dev/null +++ b/nel/src/misc/ucstring.cpp @@ -0,0 +1,152 @@ +// NeL - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "stdmisc.h" +#include "nel/misc/ucstring.h" + +std::string ucstring::toUtf8() const +{ + std::string res; + ucstring::const_iterator first(begin()), last(end()); + for (; first != last; ++first) + { + //ucchar c = *first; + uint nbLoop = 0; + if (*first < 0x80) + res += char(*first); + else if (*first < 0x800) + { + ucchar c = *first; + c = c >> 6; + c = c & 0x1F; + res += char(c) | 0xC0; + nbLoop = 1; + } + else /*if (*first < 0x10000)*/ + { + ucchar c = *first; + c = c >> 12; + c = c & 0x0F; + res += char(c) | 0xE0; + nbLoop = 2; + } + + for (uint i=0; i> ((nbLoop - i - 1) * 6); + c = c & 0x3F; + res += char(c) | 0x80; + } + } + return res; +} + +void ucstring::fromUtf8(const std::string &stringUtf8) +{ + // clear the string + erase(); + + uint8 c; + ucchar code; + sint iterations = 0; + + std::string::const_iterator first(stringUtf8.begin()), last(stringUtf8.end()); + for (; first != last; ) + { + c = *first++; + code = c; + + if ((code & 0xFE) == 0xFC) + { + code &= 0x01; + iterations = 5; + } + else if ((code & 0xFC) == 0xF8) + { + code &= 0x03; + iterations = 4; + } + else if ((code & 0xF8) == 0xF0) + { + code &= 0x07; + iterations = 3; + } + else if ((code & 0xF0) == 0xE0) + { + code &= 0x0F; + iterations = 2; + } + else if ((code & 0xE0) == 0xC0) + { + code &= 0x1F; + iterations = 1; + } + else if ((code & 0x80) == 0x80) + { + // If it's not a valid UTF8 string, just copy the line without utf8 conversion + rawCopy(stringUtf8); + return; + } + else + { + push_back(code); + iterations = 0; + } + + if (iterations) + { + for (sint i = 0; i < iterations; i++) + { + if (first == last) + { + // If it's not a valid UTF8 string, just copy the line without utf8 conversion + rawCopy(stringUtf8); + return; + } + + uint8 ch; + ch = *first ++; + + if ((ch & 0xC0) != 0x80) + { + // If it's not a valid UTF8 string, just copy the line without utf8 conversion + rawCopy(stringUtf8); + return; + } + + code <<= 6; + code |= (ucchar)(ch & 0x3F); + } + push_back(code); + } + } +} + +void ucstring::rawCopy(const std::string &str) +{ + // We need to convert the char into 8bits unsigned int before promotion to 16 bits + // otherwise, as char are signed on some compiler (MSCV for ex), the sign bit is extended to 16 bits. + resize(str.size()); + std::string::const_iterator first(str.begin()), last(str.end()); + iterator dest(begin()); + for (;first != last; ++first, ++dest) + { + *dest = uint8(*first); + } +} + +/* end of file */ From 1300d5d4d4efd188ebfca26fb9cc31b8d6a388ce Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 04:02:02 +0800 Subject: [PATCH 023/205] Move ucstring utf8 implementation to header --- nel/include/nel/misc/ucstring.h | 12 +----------- nel/src/misc/ucstring.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/nel/include/nel/misc/ucstring.h b/nel/include/nel/misc/ucstring.h index 8cedb04ec..5f0616d8f 100644 --- a/nel/include/nel/misc/ucstring.h +++ b/nel/include/nel/misc/ucstring.h @@ -128,17 +128,7 @@ public: } /// Converts the controlled ucstring to a string str - void toString (std::string &str) const - { - str.resize (size ()); - for (uint i = 0; i < str.size (); i++) - { - if (operator[](i) > 255) - str[i] = '?'; - else - str[i] = (char) operator[](i); - } - } + void toString(std::string &str) const; /// Converts the controlled ucstring and returns the resulting string std::string toString () const diff --git a/nel/src/misc/ucstring.cpp b/nel/src/misc/ucstring.cpp index 5d7112114..df8f52406 100644 --- a/nel/src/misc/ucstring.cpp +++ b/nel/src/misc/ucstring.cpp @@ -17,6 +17,18 @@ #include "stdmisc.h" #include "nel/misc/ucstring.h" +void ucstring::toString(std::string &str) const +{ + str.resize(size()); + for (uint i = 0; i < str.size (); i++) + { + if (operator[](i) > 255) + str[i] = '?'; + else + str[i] = (char) operator[](i); + } +} + std::string ucstring::toUtf8() const { std::string res; From dd281306178fa10451569341b60e6e62d1c9bbeb Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 04:17:36 +0800 Subject: [PATCH 024/205] Format ucstring source --- nel/include/nel/misc/ucstring.h | 119 +++++++++++++++++--------------- nel/src/misc/ucstring.cpp | 16 ++--- 2 files changed, 70 insertions(+), 65 deletions(-) diff --git a/nel/include/nel/misc/ucstring.h b/nel/include/nel/misc/ucstring.h index 5f0616d8f..28afcdb9a 100644 --- a/nel/include/nel/misc/ucstring.h +++ b/nel/include/nel/misc/ucstring.h @@ -35,95 +35,98 @@ typedef std::basic_string ucstringbase; class ucstring : public ucstringbase { public: + ucstring() { } - ucstring () {} - - ucstring (const ucstringbase &str) : ucstringbase (str) {} + ucstring(const ucstringbase &str) + : ucstringbase(str) + { + } - ucstring (const std::string &str) : ucstringbase () + ucstring(const std::string &str) + : ucstringbase() { rawCopy(str); } - ~ucstring () {} + ~ucstring() { } - ucstring &operator= (ucchar c) + ucstring &operator=(ucchar c) { - resize (1); + resize(1); operator[](0) = c; return *this; } - ucstring &operator= (const char *str) + ucstring &operator=(const char *str) { - resize (strlen (str)); - for (uint i = 0; i < strlen (str); i++) + resize(strlen(str)); + for (uint i = 0; i < strlen(str); i++) { operator[](i) = uint8(str[i]); } return *this; } - ucstring &operator= (const std::string &str) + ucstring &operator=(const std::string &str) { - resize (str.size ()); - for (uint i = 0; i < str.size (); i++) + resize(str.size()); + for (uint i = 0; i < str.size(); i++) { operator[](i) = uint8(str[i]); } return *this; } - ucstring &operator= (const ucstringbase &str) + ucstring &operator=(const ucstringbase &str) { - ucstringbase::operator =(str); + ucstringbase::operator=(str); return *this; } - ucstring& operator= (const ucchar *str) + ucstring &operator=(const ucchar *str) { - ucstringbase::operator =(str); + ucstringbase::operator=(str); return *this; } - ucstring &operator+= (ucchar c) + ucstring &operator+=(ucchar c) { - resize (size() + 1); - operator[](size()-1) = c; + resize(size() + 1); + operator[](size() - 1) = c; return *this; } - ucstring &operator+= (const char *str) + ucstring &operator+=(const char *str) { size_t s = size(); - resize (s + strlen(str)); + resize(s + strlen(str)); for (uint i = 0; i < strlen(str); i++) { - operator[](s+i) = uint8(str[i]); + operator[](s + i) = uint8(str[i]); } return *this; } - ucstring &operator+= (const std::string &str) + ucstring &operator+=(const std::string &str) { size_t s = size(); - resize (s + str.size()); + resize(s + str.size()); for (uint i = 0; i < str.size(); i++) { - operator[](s+i) = uint8(str[i]); + operator[](s + i) = uint8(str[i]); } return *this; } - ucstring &operator+= (const ucstringbase &str) + ucstring &operator+=(const ucstringbase &str) { - ucstringbase::operator +=(str); + ucstringbase::operator+=(str); return *this; } const ucchar *c_str() const { const ucchar *tmp = ucstringbase::c_str(); - const_cast(tmp)[size()] = 0; + const_cast(tmp)[size()] = 0; return tmp; } @@ -131,7 +134,7 @@ public: void toString(std::string &str) const; /// Converts the controlled ucstring and returns the resulting string - std::string toString () const + std::string toString() const { std::string str; toString(str); @@ -165,70 +168,72 @@ public: private: void rawCopy(const std::string &str); - }; inline ucstring operator+(const ucstringbase &ucstr, ucchar c) { - ucstring ret; - ret= ucstr; - ret+= c; + ucstring ret; + ret = ucstr; + ret += c; return ret; } inline ucstring operator+(const ucstringbase &ucstr, const char *c) { - ucstring ret; - ret= ucstr; - ret+= c; + ucstring ret; + ret = ucstr; + ret += c; return ret; } inline ucstring operator+(const ucstringbase &ucstr, const std::string &c) { - ucstring ret; - ret= ucstr; - ret+= c; + ucstring ret; + ret = ucstr; + ret += c; return ret; } inline ucstring operator+(ucchar c, const ucstringbase &ucstr) { - ucstring ret; - ret= c; + ucstring ret; + ret = c; ret += ucstr; return ret; } inline ucstring operator+(const char *c, const ucstringbase &ucstr) { - ucstring ret; - ret= c; + ucstring ret; + ret = c; ret += ucstr; return ret; } inline ucstring operator+(const std::string &c, const ucstringbase &ucstr) { - ucstring ret; - ret= c; + ucstring ret; + ret = c; ret += ucstr; return ret; } -namespace NLMISC -{ +namespace NLMISC { // Traits for hash_map using CEntityId struct CUCStringHashMapTraits { - enum { bucket_size = 4, min_buckets = 8 }; + enum + { + bucket_size = 4, + min_buckets = 8 + }; CUCStringHashMapTraits() { } - size_t operator() (const ucstring &id ) const + size_t operator()(const ucstring &id) const { return id.size(); } - bool operator() (const ucstring &id1, const ucstring &id2) const + bool operator()(const ucstring &id1, const ucstring &id2) const { return id1 < id2; } @@ -239,18 +244,18 @@ struct CUCStringHashMapTraits * \param a string or a char to transform to lower case */ -ucstring toLower (const ucstring &str); -void toLower (ucchar *str); -ucchar toLower (ucchar c); +ucstring toLower(const ucstring &str); +void toLower(ucchar *str); +ucchar toLower(ucchar c); /** Convert an unicode string in upper case. * Characters with accent are converted in a uppercase character without accent * \param a string or a char to transform to upper case */ -ucstring toUpper (const ucstring &str); -void toUpper (ucchar *str); -ucchar toUpper (ucchar c); +ucstring toUpper(const ucstring &str); +void toUpper(ucchar *str); +ucchar toUpper(ucchar c); }; diff --git a/nel/src/misc/ucstring.cpp b/nel/src/misc/ucstring.cpp index df8f52406..8f81cbea1 100644 --- a/nel/src/misc/ucstring.cpp +++ b/nel/src/misc/ucstring.cpp @@ -20,18 +20,18 @@ void ucstring::toString(std::string &str) const { str.resize(size()); - for (uint i = 0; i < str.size (); i++) + for (uint i = 0; i < str.size(); i++) { if (operator[](i) > 255) str[i] = '?'; else - str[i] = (char) operator[](i); + str[i] = (char)operator[](i); } } std::string ucstring::toUtf8() const { - std::string res; + std::string res; ucstring::const_iterator first(begin()), last(end()); for (; first != last; ++first) { @@ -56,9 +56,9 @@ std::string ucstring::toUtf8() const nbLoop = 2; } - for (uint i=0; i> ((nbLoop - i - 1) * 6); c = c & 0x3F; res += char(c) | 0x80; @@ -77,7 +77,7 @@ void ucstring::fromUtf8(const std::string &stringUtf8) sint iterations = 0; std::string::const_iterator first(stringUtf8.begin()), last(stringUtf8.end()); - for (; first != last; ) + for (; first != last;) { c = *first++; code = c; @@ -131,7 +131,7 @@ void ucstring::fromUtf8(const std::string &stringUtf8) } uint8 ch; - ch = *first ++; + ch = *first++; if ((ch & 0xC0) != 0x80) { @@ -155,7 +155,7 @@ void ucstring::rawCopy(const std::string &str) resize(str.size()); std::string::const_iterator first(str.begin()), last(str.end()); iterator dest(begin()); - for (;first != last; ++first, ++dest) + for (; first != last; ++first, ++dest) { *dest = uint8(*first); } From 771248fcf4e021ba6e1fca9afd39f119de7bb6ca Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 04:18:25 +0800 Subject: [PATCH 025/205] Use platform implementation in ucstring for UTF-8 conversion on Windows to get valid UTF-16 --- nel/include/nel/misc/stream.h | 7 +++++++ nel/include/nel/misc/types_nl.h | 4 ++++ nel/include/nel/misc/ucstring.h | 4 ++++ nel/src/misc/seven_zip.cpp | 4 ++-- nel/src/misc/string_common.cpp | 2 +- nel/src/misc/ucstring.cpp | 17 +++++++++++++++++ 6 files changed, 35 insertions(+), 3 deletions(-) diff --git a/nel/include/nel/misc/stream.h b/nel/include/nel/misc/stream.h index 89db78a1c..35b6c3f26 100644 --- a/nel/include/nel/misc/stream.h +++ b/nel/include/nel/misc/stream.h @@ -300,6 +300,13 @@ public: virtual void serial(bool &b) ; #ifndef NL_OS_CYGWIN virtual void serial(char &b) ; +#endif +#ifdef NL_OS_WINDOWS + inline void serial(wchar_t &b) + { + nlctassert(sizeof(wchar_t) == sizeof(uint16)); + serial(reinterpret_cast(b)); + } #endif virtual void serial(std::string &b) ; virtual void serial(ucstring &b) ; diff --git a/nel/include/nel/misc/types_nl.h b/nel/include/nel/misc/types_nl.h index 445882c34..73c05b3a5 100644 --- a/nel/include/nel/misc/types_nl.h +++ b/nel/include/nel/misc/types_nl.h @@ -546,7 +546,11 @@ template<> struct hash * \typedef ucchar * An Unicode character (16 bits) */ +#if defined(NL_OS_WINDOWS) +typedef wchar_t ucchar; +#else typedef uint16 ucchar; +#endif #ifndef NL_OVERRIDE #define NL_OVERRIDE override diff --git a/nel/include/nel/misc/ucstring.h b/nel/include/nel/misc/ucstring.h index 28afcdb9a..8859a21d9 100644 --- a/nel/include/nel/misc/ucstring.h +++ b/nel/include/nel/misc/ucstring.h @@ -30,7 +30,11 @@ * An unicode string class (16 bits per character). * Add features to convert and assign \c ucstring to \c string and \c string to \c ucstring. */ +#if defined(NL_OS_WINDOWS) +typedef std::wstring ucstringbase; +#else typedef std::basic_string ucstringbase; +#endif class ucstring : public ucstringbase { diff --git a/nel/src/misc/seven_zip.cpp b/nel/src/misc/seven_zip.cpp index ff226af7d..ad07bf3cc 100644 --- a/nel/src/misc/seven_zip.cpp +++ b/nel/src/misc/seven_zip.cpp @@ -172,8 +172,8 @@ bool unpack7Zip(const std::string &sevenZipFile, const std::string &destFileName filename.resize(nameLen); // write filename into ucstring - SzArEx_GetFileNameUtf16(&db, 0, &filename[0]); - + SzArEx_GetFileNameUtf16(&db, 0, reinterpret_cast(&filename[0])); + // write the extracted file FILE *outputHandle = nlfopen(destFileName, "wb+"); diff --git a/nel/src/misc/string_common.cpp b/nel/src/misc/string_common.cpp index a0fb40942..93122cc70 100644 --- a/nel/src/misc/string_common.cpp +++ b/nel/src/misc/string_common.cpp @@ -244,7 +244,7 @@ std::wstring utf8ToWide(const char *str, size_t len) #if defined(NL_OS_WINDOWS) return winCpToWide(str, len, CP_UTF8); #else - // TODO: UTF-32 to UTF-8 + // TODO: UTF-8 to UTF-32 nlassert(false); #endif } diff --git a/nel/src/misc/ucstring.cpp b/nel/src/misc/ucstring.cpp index 8f81cbea1..5fad643ce 100644 --- a/nel/src/misc/ucstring.cpp +++ b/nel/src/misc/ucstring.cpp @@ -31,6 +31,12 @@ void ucstring::toString(std::string &str) const std::string ucstring::toUtf8() const { +#if defined(NL_OS_WINDOWS) + // Use OS implementation + nlctassert(sizeof(wchar_t) == sizeof(ucchar)); + nlctassert(sizeof(wchar_t) == sizeof(uint16)); + return NLMISC::wideToUtf8(static_cast(*this)); +#else std::string res; ucstring::const_iterator first(begin()), last(end()); for (; first != last; ++first) @@ -65,10 +71,20 @@ std::string ucstring::toUtf8() const } } return res; +#endif } void ucstring::fromUtf8(const std::string &stringUtf8) { +#if defined(NL_OS_WINDOWS) + // Use OS implementation + nlctassert(sizeof(wchar_t) == sizeof(ucchar)); + nlctassert(sizeof(wchar_t) == sizeof(uint16)); + nlctassert(sizeof(std::wstring) == sizeof(ucstring)); // These can be swapped on Windows + static_cast(*this) = nlmove(NLMISC::utf8ToWide(stringUtf8)); + if (stringUtf8.size() && !size()) + rawCopy(stringUtf8); +#else // clear the string erase(); @@ -146,6 +162,7 @@ void ucstring::fromUtf8(const std::string &stringUtf8) push_back(code); } } +#endif } void ucstring::rawCopy(const std::string &str) From 8be138931d8d14d5bb3c026cf839ce6412df92ef Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 04:33:08 +0800 Subject: [PATCH 026/205] Fix pCB NULL --- ryzom/client/src/login.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index cb6117744..2da407ecb 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -1211,9 +1211,10 @@ void initShardDisplay() { CCtrlButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_SHARD ":s0:but")); if (pCB != NULL) + { pCB->setPushed(true); - CAHManager::getInstance()->runActionHandler (pCB->getActionOnLeftClick(), pCB, pCB->getParamsOnLeftClick()); - + CAHManager::getInstance()->runActionHandler(pCB->getActionOnLeftClick(), pCB, pCB->getParamsOnLeftClick()); + } } pList->invalidateCoords(); } From 0367e4f7c3adc0db9e762716f00d3dad334703c3 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 04:35:18 +0800 Subject: [PATCH 027/205] Fix build warnings --- ryzom/common/src/game_share/visual_slot_manager.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ryzom/common/src/game_share/visual_slot_manager.h b/ryzom/common/src/game_share/visual_slot_manager.h index 4fd46cd81..135e729a8 100644 --- a/ryzom/common/src/game_share/visual_slot_manager.h +++ b/ryzom/common/src/game_share/visual_slot_manager.h @@ -53,7 +53,7 @@ public: static void releaseInstance(); public: - typedef struct + typedef struct TElement { uint32 Index; NLMISC::CSheetId SheetId; @@ -66,7 +66,7 @@ public: } } TElement; - typedef struct + typedef struct TElementList { // elements list for a visual slot. std::vector Element; From 9896eae64d55585ff6a94109c3736da5816eb0b8 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 06:05:22 +0800 Subject: [PATCH 028/205] Fix build warnings --- .../3d/driver/direct3d/driver_direct3d.cpp | 2 +- .../driver_opengl_vertex_buffer_hard.cpp | 9 +- nel/src/3d/render_trav.cpp | 2 +- nel/src/3d/scene.cpp | 4 +- nel/src/3d/shadow_map_manager.cpp | 4 +- nel/src/3d/shape_bank.cpp | 3 +- nel/src/3d/surface_light_grid.cpp | 23 ++--- nel/src/3d/tessellation.cpp | 6 ++ nel/src/gui/group_header.cpp | 21 +++-- nel/src/logic/logic_state_machine.cpp | 2 +- nel/src/misc/big_file.cpp | 10 ++- nel/src/misc/bitmap.cpp | 2 +- nel/src/misc/cdb_branch.cpp | 2 +- nel/src/misc/debug.cpp | 2 + nel/src/misc/eval_num_expr.cpp | 6 +- nel/src/misc/i18n.cpp | 28 ++++--- nel/src/misc/mem_displayer.cpp | 2 + nel/src/misc/object_arena_allocator.cpp | 29 ++++--- nel/src/misc/path.cpp | 9 +- nel/src/misc/system_utils.cpp | 28 ++++--- nel/src/misc/win_thread.cpp | 2 +- ryzom/client/src/client_chat_manager.cpp | 10 ++- ryzom/client/src/continent.cpp | 1 + ryzom/client/src/forage_source_cl.cpp | 2 +- ryzom/client/src/fx_cl.cpp | 2 +- .../src/interface_v3/action_handler_game.cpp | 2 +- .../interface_v3/action_handler_phrase.cpp | 83 ++++++++++--------- .../interface_v3/dbgroup_list_sheet_trade.cpp | 2 +- .../src/interface_v3/interface_manager.cpp | 2 +- .../src/interface_v3/sphrase_manager.cpp | 11 ++- .../client/src/r2/displayer_visual_group.cpp | 2 +- .../src/r2/dmc/client_edition_module.cpp | 1 + ryzom/client/src/r2/editor.cpp | 2 +- ryzom/client/src/r2/prim_render.cpp | 2 +- ryzom/client/src/timed_fx_manager.cpp | 2 +- .../time_weather_season/weather_function.cpp | 2 +- 36 files changed, 181 insertions(+), 141 deletions(-) diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 3a4f67aee..fc853602f 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -1173,7 +1173,7 @@ void D3DWndProc(CDriverD3D *driver, HWND hWnd, UINT message, WPARAM wParam, LPAR } } - if (driver->_EventEmitter.getNumEmitters() > 0) + if (driver && driver->_EventEmitter.getNumEmitters() > 0) { CWinEventEmitter *we = NLMISC::safe_cast(driver->_EventEmitter.getEmitter(0)); // Process the message by the emitter diff --git a/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp b/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp index 689c37ba5..8e539afd7 100644 --- a/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp +++ b/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp @@ -1373,10 +1373,11 @@ CVertexBufferHardARB::~CVertexBufferHardARB() } } #ifdef NL_DEBUG - if (_VertexPtr) - { - _VertexArrayRange->_MappedVBList.erase(_IteratorInMappedVBList); - } + if (_VertexPtr) + { + nlassert(_VertexArrayRange); + _VertexArrayRange->_MappedVBList.erase(_IteratorInMappedVBList); + } #endif #ifdef USE_OPENGLES diff --git a/nel/src/3d/render_trav.cpp b/nel/src/3d/render_trav.cpp index 0a071303f..355ceb7ab 100644 --- a/nel/src/3d/render_trav.cpp +++ b/nel/src/3d/render_trav.cpp @@ -921,7 +921,7 @@ void CRenderTrav::changeVPLightSetupMaterial(const CMaterial &mat, bool exclude Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Diffuse[i], color); } - + nlassert(_VPNumLights < MaxVPLight); if (i != _VPNumLights) { color= _VPLightDiffuse[i] * matDiff; diff --git a/nel/src/3d/scene.cpp b/nel/src/3d/scene.cpp index 7f1263ea1..db8a629ff 100644 --- a/nel/src/3d/scene.cpp +++ b/nel/src/3d/scene.cpp @@ -775,9 +775,9 @@ CTransformShape *CScene::createInstance(const string &shapeName) // Look if this instance get lightmap information #if defined(__GNUC__) && __GNUC__ < 3 - CMeshBase *pMB = (CMeshBase*)((IShape*)(pTShp->Shape)); + CMeshBase *pMB = pTShp ? (CMeshBase*)((IShape*)(pTShp->Shape)) : NULL; #else // not GNUC - CMeshBase *pMB = dynamic_cast((IShape*)(pTShp->Shape)); + CMeshBase *pMB = pTShp ? dynamic_cast((IShape*)(pTShp->Shape)) : NULL; #endif // not GNUC CMeshBaseInstance *pMBI = dynamic_cast( pTShp ); if( ( pMB != NULL ) && ( pMBI != NULL ) ) diff --git a/nel/src/3d/shadow_map_manager.cpp b/nel/src/3d/shadow_map_manager.cpp index a8400ce0b..e6a7cfe50 100644 --- a/nel/src/3d/shadow_map_manager.cpp +++ b/nel/src/3d/shadow_map_manager.cpp @@ -256,14 +256,14 @@ void CShadowMapManager::renderGenerate(CScene *scene) garbageShadowTextures(scene); IDriver *driverForShadowGeneration= scene->getRenderTrav().getAuxDriver(); + nlassert(driverForShadowGeneration); CSmartPtr previousRenderTarget = driverForShadowGeneration->getRenderTarget(); // Init // ******** uint32 wndW= _BlurTextureW, wndH= _BlurTextureH; // get some text/screen size. - if(driverForShadowGeneration) - driverForShadowGeneration->getWindowSize(wndW, wndH); + driverForShadowGeneration->getWindowSize(wndW, wndH); uint baseTextureSize= scene->getShadowMapTextureSize(); // Minimize the Dest Texture size, so the blurTexture don't get too heavy in VRAM. uint32 textDestW= min(wndW, (uint32)NL3D_SMM_MAX_TEXTDEST_SIZE); diff --git a/nel/src/3d/shape_bank.cpp b/nel/src/3d/shape_bank.cpp index 61a65c423..a7c60cd03 100644 --- a/nel/src/3d/shape_bank.cpp +++ b/nel/src/3d/shape_bank.cpp @@ -683,8 +683,7 @@ void CShapeBank::reset() while( scmIt != ShapeCacheNameToShapeCache.end() ) { CShapeCache *pShpCache = getShapeCachePtrFromShapeCacheName( scmIt->first ); - if( pShpCache == NULL ) - nlstop; // Should never happen + nlassert(pShpCache); pShpCache->MaxSize = 0; checkShapeCache( pShpCache ); diff --git a/nel/src/3d/surface_light_grid.cpp b/nel/src/3d/surface_light_grid.cpp index deec090a4..b30abe730 100644 --- a/nel/src/3d/surface_light_grid.cpp +++ b/nel/src/3d/surface_light_grid.cpp @@ -121,17 +121,20 @@ void CSurfaceLightGrid::getStaticLightSetup(NLMISC::CRGBA sunAmbient, const CVe CLightInfluenceInterpolator::CCorner &corner= interp.Corners[y*2 + x]; // For all lights uint lid; - for(lid= 0; lid leave color and alpha To 0. - if(cellCorner.LocalAmbientId!=0xFF) + if(igPointLights && cellCorner.LocalAmbientId!=0xFF) { CPointLight &pl= igPointLights[cellCorner.LocalAmbientId]; // take current ambient from pointLight diff --git a/nel/src/3d/tessellation.cpp b/nel/src/3d/tessellation.cpp index 451e1013b..9dbc12296 100644 --- a/nel/src/3d/tessellation.cpp +++ b/nel/src/3d/tessellation.cpp @@ -2678,6 +2678,8 @@ void CTessFace::updateBindAndSplit() } else { + nlassert(f0); + nlassert(f1); // multipatch face case are detected when face->Patch==NULL !!! if(f0->FLeft && f0->FLeft->Patch==NULL) { @@ -2710,6 +2712,8 @@ void CTessFace::updateBindAndSplit() } else { + nlassert(f0); + nlassert(f1); if(f0->FLeft) { while(f0->FLeft->isLeaf()) @@ -2781,6 +2785,8 @@ void CTessFace::updateBindAndSplit() { CTessFace *f; sint i; + nlassert(f0); + nlassert(f1); // Same reasoning for rectangular patchs, as above. for(i=0;i<2;i++) diff --git a/nel/src/gui/group_header.cpp b/nel/src/gui/group_header.cpp index 03d688921..5fec1d4be 100644 --- a/nel/src/gui/group_header.cpp +++ b/nel/src/gui/group_header.cpp @@ -161,8 +161,14 @@ namespace NLGUI // ... limitingParent = limitingParent->getParent(); } - - getParentContainer()->setW(totalWidth + getParentContainer()->getWReal() - limitingParent->getWReal()); + if (limitingParent) + { + getParentContainer()->setW(totalWidth + getParentContainer()->getWReal() - limitingParent->getWReal()); + } + else + { + nlwarning("No limiting parent for width"); + } } // resize H @@ -178,9 +184,14 @@ namespace NLGUI CInterfaceGroup *limitingParent = colEnclosing->getParent(); while (limitingParent && (limitingParent->getResizeFromChildH() || dynamic_cast(limitingParent))) limitingParent = limitingParent->getParent(); - - nlassert(limitingParent); - getParentContainer()->setH(col->getH() + getParentContainer()->getHReal() - limitingParent->getHReal()); + if (limitingParent) + { + getParentContainer()->setH(col->getH() + getParentContainer()->getHReal() - limitingParent->getHReal()); + } + else + { + nlwarning("No limiting parent for height"); + } } } } diff --git a/nel/src/logic/logic_state_machine.cpp b/nel/src/logic/logic_state_machine.cpp index ff99255d2..3d55be849 100644 --- a/nel/src/logic/logic_state_machine.cpp +++ b/nel/src/logic/logic_state_machine.cpp @@ -50,7 +50,7 @@ void xmlCheckNodeName (xmlNodePtr &node, const char *nodeName) // Make an error message char tmp[512]; smprintf (tmp, 512, "LogicStateMachine STATE_MACHINE XML Syntax error in block line %d, node %s should be %s", - node ? (int)node->line:-1, node->name, nodeName); + node ? (int)node->line:-1, node ? (const char *)node->name : "NULL", nodeName); nlinfo (tmp); nlstop; diff --git a/nel/src/misc/big_file.cpp b/nel/src/misc/big_file.cpp index 9713610cb..f01bbf297 100644 --- a/nel/src/misc/big_file.cpp +++ b/nel/src/misc/big_file.cpp @@ -75,7 +75,7 @@ CBigFile::CHandleFile &CBigFile::CThreadFileArray::get(uint32 index) // if the vector is not allocated, allocate it (empty entries filled with NULL => not opened FILE* in this thread) if(index>=ptr->size()) { - ptr->resize(index+1); + ptr->resize((ptrdiff_t)index + 1); } return (*ptr)[index]; @@ -278,11 +278,13 @@ bool CBigFile::BNP::readHeader(FILE *file) } char sFileName[256]; - if (fread (sFileName, 1, nStringSize, file) != nStringSize) + if (nStringSize) { - return false; + if (fread(sFileName, 1, nStringSize, file) != nStringSize) + { + return false; + } } - sFileName[nStringSize] = 0; uint32 nFileSize2; diff --git a/nel/src/misc/bitmap.cpp b/nel/src/misc/bitmap.cpp index 015a9c4c4..967cc325e 100644 --- a/nel/src/misc/bitmap.cpp +++ b/nel/src/misc/bitmap.cpp @@ -4325,7 +4325,7 @@ void CBitmap::blend(CBitmap &Bm0, CBitmap &Bm1, uint16 factor, bool inputBitmapI else #endif //#ifdef NL_OS_WINDOWS { - uint8 *endPix = dest + (numPix << 2); + uint8 *endPix = dest + ((ptrdiff_t)numPix << 2); // no mmx version uint blendFact = (uint) factor; uint invblendFact = 256 - blendFact; diff --git a/nel/src/misc/cdb_branch.cpp b/nel/src/misc/cdb_branch.cpp index 5f5cea571..f3e4f7de5 100644 --- a/nel/src/misc/cdb_branch.cpp +++ b/nel/src/misc/cdb_branch.cpp @@ -215,7 +215,7 @@ void CCDBNodeBranch::init( xmlNodePtr node, IProgressCallback &progressCallBack, else { if (!_Nodes.empty()) - for ( _IdBits=1; _Nodes.size() > unsigned(1<<_IdBits) ; _IdBits++ ) {} + for ( _IdBits=1; _Nodes.size() > ((size_t)1 <<_IdBits) ; _IdBits++ ) {} else _IdBits = 0; } diff --git a/nel/src/misc/debug.cpp b/nel/src/misc/debug.cpp index 1f7cf38db..6a40d3b0b 100644 --- a/nel/src/misc/debug.cpp +++ b/nel/src/misc/debug.cpp @@ -807,6 +807,8 @@ public: DWORD symSize = 10000; PIMAGEHLP_SYMBOL sym = (PIMAGEHLP_SYMBOL) GlobalAlloc (GMEM_FIXED, symSize); + if (!sym) return str; + ::ZeroMemory (sym, symSize); sym->SizeOfStruct = symSize; sym->MaxNameLength = symSize - sizeof(IMAGEHLP_SYMBOL); diff --git a/nel/src/misc/eval_num_expr.cpp b/nel/src/misc/eval_num_expr.cpp index 52dce523f..5d19e22a1 100644 --- a/nel/src/misc/eval_num_expr.cpp +++ b/nel/src/misc/eval_num_expr.cpp @@ -773,7 +773,7 @@ CEvalNumExpr::TReturnState CEvalNumExpr::evalExpression (double &finalResult, TT case Exponent: { int exponent; - frexp( arg0, &exponent); + (void)frexp( arg0, &exponent); value = (double)exponent; } break; @@ -1032,13 +1032,13 @@ CEvalNumExpr::TReturnState CEvalNumExpr::evalExpression (double &finalResult, TT v0 -= v1; break; case ULeftShift: - v0 = (double)(((uint)floor (v0 + 0.5))<<((uint)floor (v1 + 0.5))); + v0 = (double)(uint)(((uint)floor (v0 + 0.5))<<((uint)floor (v1 + 0.5))); break; case URightShift: v0 = (double)(((uint)floor (v0 + 0.5))>>((uint)floor (v1 + 0.5))); break; case SLeftShift: - v0 = (double)(((sint)floor (v0 + 0.5))<<((sint)floor (v1 + 0.5))); + v0 = (double)(sint)(((sint)floor (v0 + 0.5))<<((sint)floor (v1 + 0.5))); break; case SRightShift: v0 = (double)(((sint)floor (v0 + 0.5))>>((sint)floor (v1 + 0.5))); diff --git a/nel/src/misc/i18n.cpp b/nel/src/misc/i18n.cpp index f692fd849..27a47c2e4 100644 --- a/nel/src/misc/i18n.cpp +++ b/nel/src/misc/i18n.cpp @@ -339,21 +339,25 @@ std::string CI18N::getSystemLanguageCode () typedef int (WINAPI* GetUserDefaultLocaleNamePtr)(LPWSTR lpLocaleName, int cchLocaleName); // get pointer on GetUserDefaultLocaleName, kernel32.dll is always in memory so no need to call LoadLibrary - GetUserDefaultLocaleNamePtr nlGetUserDefaultLocaleName = (GetUserDefaultLocaleNamePtr)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetUserDefaultLocaleName"); - - // only use it if found - if (nlGetUserDefaultLocaleName) + HMODULE hKernel32 = GetModuleHandleA("kernel32.dll"); + if (hKernel32) { - // get user locale - wchar_t buffer[LOCALE_NAME_MAX_LENGTH]; - sint res = nlGetUserDefaultLocaleName(buffer, LOCALE_NAME_MAX_LENGTH); + GetUserDefaultLocaleNamePtr nlGetUserDefaultLocaleName = (GetUserDefaultLocaleNamePtr)GetProcAddress(hKernel32, "GetUserDefaultLocaleName"); - // convert wide string to std::string - std::string lang = wideToUtf8(buffer); + // only use it if found + if (nlGetUserDefaultLocaleName) + { + // get user locale + wchar_t buffer[LOCALE_NAME_MAX_LENGTH]; + sint res = nlGetUserDefaultLocaleName(buffer, LOCALE_NAME_MAX_LENGTH); - // only keep 2 first characters - if (lang.size() > 1) - _SystemLanguageCode = lang.substr(0, 2); + // convert wide string to std::string + std::string lang = wideToUtf8(buffer); + + // only keep 2 first characters + if (lang.size() > 1) + _SystemLanguageCode = lang.substr(0, 2); + } } } #endif diff --git a/nel/src/misc/mem_displayer.cpp b/nel/src/misc/mem_displayer.cpp index 04e5c71dd..0250fc4c6 100644 --- a/nel/src/misc/mem_displayer.cpp +++ b/nel/src/misc/mem_displayer.cpp @@ -58,6 +58,8 @@ static string getFuncInfo (DWORD_TYPE funcAddr, DWORD_TYPE stackAddr) DWORD symSize = 10000; PIMAGEHLP_SYMBOL sym = (PIMAGEHLP_SYMBOL) GlobalAlloc (GMEM_FIXED, symSize); + if (!sym) return str; + ::ZeroMemory (sym, symSize); sym->SizeOfStruct = symSize; sym->MaxNameLength = symSize - sizeof(IMAGEHLP_SYMBOL); diff --git a/nel/src/misc/object_arena_allocator.cpp b/nel/src/misc/object_arena_allocator.cpp index bd00affc9..ba2c81148 100644 --- a/nel/src/misc/object_arena_allocator.cpp +++ b/nel/src/misc/object_arena_allocator.cpp @@ -60,22 +60,23 @@ CObjectArenaAllocator::~CObjectArenaAllocator() void *CObjectArenaAllocator::alloc(uint size) { #ifdef NL_DEBUG - if (_WantBreakOnAlloc) + if (_WantBreakOnAlloc) + { + if (_AllocID == _BreakAllocID) { - if (_AllocID == _BreakAllocID) - { - nlassert(0); - } + nlassert(0); } + } #endif if (size >= _MaxAllocSize) { // use standard allocator nlctassert(NL_DEFAULT_MEMORY_ALIGNMENT >= sizeof(uint)); - uint8 *block = (uint8 *)aligned_malloc(NL_DEFAULT_MEMORY_ALIGNMENT + size, NL_DEFAULT_MEMORY_ALIGNMENT); //new uint8[size + sizeof(uint)]; // an additionnal uint is needed to store size of block - if (!block) return NULL; + uint8 *block = (uint8 *)aligned_malloc(NL_DEFAULT_MEMORY_ALIGNMENT + (ptrdiff_t)size, NL_DEFAULT_MEMORY_ALIGNMENT); //new uint8[size + sizeof(uint)]; // an additionnal uint is needed to store size of block + if (!block) throw std::bad_alloc(); #ifdef NL_DEBUG - _MemBlockToAllocID[block] = _AllocID; + _MemBlockToAllocID[block] = _AllocID; + ++_AllocID; #endif *(uint *) block = size; return block + NL_DEFAULT_MEMORY_ALIGNMENT; @@ -87,16 +88,14 @@ void *CObjectArenaAllocator::alloc(uint size) _ObjectSizeToAllocator[entry] = new CFixedSizeAllocator(entry * _Granularity + NL_DEFAULT_MEMORY_ALIGNMENT, _MaxAllocSize / size); // an additionnal uint is needed to store size of block } void *block = _ObjectSizeToAllocator[entry]->alloc(); + if (!block) throw std::bad_alloc(); nlassert(((uintptr_t)block % NL_DEFAULT_MEMORY_ALIGNMENT) == 0); #ifdef NL_DEBUG - if (block) - { - _MemBlockToAllocID[block] = _AllocID; - } - ++_AllocID; + _MemBlockToAllocID[block] = _AllocID; + ++_AllocID; #endif - *(uint *) block = size; - return (void *) ((uint8 *) block + NL_DEFAULT_MEMORY_ALIGNMENT); + *(uint *)block = size; + return (void *)((uint8 *)block + NL_DEFAULT_MEMORY_ALIGNMENT); } // ***************************************************************************************************************** diff --git a/nel/src/misc/path.cpp b/nel/src/misc/path.cpp index cdc71c1eb..a2f817210 100644 --- a/nel/src/misc/path.cpp +++ b/nel/src/misc/path.cpp @@ -1341,10 +1341,13 @@ void CFileContainer::addSearchBigFile (const string &sBigFilename, bool recurse, fclose(Handle); return; } - if (fread (FileName, 1, nStringSize, Handle) != nStringSize) + if (nStringSize) { - fclose(Handle); - return; + if (fread(FileName, 1, nStringSize, Handle) != nStringSize) + { + fclose(Handle); + return; + } } FileName[nStringSize] = 0; uint32 nFileSize2; diff --git a/nel/src/misc/system_utils.cpp b/nel/src/misc/system_utils.cpp index 8e6a1feae..45da347bd 100644 --- a/nel/src/misc/system_utils.cpp +++ b/nel/src/misc/system_utils.cpp @@ -173,23 +173,25 @@ bool CSystemUtils::copyTextToClipboard(const ucstring &text) { // create a lock on this buffer void *hLock = GlobalLock(mem); + if (hLock) + { + // copy text to this buffer + if (isUnicode) + wcscpy((wchar_t *)hLock, (const wchar_t *)text.c_str()); + else + strcpy((char *)hLock, text.toString().c_str()); - // copy text to this buffer - if (isUnicode) - wcscpy((wchar_t*)hLock, (const wchar_t*)text.c_str()); - else - strcpy((char*)hLock, text.toString().c_str()); - - // unlock buffer - GlobalUnlock(mem); + // unlock buffer + GlobalUnlock(mem); - // empty clipboard - EmptyClipboard(); + // empty clipboard + EmptyClipboard(); - // set new data to clipboard in the right format - SetClipboardData(isUnicode ? CF_UNICODETEXT:CF_TEXT, mem); + // set new data to clipboard in the right format + SetClipboardData(isUnicode ? CF_UNICODETEXT : CF_TEXT, mem); - res = true; + res = true; + } } CloseClipboard(); diff --git a/nel/src/misc/win_thread.cpp b/nel/src/misc/win_thread.cpp index 0de191d55..c3624c161 100644 --- a/nel/src/misc/win_thread.cpp +++ b/nel/src/misc/win_thread.cpp @@ -209,11 +209,11 @@ void CWinThread::start () ThreadHandle = (void *) ::CreateThread (NULL, 0, ProxyFunc, this, 0, (DWORD *)&ThreadId); // nldebug("NLMISC: thread %x started for runnable '%x'", typeid( Runnable ).name()); // OutputDebugString(toString(NL_LOC_MSG " NLMISC: thread %x started for runnable '%s'\n", ThreadId, typeid( *Runnable ).name()).c_str()); - SetThreadPriorityBoost (ThreadHandle, TRUE); // FALSE == Enable Priority Boost if (ThreadHandle == NULL) { throw EThread ( "Cannot create new thread" ); } + SetThreadPriorityBoost (ThreadHandle, TRUE); // FALSE == Enable Priority Boost _SuspendCount = 0; } diff --git a/ryzom/client/src/client_chat_manager.cpp b/ryzom/client/src/client_chat_manager.cpp index 9d222a1b7..a61c21701 100644 --- a/ryzom/client/src/client_chat_manager.cpp +++ b/ryzom/client/src/client_chat_manager.cpp @@ -1230,11 +1230,13 @@ class CHandlerEnterTell : public IActionHandler { CGroupContainer *pGC = pCGW->createFreeTeller(receiver); if (pGC != NULL) - pGC->setActive(true); - CGroupEditBox *eb = dynamic_cast(pGC->getGroup("eb")); - if (eb) { - CWidgetManager::getInstance()->setCaptureKeyboard(eb); + pGC->setActive(true); + CGroupEditBox *eb = dynamic_cast(pGC->getGroup("eb")); + if (eb) + { + CWidgetManager::getInstance()->setCaptureKeyboard(eb); + } } } } diff --git a/ryzom/client/src/continent.cpp b/ryzom/client/src/continent.cpp index 03b9a1fce..6bd22741a 100644 --- a/ryzom/client/src/continent.cpp +++ b/ryzom/client/src/continent.cpp @@ -956,6 +956,7 @@ void CContinent::unselect() // Setup the Root scene. if (BackgroundIG) { + nlassert(SceneRoot); BackgroundIG->removeFromScene (*SceneRoot); SceneRoot->deleteInstanceGroup (BackgroundIG); BackgroundIG = NULL; diff --git a/ryzom/client/src/forage_source_cl.cpp b/ryzom/client/src/forage_source_cl.cpp index 4e673caaf..be41c0e75 100644 --- a/ryzom/client/src/forage_source_cl.cpp +++ b/ryzom/client/src/forage_source_cl.cpp @@ -101,7 +101,7 @@ bool CForageSourceCL::build( const CEntitySheet *sheet ) const CForageSourceSheet *forageSourceSheet = dynamic_cast(sheet); if ( ! forageSourceSheet ) { - nlwarning( "Bad sheet %s for forage source", sheet->Id.toString().c_str() ); + nlwarning( "Bad sheet %s for forage source", sheet ? sheet->Id.toString().c_str() : "NULL" ); return false; } if ( ! setFx( forageSourceSheet->FxFilename ) ) diff --git a/ryzom/client/src/fx_cl.cpp b/ryzom/client/src/fx_cl.cpp index e1f29fd77..aeb3ddcba 100644 --- a/ryzom/client/src/fx_cl.cpp +++ b/ryzom/client/src/fx_cl.cpp @@ -75,7 +75,7 @@ bool CFxCL::build( const CEntitySheet *sheet ) if ( (! _FXSheet) || (_FXSheet->PSList.empty()) ) { _BadBuild = true; - nlwarning( "Bad sheet %s for fx", sheet->Id.toString().c_str() ); + nlwarning( "Bad sheet %s for fx", sheet ? sheet->Id.toString().c_str() : "NULL" ); return false; } diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 5af8485d6..bbb392131 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -1334,7 +1334,7 @@ class CSelectItemSheet : public IActionHandler // check if user has the level to use the item (applies to item & plans) if (ctrlSheet->getSheetCategory() == CDBCtrlSheet::Item) { - if (csg->getName() == "buy_selection") + if (csg && csg->getName() == "buy_selection") { const CItemSheet *is = ctrlSheet->asItemSheet(); if (is) diff --git a/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 8a94a4c16..dcc55f9ea 100644 --- a/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1191,57 +1191,60 @@ public: if( pPM->avoidCyclicForPhrase(phraseCom) ) cyclic= false; - // **** Launch the cast - // Cast only if their is a target, or if it is not a combat action - CEntityCL *target = EntitiesMngr.entity(UserEntity->targetSlot()); - if(target || !rootBrick->isCombat()) + if (UserEntity) { - // combat (may moveTo before) ? - if(rootBrick->isCombat()) + // **** Launch the cast + // Cast only if their is a target, or if it is not a combat action + CEntityCL *target = EntitiesMngr.entity(UserEntity->targetSlot()); + if (target || !rootBrick->isCombat()) { - if( !UserEntity->canEngageCombat() ) - return; + // combat (may moveTo before) ? + if (rootBrick->isCombat()) + { + if (!UserEntity->canEngageCombat()) + return; - UserEntity->executeCombatWithPhrase(target, memoryLine, memoryIndex, cyclic); - } - // else can cast soon! - else if ( rootBrick->isForageExtraction() && (! UserEntity->isRiding()) ) // if mounted, send directly to server (without moving) to receive the error message - { - // Yoyo: TEMP if a target selected, must be a forage source - if(!target || target->isForageSource()) + UserEntity->executeCombatWithPhrase(target, memoryLine, memoryIndex, cyclic); + } + // else can cast soon! + else if (rootBrick->isForageExtraction() && (!UserEntity->isRiding())) // if mounted, send directly to server (without moving) to receive the error message + { + // Yoyo: TEMP if a target selected, must be a forage source + if (!target || target->isForageSource()) + { + // Cancel any follow + UserEntity->disableFollow(); + // reset any moveTo also (if target==NULL, moveToExtractionPhrase() and therefore resetAnyMoveTo() not called) + // VERY important if previous MoveTo was a SPhrase MoveTo (because cancelClientExecute() must be called) + UserEntity->resetAnyMoveTo(); + + // Move to targetted source + if (target) + UserEntity->moveToExtractionPhrase(target->slot(), MaxExtractionDistance, memoryLine, memoryIndex, cyclic); + + // start client execution + pPM->clientExecute(memoryLine, memoryIndex, cyclic); + + if (!target) + { + // inform Server of phrase cast + pPM->sendExecuteToServer(memoryLine, memoryIndex, cyclic); + } + } + } + else { - // Cancel any follow - UserEntity->disableFollow(); - // reset any moveTo also (if target==NULL, moveToExtractionPhrase() and therefore resetAnyMoveTo() not called) + // Cancel any moveTo(), because don't want to continue reaching the prec entity // VERY important if previous MoveTo was a SPhrase MoveTo (because cancelClientExecute() must be called) UserEntity->resetAnyMoveTo(); - // Move to targetted source - if ( target ) - UserEntity->moveToExtractionPhrase( target->slot(), MaxExtractionDistance, memoryLine, memoryIndex, cyclic ); - - // start client execution + // start client execution: NB: start client execution even if it pPM->clientExecute(memoryLine, memoryIndex, cyclic); - if ( ! target ) - { - // inform Server of phrase cast - pPM->sendExecuteToServer(memoryLine, memoryIndex, cyclic); - } + // inform Server of phrase cast + pPM->sendExecuteToServer(memoryLine, memoryIndex, cyclic); } } - else - { - // Cancel any moveTo(), because don't want to continue reaching the prec entity - // VERY important if previous MoveTo was a SPhrase MoveTo (because cancelClientExecute() must be called) - UserEntity->resetAnyMoveTo(); - - // start client execution: NB: start client execution even if it - pPM->clientExecute(memoryLine, memoryIndex, cyclic); - - // inform Server of phrase cast - pPM->sendExecuteToServer(memoryLine, memoryIndex, cyclic); - } } } } 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 4a7ef5701..ce7f2fcf5 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -475,7 +475,7 @@ bool CDBGroupListSheetTrade::CSheetChildTrade::isSheetValid(CDBGroupListSheetTex if ((pIS != NULL) && (!pIS->DropOrSell)) return false; // test if this whole family of items can be sold - if( !ITEMFAMILY::isSellableByPlayer(pIS->Family) ) + if((pIS != NULL) && !ITEMFAMILY::isSellableByPlayer(pIS->Family) ) return false; } diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 23440218e..5737e50a0 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -2980,8 +2980,8 @@ void CInterfaceManager::log(const ucstring &str, const std::string &cat) { const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " (" + NLMISC::toUpper(cat) + ") * " + str.toUtf8(); fprintf(f, "%s\n", finalString.c_str()); + fclose(f); } - fclose(f); } } diff --git a/ryzom/client/src/interface_v3/sphrase_manager.cpp b/ryzom/client/src/interface_v3/sphrase_manager.cpp index 5ebf3eee9..dc605d11d 100644 --- a/ryzom/client/src/interface_v3/sphrase_manager.cpp +++ b/ryzom/client/src/interface_v3/sphrase_manager.cpp @@ -3576,13 +3576,12 @@ void CSPhraseManager::updatePhraseProgressionDB() break; } } - } - - // if show, but only if full learnt, skip it if not fully learnt - if(phrase->ShowInAPOnlyIfLearnt && !known) - { - continue; + // if show, but only if full learnt, skip it if not fully learnt + if (phrase->ShowInAPOnlyIfLearnt && !known) + { + continue; + } } diff --git a/ryzom/client/src/r2/displayer_visual_group.cpp b/ryzom/client/src/r2/displayer_visual_group.cpp index 05e120e66..0edc18880 100644 --- a/ryzom/client/src/r2/displayer_visual_group.cpp +++ b/ryzom/client/src/r2/displayer_visual_group.cpp @@ -98,7 +98,7 @@ protected: { CGroupMap *gm = CTool::getWorldMap(); if (!gm) dest = CVector::Null; - gm->worldToWindow(dest, src); + else gm->worldToWindow(dest, src); } }; diff --git a/ryzom/client/src/r2/dmc/client_edition_module.cpp b/ryzom/client/src/r2/dmc/client_edition_module.cpp index f58a9f669..6740dabfe 100644 --- a/ryzom/client/src/r2/dmc/client_edition_module.cpp +++ b/ryzom/client/src/r2/dmc/client_edition_module.cpp @@ -2227,6 +2227,7 @@ void CClientEditionModule::addToSaveList(const std::string& filename, const std: if (!ok) { delete sv; + return; } else { diff --git a/ryzom/client/src/r2/editor.cpp b/ryzom/client/src/r2/editor.cpp index 8e146e9ad..96b935e34 100644 --- a/ryzom/client/src/r2/editor.cpp +++ b/ryzom/client/src/r2/editor.cpp @@ -6302,7 +6302,7 @@ CInstance *CEditor::getInstanceUnderPos(float x, float y, float distSelection, b objectSelected= precInstanceUnderPos->getDisplayerVisual(); } - if (objectSelected->getSelectionType() == ISelectableObject::GroundProjected) + if (objectSelected && objectSelected->getSelectionType() == ISelectableObject::GroundProjected) { if (borderSelected && borderSelected != objectSelected) { diff --git a/ryzom/client/src/r2/prim_render.cpp b/ryzom/client/src/r2/prim_render.cpp index 59b05e1c4..f4b6cb8a9 100644 --- a/ryzom/client/src/r2/prim_render.cpp +++ b/ryzom/client/src/r2/prim_render.cpp @@ -202,7 +202,7 @@ CCtrlPolygon *CPrimRender::newCtrlPolygon() const { CGroupMap *gm = CTool::getWorldMap(); if (!gm) dest = CVector::Null; - gm->worldToWindow(dest, src); + else gm->worldToWindow(dest, src); } }; CViewBase::TCtorParam param; diff --git a/ryzom/client/src/timed_fx_manager.cpp b/ryzom/client/src/timed_fx_manager.cpp index b316f0ab5..6f46d6712 100644 --- a/ryzom/client/src/timed_fx_manager.cpp +++ b/ryzom/client/src/timed_fx_manager.cpp @@ -204,7 +204,7 @@ CTimedFXManager::TFXGroupHandle CTimedFXManager::add(const std::vector //sint32 debugDay; if (!(fi.FXSheet && fi.FXSheet->Mode == CSeasonFXSheet::AlwaysStarted)) { - if (fi.FXSheet->Mode == CSeasonFXSheet::Spawn) + if (fi.FXSheet && fi.FXSheet->Mode == CSeasonFXSheet::Spawn) { // compute next spawn date float cycleLength = fi.FXSheet ? fi.FXSheet->CycleDuration : _DayLength; diff --git a/ryzom/common/src/game_share/time_weather_season/weather_function.cpp b/ryzom/common/src/game_share/time_weather_season/weather_function.cpp index 02432142f..f62a5a244 100644 --- a/ryzom/common/src/game_share/time_weather_season/weather_function.cpp +++ b/ryzom/common/src/game_share/time_weather_season/weather_function.cpp @@ -37,7 +37,7 @@ CWeatherFunction::CWeatherFunction() void CWeatherFunction::buildFromSheet(const CWeatherFunctionSheet &sheet, const CWeatherManager &wm) { // copy common part of objects (parameters) - *static_cast(this) = *static_cast(&sheet); + static_cast(*this) = static_cast(sheet); // get pointer on the setup from their names _WeatherSetups.resize(sheet.SetupNames.size()); nlassert(sheet.SetupWeights.size() == sheet.SetupNames.size()); From 7a9accde1166ec27531d8deb078f08062e7c8ff3 Mon Sep 17 00:00:00 2001 From: Xtarsia <69606701+Xtarsia@users.noreply.github.com> Date: Sat, 24 Oct 2020 01:13:19 +0100 Subject: [PATCH 029/205] Update info_player.xml closes #160 --- .../gamedev/interfaces_v3/info_player.xml | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/ryzom/client/data/gamedev/interfaces_v3/info_player.xml b/ryzom/client/data/gamedev/interfaces_v3/info_player.xml index 2d248087f..98dab16a8 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/info_player.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/info_player.xml @@ -513,7 +513,7 @@ - + @@ -581,13 +581,13 @@ - + - - - + + + @@ -606,7 +606,7 @@ - + @@ -624,21 +624,21 @@ - - - - - - + + + + + + - + - - - + + + @@ -656,7 +656,7 @@ - + @@ -672,17 +672,17 @@ - - - - - - + + + + + + - - + + From c68c3746dd1554fdd3b31a7cff7d7c4f93c7ff34 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 19:07:41 +0800 Subject: [PATCH 030/205] Build fix --- nel/tools/3d/panoply_preview/main_window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nel/tools/3d/panoply_preview/main_window.cpp b/nel/tools/3d/panoply_preview/main_window.cpp index 1b743d439..1ef144a14 100644 --- a/nel/tools/3d/panoply_preview/main_window.cpp +++ b/nel/tools/3d/panoply_preview/main_window.cpp @@ -53,7 +53,7 @@ namespace { QString nli18n(const char *label) { - return QString::fromUtf16(CI18N::get(label).c_str()); + return QString::fromUtf16((const ushort *)CI18N::get(label).c_str()); } } /* anonymous namespace */ From c068d757eb2442692f47201e9124afbab6c2f523 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 19:23:11 +0800 Subject: [PATCH 031/205] Build fix --- nel/include/nel/misc/string_common.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nel/include/nel/misc/string_common.h b/nel/include/nel/misc/string_common.h index 9f6d59aae..6021b8159 100644 --- a/nel/include/nel/misc/string_common.h +++ b/nel/include/nel/misc/string_common.h @@ -193,6 +193,10 @@ inline std::string toString(const sint32 &val) { return toString("%d", val); } inline std::string toString(const uint64 &val) { return toString("%" NL_I64 "u", val); } inline std::string toString(const sint64 &val) { return toString("%" NL_I64 "d", val); } +#ifdef NL_OS_WINDOWS +inline std::string toString(const wchar_t &val) { return toString(reinterpret_cast(val)); } +#endif + #ifdef NL_COMP_GCC # if GCC_VERSION == 40102 @@ -246,6 +250,10 @@ inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf( inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; } inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; } +#ifdef NL_OS_WINDOWS +inline bool fromString(const std::string &str, wchar_t &val) { return fromString(str, reinterpret_cast(val)); } +#endif + // Fast string to bool, reliably defined for strings starting with 0, 1, t, T, f, F, y, Y, n, N, anything else is undefined. // (str[0] == '1' || (str[0] & 0xD2) == 0x50) // - Kaetemi From 8d94baaf14a9ba71ffbca056df6673383e3cd7ae Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 21:17:22 +0800 Subject: [PATCH 032/205] More consistent unicode behaviour for text --- nel/include/nel/gui/group_editbox.h | 4 +- nel/src/gui/ctrl_base.cpp | 52 ++++++++++--------- nel/src/gui/ctrl_text_button.cpp | 8 +-- nel/src/gui/dbgroup_combo_box.cpp | 2 +- nel/src/gui/dbview_quantity.cpp | 7 +-- nel/src/gui/group_editbox.cpp | 20 +------ nel/src/gui/group_html.cpp | 4 +- nel/src/gui/group_list.cpp | 9 ++-- nel/src/gui/group_menu.cpp | 7 +-- nel/src/gui/group_paragraph.cpp | 9 ++-- nel/src/gui/group_tree.cpp | 7 +-- nel/src/gui/lua_ihm.cpp | 6 +-- nel/src/gui/view_text.cpp | 12 ++--- nel/src/gui/view_text_formated.cpp | 38 +++++++------- nel/src/gui/view_text_id_formated.cpp | 27 +++++----- nel/src/misc/system_utils.cpp | 21 +++++--- .../src/interface_v3/macrocmd_manager.cpp | 10 ++-- ryzom/client/src/login.cpp | 4 +- 18 files changed, 121 insertions(+), 126 deletions(-) diff --git a/nel/include/nel/gui/group_editbox.h b/nel/include/nel/gui/group_editbox.h index 096f3daa0..dc343410b 100644 --- a/nel/include/nel/gui/group_editbox.h +++ b/nel/include/nel/gui/group_editbox.h @@ -79,8 +79,6 @@ namespace NLGUI sint64 getInputStringAsInt64() const; void setInputStringAsFloat(float val); float getInputStringAsFloat() const; - void setInputStringAsStdString(const std::string &str); - std::string getInputStringAsStdString() const; void setInputStringAsUtf8(const std::string &str); std::string getInputStringAsUtf8() const; void setColor(NLMISC::CRGBA col); @@ -189,7 +187,7 @@ namespace NLGUI REFLECT_LUA_METHOD("setSelectionAll", luaSetSelectionAll); REFLECT_LUA_METHOD("setFocusOnText", luaSetFocusOnText); REFLECT_LUA_METHOD("cancelFocusOnText", luaCancelFocusOnText); - REFLECT_STRING("input_string", getInputStringAsStdString, setInputStringAsStdString); + REFLECT_STRING("input_string", getInputStringAsUtf8, setInputStringAsUtf8); REFLECT_UCSTRING("uc_input_string", getInputString, setInputString); REFLECT_EXPORT_END diff --git a/nel/src/gui/ctrl_base.cpp b/nel/src/gui/ctrl_base.cpp index 2d67ccc30..0124bfdee 100644 --- a/nel/src/gui/ctrl_base.cpp +++ b/nel/src/gui/ctrl_base.cpp @@ -122,30 +122,26 @@ namespace NLGUI CXMLAutoPtr prop; // get static toolTip - prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip" ); - if (prop) + prop = (char *)xmlGetProp(cur, (xmlChar *)"tooltip_i18n"); + if ((bool)prop && strlen((const char *)prop) > 0) { - const char *propPtr = prop; - if (strlen(propPtr) > 2 && propPtr[0] == 'u' && propPtr[1] == ':') - _ContextHelp = ucstring::makeFromUtf8(std::string(propPtr).substr(2)); + // Force I18N tooltip + if (!editorMode) + _ContextHelp = CI18N::get((const char *)prop); else - _ContextHelp = ucstring(propPtr); - - - if( !editorMode && ( strlen(propPtr) > 2 ) ) - { - if ((propPtr[0] == 'u') && (propPtr[1] == 'i')) - _ContextHelp = CI18N::get ((const char *) prop); - } + _ContextHelp.fromUtf8((const char *)prop); } - // Force I18N tooltip - prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip_i18n" ); - if ((bool)prop && strlen((const char*)prop)>0) + else { - if( !editorMode ) - _ContextHelp = CI18N::get ((const char *) prop); - else - _ContextHelp = (const char*)prop; + // get static toolTip + prop = (char *)xmlGetProp(cur, (xmlChar *)"tooltip"); + if (prop) + { + if (!editorMode && NLMISC::startsWith((const char *)prop, "ui")) + _ContextHelp = CI18N::get((const char *)prop); + else + _ContextHelp.fromUtf8((const char *)prop); + } } // get dynamic toolTip ActionHandler @@ -173,7 +169,7 @@ namespace NLGUI _ToolTipSpecialParent= CStringShared(); if(prop) { - _ToolTipSpecialParent= std::string((const char*)prop); + _ToolTipSpecialParent= (const char*)prop; } // Tooltip posref @@ -201,12 +197,12 @@ namespace NLGUI { if( name == "tooltip" ) { - return _ContextHelp.toString(); + return _ContextHelp.toUtf8(); } else if( name == "tooltip_i18n" ) { - return _ContextHelp.toString(); + return _ContextHelp.toUtf8(); } else if( name == "on_tooltip" ) @@ -262,13 +258,19 @@ namespace NLGUI { if( name == "tooltip" ) { - _ContextHelp = ucstring::makeFromUtf8(value); + if (!editorMode && NLMISC::startsWith(value, "ui")) + _ContextHelp = CI18N::get(value); + else + _ContextHelp.fromUtf8(value); return; } else if( name == "tooltip_i18n" ) { - _ContextHelp = value; + if (!editorMode) + _ContextHelp = CI18N::get(value); + else + _ContextHelp.fromUtf8(value); return; } else diff --git a/nel/src/gui/ctrl_text_button.cpp b/nel/src/gui/ctrl_text_button.cpp index de01174ed..942dd11f8 100644 --- a/nel/src/gui/ctrl_text_button.cpp +++ b/nel/src/gui/ctrl_text_button.cpp @@ -596,9 +596,11 @@ namespace NLGUI if (prop) { const char *propPtr = prop; - ucstring text = ucstring(propPtr); - if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) - text = CI18N::get (propPtr); + ucstring text; + if (NLMISC::startsWith(propPtr, "ui")) + text = CI18N::get(propPtr); + else + text.fromUtf8(propPtr); _ViewText->setText(text); } } diff --git a/nel/src/gui/dbgroup_combo_box.cpp b/nel/src/gui/dbgroup_combo_box.cpp index 834d2d5bf..59a8b03c8 100644 --- a/nel/src/gui/dbgroup_combo_box.cpp +++ b/nel/src/gui/dbgroup_combo_box.cpp @@ -467,7 +467,7 @@ namespace NLGUI void CDBGroupComboBox::setViewText(const ucstring & text) { _IsExternViewText = true; - _ExternViewText = ucstring(text); + _ExternViewText = text; _ViewText->setText(_ExternViewText); } diff --git a/nel/src/gui/dbview_quantity.cpp b/nel/src/gui/dbview_quantity.cpp index cac772c96..0b01f14f0 100644 --- a/nel/src/gui/dbview_quantity.cpp +++ b/nel/src/gui/dbview_quantity.cpp @@ -147,9 +147,10 @@ namespace NLGUI if(ptr) { const char *propPtr = ptr; - _EmptyText = ucstring(propPtr); - if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) - _EmptyText = CI18N::get (propPtr); + if (NLMISC::startsWith(propPtr, "ui")) + _EmptyText = CI18N::get(propPtr); + else + _EmptyText.fromUtf8(propPtr); } // init cache. diff --git a/nel/src/gui/group_editbox.cpp b/nel/src/gui/group_editbox.cpp index 136909f63..2879a62af 100644 --- a/nel/src/gui/group_editbox.cpp +++ b/nel/src/gui/group_editbox.cpp @@ -1229,7 +1229,7 @@ namespace NLGUI { makeTopWindow(); // for french, deutsch and russian, be aware of unicode - std::string command = ucstring(_InputString.substr(1)).toUtf8(); + std::string command = _InputString.substr(1).toUtf8(); ICommand::expand(command); // then back to ucstring _InputString.fromUtf8(command); @@ -1735,26 +1735,10 @@ namespace NLGUI CInterfaceGroup::setActive(active); } - // *************************************************************************** - void CGroupEditBox::setInputStringAsStdString(const std::string &str) - { - setInputString(ucstring(str)); - } - - // *************************************************************************** - std::string CGroupEditBox::getInputStringAsStdString() const - { - std::string result; - _InputString.toString(result); - return result; - } - // *************************************************************************** void CGroupEditBox::setInputStringAsUtf8(const std::string &str) { - ucstring tmp; - tmp.fromUtf8(str); - setInputString(tmp); + setInputString(ucstring::makeFromUtf8(str)); } // *************************************************************************** diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 50b381a3c..0c294c766 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -4716,7 +4716,7 @@ namespace NLGUI const char *funcName = "addString"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); - addString(ucstring(ls.toString(1))); + addString(ucstring::makeFromUtf8(ls.toString(1))); return 0; } @@ -5470,7 +5470,7 @@ namespace NLGUI } else { - ctrlButton->setDefaultContextHelp(ucstring(tooltip)); + ctrlButton->setDefaultContextHelp(ucstring::makeFromUtf8(tooltip)); } } diff --git a/nel/src/gui/group_list.cpp b/nel/src/gui/group_list.cpp index b49eed7cc..d619a8146 100644 --- a/nel/src/gui/group_list.cpp +++ b/nel/src/gui/group_list.cpp @@ -518,11 +518,10 @@ namespace NLGUI { _HardText = std::string( (const char*)ptr ); const char *propPtr = ptr; - ucstring Text = ucstring(propPtr); - if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) - Text = CI18N::get (propPtr); - - addTextChild(Text); + if (NLMISC::startsWith(propPtr, "ui")) + addTextChild(CI18N::get(propPtr)); + else + addTextChild(ucstring::makeFromUtf8(propPtr)); } else { diff --git a/nel/src/gui/group_menu.cpp b/nel/src/gui/group_menu.cpp index 3fc8d0bbb..830b74fb9 100644 --- a/nel/src/gui/group_menu.cpp +++ b/nel/src/gui/group_menu.cpp @@ -283,9 +283,10 @@ namespace NLGUI if (name) { const char *ptrName = (const char*)name; - ucstrName = ucstring(ptrName); - if ((strlen(ptrName)>2) && (ptrName[0] == 'u') && (ptrName[1] == 'i')) - ucstrName = CI18N::get (ptrName); + if (NLMISC::startsWith(ptrName, "ui")) + ucstrName = CI18N::get(ptrName); + else + ucstrName.fromUtf8(ptrName); } CXMLAutoPtr ah((const char*) xmlGetProp (cur, (xmlChar*)"handler")); diff --git a/nel/src/gui/group_paragraph.cpp b/nel/src/gui/group_paragraph.cpp index 9424c0218..f772309a6 100644 --- a/nel/src/gui/group_paragraph.cpp +++ b/nel/src/gui/group_paragraph.cpp @@ -476,11 +476,10 @@ namespace NLGUI { _HardText = std::string( (const char*)ptr ); const char *propPtr = ptr; - ucstring Text = ucstring(propPtr); - if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) - Text = CI18N::get (propPtr); - - addTextChild(Text); + if (NLMISC::startsWith(propPtr, "ui")) + addTextChild(CI18N::get(propPtr)); + else + addTextChild(ucstring::makeFromUtf8(propPtr)); } else { diff --git a/nel/src/gui/group_tree.cpp b/nel/src/gui/group_tree.cpp index 83c080b5e..9fad363f0 100644 --- a/nel/src/gui/group_tree.cpp +++ b/nel/src/gui/group_tree.cpp @@ -306,9 +306,10 @@ namespace NLGUI if (name) { const char *ptrName = (const char*)name; - Text = ucstring(ptrName); - if ((strlen(ptrName)>2) && (ptrName[0] == 'u') && (ptrName[1] == 'i')) - Text = CI18N::get (ptrName); + if (NLMISC::startsWith(ptrName, "ui")) + Text = CI18N::get(ptrName); + else + ucstring::makeFromUtf8(ptrName); } CXMLAutoPtr color((const char*) xmlGetProp (cur, (xmlChar*)"color")); diff --git a/nel/src/gui/lua_ihm.cpp b/nel/src/gui/lua_ihm.cpp index 946baa560..cf60444a6 100644 --- a/nel/src/gui/lua_ihm.cpp +++ b/nel/src/gui/lua_ihm.cpp @@ -1880,21 +1880,21 @@ namespace NLGUI ucstring CLuaIHM::findReplaceAll(const ucstring &str, const std::string &search, const std::string &replace) { //H_AUTO(Lua_CLuaIHM_findReplaceAll) - return findReplaceAll(str, ucstring(search), ucstring(replace)); + return findReplaceAll(str, ucstring::makeFromUtf8(search), ucstring::makeFromUtf8(replace)); } // *************************************************************************** ucstring CLuaIHM::findReplaceAll(const ucstring &str, const std::string &search, const ucstring &replace) { //H_AUTO(Lua_CLuaIHM_findReplaceAll) - return findReplaceAll(str, ucstring(search), ucstring(replace)); + return findReplaceAll(str, ucstring::makeFromUtf8(search), replace); } // *************************************************************************** ucstring CLuaIHM::findReplaceAll(const ucstring &str, const ucstring &search, const std::string &replace) { //H_AUTO(Lua_CLuaIHM_findReplaceAll) - return findReplaceAll(str, ucstring(search), ucstring(replace)); + return findReplaceAll(str, search, ucstring::makeFromUtf8(replace)); } diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index dab618ff8..1b7d3f457 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -982,11 +982,11 @@ namespace NLGUI if (prop) { const char *propPtr = prop; - _Text = ucstring(propPtr); - - if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) - _Text = CI18N::get (propPtr); - setCase (_Text, _CaseMode); + if (NLMISC::startsWith(propPtr, "ui")) + _Text = CI18N::get(propPtr); + else + _Text.fromUtf8(propPtr); + setCase(_Text, _CaseMode); } prop = (char*) xmlGetProp( cur, (xmlChar*)"hardtext_format" ); @@ -2155,7 +2155,7 @@ namespace NLGUI float dotWidth = 0.f; if (_OverflowText.size() > 0) { - si = TextContext->getStringInfo (ucstring(_OverflowText)); + si = TextContext->getStringInfo(_OverflowText); dotWidth = si.StringWidth; } diff --git a/nel/src/gui/view_text_formated.cpp b/nel/src/gui/view_text_formated.cpp index ac9263936..aa948e986 100644 --- a/nel/src/gui/view_text_formated.cpp +++ b/nel/src/gui/view_text_formated.cpp @@ -34,26 +34,26 @@ namespace NLGUI CViewTextFormated::IViewTextFormatter *CViewTextFormated::textFormatter = NULL; - std::string CViewTextFormated::getProperty( const std::string &name ) const - { - if( name == "format" ) - { - return getFormatString().toString(); - } - else - return CViewText::getProperty( name ); - } - - void CViewTextFormated::setProperty( const std::string &name, const std::string &value ) - { - if( name == "format" ) + std::string CViewTextFormated::getProperty(const std::string &name) const + { + if (name == "format") { - setFormatString( value ); - return; + return getFormatString().toUtf8(); } else - CViewText::setProperty( name, value ); - } + return CViewText::getProperty(name); + } + + void CViewTextFormated::setProperty(const std::string &name, const std::string &value) + { + if (name == "format") + { + setFormatString(ucstring::makeFromUtf8(value)); + return; + } + else + CViewText::setProperty(name, value); + } xmlNodePtr CViewTextFormated::serialize( xmlNodePtr parentNode, const char *type ) const { @@ -62,7 +62,7 @@ namespace NLGUI return NULL; xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_formated" ); - xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().c_str() ); + xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().toUtf8().c_str() ); return NULL; } @@ -73,7 +73,7 @@ namespace NLGUI if (!CViewText::parse(cur, parentGroup)) return false; CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"format" )); if (prop) - setFormatString(ucstring((const char *) prop)); + setFormatString(ucstring::makeFromUtf8((const char *)prop)); else setFormatString(ucstring("$t")); return true; diff --git a/nel/src/gui/view_text_id_formated.cpp b/nel/src/gui/view_text_id_formated.cpp index 28998cee0..5304e9e5c 100644 --- a/nel/src/gui/view_text_id_formated.cpp +++ b/nel/src/gui/view_text_id_formated.cpp @@ -33,36 +33,35 @@ NLMISC_REGISTER_OBJECT(CViewBase, CViewTextIDFormated, std::string, "text_id_for namespace NLGUI { - std::string CViewTextIDFormated::getProperty( const std::string &name ) const + std::string CViewTextIDFormated::getProperty(const std::string &name) const { - if( name == "format" ) + if (name == "format") { - return getFormatString().toString(); + return getFormatString().toUtf8(); } else - return CViewTextID::getProperty( name ); + return CViewTextID::getProperty(name); } - - void CViewTextIDFormated::setProperty( const std::string &name, const std::string &value ) + void CViewTextIDFormated::setProperty(const std::string &name, const std::string &value) { - if( name == "format" ) + if (name == "format") { - setFormatString( value ); + setFormatString(ucstring::makeFromUtf8(value)); return; } else - CViewTextID::setProperty( name, value ); + CViewTextID::setProperty(name, value); } - xmlNodePtr CViewTextIDFormated::serialize( xmlNodePtr parentNode, const char *type ) const + xmlNodePtr CViewTextIDFormated::serialize(xmlNodePtr parentNode, const char *type) const { - xmlNodePtr node = CViewTextID::serialize( parentNode, type ); - if( node == NULL ) + xmlNodePtr node = CViewTextID::serialize(parentNode, type); + if (node == NULL) return NULL; xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_id_formated" ); - xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().c_str() ); + xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().toUtf8().c_str() ); return node; } @@ -73,7 +72,7 @@ namespace NLGUI if (!CViewTextID::parse(cur, parentGroup)) return false; CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"format" )); if (prop) - setFormatString(ucstring((const char *) prop)); + setFormatString(ucstring::makeFromUtf8((const char *)prop)); else setFormatString(ucstring("$t")); return true; diff --git a/nel/src/misc/system_utils.cpp b/nel/src/misc/system_utils.cpp index 45da347bd..42fe63fca 100644 --- a/nel/src/misc/system_utils.cpp +++ b/nel/src/misc/system_utils.cpp @@ -167,7 +167,10 @@ bool CSystemUtils::copyTextToClipboard(const ucstring &text) bool isUnicode = (IsClipboardFormatAvailable(CF_UNICODETEXT) == TRUE); // allocates a buffer to copy text in global memory - HGLOBAL mem = GlobalAlloc(GHND|GMEM_DDESHARE, (text.size()+1) * (isUnicode ? 2:1)); + std::string textLocal; + if (!isUnicode) textLocal = NLMISC::wideToMbcs(text); + if (text.size() && !textLocal.size()) textLocal = text.toString(); + HGLOBAL mem = GlobalAlloc(GHND | GMEM_DDESHARE, isUnicode ? ((text.size() + 1) * sizeof(wchar_t)) : textLocal.size()); if (mem) { @@ -179,7 +182,7 @@ bool CSystemUtils::copyTextToClipboard(const ucstring &text) if (isUnicode) wcscpy((wchar_t *)hLock, (const wchar_t *)text.c_str()); else - strcpy((char *)hLock, text.toString().c_str()); + strcpy((char *)hLock, textLocal.c_str()); // unlock buffer GlobalUnlock(mem); @@ -213,7 +216,7 @@ bool CSystemUtils::pasteTextFromClipboard(ucstring &text) // get data from clipboard (if not of this type, they are converted) // warning, this code can't be debuggued in VC++ IDE, hObj will be always NULL - HANDLE hObj = GetClipboardData(isUnicode ? CF_UNICODETEXT:CF_TEXT); + HANDLE hObj = GetClipboardData(isUnicode ? CF_UNICODETEXT : CF_TEXT); if (hObj) { @@ -224,9 +227,15 @@ bool CSystemUtils::pasteTextFromClipboard(ucstring &text) { // retrieve clipboard data if (isUnicode) - text = (const ucchar*)hLock; - else - text = (const char*)hLock; + { + text = (const ucchar *)hLock; + } + else + { + static_cast(text) = NLMISC::mbcsToWide((const char *)hLock); + if (!text.size() && ((const char *)hLock)[0]) + text = (const char *)hLock; + } // unlock data GlobalUnlock(hObj); diff --git a/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/ryzom/client/src/interface_v3/macrocmd_manager.cpp index 4ffb2bb17..6aa831eac 100644 --- a/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -636,7 +636,7 @@ public: CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(Params)); if (pCS == NULL) return; - pCS->setMacroText(pEB->getInputStringAsStdString()); + pCS->setMacroText(pEB->getInputStringAsUtf8()); } }; REGISTER_ACTION_HANDLER( CHandlerEBUpdateMacroText, "eb_update_macro_text"); @@ -703,10 +703,10 @@ public: CGroupEditBox *pEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_MACROICONCREATION_EDITTEXT)); if (pEB != NULL) { - pEB->setInputStringAsStdString(pMCM->CurrentEditMacro.DispText); + pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.DispText); CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_MACROICONCREATION_ICON)); if (pCS != NULL) - pCS->setMacroText(pEB->getInputStringAsStdString()); + pCS->setMacroText(pEB->getInputStringAsUtf8()); } CAHManager::getInstance()->runActionHandler("set_macro_back", NULL, string("target=")+CTRL_MACROICONCREATION_ICON+"|value="+toString(back)); @@ -862,11 +862,11 @@ public: if (pEB == NULL) return; CMacroCmdManager *pMCM = CMacroCmdManager::getInstance(); - pMCM->CurrentEditMacro.Name = pEB->getInputStringAsStdString(); + pMCM->CurrentEditMacro.Name = pEB->getInputStringAsUtf8(); if ((pMCM->CurrentEditMacro.Name.size() >= 2) && (pMCM->CurrentEditMacro.Name[0] == 'u') && (pMCM->CurrentEditMacro.Name[1] == 'i')) pMCM->CurrentEditMacro.Name[0] = 'U'; - pEB->setInputString(pMCM->CurrentEditMacro.Name); + pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.Name); } }; REGISTER_ACTION_HANDLER( CHandlerNewMacroEnterName, "new_macro_enter_name"); diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index 2da407ecb..96922d399 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -1379,8 +1379,8 @@ class CAHOnLogin : public IActionHandler return; } - LoginLogin = pGEBLog->getInputStringAsStdString(); - LoginPassword = pGEBPwd->getInputStringAsStdString(); + LoginLogin = pGEBLog->getInputString().toString(); // FIXME: Unicode login + LoginPassword = pGEBPwd->getInputString().toString(); onlogin(); } From 639b4328171882c35d48fa0bfd7bb6ade71d1f87 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 21:17:44 +0800 Subject: [PATCH 033/205] Match GL behaviour in D3D for screensaver --- .../3d/driver/direct3d/driver_direct3d.cpp | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/nel/src/3d/driver/direct3d/driver_direct3d.cpp index fc853602f..211ed27fd 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -1225,12 +1225,29 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l D3DWndProc (pDriver, hWnd, message, wParam, lParam); } + if (message == WM_SYSCOMMAND) + { + switch (wParam) + { #ifdef NL_DISABLE_MENU - // disable menu (F10, ALT and ALT+SPACE key doesn't freeze or open the menu) - if(message == WM_SYSCOMMAND && wParam == SC_KEYMENU) - return 0; + // disable menu (F10, ALT and ALT+SPACE key doesn't freeze or open the menu) + case SC_KEYMENU: #endif // NL_DISABLE_MENU + // Screensaver Trying To Start? + case SC_SCREENSAVE: + + // Monitor Trying To Enter Powersave? + case SC_MONITORPOWER: + + // Prevent From Happening + return 0; + + default: + break; + } + } + // ace: if we receive close, exit now or it'll assert after if(message == WM_CLOSE) { From 8c6609943b1217735eaabcf77b273bee77554f89 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 25 Oct 2020 01:23:14 +0800 Subject: [PATCH 034/205] Dump scenario, kaetemi/ryzomclassic#155 --- ryzom/client/src/r2/dmc/client_edition_module.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ryzom/client/src/r2/dmc/client_edition_module.cpp b/ryzom/client/src/r2/dmc/client_edition_module.cpp index 6740dabfe..e388707ca 100644 --- a/ryzom/client/src/r2/dmc/client_edition_module.cpp +++ b/ryzom/client/src/r2/dmc/client_edition_module.cpp @@ -1154,6 +1154,15 @@ void CClientEditionModule::startingScenario(class NLNET::IModuleProxy * /* serve { ok = true; connectionState = "uiR2EDUploadScenario"; + +#if !FINAL_VERSION + string filename = CFile::findNewFile("scenario.rt.txt"); + COFile output(filename); + std::string ss; + rtDataPtr->serialize(ss); + output.serialBuffer((uint8*)ss.c_str(),(uint)ss.size()); + output.flush(); +#endif } else { From 78917354d9bd23f279bd07f6feb01e2e1501f6c3 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 25 Oct 2020 01:23:29 +0800 Subject: [PATCH 035/205] Disable tmp debug feature --- ryzom/client/src/connection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 47c45984d..38a10d7e4 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -981,7 +981,7 @@ TInterfaceState globalMenu() while (PlayerWantToGoInGame == false) { - #if defined(NL_OS_WINDOWS) && defined(NL_DEBUG) + #if defined(NL_OS_WINDOWS) && defined(NL_DEBUG) && 0 // tmp for debug if (::GetAsyncKeyState(VK_SPACE)) { @@ -1067,7 +1067,7 @@ TInterfaceState globalMenu() nlSleep(ClientCfg.Sleep); } - #if defined(NL_OS_WINDOWS) && defined(NL_DEBUG) + #if defined(NL_OS_WINDOWS) && defined(NL_DEBUG) && 0 if (::GetAsyncKeyState(VK_CONTROL)) { pIM->displayUIViewBBoxs(""); From 06b430349c0b3d5150747c9f0f375fcc52517668 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 25 Oct 2020 01:55:35 +0800 Subject: [PATCH 036/205] Disconnect if UDP Login fails, ryzom/ryzomcore#622 --- ryzom/client/src/network_connection.cpp | 12 ++++++++++++ ryzom/client/src/network_connection.h | 1 + 2 files changed, 13 insertions(+) diff --git a/ryzom/client/src/network_connection.cpp b/ryzom/client/src/network_connection.cpp index 731677043..c1e9d8975 100644 --- a/ryzom/client/src/network_connection.cpp +++ b/ryzom/client/src/network_connection.cpp @@ -680,6 +680,7 @@ bool CNetworkConnection::connect(string &result) _LatestLoginTime = ryzomGetLocalTime (); _LatestSyncTime = _LatestLoginTime; _LatestProbeTime = _LatestLoginTime; + m_LoginAttempts = 0; nlinfo("CNET[%p]: Client connected to shard, attempting login", this); return true; @@ -1091,6 +1092,17 @@ bool CNetworkConnection::stateLogin() { sendSystemLogin(); _LatestLoginTime = _UpdateTime; + if (m_LoginAttempts > 24) + { + m_LoginAttempts = 0; + disconnect(); // will send disconnection message + nlwarning("CNET[%p]: Too many LOGIN attempts, connection problem", this); + return false; // exit now from loop, don't expect a new state + } + else + { + ++m_LoginAttempts; + } } return false; diff --git a/ryzom/client/src/network_connection.h b/ryzom/client/src/network_connection.h index d11702682..84bb26d43 100644 --- a/ryzom/client/src/network_connection.h +++ b/ryzom/client/src/network_connection.h @@ -822,6 +822,7 @@ private: void sendSystemLogin(); bool stateLogin(); NLMISC::TTime _LatestLoginTime; + int m_LoginAttempts; // void receiveSystemSync(NLMISC::CBitMemStream &msgin); From 2568b6f321507c9d5b8178d55eed8385fca6fd48 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 25 Oct 2020 01:56:10 +0800 Subject: [PATCH 037/205] Don't probe if normal received in probe state, otherwise server will not enter probe state, ryzom/ryzomcore#622, ryzom/ryzomcore#133 --- ryzom/client/src/network_connection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ryzom/client/src/network_connection.cpp b/ryzom/client/src/network_connection.cpp index c1e9d8975..4778641c0 100644 --- a/ryzom/client/src/network_connection.cpp +++ b/ryzom/client/src/network_connection.cpp @@ -2320,6 +2320,7 @@ bool CNetworkConnection::stateProbe() else { nlwarning("CNET[%p]: received normal in state Probe", this); + _LatestProbeTime = _UpdateTime; } } } From c252b56c93e5d7f18e66ace296d6a46fb84b93c3 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 25 Oct 2020 04:18:56 +0800 Subject: [PATCH 038/205] Fix crash on save file corruption --- ryzom/client/src/item_group_manager.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ryzom/client/src/item_group_manager.cpp b/ryzom/client/src/item_group_manager.cpp index fddba873f..83c8b4f5a 100644 --- a/ryzom/client/src/item_group_manager.cpp +++ b/ryzom/client/src/item_group_manager.cpp @@ -301,10 +301,18 @@ bool CItemGroupManager::loadGroups() NLMISC::CIFile f; f.open(userGroupFileName); NLMISC::CIXml xmlStream; - xmlStream.init(f); - // Actual loading xmlNodePtr globalEnclosing; - globalEnclosing = xmlStream.getRootNode(); + try + { + xmlStream.init(f); + // Actual loading + globalEnclosing = xmlStream.getRootNode(); + } + catch (const NLMISC::EXmlParsingError &ex) + { + nlwarning("Failed to parse '%s', skip", userGroupFileName.c_str()); + return false; + } if(!globalEnclosing) { nlwarning("no root element in item_group xml, skipping xml parsing"); From a3780e307ed084223b87af505d613bb2a61ed468 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 25 Oct 2020 05:44:08 +0800 Subject: [PATCH 039/205] Fix missing ghost components in animation loading mode, kaetemi/ryzomclassic#155 --- ryzom/client/src/r2/editor.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/ryzom/client/src/r2/editor.cpp b/ryzom/client/src/r2/editor.cpp index 96b935e34..036e77b21 100644 --- a/ryzom/client/src/r2/editor.cpp +++ b/ryzom/client/src/r2/editor.cpp @@ -212,14 +212,24 @@ CDynamicMapClient(eid, clientGateway, luaState) void CDynamicMapClientEventForwarder::nodeErased(const std::string& instanceId, const std::string& attrName, sint32 position) { //H_AUTO(R2_CDynamicMapClientEventForwarder_nodeErased) - if (getEditor().getMode() != CEditor::EditionMode) return; + if (getEditor().getMode() != CEditor::EditionMode) + { + nlassert(getEditor().getMode() != CEditor::AnimationModeLoading); /* Probably should not happen */ + nldebug("Node erased, but not in edition mode"); + return; + } getEditor().nodeErased(instanceId, attrName, position); } void CDynamicMapClientEventForwarder::nodeSet(const std::string& instanceId, const std::string& attrName, CObject* value) { //H_AUTO(R2_CDynamicMapClientEventForwarder_nodeSet) - if (getEditor().getMode() != CEditor::EditionMode) return; + if (getEditor().getMode() != CEditor::EditionMode + && getEditor().getMode() != CEditor::AnimationModeLoading /* Loading animation scenario from terminal, ghost nodes created by translator */) + { + nldebug("Node set, but not in edition mode"); + return; + } getEditor().nodeSet(instanceId, attrName, value); } @@ -227,7 +237,12 @@ void CDynamicMapClientEventForwarder::nodeInserted(const std::string& instanceId const std::string& key, CObject* value) { //H_AUTO(R2_CDynamicMapClientEventForwarder_nodeInserted) - if (getEditor().getMode() != CEditor::EditionMode) return; + if (getEditor().getMode() != CEditor::EditionMode + && getEditor().getMode() != CEditor::AnimationModeLoading /* Loading animation scenario from terminal, ghost nodes created by translator */) + { + nldebug("Node inserted, but not in edition mode"); + return; + } getEditor().nodeInserted(instanceId, attrName, position, key, value); } @@ -236,7 +251,12 @@ void CDynamicMapClientEventForwarder::nodeMoved( const std::string& destInstanceId, const std::string& destAttrName, sint32 destPosition) { //H_AUTO(R2_CDynamicMapClientEventForwarder_nodeMoved) - if (getEditor().getMode() != CEditor::EditionMode) return; + if (getEditor().getMode() != CEditor::EditionMode) + { + nlassert(getEditor().getMode() != CEditor::AnimationModeLoading); /* Probably should not happen */ + nldebug("Node moved, but not in edition mode"); + return; + } getEditor().nodeMoved(instanceId, attrName, position, destInstanceId, destAttrName, destPosition); } From b61ad76ac2dae962c42b7a85a43e8f44d6335df7 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 23:14:45 +0800 Subject: [PATCH 040/205] Fix R2 feature info checkbox, kaetemi/ryzomclassic#158 --- ryzom/client/data/gamedev/interfaces_v3/r2ed.xml | 4 ++-- ryzom/common/data_common/r2/r2_features.lua | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ryzom/client/data/gamedev/interfaces_v3/r2ed.xml b/ryzom/client/data/gamedev/interfaces_v3/r2ed.xml index 54021b5bf..a522c9df0 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/r2ed.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/r2ed.xml @@ -3064,13 +3064,13 @@ text_y="-2" - - + diff --git a/ryzom/common/data_common/r2/r2_features.lua b/ryzom/common/data_common/r2/r2_features.lua index e354c1280..53a63f6d9 100644 --- a/ryzom/common/data_common/r2/r2_features.lua +++ b/ryzom/common/data_common/r2/r2_features.lua @@ -1027,9 +1027,9 @@ r2.displayFeatureHelp = function(className) assert(nil) end - local checkBox = getUI("ui:interface:feature_help:content:custom_bbox_enabled") + local checkBox = getUI("ui:interface:feature_help:content:show_again") assert(checkBox) - local chkBoxText = getUI("ui:interface:feature_help:content:text_custom") + local chkBoxText = getUI("ui:interface:feature_help:content:show_again_label") assert(chkBoxText) if className == "Npc" then @@ -1082,21 +1082,21 @@ end function r2.setFeatureDisplayHelp() - local checkBox = getUI("ui:interface:feature_help:content:custom_bbox_enabled") + local checkBox = getUI("ui:interface:feature_help:content:show_again") assert(checkBox) - local isChecked = checkBox.pushed - debugInfo("checked: " ..tostring(isChecked)) + local showAgain = checkBox.pushed + --debugInfo("checked: " ..tostring(showAgain)) local ui = getUI("ui:interface:feature_help") local name = ui.Env.uc_title local len = string.len(name) - 10 - 6 local className = string.sub(name, -10-len, 6+len) --removing uiR2Ed and _HelpTitle --formName = formName .."Form" - + assert(className) --debugInfo("Form name: " ..formName) - if isChecked == false then + if showAgain then r2.setDisplayInfo(className, 1) else r2.setDisplayInfo(className, 0) end From 92ee96a783dca7d5bb468dc1165425c5a500b531 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 24 Oct 2020 23:19:37 +0800 Subject: [PATCH 041/205] Log the recorded history, kaetemi/ryzomclassic#152 --- ryzom/server/src/ai_service/state_instance.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ryzom/server/src/ai_service/state_instance.h b/ryzom/server/src/ai_service/state_instance.h index 8f472702b..c38b7530d 100644 --- a/ryzom/server/src/ai_service/state_instance.h +++ b/ryzom/server/src/ai_service/state_instance.h @@ -505,7 +505,9 @@ void CStateInstance::processStateEvent(CAIEvent const& stateEvent, CAIState cons if (getDebugHistory()->isRecording()) { - nldebug("Reaction for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 + nldebug("Reaction for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 + nldebug("STATE: '%s' EVENT: '%s' REACTION: '%s'", state->getAliasNode()->fullName().c_str(), + stateEvent.getName().c_str(), reaction.getAliasNode()->fullName().c_str()); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 getDebugHistory()->addHistory("STATE: '%s' EVENT: '%s' REACTION: '%s'", state->getAliasNode()->fullName().c_str(), stateEvent.getName().c_str(), reaction.getAliasNode()->fullName().c_str()); } @@ -514,13 +516,13 @@ void CStateInstance::processStateEvent(CAIEvent const& stateEvent, CAIState cons if (!reaction.getAction()) { - nldebug("Failed to find action for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 + nldebug("Failed to find action for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 nlwarning("Failed to find action for event: %s",reaction.getAliasNode()->fullName().c_str()); continue; } if (!reaction.getAction()->executeAction(this, NULL)) { - nldebug("Failed to execute action for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 + nldebug("Failed to execute action for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 nlwarning("Failed to execute action for event '%s': for stateInstance:'%s' in state:'%s'", stateEvent.getName().c_str(), aliasTreeOwner()->getAliasNode()->fullName().c_str(), state->getAliasNode()->fullName().c_str()); continue; @@ -531,7 +533,9 @@ void CStateInstance::processStateEvent(CAIEvent const& stateEvent, CAIState cons { if (getDebugHistory()->isRecording()) { - nldebug("No reaction for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 + nldebug("No reaction for event"); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 + nldebug("STATE: '%s' EVENT: '%s' NO REACTION", state->getAliasNode()->fullName().c_str(), + stateEvent.getName().c_str()); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152 getDebugHistory()->addHistory("STATE: '%s' EVENT: '%s' NO REACTION", state->getAliasNode()->fullName().c_str(), stateEvent.getName().c_str()); } From 277a854f8da809bb4482e8bc8ca86f5e4473a79a Mon Sep 17 00:00:00 2001 From: Xtarsia <69606701+Xtarsia@users.noreply.github.com> Date: Mon, 26 Oct 2020 15:00:30 +0000 Subject: [PATCH 042/205] Update widgets.xml Closes #157 --- ryzom/client/data/gamedev/interfaces_v3/widgets.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/data/gamedev/interfaces_v3/widgets.xml b/ryzom/client/data/gamedev/interfaces_v3/widgets.xml index b78ee1ff1..40ecda46f 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/widgets.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/widgets.xml @@ -1384,7 +1384,7 @@ - + From 973531f461d46ded593c4615c6575a96cb09c1a7 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 26 Oct 2020 03:55:36 +0800 Subject: [PATCH 043/205] UTF string view base, ryzom/ryzomcore#335 --- nel/include/nel/misc/types_nl.h | 8 +++ nel/include/nel/misc/utf_string_view.h | 95 ++++++++++++++++++++++++++ nel/src/misc/utf_string_view.cpp | 76 +++++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 nel/include/nel/misc/utf_string_view.h create mode 100644 nel/src/misc/utf_string_view.cpp diff --git a/nel/include/nel/misc/types_nl.h b/nel/include/nel/misc/types_nl.h index 73c05b3a5..b8fe8270a 100644 --- a/nel/include/nel/misc/types_nl.h +++ b/nel/include/nel/misc/types_nl.h @@ -552,6 +552,14 @@ typedef wchar_t ucchar; typedef uint16 ucchar; #endif +#ifdef NL_CPP14 +typedef char32_t u32char; +typedef std::u32string u32string; +#else +typedef uint32 u32char; +typedef std::basic_string u32string; +#endif + #ifndef NL_OVERRIDE #define NL_OVERRIDE override #endif diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h new file mode 100644 index 000000000..78df8c141 --- /dev/null +++ b/nel/include/nel/misc/utf_string_view.h @@ -0,0 +1,95 @@ +// NeL - MMORPG Framework +// Copyright (C) 2020 Jan BOON (Kaetemi) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef NLMISC_UTF_STRING_VIEW_H +#define NLMISC_UTF_STRING_VIEW_H + +#include +#include +#include +#include + +namespace NLMISC { + +/// 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. +/// Strings are not necessarily NUL-terminated. +class CUtfStringView +{ +public: + inline CUtfStringView(const char *utf8Str) : m_Str(utf8Str), m_Size(strlen(utf8Str)), m_Iterator(utf8Iterator) {} + inline CUtfStringView(const char *utf8Str, size_t len): m_Str(utf8Str), m_Size(len), m_Iterator(utf8Iterator) + { + nlassert(len <= strlen(utf8Str)); + } + + inline CUtfStringView(const std::string &utf8Str) : m_Str(utf8Str.c_str()), m_Size(utf8Str.size()), m_Iterator(utf8Iterator) {} + inline CUtfStringView(const ucstring &utf16Str) : m_Str(utf16Str.c_str()), m_Size(utf16Str.size() << 1), m_Iterator(utf16Iterator) {} + inline CUtfStringView(const u32string &utf32Str) : m_Str(utf32Str.c_str()), m_Size(utf32Str.size() << 2), m_Iterator(utf32Iterator) {} + + std::string toUtf8(); // Makes a copy + u32string toUtf32(); // Makes a copy + + inline bool isUtf8() { return m_Iterator == utf8Iterator; } + inline bool isUtf16() { return m_Iterator == utf16Iterator; } + inline bool isUtf32() { return m_Iterator == utf32Iterator; } + + struct const_iterator + { + public: + inline void operator++() + { + m_Char = m_View.m_Iterator(&m_Addr); + if ((ptrdiff_t)m_Addr > ((ptrdiff_t)m_View.m_Str + m_View.m_Size)) + { + m_Addr = 0; + m_Char = 0; + } + } + inline bool operator!=(const const_iterator &o) const { return m_Addr != o.m_Addr; } + inline bool operator==(const const_iterator &o) const { return m_Addr == o.m_Addr; } + inline const u32char &operator*() const { return m_Char; } + private: + friend class CUtfStringView; + inline const_iterator(const CUtfStringView &view, const void *addr) : m_View(view), m_Addr(addr), m_Char(addr ? view.m_Iterator(&m_Addr) : 0) { } + const CUtfStringView &m_View; + const void *m_Addr; // Next address + u32char m_Char; + }; + + typedef const_iterator iterator; + + iterator begin() const { return iterator(*this, m_Str); } + inline iterator end() const { return iterator(*this, NULL); } + +private: + typedef u32char (*TIterator)(const void **addr); + static u32char utf8Iterator(const void **addr); + static u32char utf16Iterator(const void **addr); + static u32char utf32Iterator(const void **addr); + + const void *const m_Str; + const size_t m_Size; + const TIterator m_Iterator; + +}; /* class CUtfStringView */ + +} /* namespace NLMISC */ + +#endif /* #ifndef NLMISC_STREAMED_PACKAGE_PROVIDER_H */ + +/* end of file */ diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp new file mode 100644 index 000000000..57dc5e226 --- /dev/null +++ b/nel/src/misc/utf_string_view.cpp @@ -0,0 +1,76 @@ +// NeL - MMORPG Framework +// Copyright (C) 2020 Jan BOON (Kaetemi) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "stdmisc.h" + +// Project includes +#include + +namespace NLMISC +{ + +std::string CUtfStringView::toUtf8() +{ + if (m_Iterator == utf8Iterator) + return std::string((const char *)m_Str, (const char *)((ptrdiff_t)m_Str + m_Size)); + std::string res; + res.reserve((m_Size << 1) + 1); + for (iterator it(begin()), end(end()); it != end; ++it) + { + u32char c = *it; + res += (char)c; /* TODO: Encode UTF-8 */ + } +} + +u32string CUtfStringView::toUtf32() +{ + if (m_Iterator == utf32Iterator) + return u32string((const u32char *)m_Str, (const u32char *)((ptrdiff_t)m_Str + m_Size)); + u32string res; + res.reserve(m_Size + 1); + for (iterator it(begin()), end(end()); it != end; ++it) + res += *it; +} + +u32char CUtfStringView::utf8Iterator(const void **addr) +{ + /* TODO: Decode UTF-8 */ + const ucchar **pp = reinterpret_cast(addr); + ucchar c = **pp; + ++(*pp); + return c; +} + +u32char CUtfStringView::utf16Iterator(const void **addr) +{ + /* TODO: Decode UTF-16 */ + const ucchar **pp = reinterpret_cast(addr); + ucchar c = **pp; + ++(*pp); + return c; +} + +u32char CUtfStringView::utf32Iterator(const void **addr) +{ + const u32char **pp = reinterpret_cast(addr); + u32char c = **pp; + ++(*pp); + return c; +} + +} /* namespace NLMISC */ + +/* end of file */ From 81143cdf438cc7e3b8e54e97dafcac03b82a028c Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 01:03:02 +0800 Subject: [PATCH 044/205] Proper UTF encoding, ryzom/ryzomcore#335 --- nel/include/nel/misc/ucstring.h | 5 + nel/include/nel/misc/utf_string_view.h | 18 +-- nel/src/misc/ucstring.cpp | 131 +-------------------- nel/src/misc/utf_string_view.cpp | 154 ++++++++++++++++++++++--- 4 files changed, 157 insertions(+), 151 deletions(-) diff --git a/nel/include/nel/misc/ucstring.h b/nel/include/nel/misc/ucstring.h index 8859a21d9..28c83ce2f 100644 --- a/nel/include/nel/misc/ucstring.h +++ b/nel/include/nel/misc/ucstring.h @@ -46,6 +46,11 @@ public: { } + ucstring(const ucchar *begin, const ucchar *end) + : ucstringbase(begin, end) + { + } + ucstring(const std::string &str) : ucstringbase() { diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index 78df8c141..503fc3737 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -19,7 +19,6 @@ #include #include -#include #include namespace NLMISC { @@ -27,7 +26,7 @@ namespace NLMISC { /// 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. -/// Strings are not necessarily NUL-terminated. +/// Strings are not required to be NUL-terminated, but must have at least one character extra. class CUtfStringView { public: @@ -41,12 +40,13 @@ public: inline CUtfStringView(const ucstring &utf16Str) : m_Str(utf16Str.c_str()), m_Size(utf16Str.size() << 1), m_Iterator(utf16Iterator) {} inline CUtfStringView(const u32string &utf32Str) : m_Str(utf32Str.c_str()), m_Size(utf32Str.size() << 2), m_Iterator(utf32Iterator) {} - std::string toUtf8(); // Makes a copy - u32string toUtf32(); // Makes a copy + std::string toUtf8(bool reEncode = false) const; // Makes a copy + ucstring toUtf16(bool reEncode = false) const; // Makes a copy + u32string toUtf32() const; // Makes a copy - inline bool isUtf8() { return m_Iterator == utf8Iterator; } - inline bool isUtf16() { return m_Iterator == utf16Iterator; } - inline bool isUtf32() { return m_Iterator == utf32Iterator; } + inline bool isUtf8() const { return m_Iterator == utf8Iterator; } + inline bool isUtf16() const { return m_Iterator == utf16Iterator; } + inline bool isUtf32() const { return m_Iterator == utf32Iterator; } struct const_iterator { @@ -82,8 +82,8 @@ private: static u32char utf16Iterator(const void **addr); static u32char utf32Iterator(const void **addr); - const void *const m_Str; - const size_t m_Size; + const void *const m_Str; // String + const size_t m_Size; // Size in bytes const TIterator m_Iterator; }; /* class CUtfStringView */ diff --git a/nel/src/misc/ucstring.cpp b/nel/src/misc/ucstring.cpp index 5fad643ce..79cf78f7e 100644 --- a/nel/src/misc/ucstring.cpp +++ b/nel/src/misc/ucstring.cpp @@ -16,6 +16,7 @@ #include "stdmisc.h" #include "nel/misc/ucstring.h" +#include "nel/misc/utf_string_view.h" void ucstring::toString(std::string &str) const { @@ -31,138 +32,12 @@ void ucstring::toString(std::string &str) const std::string ucstring::toUtf8() const { -#if defined(NL_OS_WINDOWS) - // Use OS implementation - nlctassert(sizeof(wchar_t) == sizeof(ucchar)); - nlctassert(sizeof(wchar_t) == sizeof(uint16)); - return NLMISC::wideToUtf8(static_cast(*this)); -#else - std::string res; - ucstring::const_iterator first(begin()), last(end()); - for (; first != last; ++first) - { - //ucchar c = *first; - uint nbLoop = 0; - if (*first < 0x80) - res += char(*first); - else if (*first < 0x800) - { - ucchar c = *first; - c = c >> 6; - c = c & 0x1F; - res += char(c) | 0xC0; - nbLoop = 1; - } - else /*if (*first < 0x10000)*/ - { - ucchar c = *first; - c = c >> 12; - c = c & 0x0F; - res += char(c) | 0xE0; - nbLoop = 2; - } - - for (uint i = 0; i < nbLoop; ++i) - { - ucchar c = *first; - c = c >> ((nbLoop - i - 1) * 6); - c = c & 0x3F; - res += char(c) | 0x80; - } - } - return res; -#endif + return NLMISC::CUtfStringView(*this).toUtf8(); } void ucstring::fromUtf8(const std::string &stringUtf8) { -#if defined(NL_OS_WINDOWS) - // Use OS implementation - nlctassert(sizeof(wchar_t) == sizeof(ucchar)); - nlctassert(sizeof(wchar_t) == sizeof(uint16)); - nlctassert(sizeof(std::wstring) == sizeof(ucstring)); // These can be swapped on Windows - static_cast(*this) = nlmove(NLMISC::utf8ToWide(stringUtf8)); - if (stringUtf8.size() && !size()) - rawCopy(stringUtf8); -#else - // clear the string - erase(); - - uint8 c; - ucchar code; - sint iterations = 0; - - std::string::const_iterator first(stringUtf8.begin()), last(stringUtf8.end()); - for (; first != last;) - { - c = *first++; - code = c; - - if ((code & 0xFE) == 0xFC) - { - code &= 0x01; - iterations = 5; - } - else if ((code & 0xFC) == 0xF8) - { - code &= 0x03; - iterations = 4; - } - else if ((code & 0xF8) == 0xF0) - { - code &= 0x07; - iterations = 3; - } - else if ((code & 0xF0) == 0xE0) - { - code &= 0x0F; - iterations = 2; - } - else if ((code & 0xE0) == 0xC0) - { - code &= 0x1F; - iterations = 1; - } - else if ((code & 0x80) == 0x80) - { - // If it's not a valid UTF8 string, just copy the line without utf8 conversion - rawCopy(stringUtf8); - return; - } - else - { - push_back(code); - iterations = 0; - } - - if (iterations) - { - for (sint i = 0; i < iterations; i++) - { - if (first == last) - { - // If it's not a valid UTF8 string, just copy the line without utf8 conversion - rawCopy(stringUtf8); - return; - } - - uint8 ch; - ch = *first++; - - if ((ch & 0xC0) != 0x80) - { - // If it's not a valid UTF8 string, just copy the line without utf8 conversion - rawCopy(stringUtf8); - return; - } - - code <<= 6; - code |= (ucchar)(ch & 0x3F); - } - push_back(code); - } - } -#endif + *this = NLMISC::CUtfStringView(stringUtf8).toUtf16(); } void ucstring::rawCopy(const std::string &str) diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp index 57dc5e226..ee5fdf089 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -19,52 +19,178 @@ // Project includes #include +// References: +// - https://twiserandom.com/unicode/unicode-encoding-utf-8-utf-16-utf-32/ +// - https://www.compart.com/en/unicode/U+1F30D +// - 0xF0 0x9F 0x8C 0x8D +// - 0xD83C 0xDF0D +// - 0x0001F30D + namespace NLMISC { -std::string CUtfStringView::toUtf8() +std::string CUtfStringView::toUtf8(bool reEncode) const { - if (m_Iterator == utf8Iterator) + // Decode UTF and encode UTF-8 + // This implementation makes no attempt at fixing invalid codepoints + if (m_Iterator == utf8Iterator && !reEncode) return std::string((const char *)m_Str, (const char *)((ptrdiff_t)m_Str + m_Size)); std::string res; - res.reserve((m_Size << 1) + 1); + res.reserve(m_Size); + for (iterator it(begin()), end(end()); it != end; ++it) + { + u32char c = *it; + if (c < 0x80) + { + // Encode as 1 byte + res += (char)c; + } + else if (c < 0x0800) + { + // Encode as 2 bytes + res += (char)((c & 0x07C0) >> 6) | 0xC0; + res += (char)(c & 0x3F) | 0x80; + } + else if (c < 0x010000) + { + // Encode as 3 bytes + res += (char)((c & 0xF000) >> 12) | 0xE0; + res += (char)((c & 0x0FC0) >> 6) | 0x80; + res += (char)(c & 0x3F) | 0x80; + } + else + { + // Encode as 4 bytes + res += (char)((c & 0x1C0000) >> 18) | 0xF0; + res += (char)((c & 0x03F000) >> 12) | 0x80; + res += (char)((c & 0x0FC0) >> 6) | 0x80; + res += (char)(c & 0x3F) | 0x80; + } + } + return res; +} + +ucstring CUtfStringView::toUtf16(bool reEncode) const +{ + if (m_Iterator == utf16Iterator && !reEncode) + return ucstring((const ucchar *)m_Str, (const ucchar *)((ptrdiff_t)m_Str + m_Size)); + ucstring res; + res.reserve(m_Size << 1); for (iterator it(begin()), end(end()); it != end; ++it) { u32char c = *it; - res += (char)c; /* TODO: Encode UTF-8 */ + if (c < 0x10000) + { + res += c; + } + else + { + c -= 0x10000; + res += (c >> 10) | 0xD800; + res += (c & 0x3FF) | 0xDC00; + } } + return res; } -u32string CUtfStringView::toUtf32() +u32string CUtfStringView::toUtf32() const { + // Decode any UTF + // This implementation makes no attempt at fixing bad encoding if (m_Iterator == utf32Iterator) return u32string((const u32char *)m_Str, (const u32char *)((ptrdiff_t)m_Str + m_Size)); u32string res; - res.reserve(m_Size + 1); + res.reserve(m_Size << 2); for (iterator it(begin()), end(end()); it != end; ++it) res += *it; + return res; } u32char CUtfStringView::utf8Iterator(const void **addr) { - /* TODO: Decode UTF-8 */ - const ucchar **pp = reinterpret_cast(addr); - ucchar c = **pp; + // Decode UTF-8 + // This implementation makes no attempt at fixing bad encoding, except for bad UTF-16 surrogate pairs + const uint8 **pp = reinterpret_cast(addr); + u32char c0 = **pp; ++(*pp); - return c; + if ((c0 & 0xC0) == 0xC0) + { + uint8 cx = **pp; + if ((cx & 0xC0) == 0x80) + { + ++(*pp); + c0 &= 0x3F; // Drop first two bits + c0 <<= 6; + c0 |= (cx & 0x3F); // 12 bits now (6 + 6), 2-byte encoding + if (c0 & 0x800) + { + cx = **pp; + if ((cx & 0xC0) == 0x80) + { + ++(*pp); + c0 &= 0x07FF; // Drop first bit + c0 <<= 6; + c0 |= (cx & 0x3F); // 17 bits now (12 - 1 + 6), 3-byte encoding + if (c0 & 0x10000) + { + cx = **pp; + if ((cx & 0xC0) == 0x80) + { + ++(*pp); + c0 &= 0xFFFF; // Drop first bit + c0 <<= 6; + c0 |= (cx & 0x3F); // 22 bits now (17 - 1 + 6), 3-byte encoding + } + } + else if ((c0 & 0xFC00) == 0xD800) // Higher bits of nutcase UTF-16 encoded as UTF-8 + { + uint8 cy; + if ((*pp)[0] == 0xED && ((cx = (*pp)[1]) & 0xF0) == 0xB0 && ((cy = (*pp)[2]) & 0xC0) == 0x80) + { + // Lower bits of nutcase UTF-16 encoded as UTF-8 + (*pp) += 3; + uint16 c1 = (cx & 0x0F); + c1 <<= 6; + c1 |= (cy & 0x3F); + c0 &= 0x03FF; + c0 <<= 10; + c0 |= (c1 & 0x03FF); + c0 += 0x10000; + } + } + } + } + } + } + return c0; } u32char CUtfStringView::utf16Iterator(const void **addr) { - /* TODO: Decode UTF-16 */ - const ucchar **pp = reinterpret_cast(addr); - ucchar c = **pp; + // Decode UTF-16 + // This implementation makes no attempt at fixing bad encoding + const uint16 **pp = reinterpret_cast(addr); + u32char c0 = **pp; ++(*pp); - return c; + if ((c0 & 0xFC00) == 0xD800) // Higher bits + { + uint16 c1 = **pp; + if ((c1 & 0xFC00) == 0xDC00) // Lower bits + { + ++(*pp); + c0 &= 0x03FF; + c0 <<= 10; + c0 |= (c1 & 0x03FF); + c0 += 0x10000; + } + } + return c0; } u32char CUtfStringView::utf32Iterator(const void **addr) { + // UTF-32 + // This implementation makes no attempt at fixing bad encoding const u32char **pp = reinterpret_cast(addr); u32char c = **pp; ++(*pp); From 8fc6ec3b3554e95e509979353a4f28b66a2cd55c Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 01:03:13 +0800 Subject: [PATCH 045/205] Show box character instead of dot --- nel/src/3d/font_generator.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nel/src/3d/font_generator.cpp b/nel/src/3d/font_generator.cpp index 44d8f5ab0..0bad785a6 100644 --- a/nel/src/3d/font_generator.cpp +++ b/nel/src/3d/font_generator.cpp @@ -307,11 +307,13 @@ uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, bool embolden, bool obl // retrieve glyph index from character code FT_UInt glyph_index = FT_Get_Char_Index (_Face, c); + /* if (glyph_index == 0) { // no glyph available, replace with a dot glyph_index = FT_Get_Char_Index (_Face, ucchar('.')); } + */ // load glyph image into the slot (erase previous one) error = FT_Load_Glyph (_Face, glyph_index, FT_LOAD_DEFAULT); From 25049eaead0d2cf2cb9e0d902923a7195e09663a Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 01:15:16 +0800 Subject: [PATCH 046/205] Complete some missing implementation for wide strings --- nel/include/nel/misc/utf_string_view.h | 15 ++++++++++++ nel/src/misc/string_common.cpp | 9 ++++--- nel/src/misc/utf_string_view.cpp | 33 ++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index 503fc3737..e972ca7cf 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -35,6 +35,19 @@ public: { nlassert(len <= strlen(utf8Str)); } +#if defined(NL_OS_WINDOWS) + inline CUtfStringView(const wchar_t *utf16Str) : m_Str(utf16Str), m_Size(wcslen(utf16Str)), m_Iterator(utf16Iterator) {} + inline CUtfStringView(const wchar_t *utf16Str, size_t len): m_Str(utf16Str), m_Size(len), m_Iterator(utf16Iterator) + { + nlassert(len <= wcslen(utf16Str)); + } +#else + inline CUtfStringView(const wchar_t *utf32Str) : m_Str(utf32Str), m_Size(wcslen(utf32Str)), m_Iterator(utf32Iterator) {} + inline CUtfStringView(const wchar_t *utf32Str, size_t len): m_Str(utf32Str), m_Size(len), m_Iterator(utf32Iterator) + { + nlassert(len <= wcslen(utf32Str)); + } +#endif inline CUtfStringView(const std::string &utf8Str) : m_Str(utf8Str.c_str()), m_Size(utf8Str.size()), m_Iterator(utf8Iterator) {} inline CUtfStringView(const ucstring &utf16Str) : m_Str(utf16Str.c_str()), m_Size(utf16Str.size() << 1), m_Iterator(utf16Iterator) {} @@ -44,6 +57,8 @@ public: ucstring toUtf16(bool reEncode = false) const; // Makes a copy u32string toUtf32() const; // Makes a copy + std::wstring toWide() const; // Platform dependent, UTF-16 or UTF-32. Makes a copy. + inline bool isUtf8() const { return m_Iterator == utf8Iterator; } inline bool isUtf16() const { return m_Iterator == utf16Iterator; } inline bool isUtf32() const { return m_Iterator == utf32Iterator; } diff --git a/nel/src/misc/string_common.cpp b/nel/src/misc/string_common.cpp index 93122cc70..f869a5d35 100644 --- a/nel/src/misc/string_common.cpp +++ b/nel/src/misc/string_common.cpp @@ -21,6 +21,7 @@ #include "nel/misc/string_common.h" #include "nel/misc/sstring.h" +#include "nel/misc/utf_string_view.h" using namespace std; @@ -228,8 +229,7 @@ std::string wideToUtf8(const wchar_t *str, size_t len) #if defined(NL_OS_WINDOWS) return winWideToCp(str, len, CP_UTF8); #else - // TODO: UTF-32 to UTF-8 - nlassert(false); + return CUtfStringView(str, len).toUtf8(); #endif } @@ -242,10 +242,9 @@ std::string wideToUtf8(const std::wstring &str) std::wstring utf8ToWide(const char *str, size_t len) { #if defined(NL_OS_WINDOWS) - return winCpToWide(str, len, CP_UTF8); + return winCpToWide(str, len, CP_UTF8); // UTF-16 #else - // TODO: UTF-8 to UTF-32 - nlassert(false); + return CUtfStringView(str, len).toWide(); // UTF-32 #endif } diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp index ee5fdf089..db2ea7cec 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -106,6 +106,39 @@ u32string CUtfStringView::toUtf32() const return res; } +std::wstring CUtfStringView::toWide() const +{ +#ifdef NL_OS_WINDOWS + if (m_Iterator == utf16Iterator) + return std::wstring((const wchar_t *)m_Str, (const wchar_t *)((ptrdiff_t)m_Str + m_Size)); + std::wstring res; + res.reserve(m_Size << 1); + for (iterator it(begin()), end(end()); it != end; ++it) + { + u32char c = *it; + if (c < 0x10000) + { + res += c; + } + else + { + c -= 0x10000; + res += (c >> 10) | 0xD800; + res += (c & 0x3FF) | 0xDC00; + } + } + return res; +#else + if (m_Iterator == utf32Iterator) + return std::wstring((const wchar_t *)m_Str, (const wchar_t *)((ptrdiff_t)m_Str + m_Size)); + std::wstring res; + res.reserve(m_Size << 2); + for (iterator it(begin()), end(end()); it != end; ++it) + res += *it; + return res; +#endif +} + u32char CUtfStringView::utf8Iterator(const void **addr) { // Decode UTF-8 From dca59073aa4121819a080cb5bec367db8c32c7d9 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 01:15:49 +0800 Subject: [PATCH 047/205] Use platform wide string interface for platform api, not ucstring --- nel/src/misc/path.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/nel/src/misc/path.cpp b/nel/src/misc/path.cpp index a2f817210..2e3aacae6 100644 --- a/nel/src/misc/path.cpp +++ b/nel/src/misc/path.cpp @@ -2790,16 +2790,13 @@ bool CPath::isAbsolutePath(const std::string &path) bool CFile::setRWAccess(const std::string &filename) { #ifdef NL_OS_WINDOWS - ucstring ucFile; - ucFile.fromUtf8(filename); - - wchar_t *wideFile = (wchar_t*)ucFile.c_str(); + std::wstring wideFile = NLMISC::utf8ToWide(filename); // if the file exists and there's no write access - if (_waccess (wideFile, 00) == 0 && _waccess (wideFile, 06) == -1) + if (_waccess (wideFile.c_str(), 00) == 0 && _waccess (wideFile.c_str(), 06) == -1) { // try to set the read/write access - if (_wchmod (wideFile, _S_IREAD | _S_IWRITE) == -1) + if (_wchmod (wideFile.c_str(), _S_IREAD | _S_IWRITE) == -1) { if (INelContext::getInstance().getAlreadyCreateSharedAmongThreads()) { @@ -2822,6 +2819,7 @@ bool CFile::setRWAccess(const std::string &filename) return false; } } +#endif else { if (INelContext::getInstance().getAlreadyCreateSharedAmongThreads()) @@ -2830,7 +2828,6 @@ bool CFile::setRWAccess(const std::string &filename) } // return false; } -#endif return true; } From 1a045e437e9b1a11f28711e3749696c99f0235e1 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 02:47:44 +0800 Subject: [PATCH 048/205] Accept any UTF string in NL3D text rendering, support UTF-32 characters, ryzom/ryzomcore#335 --- nel/include/nel/3d/computed_string.h | 2 +- nel/include/nel/3d/font_generator.h | 8 ++--- nel/include/nel/3d/font_manager.h | 7 +++-- nel/include/nel/3d/text_context.h | 14 ++++----- nel/include/nel/3d/text_context_user.h | 8 ++--- nel/include/nel/3d/texture_font.h | 4 +-- nel/include/nel/3d/u_text_context.h | 10 +++--- nel/include/nel/misc/utf_string_view.h | 7 +++++ nel/src/3d/font_generator.cpp | 24 +++++++-------- nel/src/3d/font_manager.cpp | 42 ++++++++------------------ nel/src/3d/text_context.cpp | 8 ++--- nel/src/3d/text_context_user.cpp | 18 +++++------ 12 files changed, 72 insertions(+), 80 deletions(-) diff --git a/nel/include/nel/3d/computed_string.h b/nel/include/nel/3d/computed_string.h index 3f27a2879..c4404f661 100644 --- a/nel/include/nel/3d/computed_string.h +++ b/nel/include/nel/3d/computed_string.h @@ -181,7 +181,7 @@ public: CVertexBuffer Vertices; CMaterial *Material; CRGBA Color; - ucstring Text; + std::string Text; uint32 CacheVersion; diff --git a/nel/include/nel/3d/font_generator.h b/nel/include/nel/3d/font_generator.h index b69249d58..ea737afab 100644 --- a/nel/include/nel/3d/font_generator.h +++ b/nel/include/nel/3d/font_generator.h @@ -64,17 +64,17 @@ public: * \param height height of the generated bitmap, this value is set by this function * \param pitch pitch of the generated bitmap (+ or - the number of bytes per row), this value is set by this function */ - uint8 *getBitmap (ucchar c, uint32 size, bool embolden, bool oblique, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex); + uint8 *getBitmap (u32char c, uint32 size, bool embolden, bool oblique, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex); /** returns the width and height of a character using a specific size and * * \warning this function is not very fast (but faster than getBitmap()) because it has to load the char before. */ - void getSizes (ucchar c, uint32 size, uint32 &width, uint32 &height); + void getSizes (u32char c, uint32 size, uint32 &width, uint32 &height); - void getKerning (ucchar left, ucchar right, sint32 &kernx); + void getKerning (u32char left, u32char right, sint32 &kernx); - uint32 getCharIndex (ucchar c); + uint32 getCharIndex (u32char c); uint32 getUID() { return _UID; } diff --git a/nel/include/nel/3d/font_manager.h b/nel/include/nel/3d/font_manager.h index 663e9d23a..53310e95a 100644 --- a/nel/include/nel/3d/font_manager.h +++ b/nel/include/nel/3d/font_manager.h @@ -19,6 +19,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/smart_ptr.h" +#include "nel/misc/utf_string_view.h" #include "nel/3d/texture.h" #include "nel/3d/material.h" #include "nel/3d/texture_font.h" @@ -111,6 +112,7 @@ public: * \param output computed string * \param keep800x600Ratio true if you want that CFontManager look at Driver window size, and resize fontSize so it keeps same size... */ + /* void computeString (const std::string& s, CFontGenerator *fontGen, const NLMISC::CRGBA &color, @@ -120,11 +122,12 @@ public: IDriver *driver, CComputedString& output, bool keep800x600Ratio= true); + */ /** * Same as computeString but works with a unicode string (ucstring) */ - void computeString (const ucstring &s, + void computeString (NLMISC::CUtfStringView sv, CFontGenerator *fontGen, const NLMISC::CRGBA &color, uint32 fontSize, @@ -137,7 +140,7 @@ public: /** * Same as computeString but do not make vertex buffers and primitives */ - void computeStringInfo (const ucstring &s, + void computeStringInfo (NLMISC::CUtfStringView sv, CFontGenerator *fontGen, const NLMISC::CRGBA &color, uint32 fontSize, diff --git a/nel/include/nel/3d/text_context.h b/nel/include/nel/3d/text_context.h index 1eb256855..b18747e9a 100644 --- a/nel/include/nel/3d/text_context.h +++ b/nel/include/nel/3d/text_context.h @@ -134,7 +134,7 @@ public: uint32 textPush (const char *format, ...); /// computes an ucstring and adds the result to the cache (return the index) - uint32 textPush (const ucstring &str); + uint32 textPush (NLMISC::CUtfStringView sv); /// remove a string from the cache void erase (uint32 index); @@ -262,12 +262,12 @@ public: } /// Directly print a string - void printAt (float x, float z, const ucstring &ucstr) + void printAt (float x, float z, NLMISC::CUtfStringView sv) { nlassert(_FontGen); // compute the string just one time - _FontManager->computeString (ucstr, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, _TempString, _Keep800x600Ratio); + _FontManager->computeString (sv, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, _TempString, _Keep800x600Ratio); // draw shaded if (_Shaded) @@ -372,14 +372,14 @@ public: * \param an ucstring * \param the computed string */ - void computeString (const ucstring& s, CComputedString& output) + void computeString (NLMISC::CUtfStringView sv, CComputedString& output) { - _FontManager->computeString (s, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio); + _FontManager->computeString (sv, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio); } - void computeStringInfo (const ucstring& s, CComputedString& output) + void computeStringInfo (NLMISC::CUtfStringView sv, CComputedString& output) { - _FontManager->computeStringInfo (s, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio); + _FontManager->computeStringInfo (sv, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio); } /// Debug : write to the disk the texture cache diff --git a/nel/include/nel/3d/text_context_user.h b/nel/include/nel/3d/text_context_user.h index 2a167b2e9..951f5b154 100644 --- a/nel/include/nel/3d/text_context_user.h +++ b/nel/include/nel/3d/text_context_user.h @@ -97,13 +97,13 @@ public: */ // @{ uint32 textPush(const char *format, ...) ; - uint32 textPush(const ucstring &str) ; + uint32 textPush(NLMISC::CUtfStringView sv) ; void setStringColor(uint32 i, CRGBA newCol); void setStringSelection(uint32 i, uint32 selectStart, uint32 selectSize); void resetStringSelection(uint32 i); void erase(uint32 i) ; virtual CStringInfo getStringInfo (uint32 i); - virtual CStringInfo getStringInfo (const ucstring &ucstr); + virtual CStringInfo getStringInfo (NLMISC::CUtfStringView sv); void clear() ; void printAt(float x, float y, uint32 i) ; @@ -111,10 +111,10 @@ public: void printClipAtUnProjected(URenderStringBuffer &renderBuffer, class NL3D::CFrustum &frustum, const NLMISC::CMatrix &scaleMatrix, float x, float y, float depth, uint32 i, float xmin, float ymin, float xmax, float ymax); void printClipAtOld (float x, float y, uint32 i, float xmin, float ymin, float xmax, float ymax); - void printAt(float x, float y, const ucstring &ucstr) ; + void printAt(float x, float y, NLMISC::CUtfStringView sv) ; void printfAt(float x, float y, const char * format, ...) ; - void render3D(const CMatrix &mat, const ucstring &ucstr) ; + void render3D(const CMatrix &mat, NLMISC::CUtfStringView sv) ; void render3D(const CMatrix &mat, const char *format, ...) ; float getLastXBound() const ; diff --git a/nel/include/nel/3d/texture_font.h b/nel/include/nel/3d/texture_font.h index 865615b63..5b0796721 100644 --- a/nel/include/nel/3d/texture_font.h +++ b/nel/include/nel/3d/texture_font.h @@ -69,7 +69,7 @@ public: // Holds info for glyphs displayed on screen struct SLetterInfo { - ucchar Char; + u32char Char; sint Size; bool Embolden; bool Oblique; @@ -94,7 +94,7 @@ public: struct SLetterKey { - ucchar Char; + u32char Char; sint Size; bool Embolden; bool Oblique; diff --git a/nel/include/nel/3d/u_text_context.h b/nel/include/nel/3d/u_text_context.h index cdde02f82..829e80844 100644 --- a/nel/include/nel/3d/u_text_context.h +++ b/nel/include/nel/3d/u_text_context.h @@ -24,7 +24,7 @@ #include "nel/misc/rgba.h" #include "nel/misc/ucstring.h" #include "nel/misc/matrix.h" - +#include "nel/misc/utf_string_view.h" namespace NL3D { @@ -248,7 +248,7 @@ public: * \param an ucstring * \return the index where computed string has been inserted */ - virtual uint32 textPush (const ucstring &str) = 0; + virtual uint32 textPush (NLMISC::CUtfStringView sv) = 0; /** * set the color of a string. */ @@ -274,7 +274,7 @@ public: * Get a string information from the ucstring * The returned string info is in pixel size per default. */ - virtual CStringInfo getStringInfo (const ucstring &ucstr) = 0; + virtual CStringInfo getStringInfo (NLMISC::CUtfStringView sv) = 0; /** * empty the map */ @@ -299,7 +299,7 @@ public: /** * compute and print a ucstring at the location (2D method) x/y E [0,1] */ - virtual void printAt (float x, float y, const ucstring &ucstr) = 0; + virtual void printAt (float x, float y, NLMISC::CUtfStringView sv) = 0; /** * compute and print a string at the location (2D method) x/y E [0,1] */ @@ -309,7 +309,7 @@ public: * compute and render a ucstring at the location (3D method) * render3D() use UDriver Matrix context for Frustum/ViewMatrix, but use its own modelmatrix (mat). */ - virtual void render3D (const NLMISC::CMatrix &mat, const ucstring &ucstr) = 0; + virtual void render3D (const NLMISC::CMatrix &mat, NLMISC::CUtfStringView sv) = 0; /** * compute and render a string at the location (3D method) * render3D() use UDriver Matrix context for Frustum/ViewMatrix, but use its own modelmatrix (mat). diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index e972ca7cf..cc726bb33 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -91,6 +91,13 @@ public: iterator begin() const { return iterator(*this, m_Str); } inline iterator end() const { return iterator(*this, NULL); } + /// Largest possible number of characters in this string. + /// Number of actual characters may be less or equal. + inline size_t largestSize() const { return m_Size; } + + inline bool empty() const { return !m_Size; } + const void *ptr() const { return m_Str; } + private: typedef u32char (*TIterator)(const void **addr); static u32char utf8Iterator(const void **addr); diff --git a/nel/src/3d/font_generator.cpp b/nel/src/3d/font_generator.cpp index 0bad785a6..86a233f22 100644 --- a/nel/src/3d/font_generator.cpp +++ b/nel/src/3d/font_generator.cpp @@ -256,7 +256,7 @@ CFontGenerator::~CFontGenerator () } } -void CFontGenerator::getSizes (ucchar c, uint32 size, uint32 &width, uint32 &height) +void CFontGenerator::getSizes (u32char c, uint32 size, uint32 &width, uint32 &height) { FT_Error error; @@ -272,7 +272,7 @@ void CFontGenerator::getSizes (ucchar c, uint32 size, uint32 &width, uint32 &hei if (glyph_index == 0) { // no glyph available, replace with a dot - glyph_index = FT_Get_Char_Index (_Face, ucchar('.')); + glyph_index = FT_Get_Char_Index (_Face, u32char('.')); } // load glyph image into the slot (erase previous one) @@ -294,7 +294,7 @@ void CFontGenerator::getSizes (ucchar c, uint32 size, uint32 &width, uint32 &hei height = _Face->glyph->metrics.height >> 6; } -uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, bool embolden, bool oblique, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex) +uint8 *CFontGenerator::getBitmap (u32char c, uint32 size, bool embolden, bool oblique, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex) { FT_Error error; @@ -311,7 +311,7 @@ uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, bool embolden, bool obl if (glyph_index == 0) { // no glyph available, replace with a dot - glyph_index = FT_Get_Char_Index (_Face, ucchar('.')); + glyph_index = FT_Get_Char_Index (_Face, u32char('.')); } */ @@ -374,7 +374,7 @@ uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, bool embolden, bool obl -void CFontGenerator::getKerning (ucchar left, ucchar right, sint32 &kernx) +void CFontGenerator::getKerning (u32char left, u32char right, sint32 &kernx) { if (!FT_HAS_KERNING(_Face)) { @@ -394,14 +394,14 @@ void CFontGenerator::getKerning (ucchar left, ucchar right, sint32 &kernx) -uint32 CFontGenerator::getCharIndex (ucchar c) +uint32 CFontGenerator::getCharIndex (u32char c) { uint32 ret = FT_Get_Char_Index(_Face, c); if (ret == 0) { // no glyph available, replace with a dot - ret = FT_Get_Char_Index (_Face, ucchar('.')); + ret = FT_Get_Char_Index (_Face, u32char('.')); } return ret; @@ -475,14 +475,14 @@ CFontGenerator::~CFontGenerator () DeleteDC (hdcDib); } -void CFontGenerator::getSizes (ucchar c, uint32 size, uint32 &width, uint32 &height) +void CFontGenerator::getSizes (u32char c, uint32 size, uint32 &width, uint32 &height) { } HFONT hFont = NULL; uint32 CurrentFontSize = 0; -uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, bool embolden, bool oblique, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex) +uint8 *CFontGenerator::getBitmap (u32char c, uint32 size, bool embolden, bool oblique, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex) { if (size == 0) { @@ -529,7 +529,7 @@ uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, bool embolden, bool obl SelectObject (hdcDib, hFont); SelectObject (hdcDib, Dib); - const ucchar cc = /*(char)*/ c; + const u32char cc = /*(char)*/ c; // prevent outputing white glyph if char is not available in font DWORD glyphIndex; @@ -639,13 +639,13 @@ uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, bool embolden, bool obl -void CFontGenerator::getKerning (ucchar left, ucchar right, sint32 &kernx) +void CFontGenerator::getKerning (u32char left, u32char right, sint32 &kernx) { } -uint32 CFontGenerator::getCharIndex (ucchar c) +uint32 CFontGenerator::getCharIndex (u32char c) { return 0; } diff --git a/nel/src/3d/font_manager.cpp b/nel/src/3d/font_manager.cpp index d00ebb8f5..d467c69d1 100644 --- a/nel/src/3d/font_manager.cpp +++ b/nel/src/3d/font_manager.cpp @@ -63,27 +63,8 @@ CMaterial* CFontManager::getFontMaterial() return _MatFont; } - -// *************************************************************************** -void CFontManager::computeString (const std::string &s, - CFontGenerator *fontGen, - const NLMISC::CRGBA &color, - uint32 fontSize, - bool embolden, - bool oblique, - IDriver *driver, - CComputedString &output, - bool keep800x600Ratio) -{ - // static to avoid reallocation - static ucstring ucs; - ucs= s; - computeString(ucs, fontGen, color, fontSize, embolden, oblique, driver, output, keep800x600Ratio); -} - - // *************************************************************************** -void CFontManager::computeString (const ucstring &s, +void CFontManager::computeString (NLMISC::CUtfStringView sv, CFontGenerator *fontGen, const NLMISC::CRGBA &color, uint32 fontSize, @@ -109,7 +90,7 @@ void CFontManager::computeString (const ucstring &s, } // Setting vertices format - output.Vertices.setNumVertices (4 * (uint32)s.size()); + output.Vertices.setNumVertices (4 * (uint32)sv.largestSize()); // 1 character <-> 1 quad sint32 penx = 0, dx; @@ -144,7 +125,8 @@ void CFontManager::computeString (const ucstring &s, output.StringHeight = 0; // save string info for later rebuild as needed - output.Text = s; + if (sv.ptr() != output.Text.c_str()) // don't resave if rebuilding + output.Text = sv.toUtf8(); output.CacheVersion = getCacheVersion(); uint j = 0; @@ -156,10 +138,11 @@ void CFontManager::computeString (const ucstring &s, hlfPixScrH = 0.f; // For all chars - for (uint i = 0; i < s.size(); i++) + //for (uint i = 0; i < s.size(); i++) + for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) { // Creating font - k.Char = s[i]; + k.Char = *it; k.FontGenerator = fontGen; k.Size = fontSize; k.Embolden = embolden; @@ -245,7 +228,7 @@ void CFontManager::computeString (const ucstring &s, // *************************************************************************** -void CFontManager::computeStringInfo ( const ucstring &s, +void CFontManager::computeStringInfo ( NLMISC::CUtfStringView sv, CFontGenerator *fontGen, const NLMISC::CRGBA &color, uint32 fontSize, @@ -258,10 +241,11 @@ void CFontManager::computeStringInfo ( const ucstring &s, output.Color = color; // save string info for later rebuild as needed - output.Text = s; + if (sv.ptr() != output.Text.c_str()) // don't resave if rebuilding + output.Text = sv.toUtf8(); output.CacheVersion = 0; - if (s.empty()) + if (sv.empty()) { output.StringWidth = 0.f; output.StringHeight = 0; @@ -290,10 +274,10 @@ void CFontManager::computeStringInfo ( const ucstring &s, CTextureFont::SLetterKey k; CTextureFont::SLetterInfo *pLI; - for (uint i = 0; i < s.size(); i++) + for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) { // Creating font - k.Char = s[i]; + k.Char = *it; k.FontGenerator = fontGen; k.Size = fontSize; k.Embolden = embolden; diff --git a/nel/src/3d/text_context.cpp b/nel/src/3d/text_context.cpp index 1ccb920e4..ba40904b3 100644 --- a/nel/src/3d/text_context.cpp +++ b/nel/src/3d/text_context.cpp @@ -77,13 +77,11 @@ uint32 CTextContext::textPush (const char *format, ...) char *str; NLMISC_CONVERT_VARGS (str, format, NLMISC::MaxCStringSize); - ucstring uc; - uc.fromUtf8((const char *)str); - return textPush(uc); + return textPush(str); } // ------------------------------------------------------------------------------------------------ -uint32 CTextContext::textPush (const ucstring &str) +uint32 CTextContext::textPush (NLMISC::CUtfStringView sv) { nlassert(_FontGen); @@ -103,7 +101,7 @@ uint32 CTextContext::textPush (const ucstring &str) nlassert (index < _CacheStrings.size()); CComputedString &strToFill = _CacheStrings[index]; - _FontManager->computeString (str, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, strToFill, _Keep800x600Ratio); + _FontManager->computeString (sv, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, strToFill, _Keep800x600Ratio); // just compute letters, glyphs are rendered on demand before first draw //_FontManager->computeStringInfo(str, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, strToFill, _Keep800x600Ratio); diff --git a/nel/src/3d/text_context_user.cpp b/nel/src/3d/text_context_user.cpp index 0430eae1a..6956c0df5 100644 --- a/nel/src/3d/text_context_user.cpp +++ b/nel/src/3d/text_context_user.cpp @@ -231,11 +231,11 @@ uint32 CTextContextUser::textPush(const char *format, ...) return _TextContext.textPush(ucstring(str)) ; } -uint32 CTextContextUser::textPush(const ucstring &str) +uint32 CTextContextUser::textPush(NLMISC::CUtfStringView sv) { H_AUTO2; - return _TextContext.textPush(str) ; + return _TextContext.textPush(sv) ; } void CTextContextUser::setStringColor(uint32 i, CRGBA newCol) { @@ -279,11 +279,11 @@ UTextContext::CStringInfo CTextContextUser::getStringInfo(uint32 i) else return CStringInfo(cstr->StringWidth, cstr->StringHeight, cstr->StringLine); } -UTextContext::CStringInfo CTextContextUser::getStringInfo(const ucstring &str) +UTextContext::CStringInfo CTextContextUser::getStringInfo(NLMISC::CUtfStringView sv) { H_AUTO2; - _TextContext.computeStringInfo(str, _CacheString); + _TextContext.computeStringInfo(sv, _CacheString); return CStringInfo (_CacheString.StringWidth, _CacheString.StringHeight, _CacheString.StringLine); } void CTextContextUser::clear() @@ -319,11 +319,11 @@ void CTextContextUser::printClipAtOld (float x, float y, uint32 i, float xmin, f printClipAt(rdrBuffer, x, y ,i, xmin, ymin, xmax, ymax); flushRenderBuffer(&rdrBuffer); } -void CTextContextUser::printAt(float x, float y, const ucstring &ucstr) +void CTextContextUser::printAt(float x, float y, NLMISC::CUtfStringView sv) { H_AUTO2; - _TextContext.printAt(x, y, ucstr); + _TextContext.printAt(x, y, sv); _DriverUser->restoreMatrixContext(); } void CTextContextUser::printfAt(float x, float y, const char * format, ...) @@ -337,12 +337,12 @@ void CTextContextUser::printfAt(float x, float y, const char * format, ...) _DriverUser->restoreMatrixContext(); } -void CTextContextUser::render3D(const CMatrix &mat, const ucstring &ucstr) +void CTextContextUser::render3D(const CMatrix &mat, NLMISC::CUtfStringView sv) { NL3D_HAUTO_RENDER_3D_TEXTCONTEXT; CComputedString computedStr; - _TextContext.computeString(ucstr,computedStr); + _TextContext.computeString(sv,computedStr); computedStr.render3D(*_Driver,mat); @@ -355,7 +355,7 @@ void CTextContextUser::render3D(const CMatrix &mat, const char *format, ...) char *str; NLMISC_CONVERT_VARGS (str, format, NLMISC::MaxCStringSize); - render3D(mat, ucstring(str)); + render3D(mat, str); _DriverUser->restoreMatrixContext(); } From 932a612f53a1c012379f3dbe3f16a2ffe2300d26 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 04:32:01 +0800 Subject: [PATCH 049/205] Support UTF-32 in edit box, ryzom/ryzomcore#335 --- nel/include/nel/3d/font_manager.h | 14 +++ nel/include/nel/3d/text_context.h | 5 + nel/include/nel/3d/text_context_user.h | 1 + nel/include/nel/3d/u_text_context.h | 5 + nel/include/nel/gui/group_editbox.h | 22 ++-- nel/include/nel/misc/utf_string_view.h | 35 +++++- nel/src/3d/font_manager.cpp | 19 ++- nel/src/3d/text_context_user.cpp | 7 ++ nel/src/gui/group_editbox.cpp | 112 +++++++++++------- nel/src/gui/group_html.cpp | 3 +- nel/src/gui/view_text.cpp | 15 ++- ryzom/client/src/connection.cpp | 8 +- .../src/interface_v3/action_handler_edit.cpp | 17 +-- .../src/interface_v3/action_handler_item.cpp | 20 ++-- .../src/interface_v3/action_phrase_faber.cpp | 2 +- .../bot_chat_page_create_guild.cpp | 4 +- .../src/interface_v3/bot_chat_page_trade.cpp | 14 +-- ryzom/client/src/interface_v3/chat_window.cpp | 8 +- .../src/interface_v3/dbgroup_build_phrase.cpp | 6 +- ryzom/client/src/interface_v3/group_map.cpp | 12 +- .../src/interface_v3/inventory_manager.cpp | 6 +- .../client/src/interface_v3/macrocmd_key.cpp | 2 +- .../src/interface_v3/macrocmd_manager.cpp | 2 +- .../src/interface_v3/people_interraction.cpp | 14 +-- ryzom/client/src/interface_v3/people_list.cpp | 8 +- ryzom/client/src/login.cpp | 18 +-- ryzom/client/src/r2/editor.cpp | 4 +- 27 files changed, 250 insertions(+), 133 deletions(-) diff --git a/nel/include/nel/3d/font_manager.h b/nel/include/nel/3d/font_manager.h index 53310e95a..134df26f9 100644 --- a/nel/include/nel/3d/font_manager.h +++ b/nel/include/nel/3d/font_manager.h @@ -137,6 +137,20 @@ public: CComputedString &output, bool keep800x600Ratio= true); + /** + * Same as computeString but do not make vertex buffers and primitives + */ + void computeStringInfo (NLMISC::CUtfStringView sv, + size_t len, + CFontGenerator *fontGen, + const NLMISC::CRGBA &color, + uint32 fontSize, + bool embolden, + bool oblique, + IDriver *driver, + CComputedString &output, + bool keep800x600Ratio= true); + /** * Same as computeString but do not make vertex buffers and primitives */ diff --git a/nel/include/nel/3d/text_context.h b/nel/include/nel/3d/text_context.h index b18747e9a..01a711e7e 100644 --- a/nel/include/nel/3d/text_context.h +++ b/nel/include/nel/3d/text_context.h @@ -382,6 +382,11 @@ public: _FontManager->computeStringInfo (sv, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio); } + void computeStringInfo (NLMISC::CUtfStringView sv, CComputedString& output, size_t len) + { + _FontManager->computeStringInfo (sv, len, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio); + } + /// Debug : write to the disk the texture cache void dumpCache (const char *filename) { diff --git a/nel/include/nel/3d/text_context_user.h b/nel/include/nel/3d/text_context_user.h index 951f5b154..039aebcd0 100644 --- a/nel/include/nel/3d/text_context_user.h +++ b/nel/include/nel/3d/text_context_user.h @@ -104,6 +104,7 @@ public: void erase(uint32 i) ; virtual CStringInfo getStringInfo (uint32 i); virtual CStringInfo getStringInfo (NLMISC::CUtfStringView sv); + virtual CStringInfo getStringInfo (NLMISC::CUtfStringView sv, size_t len); void clear() ; void printAt(float x, float y, uint32 i) ; diff --git a/nel/include/nel/3d/u_text_context.h b/nel/include/nel/3d/u_text_context.h index 829e80844..9cf710b11 100644 --- a/nel/include/nel/3d/u_text_context.h +++ b/nel/include/nel/3d/u_text_context.h @@ -275,6 +275,11 @@ public: * The returned string info is in pixel size per default. */ virtual CStringInfo getStringInfo (NLMISC::CUtfStringView sv) = 0; + /** + * Get a string information from the ucstring + * The returned string info is in pixel size per default. + */ + virtual CStringInfo getStringInfo (NLMISC::CUtfStringView sv, size_t len) = 0; /** * empty the map */ diff --git a/nel/include/nel/gui/group_editbox.h b/nel/include/nel/gui/group_editbox.h index dc343410b..62b78584c 100644 --- a/nel/include/nel/gui/group_editbox.h +++ b/nel/include/nel/gui/group_editbox.h @@ -63,16 +63,16 @@ namespace NLGUI virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc); /// Accessors - ucstring getInputString() const { return _InputString; } - const ucstring &getInputStringRef() const { return _InputString; } + u32string getInputString() const { return _InputString; } + const u32string &getInputStringRef() const { return _InputString; } const ucstring &getPrompt() const { return _Prompt; } /** Set the prompt * NB : line returns are encoded as '\n', not '\r\n' */ void setPrompt(const ucstring &s) { _Prompt = s; } - void setInputString(const ucstring &str); - void setInputStringRef(const ucstring &str) {_InputString = str; }; + void setInputString(const u32string &str); + void setInputStringRef(const u32string &str) {_InputString = str; }; void setInputStringAsInt(sint32 val); sint32 getInputStringAsInt() const; void setInputStringAsInt64(sint64 val); @@ -81,6 +81,8 @@ namespace NLGUI float getInputStringAsFloat() const; void setInputStringAsUtf8(const std::string &str); std::string getInputStringAsUtf8() const; + void setInputStringAsUtf16(const ucstring &str); + ucstring getInputStringAsUtf16() const; void setColor(NLMISC::CRGBA col); @@ -119,7 +121,7 @@ namespace NLGUI sint32 getMaxHistoric() const {return _MaxHistoric;} sint32 getCurrentHistoricIndex () const {return _CurrentHistoricIndex;} void setCurrentHistoricIndex (sint32 index) {_CurrentHistoricIndex=index;} - const ucstring &getHistoric(uint32 index) const {return _Historic[index];} + const u32string &getHistoric(uint32 index) const {return _Historic[index];} uint32 getNumHistoric() const {return (uint32)_Historic.size ();} // Get on change action handler @@ -188,7 +190,7 @@ namespace NLGUI REFLECT_LUA_METHOD("setFocusOnText", luaSetFocusOnText); REFLECT_LUA_METHOD("cancelFocusOnText", luaCancelFocusOnText); REFLECT_STRING("input_string", getInputStringAsUtf8, setInputStringAsUtf8); - REFLECT_UCSTRING("uc_input_string", getInputString, setInputString); + REFLECT_UCSTRING("uc_input_string", getInputStringAsUtf16, setInputStringAsUtf16); REFLECT_EXPORT_END /** Restore the original value of the edit box. @@ -227,16 +229,16 @@ namespace NLGUI // Text info ucstring _Prompt; - ucstring _InputString; + u32string _InputString; CViewText *_ViewText; // undo / redo - ucstring _StartInputString; // value of the input string when focus was acuired first - ucstring _ModifiedInputString; + u32string _StartInputString; // value of the input string when focus was acuired first + u32string _ModifiedInputString; // Historic info - typedef std::deque THistoric; + typedef std::deque THistoric; THistoric _Historic; uint32 _MaxHistoric; sint32 _CurrentHistoricIndex; diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index cc726bb33..a23c2abca 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -30,6 +30,8 @@ namespace NLMISC { class CUtfStringView { public: + inline CUtfStringView() : m_Str(NULL), m_Size(0), m_Iterator(utf32Iterator) {} + inline CUtfStringView(const char *utf8Str) : m_Str(utf8Str), m_Size(strlen(utf8Str)), m_Iterator(utf8Iterator) {} inline CUtfStringView(const char *utf8Str, size_t len): m_Str(utf8Str), m_Size(len), m_Iterator(utf8Iterator) { @@ -68,16 +70,31 @@ public: public: inline void operator++() { - m_Char = m_View.m_Iterator(&m_Addr); + m_Char = m_View.m_Iterator(&m_Addr); if ((ptrdiff_t)m_Addr > ((ptrdiff_t)m_View.m_Str + m_View.m_Size)) { m_Addr = 0; m_Char = 0; } } + inline void operator+=(ptrdiff_t a) + { + while (m_Addr) + { + ++(*this); + } + } inline bool operator!=(const const_iterator &o) const { return m_Addr != o.m_Addr; } inline bool operator==(const const_iterator &o) const { return m_Addr == o.m_Addr; } inline const u32char &operator*() const { return m_Char; } + const_iterator() : m_View(*(CUtfStringView *)NULL), m_Addr(NULL), m_Char(0) { } + + const_iterator &operator=(const const_iterator &other) + { + if(this == &other) return *this; + this->~const_iterator(); + return *new(this) const_iterator(other); + } private: friend class CUtfStringView; inline const_iterator(const CUtfStringView &view, const void *addr) : m_View(view), m_Addr(addr), m_Char(addr ? view.m_Iterator(&m_Addr) : 0) { } @@ -98,12 +115,28 @@ public: inline bool empty() const { return !m_Size; } const void *ptr() const { return m_Str; } + inline CUtfStringView substr(const iterator &begin, const iterator &end) const + { + return CUtfStringView(begin.m_Addr, (ptrdiff_t)end.m_Addr - (ptrdiff_t)begin.m_Addr, m_Iterator); + } + + inline bool endsWith(char c) { nlassert(c < 0x80); return *((char *)m_Str + m_Size - 1) == c; } + + CUtfStringView &operator=(const CUtfStringView &other) + { + if(this == &other) return *this; + this->~CUtfStringView(); + return *new(this) CUtfStringView(other); + } + private: typedef u32char (*TIterator)(const void **addr); static u32char utf8Iterator(const void **addr); static u32char utf16Iterator(const void **addr); static u32char utf32Iterator(const void **addr); + inline CUtfStringView(const void *str, size_t len, TIterator it) : m_Str(str), m_Size(len), m_Iterator(it) { } + const void *const m_Str; // String const size_t m_Size; // Size in bytes const TIterator m_Iterator; diff --git a/nel/src/3d/font_manager.cpp b/nel/src/3d/font_manager.cpp index d467c69d1..70fb59639 100644 --- a/nel/src/3d/font_manager.cpp +++ b/nel/src/3d/font_manager.cpp @@ -237,6 +237,22 @@ void CFontManager::computeStringInfo ( NLMISC::CUtfStringView sv, IDriver *driver, CComputedString &output, bool keep800x600Ratio ) +{ + computeStringInfo(sv, sv.largestSize(), fontGen, color, fontSize, embolden, oblique, driver, output, keep800x600Ratio); +} + + +// *************************************************************************** +void CFontManager::computeStringInfo ( NLMISC::CUtfStringView sv, + size_t len, + CFontGenerator *fontGen, + const NLMISC::CRGBA &color, + uint32 fontSize, + bool embolden, + bool oblique, + IDriver *driver, + CComputedString &output, + bool keep800x600Ratio ) { output.Color = color; @@ -274,7 +290,8 @@ void CFontManager::computeStringInfo ( NLMISC::CUtfStringView sv, CTextureFont::SLetterKey k; CTextureFont::SLetterInfo *pLI; - for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) + size_t idx = 0; + for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end && idx < len; ++it, ++idx) { // Creating font k.Char = *it; diff --git a/nel/src/3d/text_context_user.cpp b/nel/src/3d/text_context_user.cpp index 6956c0df5..95d9ebe1c 100644 --- a/nel/src/3d/text_context_user.cpp +++ b/nel/src/3d/text_context_user.cpp @@ -286,6 +286,13 @@ UTextContext::CStringInfo CTextContextUser::getStringInfo(NLMISC::CUtfStringVie _TextContext.computeStringInfo(sv, _CacheString); return CStringInfo (_CacheString.StringWidth, _CacheString.StringHeight, _CacheString.StringLine); } +UTextContext::CStringInfo CTextContextUser::getStringInfo(NLMISC::CUtfStringView sv, size_t len) +{ + H_AUTO2; + + _TextContext.computeStringInfo(sv, _CacheString, len); + return CStringInfo (_CacheString.StringWidth, _CacheString.StringHeight, _CacheString.StringLine); +} void CTextContextUser::clear() { H_AUTO2; diff --git a/nel/src/gui/group_editbox.cpp b/nel/src/gui/group_editbox.cpp index 2879a62af..b9dc44895 100644 --- a/nel/src/gui/group_editbox.cpp +++ b/nel/src/gui/group_editbox.cpp @@ -21,6 +21,7 @@ #include "stdpch.h" #include "nel/gui/group_editbox.h" #include "nel/misc/command.h" +#include "nel/misc/utf_string_view.h" #include "nel/gui/view_text.h" #include "nel/misc/xml_auto_ptr.h" #include "nel/gui/interface_options.h" @@ -826,11 +827,12 @@ namespace NLGUI } // ---------------------------------------------------------------------------- - void CGroupEditBox::writeString(const ucstring &str, bool replace, bool atEnd) + void CGroupEditBox::writeString(const ucstring &str16, bool replace, bool atEnd) { + u32string str = CUtfStringView(str16).toUtf32(); sint length = (sint)str.length(); - ucstring toAppend; + u32string toAppend; // filter character depending on the entry type switch (_EntryType) { @@ -963,7 +965,7 @@ namespace NLGUI { length = _MaxNumChar - (sint)_InputString.length(); } - ucstring toAdd = toAppend.substr(0, length); + u32string toAdd = toAppend.substr(0, length); sint32 minPos; sint32 maxPos; if (_CurrSelection == this) @@ -1013,7 +1015,7 @@ namespace NLGUI _CursorAtPreviousLineEnd = false; if (_ClearOnEscape) { - setInputString(ucstring("")); + setInputString(u32string()); triggerOnChangeAH(); } CWidgetManager::getInstance()->setCaptureKeyboard(NULL); @@ -1059,8 +1061,9 @@ namespace NLGUI { if (isKeyRETURN) { - ucstring copyStr= _InputString; - if ((uint) std::count(copyStr.begin(), copyStr.end(), '\n') >= _MaxNumReturn) + //ucstring copyStr= _InputString; + //if ((uint) std::count(copyStr.begin(), copyStr.end(), '\n') >= _MaxNumReturn) + if ((uint)std::count(_InputString.begin(), _InputString.end(), '\n') >= _MaxNumReturn) break; } @@ -1121,11 +1124,11 @@ namespace NLGUI if(_EntryType==Integer && (_IntegerMinValue!=INT_MIN || _IntegerMaxValue!=INT_MAX)) { // estimate new string - ucstring copyStr= _InputString; - ucstring::iterator it = copyStr.begin() + _CursorPos; + u32string copyStr= _InputString; + u32string::iterator it = copyStr.begin() + _CursorPos; copyStr.insert(it, c); sint32 value; - fromString(copyStr.toString(), value); + fromString(CUtfStringView(copyStr).toUtf8(), value); // if out of bounds, abort char if(value<_IntegerMinValue || value>_IntegerMaxValue) return; @@ -1134,12 +1137,12 @@ namespace NLGUI if(_EntryType==PositiveInteger && (_PositiveIntegerMinValue!=0 || _PositiveIntegerMaxValue!=UINT_MAX)) { // estimate new string - ucstring copyStr= _InputString; - ucstring::iterator it = copyStr.begin() + _CursorPos; + u32string copyStr= _InputString; + u32string::iterator it = copyStr.begin() + _CursorPos; copyStr.insert(it, c); // \todo yoyo: this doesn't really work i think.... uint32 value; - fromString(copyStr.toString(), value); + fromString(CUtfStringView(copyStr).toUtf8(), value); // if out of bounds, abort char if(value<_PositiveIntegerMinValue || value>_PositiveIntegerMaxValue) return; @@ -1148,7 +1151,7 @@ namespace NLGUI if ((uint) _InputString.length() < _MaxNumChar) { makeTopWindow(); - ucstring::iterator it = _InputString.begin() + _CursorPos; + u32string::iterator it = _InputString.begin() + _CursorPos; _InputString.insert(it, c); ++ _CursorPos; triggerOnChangeAH(); @@ -1229,11 +1232,11 @@ namespace NLGUI { makeTopWindow(); // for french, deutsch and russian, be aware of unicode - std::string command = _InputString.substr(1).toUtf8(); + std::string command = CUtfStringView(_InputString.substr(1)).toUtf8(); ICommand::expand(command); - // then back to ucstring - _InputString.fromUtf8(command); - _InputString = '/' + _InputString; + // then back to u32string + _InputString = CUtfStringView('/' + command).toUtf32(); + _InputString = _InputString; _CursorPos = (sint32)_InputString.length(); _CursorAtPreviousLineEnd = false; triggerOnChangeAH(); @@ -1260,7 +1263,7 @@ namespace NLGUI // else delete last character else if(_InputString.size () > 0 && _CursorPos != 0) { - ucstring::iterator it = _InputString.begin() + (_CursorPos - 1); + u32string::iterator it = _InputString.begin() + (_CursorPos - 1); _InputString.erase(it); -- _CursorPos; _CursorAtPreviousLineEnd = false; @@ -1439,7 +1442,7 @@ namespace NLGUI } else { - usTmp = _Prompt + _InputString; + usTmp = _Prompt + CUtfStringView(_InputString).toUtf16(); } _ViewText->setText (usTmp); } @@ -1622,7 +1625,7 @@ namespace NLGUI // ---------------------------------------------------------------------------- - void CGroupEditBox::setInputString(const ucstring &str) + void CGroupEditBox::setInputString(const u32string &str) { _InputString = str; if (_CursorPos > (sint32) str.length()) @@ -1641,7 +1644,7 @@ namespace NLGUI void CGroupEditBox::setDefaultInputString(const ucstring &str) { _DefaultInputString= true; - setInputString(str); + setInputString(CUtfStringView(str).toUtf32()); } @@ -1649,35 +1652,35 @@ namespace NLGUI sint32 CGroupEditBox::getInputStringAsInt() const { sint32 value; - fromString(_InputString.toString(), value); + fromString(getInputStringAsUtf8(), value); return value; } // *************************************************************************** void CGroupEditBox::setInputStringAsInt(sint32 val) { - setInputString(NLMISC::toString(val)); + setInputStringAsUtf8(NLMISC::toString(val)); } // *************************************************************************** sint64 CGroupEditBox::getInputStringAsInt64() const { sint64 value; - fromString(_InputString.toString(), value); + fromString(getInputStringAsUtf8(), value); return value; } // *************************************************************************** void CGroupEditBox::setInputStringAsInt64(sint64 val) { - setInputString(NLMISC::toString(val)); + setInputStringAsUtf8(NLMISC::toString(val)); } // *************************************************************************** float CGroupEditBox::getInputStringAsFloat() const { float value; - fromString(_InputString.toString(), value); + fromString(getInputStringAsUtf8(), value); return value; } @@ -1685,14 +1688,14 @@ namespace NLGUI void CGroupEditBox::setInputStringAsFloat(float val) { string fmt= "%." + NLMISC::toString(_MaxFloatPrec) + "f"; - setInputString(NLMISC::toString(fmt.c_str(), val)); + setInputStringAsUtf8(NLMISC::toString(fmt.c_str(), val)); } // *************************************************************************** void CGroupEditBox::cutSelection() { - sint32 minPos= min(_CursorPos, _SelectCursorPos); - sint32 maxPos= max(_CursorPos, _SelectCursorPos); + ptrdiff_t minPos= min(_CursorPos, _SelectCursorPos); + ptrdiff_t maxPos= max(_CursorPos, _SelectCursorPos); // cut the selection if(!_InputString.empty()) { @@ -1706,10 +1709,10 @@ namespace NLGUI // *************************************************************************** ucstring CGroupEditBox::getSelection() { - sint32 minPos= min(_CursorPos, _SelectCursorPos); - sint32 maxPos= max(_CursorPos, _SelectCursorPos); + ptrdiff_t minPos= min(_CursorPos, _SelectCursorPos); + ptrdiff_t maxPos= max(_CursorPos, _SelectCursorPos); // get the selection - return _InputString.substr(minPos, maxPos-minPos); + return CUtfStringView(_InputString.substr(minPos, maxPos-minPos)).toUtf16(); } @@ -1738,13 +1741,25 @@ namespace NLGUI // *************************************************************************** void CGroupEditBox::setInputStringAsUtf8(const std::string &str) { - setInputString(ucstring::makeFromUtf8(str)); + setInputString(CUtfStringView(str).toUtf32()); } // *************************************************************************** std::string CGroupEditBox::getInputStringAsUtf8() const { - return _InputString.toUtf8(); + return CUtfStringView(_InputString).toUtf8(); + } + + // *************************************************************************** + void CGroupEditBox::setInputStringAsUtf16(const ucstring &str) + { + setInputString(CUtfStringView(str).toUtf32()); + } + + // *************************************************************************** + ucstring CGroupEditBox::getInputStringAsUtf16() const + { + return CUtfStringView(_InputString).toUtf16(); } // *************************************************************************** @@ -1755,7 +1770,7 @@ namespace NLGUI return; // set the string and maybe execute - setInputString((ucchar) '/' + command); + setInputString(CUtfStringView((ucchar) '/' + command).toUtf32()); if (execute) { // stop selection @@ -1810,13 +1825,30 @@ namespace NLGUI // *************************************************************************** void CGroupEditBox::serialConfig(NLMISC::IStream &f) { - f.serialVersion(0); + uint version = f.serialVersion(1); if(_DefaultInputString) // Don't want to save the default input { _DefaultInputString= false; _InputString.clear(); } - f.serial(_InputString); + if (version < 1) + { + ucstring str; + if (!f.isReading()) + str = CUtfStringView(_InputString).toUtf16(); + f.serial(str); + if (f.isReading()) + _InputString = CUtfStringView(str).toUtf32(); + } + else + { + std::string str; + if (!f.isReading()) + str = CUtfStringView(_InputString).toUtf8(); + f.serial(str); + if (f.isReading()) + _InputString = CUtfStringView(str).toUtf32(); + } f.serial(_CursorPos); f.serial(_PrevNumLine); if (f.isReading()) @@ -1838,7 +1870,7 @@ namespace NLGUI void CGroupEditBox::onQuit() { // clear the text and restore backup pos before final save - setInputString(ucstring("")); + setInputString(u32string()); _CurrSelection = NULL; } @@ -1846,7 +1878,7 @@ namespace NLGUI void CGroupEditBox::onLoadConfig() { // config is not saved when there's an empty string, so restore that default state. - setInputString(ucstring("")); + setInputString(u32string()); _CurrSelection = NULL; _PrevNumLine = 1; } @@ -1861,7 +1893,7 @@ namespace NLGUI if (_DefaultInputString) { _DefaultInputString= false; - setInputString(ucstring()); + setInputString(u32string()); } _CanRedo = false; _CanUndo = false; diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 0c294c766..7f80405ce 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -27,6 +27,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/rgba.h" #include "nel/misc/algo.h" +#include "nel/misc/utf_string_view.h" #include "nel/gui/libwww.h" #include "nel/gui/group_html.h" #include "nel/gui/group_list.h" @@ -3023,7 +3024,7 @@ namespace NLGUI CGroupEditBox *eb = dynamic_cast(textArea->getGroup("eb")); if (eb) { - eb->setInputString(decodeHTMLEntities(content)); + eb->setInputString(CUtfStringView(decodeHTMLEntities(content)).toUtf32()); if (style.hasStyle("background-color")) { CViewBitmap *bg = dynamic_cast(eb->getView("bg")); diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index 1b7d3f457..7376cd39a 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -2466,9 +2466,8 @@ namespace NLGUI if ((uint) (index - charIndex) > currWord.NumSpaces) { // get the x position - ucstring subStr = currWord.Text.substr(0, index - charIndex - currWord.NumSpaces); // compute the size - UTextContext::CStringInfo si = TextContext->getStringInfo(subStr); + UTextContext::CStringInfo si = TextContext->getStringInfo(currWord.Text, (ptrdiff_t)index - charIndex - currWord.NumSpaces); fx = px + si.StringWidth + currWord.NumSpaces * currLine.getSpaceWidth(); x = fx / _Scale; @@ -2496,9 +2495,8 @@ namespace NLGUI else { // get the x position - ucstring subStr = _Text.substr(0, index); // compute the size - UTextContext::CStringInfo si = TextContext->getStringInfo(subStr); + UTextContext::CStringInfo si = TextContext->getStringInfo(_Text, index); y = 0; x = (sint) ceilf(si.StringWidth / _Scale); } @@ -2511,12 +2509,13 @@ namespace NLGUI float px = 0.f; UTextContext::CStringInfo si; - ucstring singleChar(" "); - uint i; - for (i = 0; i < textValue.length(); ++i) + u32string singleChar(1, ' '); + uint i = 0; + NLMISC::CUtfStringView sv(textValue); + for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it, ++i) { // get character width - singleChar[0] = textValue[i]; + singleChar[0] = *it; si = textContext.getStringInfo(singleChar); px += si.StringWidth; // the character is at the i - 1 position diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 38a10d7e4..5aad200ae 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -1686,7 +1686,7 @@ public: ucstring sSurName = ucstring("NotSet"); CGroupEditBox *pGEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sEditBoxPath)); if (pGEB != NULL) - sFirstName = pGEB->getInputString(); + sFirstName = pGEB->getInputStringAsUtf16(); else nlwarning ("can't get edit box name : %s",sEditBoxPath.c_str()); @@ -2562,7 +2562,7 @@ static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName viewText->setText(text); CGroupEditBox* editBox = dynamic_cast(result); if(editBox) - editBox->setInputString(text); + editBox->setInputStringAsUtf16(text); } } @@ -2826,7 +2826,7 @@ class CAHScenarioControl : public IActionHandler { CGroupEditBox* editBox = dynamic_cast(result); if(editBox) - editBox->setInputString(description); + editBox->setInputStringAsUtf16(description); } } } @@ -2977,7 +2977,7 @@ class CAHLoadScenario : public IActionHandler { CGroupEditBox* editBox = dynamic_cast(result); if(editBox) - description = editBox->getInputString().toString(); + description = editBox->getInputStringAsUtf8(); } // races diff --git a/ryzom/client/src/interface_v3/action_handler_edit.cpp b/ryzom/client/src/interface_v3/action_handler_edit.cpp index 00a07dd39..81837bf4a 100644 --- a/ryzom/client/src/interface_v3/action_handler_edit.cpp +++ b/ryzom/client/src/interface_v3/action_handler_edit.cpp @@ -27,6 +27,7 @@ using namespace NLMISC; #include "nel/gui/action_handler.h" #include "nel/gui/group_editbox.h" +#include "nel/misc/utf_string_view.h" #include "interface_manager.h" #include "../client_chat_manager.h" #include "people_interraction.h" @@ -56,7 +57,7 @@ extern CClientChatManager ChatMngr; // *************************************************************************** // used for character classifiction (when the user press Ctrl-arrow) -static inline uint getCharacterCategory(ucchar c) +static inline uint getCharacterCategory(u32char c) { if (c == ' ') return 0; if (c > 127 || isalpha((char) c)) return 1; // alpha & other characters @@ -69,7 +70,7 @@ static inline uint getCharacterCategory(ucchar c) /** skip a block of character in a string, (same behaviour than when Ctrl-arrow is pressed) * It returns the new index */ -static uint skipUCCharsRight(uint startPos, const ucstring &str) +static uint skipUCCharsRight(uint startPos, const u32string &str) { uint pos = startPos; uint endIndex = (uint)str.length(); @@ -86,7 +87,7 @@ static uint skipUCCharsRight(uint startPos, const ucstring &str) /** skip a block of character in a string, (same behaviour than when Ctrl-arrow is pressed) * It returns the new index */ -static uint skipUCCharsLeft(uint startPos, const ucstring &str) +static uint skipUCCharsLeft(uint startPos, const u32string &str) { uint pos = startPos; -- pos; @@ -362,7 +363,7 @@ class CAHEditPreviousLine : public CAHEdit if (_GroupEdit->getMaxHistoric() && (! _GroupEdit->getViewText()->getMultiLine())) { // Get the start of the string. - ucstring startStr= _GroupEdit->getInputStringRef().substr(0, _GroupEdit->getCursorPos()); + u32string startStr= _GroupEdit->getInputStringRef().substr(0, _GroupEdit->getCursorPos()); // Search all historic string that match startStr. for(sint i=_GroupEdit->getCurrentHistoricIndex()+1;i<(sint)_GroupEdit->getNumHistoric();i++) @@ -434,7 +435,7 @@ class CAHEditNextLine : public CAHEdit if( (! _GroupEdit->getViewText()->getMultiLine()) && _GroupEdit->getMaxHistoric() && _GroupEdit->getCurrentHistoricIndex()>0) { // Get the start of the string. - ucstring startStr= _GroupEdit->getInputStringRef().substr(0, _GroupEdit->getCursorPos()); + u32string startStr= _GroupEdit->getInputStringRef().substr(0, _GroupEdit->getCursorPos()); // Search all historic string that match startStr. for(sint i=_GroupEdit->getCurrentHistoricIndex()-1;i>=0;i--) @@ -520,8 +521,8 @@ protected: // else cut forwards else if(_GroupEdit->getCursorPos() < (sint32) _GroupEdit->getInputStringRef().length()) { - ucstring inputString = _GroupEdit->getInputStringRef(); - ucstring::iterator it = inputString.begin() + _GroupEdit->getCursorPos(); + u32string inputString = _GroupEdit->getInputStringRef(); + u32string::iterator it = inputString.begin() + _GroupEdit->getCursorPos(); inputString.erase(it); _GroupEdit->setInputStringRef (inputString); if (!_GroupEdit->getAHOnChange().empty()) @@ -638,7 +639,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit void actionPart () { // If the line starts with '/tell ', do not try to expand - static const ucstring TELL_STR("/tell "); + static const u32string TELL_STR(CUtfStringView("/tell ").toUtf32()); if (_GroupEdit->getInputString().substr(0, TELL_STR.length()) != TELL_STR) { if (_GroupEdit->expand()) return; diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 3d0981306..998bfcd77 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -129,7 +129,7 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() { if ( pIS->Family == ITEMFAMILY::SCROLL) { - editBoxLarge->setInputString(itemInfo.CustomText); + editBoxLarge->setInputStringAsUtf16(itemInfo.CustomText); editLarge->setActive(true); editBoxLarge->setActive(true); @@ -147,7 +147,7 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() strFindReplace(customText, "%mfc", ucstring()); } - editBoxShort->setInputString(customText); + editBoxShort->setInputStringAsUtf16(customText); editShort->setActive(true); editBoxShort->setActive(true); @@ -239,8 +239,8 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() closeButton->setActive(false); group->setActive(true); - editBoxShort->setInputString(ucstring()); - editBoxLarge->setInputString(ucstring()); + editBoxShort->setInputString(u32string()); + editBoxLarge->setInputString(u32string()); display->setTextFormatTaged(ucstring()); @@ -250,7 +250,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() // If we already have item info if ( pIS->Family == ITEMFAMILY::SCROLL) { - editBoxLarge->setInputString(itemInfo.CustomText); + editBoxLarge->setInputStringAsUtf16(itemInfo.CustomText); editLarge->setActive(true); editBoxLarge->setActive(true); @@ -269,7 +269,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() strFindReplace(customText, "%mfc", ucstring()); } - editBoxShort->setInputString(customText); + editBoxShort->setInputStringAsUtf16(customText); editShort->setActive(true); editBoxShort->setActive(true); @@ -297,8 +297,8 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() closeButton->setActive(true); group->setActive(false); - editBoxShort->setInputString(ucstring()); - editBoxLarge->setInputString(ucstring()); + editBoxShort->setInputString(u32string()); + editBoxLarge->setInputString(u32string()); display->setTextFormatTaged(ucstring()); // Finish the display or add the waiter @@ -406,11 +406,11 @@ void CInterfaceItemEdition::CItemEditionWindow::validate() if (group && editShort && editBoxShort && editLarge && editBoxLarge && display && editButtons && closeButton && background) { bool textValid = editShort->getActive(); - ucstring text = editBoxShort->getInputString(); + ucstring text = editBoxShort->getInputStringAsUtf16(); if (!textValid) { textValid = editLarge->getActive(); - text = editBoxLarge->getInputString(); + text = editBoxLarge->getInputStringAsUtf16(); } if (textValid) diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index 40efedac0..d039444f9 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -718,7 +718,7 @@ void CActionPhraseFaber::startMpSelection(uint itemReqLine, uint mpSlot) if (eb) { CWidgetManager::getInstance()->setCaptureKeyboard(eb); - eb->setInputString(toString(maxQuantity)); + eb->setInputStringAsUtf8(toString(maxQuantity)); eb->setSelectionAll(); } } diff --git a/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp b/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp index b7ec631b9..105d4a180 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp @@ -70,10 +70,10 @@ class CHandlerGuildCreate : public IActionHandler CGroupEditBox *pDesc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(guildDescWin)); - ucstring guildName = pGEB->getInputString(); + ucstring guildName = pGEB->getInputStringAsUtf16(); ucstring guildDesc; - if (pDesc != NULL) guildDesc = pDesc->getInputString(); + if (pDesc != NULL) guildDesc = pDesc->getInputStringAsUtf16(); uint64 icon = CGuildManager::iconMake((uint8)pCS->getGuildBack(), (uint8)pCS->getGuildSymbol(), pCS->getInvertGuildSymbol(), pCS->getGuildColor1(), pCS->getGuildColor2()); diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 4a59163b3..64f19214f 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -333,7 +333,7 @@ uint32 CBotChatPageTrade::getCurrItemQuantity() const CGroupEditBox *ed = dynamic_cast(ig->getGroup("header_opened:standard_price:quantity:edit:eb")); if (!ed) return std::numeric_limits::max(); uint32 intQuantity; - if (fromString(ed->getInputString().toString(), intQuantity)) + if (fromString(ed->getInputStringAsUtf8(), intQuantity)) { return intQuantity; } @@ -1465,7 +1465,7 @@ void CBotChatPageTrade::setupPriceGroupQuantity(CInterfaceGroup *priceGroup, sin CGroupEditBox *eb = dynamic_cast(quantityGroup->getGroup("edit:eb")); if (eb) { - eb->setInputString(toString(defaultQuantity)); + eb->setInputStringAsUtf8(toString(defaultQuantity)); } } } @@ -1569,7 +1569,7 @@ void CBotChatPageTrade::setupResellGroup(bool sellMode, uint defaultQuantity, CI { sint32 resaleMargin= NLGUI::CDBManager::getInstance()->getDbProp( "UI:SAVE:TRADE_ITEM:RESALE_MARGIN" )->getValue32(); clamp(resaleMargin, 0, (sint32)MaxResaleMargin); - eb->setInputString( toString( resaleMargin ) ); + eb->setInputStringAsUtf8( toString( resaleMargin ) ); eb->setPositiveIntegerMaxValue(MaxResaleMargin); } } @@ -1725,8 +1725,8 @@ void CBotChatPageTrade::startChangeBuyFilterDialog(const std::string &dbext, con sint rangeMax= 0; if(dbRangeMin) rangeMin= dbRangeMin->getValue32(); if(dbRangeMax) rangeMax= dbRangeMax->getValue32(); - if(edMin) edMin->setInputString(toString(rangeMin)); - if(edMax) edMax->setInputString(toString(rangeMax)); + if(edMin) edMin->setInputStringAsUtf8(toString(rangeMin)); + if(edMax) edMax->setInputStringAsUtf8(toString(rangeMax)); if(edMin) edMin->setPositiveIntegerMaxValue(maxValue); if(edMax) edMax->setPositiveIntegerMaxValue(maxValue); @@ -1754,8 +1754,8 @@ void CBotChatPageTrade::resetBuyFilterDialog() sint rangeMin= 0; sint rangeMax= _FilterBuyDlgMaxValue; // write result in EditBox, and in db - if(edMin) edMin->setInputString(toString(rangeMin)); - if(edMax) edMax->setInputString(toString(rangeMax)); + if(edMin) edMin->setInputStringAsUtf8(toString(rangeMin)); + if(edMax) edMax->setInputStringAsUtf8(toString(rangeMax)); if(dbRangeMin) dbRangeMin->setValue32(rangeMin); if(dbRangeMax) dbRangeMax->setValue32(rangeMax); diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index 1537e7b8b..bfac81212 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -363,7 +363,7 @@ void CChatWindow::setCommand(const ucstring &command,bool execute) void CChatWindow::setEntry(const ucstring &entry) { if (!_EB) return; - _EB->setInputString(entry); + _EB->setInputStringAsUtf16(entry); } //================================================================================= @@ -1273,7 +1273,7 @@ public: { CGroupEditBox *pEB = dynamic_cast(pCaller); if (pEB == NULL) return; - ucstring text = pEB->getInputString(); + ucstring text = pEB->getInputStringAsUtf16(); // If the line is empty, do nothing if(text.empty()) return; @@ -1289,7 +1289,7 @@ public: // Parse any tokens in the text if ( ! CInterfaceManager::parseTokens(text)) { - pEB->setInputString (string("")); + pEB->setInputString (u32string()); return; } @@ -1329,7 +1329,7 @@ public: } } // Clear input string - pEB->setInputString (ucstring("")); + pEB->setInputString (u32string()); CGroupContainer *gc = static_cast< CGroupContainer* >( pEB->getEnclosingContainer() ); if (gc) diff --git a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp index 3cd8e759c..8ffa62530 100644 --- a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp @@ -279,7 +279,7 @@ void CDBGroupBuildPhrase::clearBuildingPhrase() // Empty the name if(_UserSentenceName) { - _UserSentenceName->setInputString(ucstring()); + _UserSentenceName->setInputString(u32string()); } // update Display @@ -373,7 +373,7 @@ void CDBGroupBuildPhrase::startComposition(const CSPhraseCom &phrase) // set the editable name. if(_UserSentenceName) - _UserSentenceName->setInputString(name); + _UserSentenceName->setInputStringAsUtf16(name); } @@ -1790,7 +1790,7 @@ void CDBGroupBuildPhrase::buildCurrentPhrase(CSPhraseCom &newPhrase) // Set the Name if(_UserSentenceName) { - newPhrase.Name= _UserSentenceName->getInputString(); + newPhrase.Name= _UserSentenceName->getInputStringAsUtf16(); } } diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index 17e75486a..b696ae40d 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -141,12 +141,12 @@ static void popupLandMarkNameDialog() const CUserLandMark userLM = map->getUserLandMark(LastSelectedLandMark); NLGUI::CDBManager::getInstance()->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(cb->getTextPos(userLM.Type)); - eb->setInputString(userLM.Title); + eb->setInputStringAsUtf16(userLM.Title); } else { NLGUI::CDBManager::getInstance()->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(cb->getTextPos(CUserLandMark::Misc)); - eb->setInputString(ucstring()); + eb->setInputStringAsUtf16(ucstring()); } CWidgetManager::getInstance()->setCaptureKeyboard(eb); @@ -3882,7 +3882,7 @@ class CAHLandMarkFilter : public IActionHandler CGroupEditBox* eb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(group)); if (!eb) return; - text = eb->getInputString().toUtf8(); + text = eb->getInputStringAsUtf8(); } map->setLandmarkFilter(text); @@ -3988,7 +3988,7 @@ class CAHValidateUserLandMarkName : public IActionHandler CGroupMap *map = dynamic_cast(LastSelectedLandMark->getParent()); if (!map) return; // update existing landmark - map->updateUserLandMark(LastSelectedLandMark, eb->getInputString(), landMarkType); + map->updateUserLandMark(LastSelectedLandMark, eb->getInputStringAsUtf16(), landMarkType); } else { @@ -3996,11 +3996,11 @@ class CAHValidateUserLandMarkName : public IActionHandler if (!LastClickedMap) return; if( UseUserPositionForLandMark ) { - LastClickedMap->addUserLandMark(LastClickedMap->getPlayerPos(), eb->getInputString(), landMarkType); + LastClickedMap->addUserLandMark(LastClickedMap->getPlayerPos(), eb->getInputStringAsUtf16(), landMarkType); } else { - LastClickedMap->addUserLandMark(LastClickedMap->getRightClickLastPos(), eb->getInputString(), landMarkType); + LastClickedMap->addUserLandMark(LastClickedMap->getRightClickLastPos(), eb->getInputStringAsUtf16(), landMarkType); } LastClickedMap->invalidateCoords(); } diff --git a/ryzom/client/src/interface_v3/inventory_manager.cpp b/ryzom/client/src/interface_v3/inventory_manager.cpp index f84e38234..5324c6e69 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -2755,7 +2755,7 @@ class CHandlerInvSearchButton : public IActionHandler { CWidgetManager::getInstance()->setCaptureKeyboard(eb); eb->setSelectionAll(); - filter = eb->getInputString(); + filter = eb->getInputStringAsUtf16(); } CDBGroupListSheetBag *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(btn->getParent()->getId() + ":bag_list")); @@ -2805,10 +2805,10 @@ class CHandlerInvSetSearch : public IActionHandler std::string id = pCaller->getParent()->getParent()->getId(); CDBGroupListSheetBag *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id + ":bag_list")); - if (pList != NULL) pList->setSearchFilter(eb->getInputString()); + if (pList != NULL) pList->setSearchFilter(eb->getInputStringAsUtf16()); CDBGroupIconListBag *pIcons = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id + ":bag_icons")); - if (pIcons != NULL) pIcons->setSearchFilter(eb->getInputString()); + if (pIcons != NULL) pIcons->setSearchFilter(eb->getInputStringAsUtf16()); } }; REGISTER_ACTION_HANDLER( CHandlerInvSetSearch, "inv_set_search" ); diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index 7f4c26c08..241862ff1 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -1148,7 +1148,7 @@ void CModalContainerEditCmd::onChangeAction() CGroupEditBox *pEB= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( sWin )); if( pEB ) { - pEB->setInputString(ucstring("")); + pEB->setInputString(u32string()); } NLGUI::CDBManager::getInstance()->getDbProp( sDB )->setValue32(1); } diff --git a/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/ryzom/client/src/interface_v3/macrocmd_manager.cpp index 6aa831eac..39b2aedde 100644 --- a/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -886,7 +886,7 @@ public: if (pCS != NULL) pCS->readFromMacro(pMCM->CurrentEditMacro); // Name CGroupEditBox *pEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_EDIT_NAME)); - if (pEB != NULL) pEB->setInputString(pMCM->CurrentEditMacro.Name); + if (pEB != NULL) pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.Name); // Commands CGroupList *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_COMMANDS)); if (pList == NULL) return; diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index 96f27bb6c..21cfb63cf 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -2199,7 +2199,7 @@ public: if (gc) { CGroupEditBox *geb = dynamic_cast(gc->getGroup("add_contact_eb:eb")); - geb->setInputString(ucstring("")); + geb->setInputString(u32string()); } CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, sParams); } @@ -2250,18 +2250,18 @@ public: if (peopleList) { // don't add if it is the player name - if (!ClientCfg.Local && (UserEntity->getEntityName() == geb->getInputString())) + if (!ClientCfg.Local && (UserEntity->getEntityName() == geb->getInputStringAsUtf16())) { displayVisibleSystemMsg(CI18N::get("uiCantAddYourSelfInContactList")); } else { - PeopleInterraction.askAddContact(geb->getInputString(), peopleList); - geb->setInputString(ucstring("")); + PeopleInterraction.askAddContact(geb->getInputStringAsUtf16(), peopleList); + geb->setInputString(u32string()); } } } - geb->setInputString(ucstring("")); + geb->setInputString(u32string()); } } } @@ -2389,7 +2389,7 @@ public: if (eb) { CWidgetManager::getInstance()->setCaptureKeyboard(eb); - eb->setInputString(ucstring("")); + eb->setInputString(u32string()); } // if (gc->getActive()) @@ -2416,7 +2416,7 @@ class CHandlerValidatePartyChatName : public IActionHandler if (!gc) return; CGroupEditBox *eb = dynamic_cast(gc->getGroup("eb")); if (!eb) return; - ucstring title = eb->getInputString(); + ucstring title = eb->getInputStringAsUtf16(); // TODO GAMEDEV : create (or join ?) a new channel. Each channel (party chat) should have a unique name in the game // moreover, it should not have the name of another available chat window (for example, it shouldn't be named 'Around Me') diff --git a/ryzom/client/src/interface_v3/people_list.cpp b/ryzom/client/src/interface_v3/people_list.cpp index 6be310d94..43ee1543c 100644 --- a/ryzom/client/src/interface_v3/people_list.cpp +++ b/ryzom/client/src/interface_v3/people_list.cpp @@ -876,7 +876,7 @@ class CHandlerContactEntry : public IActionHandler { CGroupEditBox *pEB = dynamic_cast(pCaller); if (pEB == NULL) return; - ucstring text = pEB->getInputString(); + ucstring text = pEB->getInputStringAsUtf16(); // If the line is empty, do nothing if(text.empty()) return; @@ -884,7 +884,7 @@ class CHandlerContactEntry : public IActionHandler // Parse any tokens in the text if ( ! CInterfaceManager::parseTokens(text)) { - pEB->setInputString (string("")); + pEB->setInputString (u32string()); return; } @@ -895,7 +895,7 @@ class CHandlerContactEntry : public IActionHandler // TODO : have NLMISC::ICommand accept unicode strings std::string str = text.toUtf8().substr(1); NLMISC::ICommand::execute( str, g_log ); - pEB->setInputString (string("")); + pEB->setInputString (u32string()); return; } // Well, we could have used CChatWindow class to handle this, but CPeopleList was written earlier, so for now @@ -908,7 +908,7 @@ class CHandlerContactEntry : public IActionHandler // Simply do a tell on the player ChatMngr.tell(playerName.toString(), text); - pEB->setInputString (string("")); + pEB->setInputString (u32string()); if (gc) { // Restore position of enclosing container if it hasn't been moved/scaled/poped by the user diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index 96922d399..6f3617286 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -808,7 +808,7 @@ void initLoginScreen() CGroupEditBox *pGEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); if (pGEB != NULL && (pGEB->getInputString().empty())) { - pGEB->setInputString(l); + pGEB->setInputStringAsUtf8(l); } CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_PASSWORD "|select_all=false"); } @@ -830,8 +830,8 @@ void initAutoLogin() CInterfaceManager *pIM = CInterfaceManager::getInstance(); CGroupEditBox *pGEBLog = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); CGroupEditBox *pGEBPwd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD)); - pGEBLog->setInputString(LoginLogin); - pGEBPwd->setInputString(LoginPassword); + pGEBLog->setInputStringAsUtf8(LoginLogin); + pGEBPwd->setInputStringAsUtf8(LoginPassword); CAHManager::getInstance()->runActionHandler("on_login", NULL, ""); if (ClientCfg.R2Mode) @@ -1379,8 +1379,8 @@ class CAHOnLogin : public IActionHandler return; } - LoginLogin = pGEBLog->getInputString().toString(); // FIXME: Unicode login - LoginPassword = pGEBPwd->getInputString().toString(); + LoginLogin = pGEBLog->getInputStringAsUtf8(); + LoginPassword = pGEBPwd->getInputStringAsUtf8(); onlogin(); } @@ -2394,7 +2394,7 @@ bool initCreateAccount() { CGroupEditBox * eb = dynamic_cast(createAccountUI->findFromShortId(editBoxes[i] + ":eb")); if(eb) - eb->setInputString(ucstring("")); + eb->setInputString(u32string()); } // conditions button @@ -2581,7 +2581,7 @@ class CAHOnCreateAccountSubmit : public IActionHandler { CGroupEditBox * eb = dynamic_cast(createAccountUI->findFromShortId(editBoxes[i] + ":eb")); if(eb) - results[i] = eb->getInputString().toUtf8(); + results[i] = eb->getInputStringAsUtf8(); } // text @@ -2735,11 +2735,11 @@ class CAHCreateAccountLogin : public IActionHandler { CGroupEditBox * eb = dynamic_cast(createAccountUI->findFromShortId("eb_login:eb")); if(eb) - LoginLogin = eb->getInputString().toUtf8(); + LoginLogin = eb->getInputStringAsUtf8(); eb = dynamic_cast(createAccountUI->findFromShortId("eb_password:eb")); if(eb) - LoginPassword = eb->getInputString().toUtf8(); + LoginPassword = eb->getInputStringAsUtf8(); onlogin(false); } diff --git a/ryzom/client/src/r2/editor.cpp b/ryzom/client/src/r2/editor.cpp index 036e77b21..e9702af28 100644 --- a/ryzom/client/src/r2/editor.cpp +++ b/ryzom/client/src/r2/editor.cpp @@ -7484,7 +7484,7 @@ class CAHInviteCharacter : public IActionHandler CGroupEditBox *geb = dynamic_cast(fatherGC->getGroup("add_contact_eb:eb")); if (geb && !geb->getInputString().empty()) { - string charName = geb->getInputString().toString(); + string charName = geb->getInputStringAsUtf8(); CSessionBrowserImpl & sessionBrowser = CSessionBrowserImpl::getInstance(); sessionBrowser.inviteCharacterByName(sessionBrowser.getCharId(), charName); @@ -7506,7 +7506,7 @@ class CAHInviteCharacter : public IActionHandler CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_newcomer"); } - geb->setInputString(ucstring("")); + geb->setInputString(u32string()); } } } From 1d696b8921a0a6f9ba692e61f1cf1a6b2d41e4d7 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 04:34:18 +0800 Subject: [PATCH 050/205] Revert special handling for wchar --- nel/include/nel/misc/stream.h | 7 ------- nel/include/nel/misc/types_nl.h | 4 ---- nel/include/nel/misc/ucstring.h | 4 ---- nel/src/misc/system_utils.cpp | 4 ++-- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/nel/include/nel/misc/stream.h b/nel/include/nel/misc/stream.h index 35b6c3f26..89db78a1c 100644 --- a/nel/include/nel/misc/stream.h +++ b/nel/include/nel/misc/stream.h @@ -300,13 +300,6 @@ public: virtual void serial(bool &b) ; #ifndef NL_OS_CYGWIN virtual void serial(char &b) ; -#endif -#ifdef NL_OS_WINDOWS - inline void serial(wchar_t &b) - { - nlctassert(sizeof(wchar_t) == sizeof(uint16)); - serial(reinterpret_cast(b)); - } #endif virtual void serial(std::string &b) ; virtual void serial(ucstring &b) ; diff --git a/nel/include/nel/misc/types_nl.h b/nel/include/nel/misc/types_nl.h index b8fe8270a..bac48c3d6 100644 --- a/nel/include/nel/misc/types_nl.h +++ b/nel/include/nel/misc/types_nl.h @@ -546,11 +546,7 @@ template<> struct hash * \typedef ucchar * An Unicode character (16 bits) */ -#if defined(NL_OS_WINDOWS) -typedef wchar_t ucchar; -#else typedef uint16 ucchar; -#endif #ifdef NL_CPP14 typedef char32_t u32char; diff --git a/nel/include/nel/misc/ucstring.h b/nel/include/nel/misc/ucstring.h index 28c83ce2f..5b7597f00 100644 --- a/nel/include/nel/misc/ucstring.h +++ b/nel/include/nel/misc/ucstring.h @@ -30,11 +30,7 @@ * An unicode string class (16 bits per character). * Add features to convert and assign \c ucstring to \c string and \c string to \c ucstring. */ -#if defined(NL_OS_WINDOWS) -typedef std::wstring ucstringbase; -#else typedef std::basic_string ucstringbase; -#endif class ucstring : public ucstringbase { diff --git a/nel/src/misc/system_utils.cpp b/nel/src/misc/system_utils.cpp index 42fe63fca..63eecbf0d 100644 --- a/nel/src/misc/system_utils.cpp +++ b/nel/src/misc/system_utils.cpp @@ -168,7 +168,7 @@ bool CSystemUtils::copyTextToClipboard(const ucstring &text) // allocates a buffer to copy text in global memory std::string textLocal; - if (!isUnicode) textLocal = NLMISC::wideToMbcs(text); + if (!isUnicode) textLocal = NLMISC::wideToMbcs((const wchar_t *)text.c_str(), text.size()); if (text.size() && !textLocal.size()) textLocal = text.toString(); HGLOBAL mem = GlobalAlloc(GHND | GMEM_DDESHARE, isUnicode ? ((text.size() + 1) * sizeof(wchar_t)) : textLocal.size()); @@ -232,7 +232,7 @@ bool CSystemUtils::pasteTextFromClipboard(ucstring &text) } else { - static_cast(text) = NLMISC::mbcsToWide((const char *)hLock); + reinterpret_cast(text) = NLMISC::mbcsToWide((const char *)hLock); if (!text.size() && ((const char *)hLock)[0]) text = (const char *)hLock; } From 55d83c9486e38d70af0be93600e095bf16197859 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 05:03:51 +0800 Subject: [PATCH 051/205] Fix comment --- nel/include/nel/misc/utf_string_view.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index a23c2abca..eac06e0a1 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -26,7 +26,7 @@ namespace NLMISC { /// 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. -/// Strings are not required to be NUL-terminated, but must have at least one character extra. +/// String must be NUL terminated, but its size may specify a substring. class CUtfStringView { public: From 993c37f56d579adab13a49bfb4b8828a570245e0 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 08:24:48 +0800 Subject: [PATCH 052/205] Prefer UTF-8, cleanup, ryzom/ryzomcore#335 --- nel/include/nel/gui/group_editbox.h | 10 ++-- nel/src/gui/CMakeLists.txt | 3 +- nel/src/gui/group_editbox.cpp | 52 +++++++++---------- nel/src/gui/group_html.cpp | 2 +- ryzom/client/src/connection.cpp | 2 +- .../src/interface_v3/action_handler_edit.cpp | 3 +- .../src/interface_v3/action_handler_item.cpp | 8 +-- .../src/interface_v3/action_phrase_faber.cpp | 2 +- .../src/interface_v3/bot_chat_page_trade.cpp | 14 ++--- ryzom/client/src/interface_v3/chat_window.cpp | 4 +- .../src/interface_v3/dbgroup_build_phrase.cpp | 2 +- ryzom/client/src/interface_v3/group_map.cpp | 2 +- .../client/src/interface_v3/macrocmd_key.cpp | 6 +-- .../src/interface_v3/macrocmd_manager.cpp | 12 ++--- .../src/interface_v3/people_interraction.cpp | 8 +-- ryzom/client/src/interface_v3/people_list.cpp | 6 +-- ryzom/client/src/login.cpp | 18 +++---- ryzom/client/src/r2/editor.cpp | 4 +- 18 files changed, 77 insertions(+), 81 deletions(-) diff --git a/nel/include/nel/gui/group_editbox.h b/nel/include/nel/gui/group_editbox.h index 62b78584c..355c01d3c 100644 --- a/nel/include/nel/gui/group_editbox.h +++ b/nel/include/nel/gui/group_editbox.h @@ -63,7 +63,7 @@ namespace NLGUI virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc); /// Accessors - u32string getInputString() const { return _InputString; } + std::string getInputString() const; const u32string &getInputStringRef() const { return _InputString; } const ucstring &getPrompt() const { return _Prompt; } @@ -71,7 +71,7 @@ namespace NLGUI * NB : line returns are encoded as '\n', not '\r\n' */ void setPrompt(const ucstring &s) { _Prompt = s; } - void setInputString(const u32string &str); + void setInputString(const std::string &str); void setInputStringRef(const u32string &str) {_InputString = str; }; void setInputStringAsInt(sint32 val); sint32 getInputStringAsInt() const; @@ -79,10 +79,10 @@ namespace NLGUI sint64 getInputStringAsInt64() const; void setInputStringAsFloat(float val); float getInputStringAsFloat() const; - void setInputStringAsUtf8(const std::string &str); - std::string getInputStringAsUtf8() const; void setInputStringAsUtf16(const ucstring &str); ucstring getInputStringAsUtf16() const; + void setInputStringAsUtf32(const u32string &str); + u32string getInputStringAsUtf32() const { return _InputString; } void setColor(NLMISC::CRGBA col); @@ -189,7 +189,7 @@ namespace NLGUI REFLECT_LUA_METHOD("setSelectionAll", luaSetSelectionAll); REFLECT_LUA_METHOD("setFocusOnText", luaSetFocusOnText); REFLECT_LUA_METHOD("cancelFocusOnText", luaCancelFocusOnText); - REFLECT_STRING("input_string", getInputStringAsUtf8, setInputStringAsUtf8); + REFLECT_STRING("input_string", getInputString, setInputString); REFLECT_UCSTRING("uc_input_string", getInputStringAsUtf16, setInputStringAsUtf16); REFLECT_EXPORT_END diff --git a/nel/src/gui/CMakeLists.txt b/nel/src/gui/CMakeLists.txt index bb5a0b7f2..4dd53e857 100644 --- a/nel/src/gui/CMakeLists.txt +++ b/nel/src/gui/CMakeLists.txt @@ -1,8 +1,7 @@ FILE(GLOB SRC *.cpp *.h) FILE(GLOB HEADERS ../../include/nel/gui/*.h) -SOURCE_GROUP("include" FILES ${HEADERS}) -SOURCE_GROUP("src" FILES ${SRC}) +SOURCE_GROUP("" FILES ${HEADERS} ${SRC}) NL_TARGET_LIB(nelgui ${SRC} ${HEADERS}) diff --git a/nel/src/gui/group_editbox.cpp b/nel/src/gui/group_editbox.cpp index b9dc44895..037ae4656 100644 --- a/nel/src/gui/group_editbox.cpp +++ b/nel/src/gui/group_editbox.cpp @@ -1015,7 +1015,7 @@ namespace NLGUI _CursorAtPreviousLineEnd = false; if (_ClearOnEscape) { - setInputString(u32string()); + setInputStringAsUtf32(u32string()); triggerOnChangeAH(); } CWidgetManager::getInstance()->setCaptureKeyboard(NULL); @@ -1179,7 +1179,7 @@ namespace NLGUI if (CWidgetManager::getInstance()->getCaptureKeyboard() != this) return false; if (!_CanUndo) return false; _ModifiedInputString = _InputString; - setInputString(_StartInputString); + setInputStringAsUtf32(_StartInputString); _CanUndo = false; _CanRedo = true; setCursorPos((sint32)_InputString.length()); @@ -1192,7 +1192,7 @@ namespace NLGUI { if (CWidgetManager::getInstance()->getCaptureKeyboard() != this) return false; if (!_CanRedo) return false; - setInputString(_ModifiedInputString); + setInputStringAsUtf32(_ModifiedInputString); _CanUndo = true; _CanRedo = false; setCursorPos((sint32)_InputString.length()); @@ -1303,7 +1303,7 @@ namespace NLGUI default: break; } // update the text - setInputString(_InputString); + setInputStringAsUtf32(_InputString); // if event of type char or string, consider handle all of them if( rEDK.getKeyEventType()==NLGUI::CEventDescriptorKey::keychar || rEDK.getKeyEventType()==NLGUI::CEventDescriptorKey::keystring ) @@ -1624,8 +1624,13 @@ namespace NLGUI } + // ---------------------------------------------------------------------------- - void CGroupEditBox::setInputString(const u32string &str) + void CGroupEditBox::setInputString(const std::string &str) + { + setInputStringAsUtf32(CUtfStringView(str).toUtf32()); + } + void CGroupEditBox::setInputStringAsUtf32(const u32string &str) { _InputString = str; if (_CursorPos > (sint32) str.length()) @@ -1644,43 +1649,42 @@ namespace NLGUI void CGroupEditBox::setDefaultInputString(const ucstring &str) { _DefaultInputString= true; - setInputString(CUtfStringView(str).toUtf32()); + setInputStringAsUtf32(CUtfStringView(str).toUtf32()); } - // *************************************************************************** sint32 CGroupEditBox::getInputStringAsInt() const { sint32 value; - fromString(getInputStringAsUtf8(), value); + fromString(getInputString(), value); return value; } // *************************************************************************** void CGroupEditBox::setInputStringAsInt(sint32 val) { - setInputStringAsUtf8(NLMISC::toString(val)); + setInputString(NLMISC::toString(val)); } // *************************************************************************** sint64 CGroupEditBox::getInputStringAsInt64() const { sint64 value; - fromString(getInputStringAsUtf8(), value); + fromString(getInputString(), value); return value; } // *************************************************************************** void CGroupEditBox::setInputStringAsInt64(sint64 val) { - setInputStringAsUtf8(NLMISC::toString(val)); + setInputString(NLMISC::toString(val)); } // *************************************************************************** float CGroupEditBox::getInputStringAsFloat() const { float value; - fromString(getInputStringAsUtf8(), value); + fromString(getInputString(), value); return value; } @@ -1688,7 +1692,7 @@ namespace NLGUI void CGroupEditBox::setInputStringAsFloat(float val) { string fmt= "%." + NLMISC::toString(_MaxFloatPrec) + "f"; - setInputStringAsUtf8(NLMISC::toString(fmt.c_str(), val)); + setInputString(NLMISC::toString(fmt.c_str(), val)); } // *************************************************************************** @@ -1739,21 +1743,15 @@ namespace NLGUI } // *************************************************************************** - void CGroupEditBox::setInputStringAsUtf8(const std::string &str) - { - setInputString(CUtfStringView(str).toUtf32()); - } - - // *************************************************************************** - std::string CGroupEditBox::getInputStringAsUtf8() const + std::string CGroupEditBox::getInputString() const { - return CUtfStringView(_InputString).toUtf8(); + return NLMISC::CUtfStringView(_InputString).toUtf8(); } // *************************************************************************** void CGroupEditBox::setInputStringAsUtf16(const ucstring &str) { - setInputString(CUtfStringView(str).toUtf32()); + setInputStringAsUtf32(CUtfStringView(str).toUtf32()); } // *************************************************************************** @@ -1770,7 +1768,7 @@ namespace NLGUI return; // set the string and maybe execute - setInputString(CUtfStringView((ucchar) '/' + command).toUtf32()); + setInputStringAsUtf16((ucchar) '/' + command); if (execute) { // stop selection @@ -1853,7 +1851,7 @@ namespace NLGUI f.serial(_PrevNumLine); if (f.isReading()) { - setInputString(_InputString); + setInputStringAsUtf32(_InputString); } // serial selection @@ -1870,7 +1868,7 @@ namespace NLGUI void CGroupEditBox::onQuit() { // clear the text and restore backup pos before final save - setInputString(u32string()); + setInputStringAsUtf32(u32string()); _CurrSelection = NULL; } @@ -1878,7 +1876,7 @@ namespace NLGUI void CGroupEditBox::onLoadConfig() { // config is not saved when there's an empty string, so restore that default state. - setInputString(u32string()); + setInputStringAsUtf32(u32string()); _CurrSelection = NULL; _PrevNumLine = 1; } @@ -1893,7 +1891,7 @@ namespace NLGUI if (_DefaultInputString) { _DefaultInputString= false; - setInputString(u32string()); + setInputStringAsUtf32(u32string()); } _CanRedo = false; _CanUndo = false; diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 7f80405ce..4fab8c4bb 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -3024,7 +3024,7 @@ namespace NLGUI CGroupEditBox *eb = dynamic_cast(textArea->getGroup("eb")); if (eb) { - eb->setInputString(CUtfStringView(decodeHTMLEntities(content)).toUtf32()); + eb->setInputString(CUtfStringView(decodeHTMLEntities(content)).toUtf8()); if (style.hasStyle("background-color")) { CViewBitmap *bg = dynamic_cast(eb->getView("bg")); diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 5aad200ae..00c663e5e 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -2977,7 +2977,7 @@ class CAHLoadScenario : public IActionHandler { CGroupEditBox* editBox = dynamic_cast(result); if(editBox) - description = editBox->getInputStringAsUtf8(); + description = editBox->getInputString(); } // races diff --git a/ryzom/client/src/interface_v3/action_handler_edit.cpp b/ryzom/client/src/interface_v3/action_handler_edit.cpp index 81837bf4a..055a77422 100644 --- a/ryzom/client/src/interface_v3/action_handler_edit.cpp +++ b/ryzom/client/src/interface_v3/action_handler_edit.cpp @@ -639,8 +639,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit void actionPart () { // If the line starts with '/tell ', do not try to expand - static const u32string TELL_STR(CUtfStringView("/tell ").toUtf32()); - if (_GroupEdit->getInputString().substr(0, TELL_STR.length()) != TELL_STR) + if (!NLMISC::startsWith(_GroupEdit->getInputString(), "/tell ")) { if (_GroupEdit->expand()) return; } diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 998bfcd77..655ea084f 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -239,8 +239,8 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() closeButton->setActive(false); group->setActive(true); - editBoxShort->setInputString(u32string()); - editBoxLarge->setInputString(u32string()); + editBoxShort->setInputString(std::string()); + editBoxLarge->setInputString(std::string()); display->setTextFormatTaged(ucstring()); @@ -297,8 +297,8 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() closeButton->setActive(true); group->setActive(false); - editBoxShort->setInputString(u32string()); - editBoxLarge->setInputString(u32string()); + editBoxShort->setInputString(std::string()); + editBoxLarge->setInputString(std::string()); display->setTextFormatTaged(ucstring()); // Finish the display or add the waiter diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index d039444f9..40efedac0 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -718,7 +718,7 @@ void CActionPhraseFaber::startMpSelection(uint itemReqLine, uint mpSlot) if (eb) { CWidgetManager::getInstance()->setCaptureKeyboard(eb); - eb->setInputStringAsUtf8(toString(maxQuantity)); + eb->setInputString(toString(maxQuantity)); eb->setSelectionAll(); } } diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 64f19214f..dc2c88789 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -333,7 +333,7 @@ uint32 CBotChatPageTrade::getCurrItemQuantity() const CGroupEditBox *ed = dynamic_cast(ig->getGroup("header_opened:standard_price:quantity:edit:eb")); if (!ed) return std::numeric_limits::max(); uint32 intQuantity; - if (fromString(ed->getInputStringAsUtf8(), intQuantity)) + if (fromString(ed->getInputString(), intQuantity)) { return intQuantity; } @@ -1465,7 +1465,7 @@ void CBotChatPageTrade::setupPriceGroupQuantity(CInterfaceGroup *priceGroup, sin CGroupEditBox *eb = dynamic_cast(quantityGroup->getGroup("edit:eb")); if (eb) { - eb->setInputStringAsUtf8(toString(defaultQuantity)); + eb->setInputString(toString(defaultQuantity)); } } } @@ -1569,7 +1569,7 @@ void CBotChatPageTrade::setupResellGroup(bool sellMode, uint defaultQuantity, CI { sint32 resaleMargin= NLGUI::CDBManager::getInstance()->getDbProp( "UI:SAVE:TRADE_ITEM:RESALE_MARGIN" )->getValue32(); clamp(resaleMargin, 0, (sint32)MaxResaleMargin); - eb->setInputStringAsUtf8( toString( resaleMargin ) ); + eb->setInputString( toString( resaleMargin ) ); eb->setPositiveIntegerMaxValue(MaxResaleMargin); } } @@ -1725,8 +1725,8 @@ void CBotChatPageTrade::startChangeBuyFilterDialog(const std::string &dbext, con sint rangeMax= 0; if(dbRangeMin) rangeMin= dbRangeMin->getValue32(); if(dbRangeMax) rangeMax= dbRangeMax->getValue32(); - if(edMin) edMin->setInputStringAsUtf8(toString(rangeMin)); - if(edMax) edMax->setInputStringAsUtf8(toString(rangeMax)); + if(edMin) edMin->setInputString(toString(rangeMin)); + if(edMax) edMax->setInputString(toString(rangeMax)); if(edMin) edMin->setPositiveIntegerMaxValue(maxValue); if(edMax) edMax->setPositiveIntegerMaxValue(maxValue); @@ -1754,8 +1754,8 @@ void CBotChatPageTrade::resetBuyFilterDialog() sint rangeMin= 0; sint rangeMax= _FilterBuyDlgMaxValue; // write result in EditBox, and in db - if(edMin) edMin->setInputStringAsUtf8(toString(rangeMin)); - if(edMax) edMax->setInputStringAsUtf8(toString(rangeMax)); + if(edMin) edMin->setInputString(toString(rangeMin)); + if(edMax) edMax->setInputString(toString(rangeMax)); if(dbRangeMin) dbRangeMin->setValue32(rangeMin); if(dbRangeMax) dbRangeMax->setValue32(rangeMax); diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index bfac81212..ed1a220ca 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -1289,7 +1289,7 @@ public: // Parse any tokens in the text if ( ! CInterfaceManager::parseTokens(text)) { - pEB->setInputString (u32string()); + pEB->setInputString(std::string()); return; } @@ -1329,7 +1329,7 @@ public: } } // Clear input string - pEB->setInputString (u32string()); + pEB->setInputString (std::string()); CGroupContainer *gc = static_cast< CGroupContainer* >( pEB->getEnclosingContainer() ); if (gc) diff --git a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp index 8ffa62530..561d48235 100644 --- a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp @@ -279,7 +279,7 @@ void CDBGroupBuildPhrase::clearBuildingPhrase() // Empty the name if(_UserSentenceName) { - _UserSentenceName->setInputString(u32string()); + _UserSentenceName->setInputString(std::string()); } // update Display diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index b696ae40d..41b6f021e 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -3882,7 +3882,7 @@ class CAHLandMarkFilter : public IActionHandler CGroupEditBox* eb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(group)); if (!eb) return; - text = eb->getInputStringAsUtf8(); + text = eb->getInputString(); } map->setLandmarkFilter(text); diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index 241862ff1..f97e90723 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -679,7 +679,7 @@ void CModalContainerEditCmd::activateFrom (const std::string &cmdName, const std else sEditBox = WinName+WIN_EDITCMD_COMBO_SECOND_PARAM_EDITBOX; CGroupEditBox *pEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sEditBox)); // sTmp is utf8 - pEB->setInputStringAsUtf8(sTmp); + pEB->setInputString(sTmp); } // Setup the param name if any @@ -863,7 +863,7 @@ void CModalContainerEditCmd::validCurrentCommand() CGroupEditBox *pEB= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( sWin )); // convert to utf8 if (pEB != NULL) - CurrentEditCmdLine.ActionName.Argu += pEB->getInputStringAsUtf8(); + CurrentEditCmdLine.ActionName.Argu += pEB->getInputString(); noParam++; } } @@ -1148,7 +1148,7 @@ void CModalContainerEditCmd::onChangeAction() CGroupEditBox *pEB= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( sWin )); if( pEB ) { - pEB->setInputString(u32string()); + pEB->setInputString(std::string()); } NLGUI::CDBManager::getInstance()->getDbProp( sDB )->setValue32(1); } diff --git a/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/ryzom/client/src/interface_v3/macrocmd_manager.cpp index 39b2aedde..bf2197e45 100644 --- a/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -636,7 +636,7 @@ public: CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(Params)); if (pCS == NULL) return; - pCS->setMacroText(pEB->getInputStringAsUtf8()); + pCS->setMacroText(pEB->getInputString()); } }; REGISTER_ACTION_HANDLER( CHandlerEBUpdateMacroText, "eb_update_macro_text"); @@ -703,10 +703,10 @@ public: CGroupEditBox *pEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_MACROICONCREATION_EDITTEXT)); if (pEB != NULL) { - pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.DispText); + pEB->setInputString(pMCM->CurrentEditMacro.DispText); CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_MACROICONCREATION_ICON)); if (pCS != NULL) - pCS->setMacroText(pEB->getInputStringAsUtf8()); + pCS->setMacroText(pEB->getInputString()); } CAHManager::getInstance()->runActionHandler("set_macro_back", NULL, string("target=")+CTRL_MACROICONCREATION_ICON+"|value="+toString(back)); @@ -862,11 +862,11 @@ public: if (pEB == NULL) return; CMacroCmdManager *pMCM = CMacroCmdManager::getInstance(); - pMCM->CurrentEditMacro.Name = pEB->getInputStringAsUtf8(); + pMCM->CurrentEditMacro.Name = pEB->getInputString(); if ((pMCM->CurrentEditMacro.Name.size() >= 2) && (pMCM->CurrentEditMacro.Name[0] == 'u') && (pMCM->CurrentEditMacro.Name[1] == 'i')) pMCM->CurrentEditMacro.Name[0] = 'U'; - pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.Name); + pEB->setInputString(pMCM->CurrentEditMacro.Name); } }; REGISTER_ACTION_HANDLER( CHandlerNewMacroEnterName, "new_macro_enter_name"); @@ -886,7 +886,7 @@ public: if (pCS != NULL) pCS->readFromMacro(pMCM->CurrentEditMacro); // Name CGroupEditBox *pEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_EDIT_NAME)); - if (pEB != NULL) pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.Name); + if (pEB != NULL) pEB->setInputString(pMCM->CurrentEditMacro.Name); // Commands CGroupList *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_COMMANDS)); if (pList == NULL) return; diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index 21cfb63cf..7bde7d0fc 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -2199,7 +2199,7 @@ public: if (gc) { CGroupEditBox *geb = dynamic_cast(gc->getGroup("add_contact_eb:eb")); - geb->setInputString(u32string()); + geb->setInputString(std::string()); } CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, sParams); } @@ -2257,11 +2257,11 @@ public: else { PeopleInterraction.askAddContact(geb->getInputStringAsUtf16(), peopleList); - geb->setInputString(u32string()); + geb->setInputString(std::string()); } } } - geb->setInputString(u32string()); + geb->setInputString(std::string()); } } } @@ -2389,7 +2389,7 @@ public: if (eb) { CWidgetManager::getInstance()->setCaptureKeyboard(eb); - eb->setInputString(u32string()); + eb->setInputString(std::string()); } // if (gc->getActive()) diff --git a/ryzom/client/src/interface_v3/people_list.cpp b/ryzom/client/src/interface_v3/people_list.cpp index 43ee1543c..1b4c7ea5e 100644 --- a/ryzom/client/src/interface_v3/people_list.cpp +++ b/ryzom/client/src/interface_v3/people_list.cpp @@ -884,7 +884,7 @@ class CHandlerContactEntry : public IActionHandler // Parse any tokens in the text if ( ! CInterfaceManager::parseTokens(text)) { - pEB->setInputString (u32string()); + pEB->setInputString (std::string()); return; } @@ -895,7 +895,7 @@ class CHandlerContactEntry : public IActionHandler // TODO : have NLMISC::ICommand accept unicode strings std::string str = text.toUtf8().substr(1); NLMISC::ICommand::execute( str, g_log ); - pEB->setInputString (u32string()); + pEB->setInputString (std::string()); return; } // Well, we could have used CChatWindow class to handle this, but CPeopleList was written earlier, so for now @@ -908,7 +908,7 @@ class CHandlerContactEntry : public IActionHandler // Simply do a tell on the player ChatMngr.tell(playerName.toString(), text); - pEB->setInputString (u32string()); + pEB->setInputString (std::string()); if (gc) { // Restore position of enclosing container if it hasn't been moved/scaled/poped by the user diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index 6f3617286..b134a5519 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -808,7 +808,7 @@ void initLoginScreen() CGroupEditBox *pGEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); if (pGEB != NULL && (pGEB->getInputString().empty())) { - pGEB->setInputStringAsUtf8(l); + pGEB->setInputString(l); } CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_PASSWORD "|select_all=false"); } @@ -830,8 +830,8 @@ void initAutoLogin() CInterfaceManager *pIM = CInterfaceManager::getInstance(); CGroupEditBox *pGEBLog = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); CGroupEditBox *pGEBPwd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD)); - pGEBLog->setInputStringAsUtf8(LoginLogin); - pGEBPwd->setInputStringAsUtf8(LoginPassword); + pGEBLog->setInputString(LoginLogin); + pGEBPwd->setInputString(LoginPassword); CAHManager::getInstance()->runActionHandler("on_login", NULL, ""); if (ClientCfg.R2Mode) @@ -1379,8 +1379,8 @@ class CAHOnLogin : public IActionHandler return; } - LoginLogin = pGEBLog->getInputStringAsUtf8(); - LoginPassword = pGEBPwd->getInputStringAsUtf8(); + LoginLogin = pGEBLog->getInputString(); + LoginPassword = pGEBPwd->getInputString(); onlogin(); } @@ -2394,7 +2394,7 @@ bool initCreateAccount() { CGroupEditBox * eb = dynamic_cast(createAccountUI->findFromShortId(editBoxes[i] + ":eb")); if(eb) - eb->setInputString(u32string()); + eb->setInputString(std::string()); } // conditions button @@ -2581,7 +2581,7 @@ class CAHOnCreateAccountSubmit : public IActionHandler { CGroupEditBox * eb = dynamic_cast(createAccountUI->findFromShortId(editBoxes[i] + ":eb")); if(eb) - results[i] = eb->getInputStringAsUtf8(); + results[i] = eb->getInputString(); } // text @@ -2735,11 +2735,11 @@ class CAHCreateAccountLogin : public IActionHandler { CGroupEditBox * eb = dynamic_cast(createAccountUI->findFromShortId("eb_login:eb")); if(eb) - LoginLogin = eb->getInputStringAsUtf8(); + LoginLogin = eb->getInputString(); eb = dynamic_cast(createAccountUI->findFromShortId("eb_password:eb")); if(eb) - LoginPassword = eb->getInputStringAsUtf8(); + LoginPassword = eb->getInputString(); onlogin(false); } diff --git a/ryzom/client/src/r2/editor.cpp b/ryzom/client/src/r2/editor.cpp index e9702af28..ee203d312 100644 --- a/ryzom/client/src/r2/editor.cpp +++ b/ryzom/client/src/r2/editor.cpp @@ -7484,7 +7484,7 @@ class CAHInviteCharacter : public IActionHandler CGroupEditBox *geb = dynamic_cast(fatherGC->getGroup("add_contact_eb:eb")); if (geb && !geb->getInputString().empty()) { - string charName = geb->getInputStringAsUtf8(); + string charName = geb->getInputString(); CSessionBrowserImpl & sessionBrowser = CSessionBrowserImpl::getInstance(); sessionBrowser.inviteCharacterByName(sessionBrowser.getCharId(), charName); @@ -7506,7 +7506,7 @@ class CAHInviteCharacter : public IActionHandler CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_newcomer"); } - geb->setInputString(u32string()); + geb->setInputString(std::string()); } } } From 1ec9f16de45311388ee8eb215f662d49f6513997 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 08:26:53 +0800 Subject: [PATCH 053/205] Get rid of useless raw copy in ucstring, default to UTF-8, ryzom/ryzomcore#335 --- nel/include/nel/misc/ucstring.h | 4 +--- nel/src/misc/ucstring.cpp | 22 +--------------------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/nel/include/nel/misc/ucstring.h b/nel/include/nel/misc/ucstring.h index 5b7597f00..61f7f416b 100644 --- a/nel/include/nel/misc/ucstring.h +++ b/nel/include/nel/misc/ucstring.h @@ -50,7 +50,7 @@ public: ucstring(const std::string &str) : ucstringbase() { - rawCopy(str); + fromUtf8(str); } ~ucstring() { } @@ -171,8 +171,6 @@ public: return ret; } -private: - void rawCopy(const std::string &str); }; inline ucstring operator+(const ucstringbase &ucstr, ucchar c) diff --git a/nel/src/misc/ucstring.cpp b/nel/src/misc/ucstring.cpp index 79cf78f7e..05c0d24ab 100644 --- a/nel/src/misc/ucstring.cpp +++ b/nel/src/misc/ucstring.cpp @@ -20,14 +20,7 @@ void ucstring::toString(std::string &str) const { - str.resize(size()); - for (uint i = 0; i < str.size(); i++) - { - if (operator[](i) > 255) - str[i] = '?'; - else - str[i] = (char)operator[](i); - } + str = nlmove(NLMISC::CUtfStringView(*this).toUtf8()); } std::string ucstring::toUtf8() const @@ -40,17 +33,4 @@ void ucstring::fromUtf8(const std::string &stringUtf8) *this = NLMISC::CUtfStringView(stringUtf8).toUtf16(); } -void ucstring::rawCopy(const std::string &str) -{ - // We need to convert the char into 8bits unsigned int before promotion to 16 bits - // otherwise, as char are signed on some compiler (MSCV for ex), the sign bit is extended to 16 bits. - resize(str.size()); - std::string::const_iterator first(str.begin()), last(str.end()); - iterator dest(begin()); - for (; first != last; ++first, ++dest) - { - *dest = uint8(*first); - } -} - /* end of file */ From 6ff5ddd790c6d339420cae52755fc24303d7fc0b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 08:32:17 +0800 Subject: [PATCH 054/205] Explicit function for obtaining 7-bit ascii, ryzom/ryzomcore#335 --- nel/include/nel/misc/utf_string_view.h | 1 + nel/src/misc/utf_string_view.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index eac06e0a1..df6bf76c8 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -60,6 +60,7 @@ public: u32string toUtf32() const; // Makes a copy std::wstring toWide() const; // Platform dependent, UTF-16 or UTF-32. Makes a copy. + std::string toAscii() const; // Returns only values 0-127, 7-bit ASCII. Makes a copy. inline bool isUtf8() const { return m_Iterator == utf8Iterator; } inline bool isUtf16() const { return m_Iterator == utf16Iterator; } diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp index db2ea7cec..3be14f515 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -106,6 +106,21 @@ u32string CUtfStringView::toUtf32() const return res; } +std::string CUtfStringView::toAscii() const +{ + std::string res; + res.reserve(m_Size); + for (iterator it(begin()), end(end()); it != end; ++it) + { + u32char c = *it; + if (c < 0x80) + res += c; + else + res += '_'; + } + return res; +} + std::wstring CUtfStringView::toWide() const { #ifdef NL_OS_WINDOWS From 698bfff501d481afa26d100db2db0a1ad1c5028c Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 08:41:39 +0800 Subject: [PATCH 055/205] Prefer UTF-8, cleanup, ryzom/ryzomcore#335 --- nel/include/nel/gui/group_editbox.h | 7 ++--- nel/src/gui/group_editbox.cpp | 26 ++++++++++++++----- .../src/interface_v3/action_handler_edit.cpp | 26 +++++++++---------- ryzom/client/src/interface_v3/chat_window.cpp | 2 +- 4 files changed, 37 insertions(+), 24 deletions(-) diff --git a/nel/include/nel/gui/group_editbox.h b/nel/include/nel/gui/group_editbox.h index 355c01d3c..36b8d63b4 100644 --- a/nel/include/nel/gui/group_editbox.h +++ b/nel/include/nel/gui/group_editbox.h @@ -64,13 +64,14 @@ namespace NLGUI /// Accessors std::string getInputString() const; + std::string getPrompt() const; const u32string &getInputStringRef() const { return _InputString; } - const ucstring &getPrompt() const { return _Prompt; } + const u32string &getPromptRef() const { return _Prompt; } /** Set the prompt * NB : line returns are encoded as '\n', not '\r\n' */ - void setPrompt(const ucstring &s) { _Prompt = s; } + void setPrompt(const std::string &s); void setInputString(const std::string &str); void setInputStringRef(const u32string &str) {_InputString = str; }; void setInputStringAsInt(sint32 val); @@ -228,7 +229,7 @@ namespace NLGUI NLMISC::CRGBA _BackSelectColor; // Text info - ucstring _Prompt; + u32string _Prompt; u32string _InputString; CViewText *_ViewText; diff --git a/nel/src/gui/group_editbox.cpp b/nel/src/gui/group_editbox.cpp index 037ae4656..1453ba5fe 100644 --- a/nel/src/gui/group_editbox.cpp +++ b/nel/src/gui/group_editbox.cpp @@ -96,7 +96,7 @@ namespace NLGUI _ViewTextDeltaX(0) { - _Prompt = ">"; + _Prompt = u32string(1, '>'); _BackSelectColor= CRGBA::White; _TextSelectColor= CRGBA::Black; } @@ -170,7 +170,7 @@ namespace NLGUI else if( name == "prompt" ) { - return _Prompt.toString(); + return CUtfStringView(_Prompt).toUtf8(); } else if( name == "enter_type" ) @@ -354,7 +354,7 @@ namespace NLGUI else if( name == "prompt" ) { - _Prompt = value; + _Prompt = CUtfStringView(value).toUtf32(); return; } else @@ -477,7 +477,7 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "max_chars_size", BAD_CAST toString( _MaxCharsSize ).c_str() ); xmlSetProp( node, BAD_CAST "enter_loose_focus", BAD_CAST toString( _LooseFocusOnEnter ).c_str() ); xmlSetProp( node, BAD_CAST "enter_recover_focus", BAD_CAST toString( _RecoverFocusOnEnter ).c_str() ); - xmlSetProp( node, BAD_CAST "prompt", BAD_CAST _Prompt.toString().c_str() ); + xmlSetProp( node, BAD_CAST "prompt", BAD_CAST CUtfStringView(_Prompt).toUtf8().c_str() ); std::string e; switch( _EntryType ) @@ -606,7 +606,7 @@ namespace NLGUI if (prop) _ResetFocusOnHide = convertBool(prop); prop = (char*) xmlGetProp( cur, (xmlChar*)"prompt" ); - if (prop) _Prompt = (const char*)prop; + if (prop) _Prompt = CUtfStringView((const char*)prop).toUtf32(); prop = (char*) xmlGetProp( cur, (xmlChar*)"entry_type" ); _EntryType = Text; @@ -1436,13 +1436,13 @@ namespace NLGUI ucstring usTmp; if (_EntryType == Password) { - usTmp = _Prompt; + usTmp = CUtfStringView(_Prompt).toUtf16(); for (uint32 i = 0; i < _InputString.size(); ++i) usTmp += "*"; } else { - usTmp = _Prompt + CUtfStringView(_InputString).toUtf16(); + usTmp = CUtfStringView(_Prompt + _InputString).toUtf16(); } _ViewText->setText (usTmp); } @@ -1624,6 +1624,12 @@ namespace NLGUI } + // ---------------------------------------------------------------------------- + void CGroupEditBox::setPrompt(const std::string &s) + { + _Prompt = CUtfStringView(s).toUtf32(); + } + // ---------------------------------------------------------------------------- void CGroupEditBox::setInputString(const std::string &str) @@ -1742,6 +1748,12 @@ namespace NLGUI CInterfaceGroup::setActive(active); } + // *************************************************************************** + std::string CGroupEditBox::getPrompt() const + { + return NLMISC::CUtfStringView(_Prompt).toUtf8(); + } + // *************************************************************************** std::string CGroupEditBox::getInputString() const { diff --git a/ryzom/client/src/interface_v3/action_handler_edit.cpp b/ryzom/client/src/interface_v3/action_handler_edit.cpp index 055a77422..bde8f5389 100644 --- a/ryzom/client/src/interface_v3/action_handler_edit.cpp +++ b/ryzom/client/src/interface_v3/action_handler_edit.cpp @@ -288,11 +288,11 @@ class CAHEditGotoLineBegin : public CAHEdit // go to the start of line if (_GroupEdit->getViewText()) { - sint line = _GroupEdit->getViewText()->getLineFromIndex(_GroupEdit->getCursorPos() + (uint)_GroupEdit->getPrompt().length()); + sint line = _GroupEdit->getViewText()->getLineFromIndex(_GroupEdit->getCursorPos() + (uint)_GroupEdit->getPromptRef().length()); if (line == -1) return; - sint newPos = std::max(_GroupEdit->getViewText()->getLineStartIndex(line), (sint) _GroupEdit->getPrompt().length()); + sint newPos = std::max(_GroupEdit->getViewText()->getLineStartIndex(line), (sint) _GroupEdit->getPromptRef().length()); if (newPos == -1) return; - _GroupEdit->setCursorPos(newPos - (sint32)_GroupEdit->getPrompt().length()); + _GroupEdit->setCursorPos(newPos - (sint32)_GroupEdit->getPromptRef().length()); _GroupEdit->setCursorAtPreviousLineEnd(false); } } @@ -310,20 +310,20 @@ class CAHEditGotoLineEnd : public CAHEdit { if (_GroupEdit->getViewText()->getMultiLine()) { - sint line = _GroupEdit->getViewText()->getLineFromIndex(_GroupEdit->getCursorPos() + (uint)_GroupEdit->getPrompt().length(), _GroupEdit->isCursorAtPreviousLineEnd()); + sint line = _GroupEdit->getViewText()->getLineFromIndex(_GroupEdit->getCursorPos() + (uint)_GroupEdit->getPromptRef().length(), _GroupEdit->isCursorAtPreviousLineEnd()); if (line == -1) return; sint newPos; bool endOfPreviousLine; _GroupEdit->getViewText()->getLineEndIndex(line, newPos, endOfPreviousLine); if (newPos != -1) { - _GroupEdit->setCursorPos(newPos - (sint32)_GroupEdit->getPrompt().length()); + _GroupEdit->setCursorPos(newPos - (sint32)_GroupEdit->getPromptRef().length()); _GroupEdit->setCursorAtPreviousLineEnd(endOfPreviousLine); } } else { - _GroupEdit->setCursorPos((sint32)_GroupEdit->getPrompt().length() + (sint32)_GroupEdit->getInputString().length()); + _GroupEdit->setCursorPos((sint32)_GroupEdit->getPromptRef().length() + (sint32)_GroupEdit->getInputString().length()); } } } @@ -378,7 +378,7 @@ class CAHEditPreviousLine : public CAHEdit } else if (_GroupEdit->getViewText()->getMultiLine()) { - uint cursorPosInText = _GroupEdit->getCursorPos() + (uint)_GroupEdit->getPrompt().length(); + uint cursorPosInText = _GroupEdit->getCursorPos() + (uint)_GroupEdit->getPromptRef().length(); if ( (_GroupEdit->getCursorPos() == (sint32) _GroupEdit->getInputStringRef().length() && _GroupEdit->getViewText()->getNumLine() == 1) || _GroupEdit->getViewText()->getLineFromIndex(cursorPosInText, _GroupEdit->isCursorAtPreviousLineEnd()) == 0 @@ -396,7 +396,7 @@ class CAHEditPreviousLine : public CAHEdit _GroupEdit->getViewText()->getCharacterIndexFromPosition(cx, cy, newCharIndex, newLineEnd); if (newLineEnd) { - _GroupEdit->setCursorPos(newCharIndex - (sint32)_GroupEdit->getPrompt().length()); + _GroupEdit->setCursorPos(newCharIndex - (sint32)_GroupEdit->getPromptRef().length()); _GroupEdit->setCursorAtPreviousLineEnd(true); sint32 newPos = _GroupEdit->getCursorPos(); clamp(newPos, (sint32) 0, (sint32) _GroupEdit->getInputStringRef().size()); @@ -417,7 +417,7 @@ class CAHEditPreviousLine : public CAHEdit { _GroupEdit->setCursorPos(newCharIndex + 1); } - _GroupEdit->setCursorPos(_GroupEdit->getCursorPos()-(sint32)_GroupEdit->getPrompt().length()); + _GroupEdit->setCursorPos(_GroupEdit->getCursorPos()-(sint32)_GroupEdit->getPromptRef().length()); sint32 newpos = _GroupEdit->getCursorPos(); clamp(newpos, (sint32) 0, (sint32)_GroupEdit->getInputStringRef().size()); _GroupEdit->setCursorPos(newpos); @@ -452,7 +452,7 @@ class CAHEditNextLine : public CAHEdit { float cx, cy; float height; - _GroupEdit->getViewText()->getCharacterPositionFromIndex(_GroupEdit->getCursorPos() + (sint)_GroupEdit->getPrompt().length(), _GroupEdit->isCursorAtPreviousLineEnd(), cx, cy, height); + _GroupEdit->getViewText()->getCharacterPositionFromIndex(_GroupEdit->getCursorPos() + (sint)_GroupEdit->getPromptRef().length(), _GroupEdit->isCursorAtPreviousLineEnd(), cx, cy, height); if (cy != 0) { cy -= height; @@ -461,7 +461,7 @@ class CAHEditNextLine : public CAHEdit _GroupEdit->getViewText()->getCharacterIndexFromPosition(cx, cy, newCharIndex, newLineEnd); if (newLineEnd) { - _GroupEdit->setCursorPos(newCharIndex - (sint32)_GroupEdit->getPrompt().length()); + _GroupEdit->setCursorPos(newCharIndex - (sint32)_GroupEdit->getPromptRef().length()); _GroupEdit->setCursorAtPreviousLineEnd(true); sint32 newPos = _GroupEdit->getCursorPos(); clamp(newPos, (sint32) 0, (sint32) _GroupEdit->getInputStringRef().size()); @@ -480,9 +480,9 @@ class CAHEditNextLine : public CAHEdit } else { - _GroupEdit->setCursorPos(min(sint32(newCharIndex + 1), sint32(_GroupEdit->getInputStringRef().length() + _GroupEdit->getPrompt().length()))); + _GroupEdit->setCursorPos(min(sint32(newCharIndex + 1), sint32(_GroupEdit->getInputStringRef().length() + _GroupEdit->getPromptRef().length()))); } - _GroupEdit->setCursorPos(_GroupEdit->getCursorPos()-(sint32)_GroupEdit->getPrompt().length()); + _GroupEdit->setCursorPos(_GroupEdit->getCursorPos()-(sint32)_GroupEdit->getPromptRef().length()); sint32 newPos = _GroupEdit->getCursorPos(); clamp(newPos, (sint32) 0, (sint32) _GroupEdit->getInputStringRef().size()); _GroupEdit->setCursorPos(newPos); diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index ed1a220ca..72a877cb7 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -262,7 +262,7 @@ void CChatWindow::setPrompt(const ucstring &prompt) if (!_Chat) return; CGroupEditBox *eb = dynamic_cast(_Chat->getGroup("eb")); if (!eb) return; - eb->setPrompt(prompt); + eb->setPrompt(prompt.toUtf8()); } void CChatWindow::setPromptColor(NLMISC::CRGBA col) From 9021ce465f09577ea5a4acf3ce0a8254aff159fa Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 11:24:30 +0800 Subject: [PATCH 056/205] Change CViewText to UTF-8, ryzom/ryzomcore#335 --- nel/include/nel/3d/computed_string.h | 1 + nel/include/nel/3d/u_text_context.h | 7 +- nel/include/nel/gui/dbview_quantity.h | 2 +- nel/include/nel/gui/group_html.h | 2 +- nel/include/nel/gui/view_text.h | 49 +++++++------ nel/include/nel/misc/utf_string_view.h | 18 ++++- nel/src/3d/font_manager.cpp | 2 + nel/src/3d/text_context_user.cpp | 8 +-- nel/src/gui/ctrl_text_button.cpp | 18 ++--- nel/src/gui/dbgroup_combo_box.cpp | 10 +-- nel/src/gui/dbview_number.cpp | 10 +-- nel/src/gui/dbview_quantity.cpp | 8 +-- nel/src/gui/group_container.cpp | 8 +-- nel/src/gui/group_editbox.cpp | 12 ++-- nel/src/gui/group_html.cpp | 12 ++-- nel/src/gui/group_list.cpp | 4 +- nel/src/gui/group_menu.cpp | 10 +-- nel/src/gui/group_paragraph.cpp | 6 +- nel/src/gui/group_tree.cpp | 2 +- nel/src/gui/view_pointer.cpp | 4 +- nel/src/gui/view_text_formated.cpp | 2 +- nel/src/gui/view_text_id.cpp | 4 +- nel/src/gui/view_text_id_formated.cpp | 2 +- nel/src/gui/widget_manager.cpp | 2 +- nel/src/misc/diff_tool.cpp | 29 ++++---- nel/src/misc/utf_string_view.cpp | 71 ++++++++++++------- ryzom/client/src/connection.cpp | 32 ++++----- ryzom/client/src/entity_cl.cpp | 2 +- ryzom/client/src/game_context_menu.cpp | 18 ++--- .../src/interface_v3/action_handler_game.cpp | 2 +- .../src/interface_v3/action_handler_help.cpp | 8 +-- .../src/interface_v3/action_phrase_faber.cpp | 6 +- .../src/interface_v3/bot_chat_page_trade.cpp | 10 +-- .../src/interface_v3/chat_text_manager.cpp | 8 +-- .../client/src/interface_v3/dbctrl_sheet.cpp | 2 +- .../src/interface_v3/dbgroup_build_phrase.cpp | 8 +-- .../dbgroup_list_sheet_icon_phrase.cpp | 2 +- .../interface_v3/dbgroup_list_sheet_text.cpp | 2 +- .../interface_v3/dbgroup_list_sheet_text.h | 2 +- ...roup_list_sheet_text_brick_composition.cpp | 6 +- .../dbgroup_list_sheet_text_phrase.cpp | 4 +- .../dbgroup_list_sheet_text_phrase_id.cpp | 2 +- .../interface_v3/dbgroup_list_sheet_trade.cpp | 2 +- .../src/interface_v3/encyclopedia_manager.cpp | 16 ++--- .../src/interface_v3/flying_text_manager.cpp | 2 +- .../client/src/interface_v3/group_compas.cpp | 2 +- .../interface_v3/group_in_scene_bubble.cpp | 16 ++--- .../interface_v3/group_in_scene_user_info.cpp | 12 ++-- ryzom/client/src/interface_v3/group_map.cpp | 10 +-- .../src/interface_v3/group_modal_get_key.cpp | 6 +- .../client/src/interface_v3/group_skills.cpp | 2 +- .../client/src/interface_v3/guild_manager.cpp | 16 ++--- .../client/src/interface_v3/interface_ddx.cpp | 4 +- .../src/interface_v3/interface_manager.cpp | 10 +-- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 2 +- .../client/src/interface_v3/macrocmd_key.cpp | 32 ++++----- .../src/interface_v3/macrocmd_manager.cpp | 10 +-- .../client/src/interface_v3/music_player.cpp | 4 +- .../src/interface_v3/people_interraction.cpp | 2 +- .../src/interface_v3/task_bar_manager.cpp | 4 +- ryzom/client/src/login.cpp | 18 ++--- ryzom/client/src/net_manager.cpp | 2 +- ryzom/client/src/player_cl.cpp | 2 +- ryzom/client/src/r2/editor.cpp | 10 +-- ryzom/client/src/session_browser_impl.cpp | 2 +- 65 files changed, 323 insertions(+), 280 deletions(-) diff --git a/nel/include/nel/3d/computed_string.h b/nel/include/nel/3d/computed_string.h index c4404f661..35bfb692c 100644 --- a/nel/include/nel/3d/computed_string.h +++ b/nel/include/nel/3d/computed_string.h @@ -182,6 +182,7 @@ public: CMaterial *Material; CRGBA Color; std::string Text; + size_t Length; uint32 CacheVersion; diff --git a/nel/include/nel/3d/u_text_context.h b/nel/include/nel/3d/u_text_context.h index 9cf710b11..c5d31b886 100644 --- a/nel/include/nel/3d/u_text_context.h +++ b/nel/include/nel/3d/u_text_context.h @@ -104,8 +104,11 @@ public: */ float StringLine; - CStringInfo() {StringWidth= StringHeight= StringLine= 0;} - CStringInfo(float w, float h, float l) {StringWidth= w; StringHeight= h; StringLine = l;} + /// The length in characters + size_t StringLength; + + CStringInfo() { StringWidth = StringHeight = StringLine = 0; StringLength = 0; } + CStringInfo(float w, float h, float l, size_t len) { StringWidth = w; StringHeight = h; StringLine = l; StringLength = len; } /** * Get the string's origin diff --git a/nel/include/nel/gui/dbview_quantity.h b/nel/include/nel/gui/dbview_quantity.h index 16a11f5a0..c23b394ab 100644 --- a/nel/include/nel/gui/dbview_quantity.h +++ b/nel/include/nel/gui/dbview_quantity.h @@ -57,7 +57,7 @@ namespace NLGUI CInterfaceProperty _NumberMax; sint32 _Cache; sint32 _CacheMax; - ucstring _EmptyText; + std::string _EmptyText; void buildTextFromCache(); }; diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index 590c43a89..1013a8b10 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -765,7 +765,7 @@ namespace NLGUI std::string _TextAreaScript; // Get last char - ucchar getLastChar() const; + u32char getLastChar() const; // Current link view class CViewLink *_CurrentViewLink; diff --git a/nel/include/nel/gui/view_text.h b/nel/include/nel/gui/view_text.h index 57ab6a096..959c82855 100644 --- a/nel/include/nel/gui/view_text.h +++ b/nel/include/nel/gui/view_text.h @@ -84,7 +84,8 @@ namespace NLGUI /// Set - void setText (const ucstring &text); + void setText(const std::string &text); + void setTextAsUtf16 (const ucstring &text); void setFontName (const std::string &name); void setFontSize (sint nFontSize, bool coef = true); void setEmbolden (bool nEmbolden); @@ -95,7 +96,8 @@ namespace NLGUI void setShadowColor (const NLMISC::CRGBA &color); void setShadowOffset (sint x, sint y); void setLineMaxW (sint nMaxW, bool invalidate=true); - void setOverflowText(const ucstring &text) { _OverflowText = text; } + void setOverflowText(const std::string &text) { _OverflowText = text; } + void setOverflowTextAsUtf16(const ucstring &text) { _OverflowText = text.toUtf8(); } void setMultiLine (bool bMultiLine); void setMultiLineSpace (sint nMultiLineSpace); void setMultiLineMaxWOnly (bool state); @@ -112,8 +114,9 @@ namespace NLGUI void disableStringSelection(); /// Get - - ucstring getText() const { return _Text; } + std::string getText() const { return _Text; } + ucstring getTextAsUtf16() const; + ucstring getHardTextAsUtf16() const; sint getFontSize() const; std::string getFontName() const { return _FontName; } bool getEmbolden() { return _Embolden; } @@ -124,7 +127,7 @@ namespace NLGUI NLMISC::CRGBA getShadowColor() { return _ShadowColor; } void getShadowOffset(sint &x, sint &y) { x = _ShadowX; y = _ShadowY; } sint getLineMaxW() const { return _LineMaxW; } - ucstring getOverflowText() const { return _OverflowText; } + ucstring getOverflowTextAsUtf16() const { return _OverflowText; } bool getMultiLine() const { return _MultiLine; } sint getMultiLineSpace() const { return _MultiLineSpace; } bool getMultiLineMaxWOnly() const { return _MultiLineMaxWOnly; } @@ -174,8 +177,9 @@ namespace NLGUI /// From a line number, get the character at which it ends (not including any '\n' ), or -1 if invalid void getLineEndIndex(uint line, sint &index, bool &endOfPreviousLine) const; - std::string getHardText() const { std::string result; _Text.toString (result); return result; } + std::string getHardText() const { return _HardText.empty() ? _Text : _HardText; } void setHardText (const std::string &ht); + void setHardTextAsUtf16(const ucstring &ht); std::string getColorAsString() const; void setColorAsString(const std::string &ht); @@ -188,9 +192,11 @@ namespace NLGUI /** Setup a Text with Format Tags. Text is store without color/format tags, and special array is allocated for Format association */ - void setTextFormatTaged(const ucstring &text); + void setTextFormatTaged(const std::string &text); + void setTextFormatTagedAsUtf16(const ucstring &text); - void setSingleLineTextFormatTaged(const ucstring &text); + void setSingleLineTextFormatTaged(const std::string &text); + void setSingleLineTextFormatTagedAsUtf16(const ucstring &text); // Remove end space void removeEndSpaces(); @@ -216,10 +222,12 @@ namespace NLGUI int luaSetLineMaxW(CLuaState &ls); REFLECT_EXPORT_START(CViewText, CViewBase) + REFLECT_STRING("text", getText, setText); REFLECT_STRING("hardtext", getHardText, setHardText); - REFLECT_UCSTRING("uc_hardtext", getText, setText); - REFLECT_UCSTRING("uc_hardtext_format", getText, setTextFormatTaged); - REFLECT_UCSTRING("uc_hardtext_single_line_format", getText, setSingleLineTextFormatTaged); + // REFLECT_UCSTRING("uc_text", getTextAsUtf16, setTextAsUtf16); // Deprecate uc_ functions + REFLECT_UCSTRING("uc_hardtext", getHardTextAsUtf16, setHardTextAsUtf16); + REFLECT_UCSTRING("uc_hardtext_format", getTextAsUtf16, setTextFormatTagedAsUtf16); // FIXME: Name doesn't make sense + REFLECT_UCSTRING("uc_hardtext_single_line_format", getTextAsUtf16, setSingleLineTextFormatTagedAsUtf16); // FIXME: Name doesn't make sense REFLECT_STRING ("color", getColorAsString, setColorAsString); REFLECT_RGBA ("color_rgba", getColorRGBA, setColorRGBA); REFLECT_SINT32 ("alpha", getAlpha, setAlpha); @@ -228,7 +236,6 @@ namespace NLGUI REFLECT_LUA_METHOD("setLineMaxW", luaSetLineMaxW); REFLECT_EXPORT_END - virtual void serial(NLMISC::IStream &f); // Sets the parent element @@ -236,9 +243,11 @@ namespace NLGUI void setParentElm( CInterfaceElement *parent ){ _ParentElm = parent; } protected: - std::string _HardtextFormat; /// Text to display. - ucstring _Text; + std::string _HardTextFormat; + std::string _HardText; + std::string _Text; + size_t _TextLength; /// index of the computed String associated to this text control uint _Index; /// info on the computed String associated to this text control @@ -278,7 +287,7 @@ namespace NLGUI sint32 _LineMaxW; /// For single line, true if the text is clamped (ie displayed with "...") bool _SingleLineTextClamped; - ucstring _OverflowText; + std::string _OverflowText; /// Multiple lines handling bool _MultiLine; @@ -339,7 +348,7 @@ namespace NLGUI public: // default ctor CWord(uint numSpaces = 0) : Index(0), NumSpaces(numSpaces) {} - ucstring Text; + std::string Text; uint Index; // index of the info for this word NL3D::UTextContext::CStringInfo Info; uint NumSpaces; // number of spaces before this word @@ -347,7 +356,7 @@ namespace NLGUI CFormatInfo Format; public: // build from a string, using the current text context - void build(const ucstring &text, NL3D::UTextContext &textContext, uint numSpaces= 0); + void build(const std::string &text, NL3D::UTextContext &textContext, uint numSpaces= 0); }; typedef std::vector TWordVect; @@ -360,7 +369,7 @@ namespace NLGUI // Clear the line & remove text contexts void clear(NL3D::UTextContext &textContext); // Add a new word (and its context) in the line + a number of spaces to append at the end of the line - void addWord(const ucstring &word, uint numSpaces, const CFormatInfo &wordFormat, float fontWidth, NL3D::UTextContext &textContext); + void addWord(const std::string &word, uint numSpaces, const CFormatInfo &wordFormat, float fontWidth, NL3D::UTextContext &textContext); void addWord(const CWord &word, float fontWidth); uint getNumWords() const { return (uint)_Words.size(); } CWord &getWord(uint index) { return _Words[index]; } @@ -442,7 +451,7 @@ namespace NLGUI void onInvalidateContent(); // may append a new line, and append a word to the last line (no spaces) - void flushWordInLine(ucstring &ucCurrentWord, bool &linePushed, const CFormatInfo &wordFormat); + void flushWordInLine(std::string &ucCurrentWord, bool &linePushed, const CFormatInfo &wordFormat); // Clear all the lines and free their datas void clearLines(); // Update in the case of a multiline text @@ -456,7 +465,7 @@ namespace NLGUI void addDontClipWordLine(std::vector &currLine); // FormatTag build. - static void buildFormatTagText(const ucstring &text, ucstring &textBuild, std::vector &formatTags, std::vector &tooltips); + static void buildFormatTagText(const std::string &text, std::string &textBuild, std::vector &formatTags, std::vector &tooltips); // FormatTag parsing. bool isFormatTagChange(uint textIndex, uint ctIndex) const; void getFormatTagChange(uint textIndex, uint &ctIndex, CFormatInfo &wordFormat) const; diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index df6bf76c8..61291f421 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -32,6 +32,7 @@ class CUtfStringView public: inline CUtfStringView() : m_Str(NULL), m_Size(0), m_Iterator(utf32Iterator) {} + inline CUtfStringView(const std::string &utf8Str) : m_Str(utf8Str.c_str()), m_Size(utf8Str.size()), m_Iterator(utf8Iterator) {} inline CUtfStringView(const char *utf8Str) : m_Str(utf8Str), m_Size(strlen(utf8Str)), m_Iterator(utf8Iterator) {} inline CUtfStringView(const char *utf8Str, size_t len): m_Str(utf8Str), m_Size(len), m_Iterator(utf8Iterator) { @@ -51,8 +52,8 @@ public: } #endif - inline CUtfStringView(const std::string &utf8Str) : m_Str(utf8Str.c_str()), m_Size(utf8Str.size()), m_Iterator(utf8Iterator) {} inline CUtfStringView(const ucstring &utf16Str) : m_Str(utf16Str.c_str()), m_Size(utf16Str.size() << 1), m_Iterator(utf16Iterator) {} + inline CUtfStringView(const ucchar *utf16Str) : m_Str(utf16Str), m_Size(strlen((const char *)utf16Str) & (ptrdiff_t)(-2)), m_Iterator(utf16Iterator) {} inline CUtfStringView(const u32string &utf32Str) : m_Str(utf32Str.c_str()), m_Size(utf32Str.size() << 2), m_Iterator(utf32Iterator) {} std::string toUtf8(bool reEncode = false) const; // Makes a copy @@ -96,9 +97,18 @@ public: this->~const_iterator(); return *new(this) const_iterator(other); } + + const void *ptr() const { return m_Addr; } private: friend class CUtfStringView; - inline const_iterator(const CUtfStringView &view, const void *addr) : m_View(view), m_Addr(addr), m_Char(addr ? view.m_Iterator(&m_Addr) : 0) { } + inline const_iterator(const CUtfStringView &view, const void *addr) : m_View(view), m_Addr(addr), m_Char(addr ? view.m_Iterator(&m_Addr) : 0) + { + if ((ptrdiff_t)m_Addr > ((ptrdiff_t)m_View.m_Str + m_View.m_Size)) + { + m_Addr = 0; + m_Char = 0; + } + } const CUtfStringView &m_View; const void *m_Addr; // Next address u32char m_Char; @@ -116,6 +126,8 @@ public: inline bool empty() const { return !m_Size; } const void *ptr() const { return m_Str; } + size_t count() const; // Slow count of UTF-32 characters + inline CUtfStringView substr(const iterator &begin, const iterator &end) const { return CUtfStringView(begin.m_Addr, (ptrdiff_t)end.m_Addr - (ptrdiff_t)begin.m_Addr, m_Iterator); @@ -130,6 +142,8 @@ public: return *new(this) CUtfStringView(other); } + static void append(std::string &str, u32char c); + private: typedef u32char (*TIterator)(const void **addr); static u32char utf8Iterator(const void **addr); diff --git a/nel/src/3d/font_manager.cpp b/nel/src/3d/font_manager.cpp index 70fb59639..4a8162f51 100644 --- a/nel/src/3d/font_manager.cpp +++ b/nel/src/3d/font_manager.cpp @@ -211,6 +211,7 @@ void CFontManager::computeString (NLMISC::CUtfStringView sv, } } output.Vertices.setNumVertices (j); + output.Length = j >> 2; // compile string info output.StringWidth = (float)penx; @@ -314,6 +315,7 @@ void CFontManager::computeStringInfo ( NLMISC::CUtfStringView sv, penx += pLI->AdvX; } } + output.Length = idx; // compile string info output.StringWidth = (float)penx; diff --git a/nel/src/3d/text_context_user.cpp b/nel/src/3d/text_context_user.cpp index 95d9ebe1c..447122293 100644 --- a/nel/src/3d/text_context_user.cpp +++ b/nel/src/3d/text_context_user.cpp @@ -275,23 +275,23 @@ UTextContext::CStringInfo CTextContextUser::getStringInfo(uint32 i) CComputedString *cstr= _TextContext.getComputedString(i); if(!cstr) - return CStringInfo(0, 0, 0); + return CStringInfo(0, 0, 0, 0); else - return CStringInfo(cstr->StringWidth, cstr->StringHeight, cstr->StringLine); + return CStringInfo(cstr->StringWidth, cstr->StringHeight, cstr->StringLine, cstr->Length); } UTextContext::CStringInfo CTextContextUser::getStringInfo(NLMISC::CUtfStringView sv) { H_AUTO2; _TextContext.computeStringInfo(sv, _CacheString); - return CStringInfo (_CacheString.StringWidth, _CacheString.StringHeight, _CacheString.StringLine); + return CStringInfo (_CacheString.StringWidth, _CacheString.StringHeight, _CacheString.StringLine, _CacheString.Length); } UTextContext::CStringInfo CTextContextUser::getStringInfo(NLMISC::CUtfStringView sv, size_t len) { H_AUTO2; _TextContext.computeStringInfo(sv, _CacheString, len); - return CStringInfo (_CacheString.StringWidth, _CacheString.StringHeight, _CacheString.StringLine); + return CStringInfo (_CacheString.StringWidth, _CacheString.StringHeight, _CacheString.StringLine, _CacheString.Length); } void CTextContextUser::clear() { diff --git a/nel/src/gui/ctrl_text_button.cpp b/nel/src/gui/ctrl_text_button.cpp index 942dd11f8..1bd32be27 100644 --- a/nel/src/gui/ctrl_text_button.cpp +++ b/nel/src/gui/ctrl_text_button.cpp @@ -136,7 +136,7 @@ namespace NLGUI if( name == "hardtext" ) { if( _ViewText != NULL ) - return _ViewText->getText().toString(); + return _ViewText->getText(); else return std::string( "" ); } @@ -316,7 +316,7 @@ namespace NLGUI if( name == "hardtext" ) { if( _ViewText != NULL ) - _ViewText->setText( value ); + _ViewText->setHardText( value ); return; } else @@ -487,7 +487,7 @@ namespace NLGUI xmlNewProp( node, BAD_CAST "wmargin", BAD_CAST toString( _WMargin ).c_str() ); xmlNewProp( node, BAD_CAST "wmin", BAD_CAST toString( _WMin ).c_str() ); xmlNewProp( node, BAD_CAST "hmin", BAD_CAST toString( _HMin ).c_str() ); - xmlNewProp( node, BAD_CAST "hardtext", BAD_CAST _ViewText->getText().toString().c_str() ); + xmlNewProp( node, BAD_CAST "hardtext", BAD_CAST _ViewText->getText().c_str() ); xmlNewProp( node, BAD_CAST "text_y", BAD_CAST toString( _TextY ).c_str() ); xmlNewProp( node, BAD_CAST "text_x", BAD_CAST toString( _TextX ).c_str() ); xmlNewProp( node, BAD_CAST "text_underlined", BAD_CAST toString( _ViewText->getUnderlined() ).c_str() ); @@ -596,11 +596,11 @@ namespace NLGUI if (prop) { const char *propPtr = prop; - ucstring text; + std::string text; if (NLMISC::startsWith(propPtr, "ui")) - text = CI18N::get(propPtr); + text = CI18N::get(propPtr).toUtf8(); else - text.fromUtf8(propPtr); + text = propPtr; _ViewText->setText(text); } } @@ -990,7 +990,7 @@ namespace NLGUI nlassert( v != NULL ); _ViewText = dynamic_cast< CViewText* >( v ); _ViewText->setId( _Id + "_text" ); - _ViewText->setText( ucstring( "text" ) ); + _ViewText->setText( "text" ); _ViewText->setSerializable( false ); } @@ -1044,14 +1044,14 @@ namespace NLGUI void CCtrlTextButton::setText (const ucstring &text) { if (_ViewText && !_IsViewTextId) - _ViewText->setText(text); + _ViewText->setText(text.toUtf8()); } // *************************************************************************** ucstring CCtrlTextButton::getText () const { if (_ViewText && !_IsViewTextId) - return _ViewText->getText(); + return CUtfStringView(_ViewText->getText()).toUtf16(); return ucstring(""); } diff --git a/nel/src/gui/dbgroup_combo_box.cpp b/nel/src/gui/dbgroup_combo_box.cpp index 59a8b03c8..f7c49fee8 100644 --- a/nel/src/gui/dbgroup_combo_box.cpp +++ b/nel/src/gui/dbgroup_combo_box.cpp @@ -236,15 +236,15 @@ namespace NLGUI // change selected text if(_CacheSelection<0 || _CacheSelection>=(sint32)_Texts.size() ) { - _ViewText->setText(ucstring()); + _ViewText->setText(std::string()); } else if(_IsExternViewText) { - _ViewText->setText(_ExternViewText); + _ViewText->setText(_ExternViewText.toUtf8()); } else { - _ViewText->setText(_Texts[_CacheSelection].second); + _ViewText->setText(_Texts[_CacheSelection].second.toUtf8()); } } } @@ -468,13 +468,13 @@ namespace NLGUI { _IsExternViewText = true; _ExternViewText = text; - _ViewText->setText(_ExternViewText); + _ViewText->setText(_ExternViewText.toUtf8()); } // *************************************************************************** ucstring CDBGroupComboBox::getViewText() const { - return _ViewText->getText(); + return CUtfStringView(_ViewText->getText()).toUtf16(); } // *************************************************************************** diff --git a/nel/src/gui/dbview_number.cpp b/nel/src/gui/dbview_number.cpp index af768140c..7ba4c17ba 100644 --- a/nel/src/gui/dbview_number.cpp +++ b/nel/src/gui/dbview_number.cpp @@ -43,7 +43,7 @@ namespace NLGUI { _Positive = false; _Cache= 0; - setText(ucstring("0")); + setText(std::string("0")); _Divisor = 1; _Modulo = 0; } @@ -225,7 +225,7 @@ namespace NLGUI // init cache. _Cache= 0; - setText(ucstring("0")); + setText(std::string("0")); return true; } @@ -238,9 +238,9 @@ namespace NLGUI if (_Cache != val) { _Cache= val; - ucstring value = _Format ? NLMISC::formatThousands(toString(val)) : toString(val); - if (_Positive) setText(val >= 0 ? ( ucstring(_Prefix) + value + ucstring(_Suffix) ) : ucstring("?")); - else setText( ucstring(_Prefix) + value + ucstring(_Suffix) ); + std::string value = _Format ? NLMISC::formatThousands(toString(val)) : toString(val); + if (_Positive) setText(val >= 0 ? ( _Prefix.toString() + value + _Suffix.toString() ) : "?"); + else setText( _Prefix.toString() + value + _Suffix.toString() ); } } diff --git a/nel/src/gui/dbview_quantity.cpp b/nel/src/gui/dbview_quantity.cpp index 0b01f14f0..0f90d598e 100644 --- a/nel/src/gui/dbview_quantity.cpp +++ b/nel/src/gui/dbview_quantity.cpp @@ -63,7 +63,7 @@ namespace NLGUI else if( name == "emptytext" ) { - return _EmptyText.toString(); + return _EmptyText; } else return CViewText::getProperty( name ); @@ -112,7 +112,7 @@ namespace NLGUI else xmlSetProp( node, BAD_CAST "valuemax", BAD_CAST "" ); - xmlSetProp( node, BAD_CAST "emptytext", BAD_CAST _EmptyText.toString().c_str() ); + xmlSetProp( node, BAD_CAST "emptytext", BAD_CAST _EmptyText.c_str() ); return node; } @@ -148,9 +148,9 @@ namespace NLGUI { const char *propPtr = ptr; if (NLMISC::startsWith(propPtr, "ui")) - _EmptyText = CI18N::get(propPtr); + _EmptyText = CI18N::get(propPtr).toUtf8(); else - _EmptyText.fromUtf8(propPtr); + _EmptyText = propPtr; } // init cache. diff --git a/nel/src/gui/group_container.cpp b/nel/src/gui/group_container.cpp index 87fb59c38..7bab62820 100644 --- a/nel/src/gui/group_container.cpp +++ b/nel/src/gui/group_container.cpp @@ -3744,7 +3744,7 @@ namespace NLGUI _TitleOpened->setY (pLayer->getValSInt32 ("title_offset_y")); } _TitleOpened->setFontSize (pLayer->getValSInt32 ("title_font_size")); - if (_TitleClass==TitleText) _TitleOpened->setText (_TitleTextOpened); + if (_TitleClass==TitleText) _TitleOpened->setText (_TitleTextOpened.toUtf8()); _TitleOpened->setActive (_Opened); // Title when the container is closed @@ -3796,7 +3796,7 @@ namespace NLGUI _TitleClosed->setY (pLayer->getValSInt32 ("title_offset_y")); } _TitleClosed->setFontSize (pLayer->getValSInt32 ("title_font_size")); - if (_TitleClass==TitleText) _TitleClosed->setText (_TitleTextClosed); + if (_TitleClass==TitleText) _TitleClosed->setText (_TitleTextClosed.toUtf8()); _TitleClosed->setActive(!_Opened); @@ -3990,7 +3990,7 @@ namespace NLGUI { _TitleTextOpened = title; if (_TitleOpened != NULL) - _TitleOpened->setText (title); + _TitleOpened->setText (title.toUtf8()); invalidateCoords(); } @@ -3999,7 +3999,7 @@ namespace NLGUI { _TitleTextClosed = title; if (_TitleClosed != NULL) - _TitleClosed->setText (_TitleTextClosed); + _TitleClosed->setText (_TitleTextClosed.toUtf8()); invalidateCoords(); } diff --git a/nel/src/gui/group_editbox.cpp b/nel/src/gui/group_editbox.cpp index 1453ba5fe..768c69066 100644 --- a/nel/src/gui/group_editbox.cpp +++ b/nel/src/gui/group_editbox.cpp @@ -96,7 +96,7 @@ namespace NLGUI _ViewTextDeltaX(0) { - _Prompt = u32string(1, '>'); + _Prompt = u32string(1, (u32char)'>'); _BackSelectColor= CRGBA::White; _TextSelectColor= CRGBA::Black; } @@ -1433,16 +1433,14 @@ namespace NLGUI { if (_ViewText) { - ucstring usTmp; + std::string usTmp; if (_EntryType == Password) { - usTmp = CUtfStringView(_Prompt).toUtf16(); - for (uint32 i = 0; i < _InputString.size(); ++i) - usTmp += "*"; + usTmp = CUtfStringView(_Prompt + u32string(_InputString.size(), 0x2022)).toUtf8(); } else { - usTmp = CUtfStringView(_Prompt + _InputString).toUtf16(); + usTmp = CUtfStringView(_Prompt + _InputString).toUtf8(); } _ViewText->setText (usTmp); } @@ -1585,7 +1583,7 @@ namespace NLGUI addView( _ViewText ); sint32 w,h; - w = std::max( sint32( _ViewText->getFontWidth() * _ViewText->getText().size() ), getW() ); + w = std::max( sint32( _ViewText->getFontWidth() * CUtfStringView(_ViewText->getText()).count() ), getW() ); h = std::max( sint32( _ViewText->getFontHeight() ), getH() ); setH( h ); diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 4fab8c4bb..7d9e48baf 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -2830,7 +2830,7 @@ namespace NLGUI // Number of child in this paragraph if (_CurrentViewLink) { - bool skipLine = !_CurrentViewLink->getText().empty() && *(_CurrentViewLink->getText().rbegin()) == (ucchar) '\n'; + bool skipLine = !_CurrentViewLink->getText().empty() && *(_CurrentViewLink->getText().rbegin()) == '\n'; bool sameShadow = style.TextShadow.Enabled && _CurrentViewLink->getShadow(); if (sameShadow && style.TextShadow.Enabled) { @@ -2853,7 +2853,7 @@ namespace NLGUI (style.GlobalColor == _CurrentViewLink->getModulateGlobalColor())) { // Concat the text - _CurrentViewLink->setText(_CurrentViewLink->getText()+tmpStr); + _CurrentViewLink->setText(_CurrentViewLink->getText()+tmpStr.toUtf8()); _CurrentViewLink->invalidateContent(); added = true; } @@ -2916,7 +2916,7 @@ namespace NLGUI newLink->setParamsOnLeftClick("name=" + getId() + "|url=" + newLink->Link); } } - newLink->setText(tmpStr); + newLink->setText(tmpStr.toUtf8()); newLink->setMultiLineSpace((uint)((float)(style.FontSize)*LineSpaceFontFactor)); newLink->setMultiLine(true); newLink->setModulateGlobalColor(style.GlobalColor); @@ -3306,11 +3306,11 @@ namespace NLGUI // *************************************************************************** - ucchar CGroupHTML::getLastChar() const + u32char CGroupHTML::getLastChar() const { if (_CurrentViewLink) { - const ucstring &str = _CurrentViewLink->getText(); + u32string str = CUtfStringView(_CurrentViewLink->getText()).toUtf32(); // FIXME: Optimize reverse UTF iteration if (!str.empty()) return str[str.length()-1]; } @@ -3710,7 +3710,7 @@ namespace NLGUI CGroupEditBox *editBox = dynamic_cast(group); if (editBox) { - entryData = editBox->getViewText()->getText(); + entryData = CUtfStringView(editBox->getViewText()->getText()).toUtf16(); addEntry = true; } } diff --git a/nel/src/gui/group_list.cpp b/nel/src/gui/group_list.cpp index d619a8146..4e04501a8 100644 --- a/nel/src/gui/group_list.cpp +++ b/nel/src/gui/group_list.cpp @@ -548,7 +548,7 @@ namespace NLGUI view->setMultiLine (multiLine); view->setTextMode(_Templ.getTextMode()); if (multiLine) view->setMultiLineSpace (_Space); - view->setText (line); + view->setText (line.toUtf8()); // Herit global-coloring view->setModulateGlobalColor(getModulateGlobalColor()); addChild(view); @@ -566,7 +566,7 @@ namespace NLGUI view->_Parent = this; view->setMultiLine (multiLine); if (multiLine) view->setMultiLineSpace (_Space); - view->setText (line); + view->setText (line.toUtf8()); view->setColor (textColor); // Herit global-coloring view->setModulateGlobalColor(getModulateGlobalColor()); diff --git a/nel/src/gui/group_menu.cpp b/nel/src/gui/group_menu.cpp index 830b74fb9..109baf278 100644 --- a/nel/src/gui/group_menu.cpp +++ b/nel/src/gui/group_menu.cpp @@ -1231,11 +1231,11 @@ namespace NLGUI { pV->setMultiLine (true); pV->setMultiLineMaxWOnly (true); - pV->setTextFormatTaged (name); + pV->setTextFormatTaged (name.toUtf8()); } else { - pV->setText (name); + pV->setText (name.toUtf8()); } pV->setColor (_GroupMenu->_Color); pV->setFontSize (_GroupMenu->_FontSize, _GroupMenu->_FontSizeCoef); @@ -1319,11 +1319,11 @@ namespace NLGUI { pV->setMultiLine (true); pV->setMultiLineMaxWOnly (true); - pV->setTextFormatTaged (name); + pV->setTextFormatTaged (name.toUtf8()); } else { - pV->setText (name); + pV->setText (name.toUtf8()); } pV->setColor (_GroupMenu->_Color); @@ -1602,7 +1602,7 @@ namespace NLGUI texture = _Lines[k].ViewText->getCheckBox()->getTexture(); } CViewTextMenu *pV = NULL; - pV = copyMenu->addLine (_Lines[k].ViewText->getText(), _Lines[k].AHName, _Lines[k].AHParams, _Lines[k].Id, _Lines[k].Cond, + pV = copyMenu->addLine (CUtfStringView(_Lines[k].ViewText->getText()).toUtf16(), _Lines[k].AHName, _Lines[k].AHParams, _Lines[k].Id, _Lines[k].Cond, texture, _Lines[k].ViewText->getCheckable(), _Lines[k].ViewText->getChecked(), _Lines[k].ViewText->getFormatted ()); copyMenu->_Lines[k].Selectable = _Lines[k].Selectable; pV->setGrayed(_Lines[k].ViewText->getGrayed()); diff --git a/nel/src/gui/group_paragraph.cpp b/nel/src/gui/group_paragraph.cpp index f772309a6..f2027a404 100644 --- a/nel/src/gui/group_paragraph.cpp +++ b/nel/src/gui/group_paragraph.cpp @@ -503,7 +503,7 @@ namespace NLGUI view->setMultiLine (multiLine); view->setTextMode(_Templ.getTextMode()); if (multiLine) view->setMultiLineSpace (_Space); - view->setText (line); + view->setText (line.toUtf8()); // Herit global-coloring view->setModulateGlobalColor(getModulateGlobalColor()); addChild (view); @@ -520,7 +520,7 @@ namespace NLGUI view->_Parent = this; view->setMultiLine (multiLine); if (multiLine) view->setMultiLineSpace (_Space); - view->setText (line); + view->setText (line.toUtf8()); view->setColor (textColor); // Herit global-coloring view->setModulateGlobalColor(getModulateGlobalColor()); @@ -730,7 +730,7 @@ namespace NLGUI if (viewText) { changeLine = viewText->getNumLine() > 1; - if (!viewText->getText().empty() && *(viewText->getText().rbegin()) == (ucchar) '\n') + if (!viewText->getText().empty() && *(viewText->getText().rbegin()) == '\n') { changeLine = true; } diff --git a/nel/src/gui/group_tree.cpp b/nel/src/gui/group_tree.cpp index 9fad363f0..93e9880bb 100644 --- a/nel/src/gui/group_tree.cpp +++ b/nel/src/gui/group_tree.cpp @@ -1292,7 +1292,7 @@ namespace NLGUI CViewText *pVT = new CViewText(TCtorParam()); line.TextOrTemplate = pVT; pVT->setId("t"+toString(_Lines.size())); - pVT->setText(pNode->Text); + pVT->setText(pNode->Text.toUtf8()); pVT->setColor(pNode->Color); if(pNode->FontSize==-1) pVT->setFontSize(_FontSize); diff --git a/nel/src/gui/view_pointer.cpp b/nel/src/gui/view_pointer.cpp index 82c0174f5..973708aa6 100644 --- a/nel/src/gui/view_pointer.cpp +++ b/nel/src/gui/view_pointer.cpp @@ -458,14 +458,14 @@ namespace NLGUI { CViewText *text = dynamic_cast (element); if (text) - text->setText(str); + text->setText(str.toUtf8()); } element = target->getView ("real_txt"); if (element) { CViewText *text = dynamic_cast (element); if (text) - text->setText(str); + text->setText(str.toUtf8()); } target->updateCoords(); target->updateCoords(); diff --git a/nel/src/gui/view_text_formated.cpp b/nel/src/gui/view_text_formated.cpp index aa948e986..87cfc12bb 100644 --- a/nel/src/gui/view_text_formated.cpp +++ b/nel/src/gui/view_text_formated.cpp @@ -87,7 +87,7 @@ namespace NLGUI formatedResult = formatString(_FormatString, ucstring("")); // - setText (formatedResult); + setText (formatedResult.toUtf8()); CViewText::checkCoords(); } diff --git a/nel/src/gui/view_text_id.cpp b/nel/src/gui/view_text_id.cpp index 562ba881a..065d02e71 100644 --- a/nel/src/gui/view_text_id.cpp +++ b/nel/src/gui/view_text_id.cpp @@ -233,9 +233,9 @@ namespace NLGUI // Set the Text if(_IsTextFormatTaged) - setTextFormatTaged(result); + setTextFormatTaged(result.toUtf8()); else - setText (result); + setText (result.toUtf8()); } CViewText::checkCoords(); } diff --git a/nel/src/gui/view_text_id_formated.cpp b/nel/src/gui/view_text_id_formated.cpp index 5304e9e5c..5b1dd2a14 100644 --- a/nel/src/gui/view_text_id_formated.cpp +++ b/nel/src/gui/view_text_id_formated.cpp @@ -106,7 +106,7 @@ namespace NLGUI } formatedResult = CViewTextFormated::formatString(_FormatString, result); // - setText (formatedResult); + setText (formatedResult.toUtf8()); // if (bValid) { diff --git a/nel/src/gui/widget_manager.cpp b/nel/src/gui/widget_manager.cpp index 864e4ef5b..2da9f9bdf 100644 --- a/nel/src/gui/widget_manager.cpp +++ b/nel/src/gui/widget_manager.cpp @@ -1516,7 +1516,7 @@ namespace NLGUI CViewText *pTxt = (CViewText*)groupContextHelp->getView("text"); if (pTxt != NULL) { - pTxt->setTextFormatTaged(_ContextHelpText); + pTxt->setTextFormatTaged(_ContextHelpText.toUtf8()); // update only to get correct W/H groupContextHelp->updateCoords (); diff --git a/nel/src/misc/diff_tool.cpp b/nel/src/misc/diff_tool.cpp index 2b2a490bc..3cbaea5a6 100644 --- a/nel/src/misc/diff_tool.cpp +++ b/nel/src/misc/diff_tool.cpp @@ -232,15 +232,15 @@ bool loadStringFile(const std::string filename, vector &stringInfos ucstring prepareStringFile(const vector &strings, bool removeDiffComments, bool noDiffInfo) { - ucstring diff; + string diff; vector::const_iterator first(strings.begin()), last(strings.end()); for (; first != last; ++first) { - ucstring str; + string str; const TStringInfo &si = *first; - string comment = si.Comments.toString(); - vector lines; + string comment = si.Comments.toUtf8(); + vector lines; explode(comment, string("\n"), lines, true); uint i; @@ -274,30 +274,29 @@ ucstring prepareStringFile(const vector &strings, bool removeDiffCo } si.Comments = ucstring(comment); - str = si.Comments; + str = comment; if (!si.Identifier.empty() || !si.Text.empty()) { // add hash value comment if needed // if (si.Comments.find(ucstring("// HASH_VALUE ")) == ucstring::npos) if (!noDiffInfo) { - str += ucstring("// HASH_VALUE ") + CI18N::hashToString(si.HashValue)+ nl; - str += ucstring("// INDEX ") + NLMISC::toString("%u", first-strings.begin())+ nl; + str += "// HASH_VALUE " + CI18N::hashToString(si.HashValue) + "\n"; + str += "// INDEX " + NLMISC::toString("%u", first-strings.begin()) + "\n"; } str += si.Identifier + '\t'; - ucstring text = CI18N::makeMarkedString('[', ']', si.Text);; - ucstring text2; + string text = CI18N::makeMarkedString('[', ']', si.Text).toUtf8(); + string text2; // add new line and tab after each \n tag - ucstring::size_type pos; - const ucstring nlTag("\\n"); - while ((pos = text.find(nlTag)) != ucstring::npos) + string::size_type pos; + while ((pos = text.find("\\n")) != string::npos) { - text2 += text.substr(0, pos+2) + nl + "\t"; + text2 += text.substr(0, pos+2) + "\n\t"; text = text.substr(pos+2); } text2 += text;//.substr(0, pos+2); - str += text2 + nl + nl; + str += text2 + "\n\n"; // str += CI18N::makeMarkedString('[', ']', si.Text) + nl + nl; } @@ -305,7 +304,7 @@ ucstring prepareStringFile(const vector &strings, bool removeDiffCo diff += str; } - return diff; + return ucstring::makeFromUtf8(diff); } diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp index 3be14f515..9f4057b66 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -29,6 +29,41 @@ namespace NLMISC { +NL_FORCE_INLINE void appendUtf8(std::string &str, u32char c) +{ + if (c < 0x80) + { + // Encode as 1 byte + str += (char)c; + } + else if (c < 0x0800) + { + // Encode as 2 bytes + str += (char)((c & 0x07C0) >> 6) | 0xC0; + str += (char)(c & 0x3F) | 0x80; + } + else if (c < 0x010000) + { + // Encode as 3 bytes + str += (char)((c & 0xF000) >> 12) | 0xE0; + str += (char)((c & 0x0FC0) >> 6) | 0x80; + str += (char)(c & 0x3F) | 0x80; + } + else + { + // Encode as 4 bytes + str += (char)((c & 0x1C0000) >> 18) | 0xF0; + str += (char)((c & 0x03F000) >> 12) | 0x80; + str += (char)((c & 0x0FC0) >> 6) | 0x80; + str += (char)(c & 0x3F) | 0x80; + } +} + +void CUtfStringView::append(std::string &str, u32char c) +{ + appendUtf8(str, c); +} + std::string CUtfStringView::toUtf8(bool reEncode) const { // Decode UTF and encode UTF-8 @@ -39,33 +74,7 @@ std::string CUtfStringView::toUtf8(bool reEncode) const res.reserve(m_Size); for (iterator it(begin()), end(end()); it != end; ++it) { - u32char c = *it; - if (c < 0x80) - { - // Encode as 1 byte - res += (char)c; - } - else if (c < 0x0800) - { - // Encode as 2 bytes - res += (char)((c & 0x07C0) >> 6) | 0xC0; - res += (char)(c & 0x3F) | 0x80; - } - else if (c < 0x010000) - { - // Encode as 3 bytes - res += (char)((c & 0xF000) >> 12) | 0xE0; - res += (char)((c & 0x0FC0) >> 6) | 0x80; - res += (char)(c & 0x3F) | 0x80; - } - else - { - // Encode as 4 bytes - res += (char)((c & 0x1C0000) >> 18) | 0xF0; - res += (char)((c & 0x03F000) >> 12) | 0x80; - res += (char)((c & 0x0FC0) >> 6) | 0x80; - res += (char)(c & 0x3F) | 0x80; - } + appendUtf8(res, *it); } return res; } @@ -154,6 +163,14 @@ std::wstring CUtfStringView::toWide() const #endif } +size_t CUtfStringView::count() const +{ + size_t res = 0; + for (iterator it(begin()), end(end()); it != end; ++it) + ++res; + return res; +} + u32char CUtfStringView::utf8Iterator(const void **addr) { // Decode UTF-8 diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 00c663e5e..36df595bf 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -1021,7 +1021,7 @@ TInterfaceState globalMenu() // Display the firewall alert string CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:outgame:connecting:title")); if (pVT != NULL) - pVT->setText(CI18N::get("uiFirewallAlert")+ucstring("...")); + pVT->setText(CI18N::get("uiFirewallAlert").toUtf8() + "..."); // The mouse and fullscreen mode should be unlocked for the user to set the firewall permission nlSleep( 30 ); // 'nice' the client, and prevent to make too many send attempts @@ -1237,8 +1237,8 @@ TInterfaceState globalMenu() if (pVT != NULL) { pVT->setMultiLine( true ); - pVT->setText(CI18N::get("uiFirewallFail")+ucstring(".\n")+ - CI18N::get("uiFirewallAlert")+ucstring(".")); + pVT->setText(CI18N::get("uiFirewallFail").toUtf8()+".\n"+ + CI18N::get("uiFirewallAlert").toUtf8()+"."); } } } @@ -1319,16 +1319,16 @@ public: if (pVT == NULL) return; if (rCS.Name.empty()) - pVT->setText(CI18N::get("uiEmptySlot")); + pVT->setText(CI18N::get("uiEmptySlot").toUtf8()); else - pVT->setText(rCS.Name); + pVT->setText(rCS.Name.toUtf8()); } // 5 slots for (; i < 5; ++i) { CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sPath+":text"+NLMISC::toString(i))); if (pVT == NULL) return; - pVT->setText(CI18N::get("uiEmptySlot")); + pVT->setText(CI18N::get("uiEmptySlot").toUtf8()); } } }; @@ -2170,8 +2170,8 @@ public: CViewText *pVT = dynamic_cast(pNewLine->getView("name")); if (pVT != NULL) { - ucstring ucstr = Mainlands[i].Name + ucstring(" ") + Mainlands[i].Description; - pVT->setText(ucstr); + std::string str = Mainlands[i].Name.toUtf8() + " " + Mainlands[i].Description.toUtf8(); + pVT->setText(str); } // Add to the list @@ -2311,7 +2311,7 @@ public: CViewText *pVT = dynamic_cast(pNewLine->getView("name")); if (pVT != NULL) { - pVT->setText(name); + pVT->setText(name.toUtf8()); } CCtrlBase *pBut = pNewLine->getCtrl("but"); @@ -2559,7 +2559,7 @@ static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName { CViewText* viewText = dynamic_cast(result); if(viewText) - viewText->setText(text); + viewText->setText(text.toUtf8()); CGroupEditBox* editBox = dynamic_cast(result); if(editBox) editBox->setInputStringAsUtf16(text); @@ -2682,7 +2682,7 @@ class CAHScenarioControl : public IActionHandler CViewText* viewText = dynamic_cast(result); if(viewText) { - viewText->setText(R2::getEditor().isInitialized()?CI18N::get("uiR2EDScenarioName"):CI18N::get("uiR2EDScenarioFileName")); + viewText->setText(R2::getEditor().isInitialized()?CI18N::get("uiR2EDScenarioName").toUtf8():CI18N::get("uiR2EDScenarioFileName").toUtf8()); } } @@ -2712,7 +2712,7 @@ class CAHScenarioControl : public IActionHandler CViewText* viewText= dynamic_cast(result); if(viewText) - viewText->setText(ucstring("")); + viewText->setText(""); } } setScenarioInformation(scenarioWnd, ""); @@ -2748,7 +2748,7 @@ class CAHScenarioControl : public IActionHandler CViewText *shardName = dynamic_cast(toggleGr->getView("button_text")); if (shardName) { - shardName->setText(Mainlands[i].Name); + shardName->setText(Mainlands[i].Name.toUtf8()); } } } @@ -3250,7 +3250,7 @@ class CAHLoadScenario : public IActionHandler { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningFreeTrial")); + pVT->setText(CI18N::get("uiRingWarningFreeTrial").toUtf8()); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); return; @@ -3331,7 +3331,7 @@ class CAHLoadScenario : public IActionHandler { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningFreeTrial")); + pVT->setText(CI18N::get("uiRingWarningFreeTrial").toUtf8()); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); } @@ -3360,7 +3360,7 @@ class CAHLoadScenario : public IActionHandler { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningInviteFreeTrial")); + pVT->setText(CI18N::get("uiRingWarningInviteFreeTrial").toUtf8()); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); } } diff --git a/ryzom/client/src/entity_cl.cpp b/ryzom/client/src/entity_cl.cpp index 10d1573cf..506069426 100644 --- a/ryzom/client/src/entity_cl.cpp +++ b/ryzom/client/src/entity_cl.cpp @@ -2353,7 +2353,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:player:header_opened:player_title")); - if (pVT != NULL) pVT->setText(_Title); + if (pVT != NULL) pVT->setText(_Title.toUtf8()); CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:player")); if (pGC != NULL) pGC->setUCTitle(_EntityName); diff --git a/ryzom/client/src/game_context_menu.cpp b/ryzom/client/src/game_context_menu.cpp index d4a152392..2b46d33dd 100644 --- a/ryzom/client/src/game_context_menu.cpp +++ b/ryzom/client/src/game_context_menu.cpp @@ -718,18 +718,18 @@ void CGameContextMenu::updateContextMenuMissionsOptions( bool forceHide ) { result = NLMISC::CI18N::get("uiMissionOptionNotReceived"); } - pVTM->setText(result); + pVTM->setText(result.toUtf8()); pVTM->setActive(true); } else { - pVTM->setText(ucstring("")); + pVTM->setText(""); pVTM->setActive(false); } } else { - pVTM->setText(ucstring("")); + pVTM->setText(""); pVTM->setActive(false); } } @@ -759,16 +759,16 @@ void CGameContextMenu::updateContextMenuWebPage(uint options) { result = NLMISC::CI18N::get("uiWebPageNameNotReceived"); } - pVTM->setText(result); + pVTM->setText(result.toUtf8()); } else { - pVTM->setText(ucstring("")); + pVTM->setText(""); } } else { - pVTM->setText(ucstring("")); + pVTM->setText(""); } } @@ -797,7 +797,7 @@ void CGameContextMenu::updateContextMenuOutpostState(uint options) { CViewTextMenu *pVTM = _TextOutpostState; if (pVTM) - pVTM->setText(ucstring(STRING_MANAGER::CStringManagerClient::getOutpostLocalizedName(outpostSheet))); + pVTM->setText(CUtfStringView(STRING_MANAGER::CStringManagerClient::getOutpostLocalizedName(outpostSheet)).toUtf8()); } // apply the active @@ -839,12 +839,12 @@ void CGameContextMenu::updateContextMenuMissionRing() { result = NLMISC::CI18N::get("uiMissionRingNameNotReceived"); } - pVTM->setText(result); + pVTM->setText(result.toUtf8()); pVTM->setActive(true); } else { - pVTM->setText(ucstring("")); + pVTM->setText(""); pVTM->setActive(false); } } diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index bbb392131..19820be99 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4606,7 +4606,7 @@ public: CViewText *pVT = dynamic_cast(pIG->getView("t")); if (!pVT) break; - names.push_back(toUpper(pVT->getText().toUtf8())); + names.push_back(toUpper(pVT->getText())); } if (names.size() != nbChilds) diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index 77f5f5552..030d34bfe 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -1167,7 +1167,7 @@ void setHelpText(CSheetHelpSetup &setup, const ucstring &text) CViewText *viewText= dynamic_cast(setup.HelpWindow->getView(setup.ViewText)); if(viewText) { - viewText->setTextFormatTaged(copyStr); + viewText->setTextFormatTaged(copyStr.toUtf8()); } CInterfaceGroup *viewTextGroup = setup.HelpWindow->getGroup(setup.ScrollTextGroup); if (viewTextGroup) viewTextGroup->setActive(true); @@ -3165,7 +3165,7 @@ void setupListBrickHeader(CSheetHelpSetup &setup) if(view) { view->setActive(true); - view->setTextFormatTaged(CI18N::get("uihelpPhraseHeaderBricks")); + view->setTextFormatTaged(CI18N::get("uihelpPhraseHeaderBricks").toUtf8()); } } @@ -3806,7 +3806,7 @@ static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const s string originFilterKey= "iompf" + ITEM_ORIGIN::enumToString((ITEM_ORIGIN::EItemOrigin)itemPart.OriginFilter); mpCraft+= CI18N::get(originFilterKey); - viewText->setText(mpCraft); + viewText->setText(mpCraft.toUtf8()); } @@ -3838,7 +3838,7 @@ static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const s CViewText *statTitle= dynamic_cast(groupStat->getElement(groupStat->getId()+":text" )); CDBViewBar *statValue= dynamic_cast(groupStat->getElement(groupStat->getId()+":bar" )); if(statTitle) - statTitle->setText(RM_FABER_STAT_TYPE::toLocalString(statType)); + statTitle->setText(RM_FABER_STAT_TYPE::toLocalString(statType).toUtf8()); if(statValue) statValue->setValue(itemPart.Stats[i]); } diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index 40efedac0..fcef685c5 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -523,7 +523,7 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick { nlstop; } - viewText->setText( text ); + viewText->setText( text.toUtf8() ); } // Set as Icon the required MP FaberType / or Sheet Texture (directly...) @@ -1724,7 +1724,7 @@ void CActionPhraseFaber::updateItemResult() + "@{FFFF})"; } strFindReplace(text, "%success", successStr ); - successView->setTextFormatTaged(text); + successView->setTextFormatTaged(text.toUtf8()); } @@ -1790,7 +1790,7 @@ void CActionPhraseFaber::updateItemResult() uint sv= uint(statArray[i]*100); if(statTitle) { - statTitle->setText(RM_FABER_STAT_TYPE::toLocalString(statType)); + statTitle->setText(RM_FABER_STAT_TYPE::toLocalString(statType).toUtf8()); statTitle->setColor(usageColor); } if(statValueBar) diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index dc2c88789..352ff65f4 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -865,7 +865,7 @@ void CBotChatPageTrade::startBuyDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCall CViewText *priceLabel = dynamic_cast(ig->getView( "standard_price:total_price_header" )); if ( _BuyMean == Money && priceLabel ) { - priceLabel->setText( CI18N::get( "uiPrice" ) ); + priceLabel->setText( CI18N::get( "uiPrice" ).toUtf8() ); priceLabel->setActive(true); } else @@ -977,7 +977,7 @@ void CBotChatPageTrade::startSellDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCal CViewText *priceLabel = dynamic_cast(ig->getView( "standard_price:total_price_header" )); if ( priceLabel ) { - priceLabel->setText( CI18N::get( "uiImmediatePrice" ) ); + priceLabel->setText( CI18N::get( "uiImmediatePrice" ).toUtf8() ); priceLabel->setActive(true); } @@ -1012,7 +1012,7 @@ void CBotChatPageTrade::startSellDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCal { ucstring itemName; itemName = sheet->getItemActualName(); - itemNameView->setText(itemName); + itemNameView->setText(itemName.toUtf8()); } // set help for item @@ -1679,14 +1679,14 @@ void CBotChatPageTrade::setupFactionPointPrice(bool /* sellMode */, uint default { ucstring fmt= CI18N::get("uiUnitFPPrice"); strFindReplace(fmt, "%fac", factionName); - vt->setText(fmt); + vt->setText(fmt.toUtf8()); } vt= dynamic_cast(fpGroup->getView("total_price_header")); if(vt) { ucstring fmt= CI18N::get("uiTotalFPPrice"); strFindReplace(fmt, "%fac", factionName); - vt->setText(fmt); + vt->setText(fmt.toUtf8()); } // setup icon according to pvp clan diff --git a/ryzom/client/src/interface_v3/chat_text_manager.cpp b/ryzom/client/src/interface_v3/chat_text_manager.cpp index 3b11d17a5..6fae6a29b 100644 --- a/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -380,12 +380,12 @@ CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CR // otherwise, set text normal and apply global color if (msg.find(ucstring("@{")) != ucstring::npos) { - vt->setTextFormatTaged(msg); + vt->setTextFormatTaged(msg.toUtf8()); vt->setColor(NLMISC::CRGBA::White); } else { - vt->setText(msg); + vt->setText(msg.toUtf8()); vt->setColor(col); } @@ -465,12 +465,12 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C if (title.size() > 0) { vt->LinkTitle = title.toUtf8(); - vt->setText(title); + vt->setText(vt->LinkTitle); } else { vt->LinkTitle = url.toUtf8(); - vt->setText(url); + vt->setText(vt->LinkTitle); } if (url.find_first_of('\'') != string::npos) diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index e0e5f2e74..81d34447d 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -2090,7 +2090,7 @@ void CDBCtrlSheet::draw() _RegenText = new CViewText(CViewBase::TCtorParam()); _RegenText->setId(getId() + ":regen"); _RegenText->setParent(_Parent); - _RegenText->setOverflowText(ucstring("")); + _RegenText->setOverflowText(std::string()); _RegenText->setModulateGlobalColor(false); _RegenText->setMultiLine(false); _RegenText->setTextMode(CViewText::ClipWord); diff --git a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp index 561d48235..c75dc3af3 100644 --- a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp @@ -1074,7 +1074,7 @@ void CDBGroupBuildPhrase::updateAllDisplay(const CSPhraseCom &phrase) float relative_cost; cost= pBM->getSabrinaCom().getPhraseBrickAndParamCost(phrase.Bricks, i); relative_cost = pBM->getSabrinaCom().getPhraseBrickAndParamRelativeCost(phrase.Bricks, i); - ucstring costText; + std::string costText; if( cost == 0 && relative_cost != 0.f ) { cost = (sint32)(relative_cost * 100.f); @@ -1119,10 +1119,10 @@ void CDBGroupBuildPhrase::updateAllDisplay(const CSPhraseCom &phrase) { word.InfoView->setActive(true); if(i==0) - word.InfoView->setText( CI18N::get("uiTextHelpSelectRootBrick") ); + word.InfoView->setText( CI18N::get("uiTextHelpSelectRootBrick").toUtf8() ); else // start effect index at 1 (human readable :) ) - word.InfoView->setText( CI18N::get("uiTextHelpSelectEffectBrick") + toString(i) ); + word.InfoView->setText( CI18N::get("uiTextHelpSelectEffectBrick").toUtf8() + toString(i) ); } } @@ -1243,7 +1243,7 @@ void CDBGroupBuildPhrase::updateAllDisplay(const CSPhraseCom &phrase) { ucstring text; pPM->buildPhraseDesc(text, phrase, 0, false, "composition"); - _TextPhraseDesc->setTextFormatTaged(text); + _TextPhraseDesc->setTextFormatTaged(text.toUtf8()); } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp index be89ead3d..9a8efa4ae 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp @@ -141,7 +141,7 @@ void CDBGroupListSheetIconPhrase::setSectionGroupId(CInterfaceGroup *pIG, uin pPM->getPhraseLevelFromSection(sectionId, minLevel, maxLevel); strFindReplace(sectionText, "%min", toString(minLevel)); strFindReplace(sectionText, "%max", toString(maxLevel)); - name->setText (sectionText); + name->setText (sectionText.toUtf8()); } } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp index f34053396..8483e9925 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp @@ -1086,7 +1086,7 @@ void CDBGroupListSheetText::CSheetChild::updateViewTextAsItem() } // set text - Text->setTextFormatTaged(text); + Text->setTextFormatTaged(text.toUtf8()); } } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h index 2486bfc29..d9a495635 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h @@ -135,7 +135,7 @@ public: { ucstring text; Ctrl->getContextHelp(text); - Text->setText(text); + Text->setText(text.toUtf8()); } // create a CViewText object that is displayed next to the item. This is the opportunnity to create diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp index 490c36b85..8e21b7f26 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp @@ -137,11 +137,11 @@ void CDBGroupListSheetTextBrickComposition::CSheetChildBrick::updateViewText(CDB // Temp if the Desc2 is empty, set Name ucstring desc2(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedCompositionDescription(brickSheetId)); if( !desc2.empty() && !hasOnlyBlankChars(desc2)) // tolerate Blank error in translation - Text->setText(desc2); + Text->setText(desc2.toUtf8()); else { desc2 = STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(brickSheetId); - Text->setText(desc2); + Text->setText(desc2.toUtf8()); } @@ -159,7 +159,7 @@ void CDBGroupListSheetTextBrickComposition::CSheetChildBrick::updateViewText(CDB { // Special Case for the "Remove Brick" brick. No Cost (not revelant) if( brick->Id==pBM->getInterfaceRemoveBrick() ) - CostView->setText( ucstring() ); + CostView->setText( std::string() ); else if( brick->SabrinaCost == 0 && brick->SabrinaRelativeCost != 0.f ) CostView->setText( toString("%+d", (sint32)(brick->SabrinaRelativeCost * 100.f) ) + string("%") ); else diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp index ec1bfbaed..3cdf24ca8 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp @@ -94,7 +94,7 @@ void CDBGroupListSheetTextPhrase::CSheetChildPhrase::updateViewText(CDBGroupList #endif // set - Text->setText(text); + Text->setText(text.toUtf8()); } @@ -173,7 +173,7 @@ void CDBGroupListSheetTextPhrase::setSectionGroupId(CInterfaceGroup *pIG, uin pPM->getPhraseLevelFromSection(sectionId, minLevel, maxLevel); strFindReplace(sectionText, "%min", toString(minLevel)); strFindReplace(sectionText, "%max", toString(maxLevel)); - name->setText (sectionText); + name->setText (sectionText.toUtf8()); } } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp index 45a78980e..6e98afc5c 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp @@ -48,7 +48,7 @@ void CDBGroupListSheetTextPhraseId::CSheetChildPhrase::updateViewText(CDBGroupLi // Get the User Name of the phrase Ctrl->getContextHelp(text); - Text->setText(text); + Text->setText(text.toUtf8()); } // *************************************************************************** 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 ce7f2fcf5..b0924f0af 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -457,7 +457,7 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT // setup color and text text= colorTag + text; - Text->setTextFormatTaged(text); + Text->setTextFormatTaged(text.toUtf8()); } // *************************************************************************** diff --git a/ryzom/client/src/interface_v3/encyclopedia_manager.cpp b/ryzom/client/src/interface_v3/encyclopedia_manager.cpp index ec82b5c8d..6ab68522d 100644 --- a/ryzom/client/src/interface_v3/encyclopedia_manager.cpp +++ b/ryzom/client/src/interface_v3/encyclopedia_manager.cpp @@ -303,8 +303,8 @@ void CEncyclopediaManager::rebuildAlbumPage(uint32 albumName) if (pRBVT != NULL) { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - const ucstring desc(pSMC->getSBrickLocalizedDescription(CSheetId(pAlbum->RewardBrick))); - pRBVT->setText(desc); + CUtfStringView desc(pSMC->getSBrickLocalizedDescription(CSheetId(pAlbum->RewardBrick))); + pRBVT->setText(desc.toUtf8()); } } @@ -359,18 +359,18 @@ void CEncyclopediaManager::rebuildThemaPage(uint32 themaName) { if (pES->type() == CEntitySheet::ITEM) { - const ucstring desc(pSMC->getItemLocalizedDescription(CSheetId(pThema->RewardSheet))); - pRBVT->setText(desc); + CUtfStringView desc(pSMC->getItemLocalizedDescription(CSheetId(pThema->RewardSheet))); + pRBVT->setText(desc.toUtf8()); } else if (pES->type() == CEntitySheet::SBRICK) { - const ucstring desc(pSMC->getSBrickLocalizedDescription(CSheetId(pThema->RewardSheet))); - pRBVT->setText(desc); + CUtfStringView desc(pSMC->getSBrickLocalizedDescription(CSheetId(pThema->RewardSheet))); + pRBVT->setText(desc.toUtf8()); } else if (pES->type() == CEntitySheet::SPHRASE) { - const ucstring desc(pSMC->getSPhraseLocalizedDescription(CSheetId(pThema->RewardSheet))); - pRBVT->setText(desc); + CUtfStringView desc(pSMC->getSPhraseLocalizedDescription(CSheetId(pThema->RewardSheet))); + pRBVT->setText(desc.toUtf8()); } } diff --git a/ryzom/client/src/interface_v3/flying_text_manager.cpp b/ryzom/client/src/interface_v3/flying_text_manager.cpp index 23e6e963e..f577d41e2 100644 --- a/ryzom/client/src/interface_v3/flying_text_manager.cpp +++ b/ryzom/client/src/interface_v3/flying_text_manager.cpp @@ -143,7 +143,7 @@ void CFlyingTextManager::addFlyingText(void *key, const ucstring &text, const NL gi.UsedThisFrame= true; // update infos - gi.ViewText->setText(text); + gi.ViewText->setText(text.toUtf8()); gi.ViewText->setColor(color); gi.GroupInScene->Position= pos; gi.GroupInScene->Scale= scale; diff --git a/ryzom/client/src/interface_v3/group_compas.cpp b/ryzom/client/src/interface_v3/group_compas.cpp index 87fcec6ce..3c18eb22c 100644 --- a/ryzom/client/src/interface_v3/group_compas.cpp +++ b/ryzom/client/src/interface_v3/group_compas.cpp @@ -414,7 +414,7 @@ void CGroupCompas::draw() } if (_DistViewText != distText) { - _DistView->setText(distText); + _DistView->setText(distText.toUtf8()); _DistViewText = distText; } } 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 86ccd8e95..f070d3224 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -530,10 +530,10 @@ void CGroupInSceneBubbleManager::addSkillPopup (uint skillId, sint delta, uint t if (group) { // Skill name - const ucstring sSkillName(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)skillId)); + CUtfStringView sSkillName(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)skillId)); CViewText *pViewSkillName = dynamic_cast(group->getView("name")); if (pViewSkillName != NULL) - pViewSkillName->setText (sSkillName); + pViewSkillName->setText (sSkillName.toUtf8()); // Skill value CCDBNodeLeaf *skillLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SKILLS:"+toString(skillId)+":BaseSKILL", false); @@ -599,7 +599,7 @@ void CGroupInSceneBubbleManager::addMessagePopup (const ucstring &message, CRGBA CViewText *pViewName = dynamic_cast(group->getView("name")); if (pViewName != NULL) { - pViewName->setText (message); + pViewName->setText (message.toUtf8()); pViewName->setColor (color); } @@ -648,7 +648,7 @@ void CGroupInSceneBubbleManager::addMessagePopupCenter (const ucstring &message, CViewText *pViewName = dynamic_cast(group->getView("name")); if (pViewName != NULL) { - pViewName->setTextFormatTaged(message); + pViewName->setTextFormatTaged(message.toUtf8()); pViewName->setColor (color); } @@ -787,7 +787,7 @@ void CGroupInSceneBubbleManager::addContextHelp (const ucstring &message, const } } - text->setText(finalMessage); + text->setText(finalMessage.toUtf8()); } } context->Group->setActive(true); @@ -1080,7 +1080,7 @@ void CGroupInSceneBubbleManager::webIgChatOpen (uint32 nBotUID, string text, con if (pVT != NULL) { pVT->setActive(false); - pVT->setText(ucstring("")); + pVT->setText(std::string()); } pCL = dynamic_cast(bubble->getElement(id+"optb"+toString(j))); if (pCL != NULL) pCL->setActive(false); @@ -1094,7 +1094,7 @@ void CGroupInSceneBubbleManager::webIgChatOpen (uint32 nBotUID, string text, con pVT->setActive(true); ucstring optionText; optionText.fromUtf8(strs[j]); - pVT->setText(optionText); + pVT->setText(optionText.toUtf8()); pCL = dynamic_cast(bubble->getElement(id+"optb"+toString(j))); if (pCL != NULL) { @@ -1485,7 +1485,7 @@ void CGroupInSceneBubble::setRawText (const ucstring &text) CInterfaceElement *pVTIE = CWidgetManager::getInstance()->getElementFromId(getId()+":header_opened:window:text"); CViewText *pVT= dynamic_cast(pVTIE); if (pVT != NULL) - pVT->setText(text); + pVT->setText(text.toUtf8()); } // *************************************************************************** diff --git a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index 8c853b191..fe846038c 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -780,19 +780,19 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) // Set player name if (info->_Name) { - info->_Name->setText(entityName); + info->_Name->setText(entityName.toUtf8()); info->_Name->setModulateGlobalColor(false); } // Set player title if (info->_Title) - info->_Title->setText(entityTitle); + info->_Title->setText(entityTitle.toUtf8()); // Set tribe name if (info->_TribeName) { nlassert(info->_GuildName == NULL); - info->_TribeName->setText(theTribeName); + info->_TribeName->setText(theTribeName.toUtf8()); } // Init user leaf nodes @@ -966,7 +966,7 @@ void CGroupInSceneUserInfo::updateDynamicData () if (pPlayer != NULL) if (pPlayer->isAFK()) entityName += CI18N::get("uiAFK"); - _Name->setText(entityName); + _Name->setText(entityName.toUtf8()); // Title color get the PVP color if (_Title) @@ -994,7 +994,7 @@ void CGroupInSceneUserInfo::updateDynamicData () STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); ucstring ucsTmp; if (pSMC->getString (_Entity->getGuildNameID(), ucsTmp)) - _GuildName->setText(ucsTmp); + _GuildName->setText(ucsTmp.toUtf8()); // guildname color is the pvp color _GuildName->setColor(entityColor); @@ -1020,7 +1020,7 @@ void CGroupInSceneUserInfo::updateDynamicData () STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); ucstring ucsTmp; if (pSMC->getString (_Entity->getEventFactionID(), ucsTmp)) - _EventFaction->setText(ucsTmp); + _EventFaction->setText(ucsTmp.toUtf8()); // guildname color depends of PVP faction or not _EventFaction->setColor(entityColor); diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index 41b6f021e..4315b1b8b 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -2483,7 +2483,7 @@ void CGroupMap::updateMatchedLandmarks() CViewText* t = dynamic_cast(g->getView("title")); if (t) { - t->setSingleLineTextFormatTaged(_MatchedLandmarks[k].Title); + t->setSingleLineTextFormatTaged(_MatchedLandmarks[k].Title.toUtf8()); } CViewBitmap* b = dynamic_cast(g->getView("icon")); @@ -2553,7 +2553,7 @@ void CGroupMap::createLMWidgets(const std::vector &lms) else // just add a text { CLandMarkText *pNewText = new CLandMarkText(CViewBase::TCtorParam()); - pNewText->setText(ucsTmp); + pNewText->setText(ucsTmp.toUtf8()); pNewText->Pos = mapPos; pNewText->setParent(this); pNewText->setParentPosRef(Hotspot_BL); @@ -3411,7 +3411,7 @@ CGroupMap::CLandMarkText* CGroupMap::findClosestLandmark(const CVector2f ¢er for(TLandMarkTextVect::const_iterator it = landmarks.begin(); it != landmarks.end(); ++it) { ucstring lc; - lc = (*it)->getText(); + lc = CUtfStringView((*it)->getText()).toUtf16(); if(filterLandmark(lc, keywords, startsWith)) { CVector2f pos; mapToWorld(pos, (*it)->Pos); @@ -3466,7 +3466,7 @@ bool CGroupMap::targetLandmarkByName(const ucstring &search, bool startsWith) co { ct.setType(CCompassTarget::ContinentLandMark); mapToWorld(ct.Pos, lmt->Pos); - ct.Name = lmt->getText(); + ct.Name = CUtfStringView(lmt->getText()).toUtf16(); closest = dist; found = true; } @@ -3814,7 +3814,7 @@ void CGroupMap::updateClosestLandMarkMenu(const std::string &menu, const NLMISC: CViewTextMenu* vt = rootMenu->addLine(ucstring(""), "map_landmark_by_index", ahParams, lineId.c_str(), "", "", false, false, false); if (!vt) break; - vt->setSingleLineTextFormatTaged(name); + vt->setSingleLineTextFormatTaged(name.toUtf8()); // TODO: should calculate from mouse pos and client width vt->setLineMaxW(800); 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 c2d29df78..e3791cf8e 100644 --- a/ryzom/client/src/interface_v3/group_modal_get_key.cpp +++ b/ryzom/client/src/interface_v3/group_modal_get_key.cpp @@ -89,7 +89,7 @@ bool CGroupModalGetKey::handleEvent (const NLGUI::CEventDescriptor &event) // Setup the text ! CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewText *pVT= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( VIEW_TEXT_KEY )); - if (pVT != NULL) pVT->setText(Combo.toUCString()); + if (pVT != NULL) pVT->setText(Combo.toUCString().toUtf8()); // Check if in use CActionsManager *pCurAM = NULL; @@ -111,12 +111,12 @@ bool CGroupModalGetKey::handleEvent (const NLGUI::CEventDescriptor &event) if (baseAction && pCurAM->isActionPresentInContext(it->second)) { ucstring shortcutName = baseAction->getActionLocalizedText(it->second); - if (pVT != NULL) pVT->setText(shortcutName); + if (pVT != NULL) pVT->setText(shortcutName.toUtf8()); } } else { - if (pVT != NULL) pVT->setText(string("")); + if (pVT != NULL) pVT->setText(string()); } } diff --git a/ryzom/client/src/interface_v3/group_skills.cpp b/ryzom/client/src/interface_v3/group_skills.cpp index f2586401a..053bddf86 100644 --- a/ryzom/client/src/interface_v3/group_skills.cpp +++ b/ryzom/client/src/interface_v3/group_skills.cpp @@ -387,7 +387,7 @@ void CGroupSkills::createAllTreeNodes() // Set Skill Name CViewText *pViewSkillName = dynamic_cast(pIG->getView("name")); if (pViewSkillName != NULL) - pViewSkillName->setText (sSkillName); + pViewSkillName->setText (sSkillName.toUtf8()); // Set Skill Max Value CViewText *pViewSkillMax = dynamic_cast(pIG->getView("max")); if (pViewSkillMax != NULL) diff --git a/ryzom/client/src/interface_v3/guild_manager.cpp b/ryzom/client/src/interface_v3/guild_manager.cpp index d00661357..3a25c0198 100644 --- a/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/ryzom/client/src/interface_v3/guild_manager.cpp @@ -470,7 +470,7 @@ void CGuildManager::update() { CViewText *pJoinPropPhraseView = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_JOIN_PROPOSAL_PHRASE)); if (pJoinPropPhraseView != NULL) - pJoinPropPhraseView->setText(_JoinPropPhrase); + pJoinPropPhraseView->setText(_JoinPropPhrase.toUtf8()); pJoinProp->setActive(true); CWidgetManager::getInstance()->setTopWindow(pJoinProp); @@ -724,7 +724,7 @@ bool CDBGroupListAscensor::CSheetChildAscensor::isInvalidated(CDBGroupListSheetT ucstring name; if (nameID && pSMC->getDynString(nameID, name)) { - Text->setText(name); + Text->setText(name.toUtf8()); uint64 icon = NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:ASCENSOR:" + toString(Index) + ":ICON")->getValue64(); @@ -830,20 +830,20 @@ class CAHGuildSheetOpen : public IActionHandler // Set name CViewText *pViewName = dynamic_cast(pLine->getView(TEMPLATE_GUILD_MEMBER_NAME)); if (pViewName != NULL) - pViewName->setText (rGuildMembers[i].Name); + pViewName->setText (rGuildMembers[i].Name.toUtf8()); // Set Grade CViewText *pViewGrade = dynamic_cast(pLine->getView(TEMPLATE_GUILD_MEMBER_GRADE)); if (pViewGrade != NULL) { if (rGuildMembers[i].Grade == EGSPD::CGuildGrade::Leader) - pViewGrade->setText (CI18N::get("uiGuildLeader")); + pViewGrade->setText (CI18N::get("uiGuildLeader").toUtf8()); else if (rGuildMembers[i].Grade == EGSPD::CGuildGrade::HighOfficer) - pViewGrade->setText (CI18N::get("uiGuildHighOfficer")); + pViewGrade->setText (CI18N::get("uiGuildHighOfficer").toUtf8()); else if (rGuildMembers[i].Grade == EGSPD::CGuildGrade::Officer) - pViewGrade->setText (CI18N::get("uiGuildOfficer")); + pViewGrade->setText (CI18N::get("uiGuildOfficer").toUtf8()); else - pViewGrade->setText (CI18N::get("uiGuildMember")); + pViewGrade->setText (CI18N::get("uiGuildMember").toUtf8()); } // online? @@ -888,7 +888,7 @@ class CAHGuildSheetOpen : public IActionHandler str += toString("%01d", rt.getRyzomCycle()+1) +", "; str += CI18N::get("ui"+MONTH::toString( (MONTH::EMonth)rt.getRyzomMonthInCurrentCycle() )) + ", "; str += toString("%02d", rt.getRyzomDayOfMonth()+1); - pViewEnterDate->setText(str); + pViewEnterDate->setText(str.toUtf8()); } // Add to the list diff --git a/ryzom/client/src/interface_v3/interface_ddx.cpp b/ryzom/client/src/interface_v3/interface_ddx.cpp index 347a0d94d..caa394723 100644 --- a/ryzom/client/src/interface_v3/interface_ddx.cpp +++ b/ryzom/client/src/interface_v3/interface_ddx.cpp @@ -350,7 +350,7 @@ void CInterfaceDDX::CParam::updateScrollView(sint32 nVal) { if(ResultView) { - ResultView->setText(ucstring(toString(nVal)) + ResultUnit); + ResultView->setText(toString(nVal) + ResultUnit.toUtf8()); } } @@ -361,7 +361,7 @@ void CInterfaceDDX::CParam::updateScrollView(double nVal) { // allow N digits string fmt= toString("%%.%df", ResultDecimal); - ResultView->setText(ucstring(toString(fmt.c_str(), nVal)) + ResultUnit); + ResultView->setText(toString(fmt.c_str(), nVal) + ResultUnit.toUtf8()); } } diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 5737e50a0..fdc132030 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1530,7 +1530,7 @@ void CInterfaceManager::updateFrameEvents() CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather")); if (pVT != NULL) - pVT->setText(str); + pVT->setText(str.toUtf8()); CCtrlBase *pTooltip= dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather_tt")); if (pTooltip != NULL) @@ -1564,7 +1564,7 @@ void CInterfaceManager::updateFrameEvents() pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:time")); if (pVT != NULL) - pVT->setText(str); + pVT->setText(str.toUtf8()); str.clear(); // Update the clock in the compass if enabled. @@ -1577,7 +1577,7 @@ void CInterfaceManager::updateFrameEvents() str = getTimestampHuman("%I:%M %p"); else str = getTimestampHuman("%H:%M"); - pVT->setText(str); + pVT->setText(str.toUtf8()); } } } @@ -2388,7 +2388,7 @@ void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucst if (group && viewText) { viewText->setCaseMode(caseMode); - viewText->setText(text); + viewText->setText(text.toUtf8()); CWidgetManager::getInstance()->enableModalWindow(NULL, group); // don't understand why but need to update coords here group->updateCoords(); @@ -2441,7 +2441,7 @@ void CInterfaceManager::validMessageBox(TValidMessageIcon icon, const ucstring & CWidgetManager::getInstance()->setProcedureAction("proc_valid_message_box_cancel", 1, ahOnCancel, paramsOnCancel); // set text and icon - viewText->setText(text); + viewText->setText(text.toUtf8()); if(viewBitmap) { bool active= true; diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 119ce44b2..ec754de33 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -884,7 +884,7 @@ int CLuaIHMRyzom::setTextFormatTaged(CLuaState &ls) throw ELuaIHMException("setTextFormatTaged(): '%s' is not a CViewText", pIE->getId().c_str()); // Set the text as format - vt->setTextFormatTaged(text); + vt->setTextFormatTaged(text.toUtf8()); return 0; } diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index f97e90723..d9dfce119 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -103,14 +103,14 @@ void addKeyLine (CGroupList *pParent, const ucstring &keyName, const ucstring &s CViewText *pViewKeyName = dynamic_cast(pKeysLine->getView(TEMPLATE_KEYS_KEY_NAME)); if (pViewKeyName != NULL) { - pViewKeyName->setText (keyName); + pViewKeyName->setText (keyName.toUtf8()); pViewKeyName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); } CViewText *pViewShortcutName = dynamic_cast(pKeysLine->getView(TEMPLATE_KEYS_SHORTCUT_NAME)); if (pViewShortcutName != NULL) { - pViewShortcutName->setText (shortcutName); + pViewShortcutName->setText (shortcutName.toUtf8()); pViewShortcutName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); } @@ -512,9 +512,9 @@ void CModalContainerEditCmd::activate() NLGUI::CDBManager::getInstance()->getDbProp( DbComboDisp2P )->setValue32(-1); // reset name of params CViewText *pViewParamName = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+VIEW_EDITCMD_FIRST_PARAM_NAME)); - if (pViewParamName != NULL) pViewParamName->setText (string("")); + if (pViewParamName != NULL) pViewParamName->setText (string()); pViewParamName = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+VIEW_EDITCMD_SECOND_PARAM_NAME)); - if (pViewParamName != NULL) pViewParamName->setText (string("")); + if (pViewParamName != NULL) pViewParamName->setText (string()); invalidCurrentCommand(); } @@ -689,7 +689,7 @@ void CModalContainerEditCmd::activateFrom (const std::string &cmdName, const std if (noParam == 0) sText = WinName+VIEW_EDITCMD_FIRST_PARAM_NAME; else sText = WinName+VIEW_EDITCMD_SECOND_PARAM_NAME; CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sText)); - if (pVT != NULL) pVT->setText(CI18N::get(pBA->Parameters[i].LocalizedName)); + if (pVT != NULL) pVT->setText(CI18N::get(pBA->Parameters[i].LocalizedName).toUtf8()); noParam++; } } @@ -711,7 +711,7 @@ void CModalContainerEditCmd::activateFrom (const std::string &cmdName, const std CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+VIEW_EDITCMD_TEXT_KEY)); if (pVT != NULL) pVT->setActive(true); // setup the text of the key - pVT->setText(it->second.toUCString()); + pVT->setText(it->second.toUCString().toUtf8()); // There is already a shortcut so we can display ok button pBut = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+CTRL_EDITCMD_BUTTON_OK)); @@ -778,7 +778,7 @@ void CModalContainerEditCmd::invalidCurrentCommand() { // Dont display key shortcut if we are in creation mode pVT= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( WinName+VIEW_EDITCMD_TEXT_KEY )); - if (pVT != NULL) pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT)); + if (pVT != NULL) pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT).toUtf8()); // Deactivate the key definer text pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+VIEW_EDITCMD_TEXT_KEY)); @@ -887,7 +887,7 @@ void CModalContainerEditCmd::validCurrentCommand() { CurrentEditCmdLine.Combo = it->second; // Yes ok let setup the text of the key - pVT->setText(it->second.toUCString()); + pVT->setText(it->second.toUCString().toUtf8()); // There is already a shortcut so we can display ok button CCtrlBaseButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+CTRL_EDITCMD_BUTTON_OK)); if (pCB != NULL) pCB->setFrozen (false); @@ -897,7 +897,7 @@ void CModalContainerEditCmd::validCurrentCommand() CurrentEditCmdLine.Combo.Key = KeyCount; CurrentEditCmdLine.Combo.KeyButtons = noKeyButton; // Display not assigned text - pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT)); + pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT).toUtf8()); // Do not display the ok button CCtrlBaseButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+CTRL_EDITCMD_BUTTON_OK)); if (pCB != NULL) pCB->setFrozen (true); @@ -1048,9 +1048,9 @@ void CModalContainerEditCmd::onChangeCategory() // reset name of params CViewText *pViewParamName; pViewParamName = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+VIEW_EDITCMD_FIRST_PARAM_NAME)); - if (pViewParamName != NULL) pViewParamName->setText (string("")); + if (pViewParamName != NULL) pViewParamName->setText (string()); pViewParamName = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+VIEW_EDITCMD_SECOND_PARAM_NAME)); - if (pViewParamName != NULL) pViewParamName->setText (string("")); + if (pViewParamName != NULL) pViewParamName->setText (string()); // Reset key invalidCurrentCommand(); } @@ -1086,9 +1086,9 @@ void CModalContainerEditCmd::onChangeAction() // reset name of params CViewText *pViewParamName; pViewParamName = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+VIEW_EDITCMD_FIRST_PARAM_NAME)); - if (pViewParamName != NULL) pViewParamName->setText (string("")); + if (pViewParamName != NULL) pViewParamName->setText (string()); pViewParamName = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+VIEW_EDITCMD_SECOND_PARAM_NAME)); - if (pViewParamName != NULL) pViewParamName->setText (string("")); + if (pViewParamName != NULL) pViewParamName->setText (string()); uint noParam = 0; for (uint i = 0; i < rVParams.size(); ++i) @@ -1111,7 +1111,7 @@ void CModalContainerEditCmd::onChangeAction() pViewParamName = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sViewText)); if (pViewParamName != NULL) - pViewParamName->setText (CI18N::get(rP.LocalizedName)); + pViewParamName->setText (CI18N::get(rP.LocalizedName).toUtf8()); } if (rP.Type == CBaseAction::CParameter::Constant) @@ -1354,7 +1354,7 @@ public: pMCM->NewKey->CurrentEditCmdLine.Combo = pGetKey->Combo; CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(pMCM->NewKey->WinName+VIEW_EDITCMD_TEXT_KEY)); - if (pVT != NULL) pVT->setText(pMCM->NewKey->CurrentEditCmdLine.Combo.toUCString()); + if (pVT != NULL) pVT->setText(pMCM->NewKey->CurrentEditCmdLine.Combo.toUCString().toUtf8()); CCtrlBaseButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(pMCM->NewKey->WinName+CTRL_EDITCMD_BUTTON_OK)); if (pCB != NULL) pCB->setFrozen (false); @@ -1366,7 +1366,7 @@ public: pMCM->EditCmd->CurrentEditCmdLine.Combo = pGetKey->Combo; pMCM->CurrentEditMacro.Combo = pMCM->EditCmd->CurrentEditCmdLine.Combo; CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_NEWMACRO_KEY)); - if (pVT != NULL) pVT->setText(pMCM->EditCmd->CurrentEditCmdLine.Combo.toUCString()); + if (pVT != NULL) pVT->setText(pMCM->EditCmd->CurrentEditCmdLine.Combo.toUCString().toUtf8()); } } }; diff --git a/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/ryzom/client/src/interface_v3/macrocmd_manager.cpp index bf2197e45..12b066fff 100644 --- a/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -827,7 +827,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); + if (pVT != NULL) pVT->setText(cmdName.toUtf8()); pNewCmd->setParent (pParent); pParent->addChild (pNewCmd); @@ -895,9 +895,9 @@ public: if (pVT != NULL) { if (pMCM->CurrentEditMacro.Combo.Key == KeyCount) - pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT)); + pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT).toUtf8()); else - pVT->setText(pMCM->CurrentEditMacro.Combo.toUCString()); + pVT->setText(pMCM->CurrentEditMacro.Combo.toUCString().toUtf8()); } pList->clearGroups(); @@ -1003,9 +1003,9 @@ void addMacroLine (CGroupList *pParent, uint macNb, const CMacroCmd ¯o) if (pVT != NULL) { if (macro.Combo.Key != KeyCount) - pVT->setText(macro.Combo.toUCString()); + pVT->setText(macro.Combo.toUCString().toUtf8()); else - pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT)); + pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT).toUtf8()); } pNewMacro->setParent (pParent); diff --git a/ryzom/client/src/interface_v3/music_player.cpp b/ryzom/client/src/interface_v3/music_player.cpp index 56f97b554..a0a7aed66 100644 --- a/ryzom/client/src/interface_v3/music_player.cpp +++ b/ryzom/client/src/interface_v3/music_player.cpp @@ -328,7 +328,7 @@ void CMusicPlayer::rebuildPlaylist() { ucstring title; title.fromUtf8(_Songs[i].Title); - pVT->setText(title); + pVT->setText(title.toUtf8()); } pVT = dynamic_cast(pNew->getView(TEMPLATE_PLAYLIST_SONG_DURATION)); @@ -483,7 +483,7 @@ void CMusicPlayer::updatePlayingInfo(const std::string info) CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:mp3_player:screen:text")); if (pVT) { - pVT->setText(ucstring::makeFromUtf8(info)); + pVT->setText(info); } } diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index 7bde7d0fc..e285bbaf9 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -2831,7 +2831,7 @@ class CHandlerSelectChatSource : public IActionHandler { ucstring title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); - pVTM->setText("["+s+"] " + title); + pVTM->setText("["+s+"] " + title.toUtf8()); } } } diff --git a/ryzom/client/src/interface_v3/task_bar_manager.cpp b/ryzom/client/src/interface_v3/task_bar_manager.cpp index 70d2d9fe7..7c9bb2a45 100644 --- a/ryzom/client/src/interface_v3/task_bar_manager.cpp +++ b/ryzom/client/src/interface_v3/task_bar_manager.cpp @@ -180,9 +180,9 @@ public: if (pVT != NULL) { if (it != acmap.end()) - pVT->setText(it->second.toUCString()); + pVT->setText(it->second.toUCString().toUtf8()); else - pVT->setText(CI18N::get("uiNotAssigned")); + pVT->setText(CI18N::get("uiNotAssigned").toUtf8()); } } } diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index b134a5519..9e0fb7f12 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -243,7 +243,7 @@ void createOptionalCatUI() pVT = dynamic_cast(pNewLine->getView("size")); if (pVT != NULL) { - pVT->setText(BGDownloader::getWrittenSize(InfoOnPatch.OptCat[i].Size)); + pVT->setText(BGDownloader::getWrittenSize(InfoOnPatch.OptCat[i].Size).toUtf8()); } // Add to the list @@ -287,7 +287,7 @@ static void setDataScanLog(const ucstring &text) CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:log_txt:log")); if (pVT != NULL) { - pVT->setText(text); + pVT->setText(text.toUtf8()); } } @@ -296,10 +296,10 @@ static void setDataScanState(const ucstring &text, ucstring progress= ucstring() { CInterfaceManager *pIM= CInterfaceManager::getInstance(); CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:state")); - if (pVT != NULL) pVT->setText(text); + if (pVT != NULL) pVT->setText(text.toUtf8()); pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:progress")); - if (pVT != NULL) pVT->setText(progress); + if (pVT != NULL) pVT->setText(progress.toUtf8()); } void initCatDisplay() @@ -338,7 +338,7 @@ static void setPatcherStateText(const std::string &baseUIPath, const ucstring &s CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(baseUIPath + ":content:state")); if (pVT != NULL) { - pVT->setText(str); + pVT->setText(str.toUtf8()); } } @@ -349,7 +349,7 @@ static void setPatcherProgressText(const std::string &baseUIPath, const ucstring CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(baseUIPath + ":content:progress")); if (pVT != NULL) { - pVT->setText(str); + pVT->setText(str.toUtf8()); } } @@ -717,7 +717,7 @@ void loginMainLoop() ucstring sTmp; sTmp = BGDownloader::getWrittenSize(currentPatchingSize); sTmp += " / " + BGDownloader::getWrittenSize(totalPatchSize); - if (pVT != NULL) pVT->setText(sTmp); + if (pVT != NULL) pVT->setText(sTmp.toUtf8()); } // else if (screen == UI_VARIABLES_SCREEN_CATDISP) // If we are displaying patch info else if (LoginSM.getCurrentState() == CLoginStateMachine::st_display_cat) @@ -766,10 +766,10 @@ void loginMainLoop() // Total size of the patches is optional cats + required cat (f(optCat)) + non opt cat CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_TOTAL_SIZE)); - if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(TotalPatchSize)); + if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(TotalPatchSize).toUtf8()); pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_NON_OPTIONAL_SIZE)); - if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(nNonOptSize)); + if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(nNonOptSize).toUtf8()); } } } diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index 642935869..d1744f3ff 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -3374,7 +3374,7 @@ private: // must set the text by hand CViewText *vt= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("server_message_box_content_view_text"))); if(vt) - vt->setTextFormatTaged(contentStr); + vt->setTextFormatTaged(contentStr.toUtf8()); // open CWidgetManager::getInstance()->setTopWindow(pGC); diff --git a/ryzom/client/src/player_cl.cpp b/ryzom/client/src/player_cl.cpp index eafdec032..15e8209db 100644 --- a/ryzom/client/src/player_cl.cpp +++ b/ryzom/client/src/player_cl.cpp @@ -753,7 +753,7 @@ void CPlayerCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle * if (_Slot == 0) { CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:player:header_opened:player_title")); - if (pVT != NULL) pVT->setText(_Title); + if (pVT != NULL) pVT->setText(_Title.toUtf8()); } // rebuild in scene interface diff --git a/ryzom/client/src/r2/editor.cpp b/ryzom/client/src/r2/editor.cpp index ee203d312..a708bc2a4 100644 --- a/ryzom/client/src/r2/editor.cpp +++ b/ryzom/client/src/r2/editor.cpp @@ -1761,7 +1761,7 @@ void CEditor::waitScenarioScreen() // Display the firewall alert string CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:r2ed_connecting:title")); if (pVT != NULL) - pVT->setText(CI18N::get("uiFirewallAlert")+ucstring("...")); + pVT->setText(CI18N::get("uiFirewallAlert").toUtf8()+"..."); // The mouse and fullscreen mode should be unlocked for the user to set the firewall permission nlSleep( 30 ); // 'nice' the client, and prevent to make too many send attempts @@ -1853,8 +1853,8 @@ void CEditor::waitScenarioScreen() if (pVT != NULL) { pVT->setMultiLine( true ); - pVT->setText(CI18N::get("uiFirewallFail")+ucstring(".\n")+ - CI18N::get("uiFirewallAlert")+ucstring(".")); + pVT->setText(CI18N::get("uiFirewallFail").toUtf8()+".\n"+ + CI18N::get("uiFirewallAlert").toUtf8()+"."); } } } @@ -6468,7 +6468,7 @@ void CEditor::connectionMsg(const std::string &stringId) CViewText *vt = dynamic_cast(r2ConnectWindow->getView("connexionMsg")); if (vt) { - vt->setText(CI18N::get(stringId)); + vt->setText(CI18N::get(stringId).toUtf8()); } } } @@ -7497,7 +7497,7 @@ class CAHInviteCharacter : public IActionHandler { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningInviteFreeTrial")); + pVT->setText(CI18N::get("uiRingWarningInviteFreeTrial").toUtf8()); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); } diff --git a/ryzom/client/src/session_browser_impl.cpp b/ryzom/client/src/session_browser_impl.cpp index 9f3cc77a9..f11c24a54 100644 --- a/ryzom/client/src/session_browser_impl.cpp +++ b/ryzom/client/src/session_browser_impl.cpp @@ -230,7 +230,7 @@ int CSessionBrowserImpl::luaJoinRingSession(CLuaState &ls) { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningFreeTrial")); + pVT->setText(CI18N::get("uiRingWarningFreeTrial").toUtf8()); CAHManager::getInstance()->runActionHandler("enter_modal", NULL, "group=ui:interface:warning_free_trial"); } From c129ce87df3838ee5d6d49cea213901e6194a7e0 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 13:51:18 +0800 Subject: [PATCH 057/205] Change CViewText to UTF-8, ryzom/ryzomcore#335 --- nel/include/nel/gui/view_text.h | 4 ++-- nel/src/3d/font_manager.cpp | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/nel/include/nel/gui/view_text.h b/nel/include/nel/gui/view_text.h index 959c82855..2ffaa8d49 100644 --- a/nel/include/nel/gui/view_text.h +++ b/nel/include/nel/gui/view_text.h @@ -247,7 +247,7 @@ namespace NLGUI std::string _HardTextFormat; std::string _HardText; std::string _Text; - size_t _TextLength; + mutable sint _TextLength; /// index of the computed String associated to this text control uint _Index; /// info on the computed String associated to this text control @@ -443,7 +443,7 @@ namespace NLGUI void setup (); void setupDefault (); - void setStringSelectionSkipingSpace(uint stringId, const ucstring &text, sint charStart, sint charEnd); + void setStringSelectionSkipingSpace(uint stringId, const std::string &text, sint charStart, sint charEnd); // void pushString(const ucstring &str, bool deleteSpaceAtStart = false); diff --git a/nel/src/3d/font_manager.cpp b/nel/src/3d/font_manager.cpp index 4a8162f51..872c1fd3d 100644 --- a/nel/src/3d/font_manager.cpp +++ b/nel/src/3d/font_manager.cpp @@ -130,6 +130,7 @@ void CFontManager::computeString (NLMISC::CUtfStringView sv, output.CacheVersion = getCacheVersion(); uint j = 0; + size_t idx = 0; { CVertexBufferReadWrite vba; output.Vertices.lock (vba); @@ -138,8 +139,7 @@ void CFontManager::computeString (NLMISC::CUtfStringView sv, hlfPixScrH = 0.f; // For all chars - //for (uint i = 0; i < s.size(); i++) - for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) + for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it, ++idx) { // Creating font k.Char = *it; @@ -211,7 +211,8 @@ void CFontManager::computeString (NLMISC::CUtfStringView sv, } } output.Vertices.setNumVertices (j); - output.Length = j >> 2; + output.Length = idx; + nlassert(output.Length == NLMISC::CUtfStringView(output.Text).count()); // compile string info output.StringWidth = (float)penx; @@ -316,6 +317,7 @@ void CFontManager::computeStringInfo ( NLMISC::CUtfStringView sv, } } output.Length = idx; + nlassert(output.Length == std::min(len, NLMISC::CUtfStringView(output.Text).count())); // compile string info output.StringWidth = (float)penx; From c3ef0fc91c2cd0a993aeda88248ab7780ae455d8 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 14:21:13 +0800 Subject: [PATCH 058/205] Change CViewText to UTF-8, ryzom/ryzomcore#335 --- nel/include/nel/gui/string_case.h | 1 + nel/include/nel/misc/common.h | 11 +-- nel/src/gui/string_case.cpp | 124 ++++++++++++++++++++++++++++++ nel/src/misc/common.cpp | 4 + nel/src/misc/unicode.cpp | 67 ++++++++++++++++ 5 files changed, 202 insertions(+), 5 deletions(-) diff --git a/nel/include/nel/gui/string_case.h b/nel/include/nel/gui/string_case.h index ec8fa2925..300d72c76 100644 --- a/nel/include/nel/gui/string_case.h +++ b/nel/include/nel/gui/string_case.h @@ -39,6 +39,7 @@ namespace NLGUI void setCase( ucstring &str, TCaseMode mode ); + void setCase( std::string &str, TCaseMode mode ); } diff --git a/nel/include/nel/misc/common.h b/nel/include/nel/misc/common.h index a5d1b2f27..7b89bae3b 100644 --- a/nel/include/nel/misc/common.h +++ b/nel/include/nel/misc/common.h @@ -227,17 +227,18 @@ inline double isValidDouble (double v) * \param str a string to transform to lower case */ -std::string toLower ( const char *str ); -std::string toLower ( const std::string &str ); -void toLower ( char *str ); +std::string toLower ( const char *str ); // UTF-8 +std::string toLower ( const std::string &str ); // UTF-8 +void toLower ( char *str ); // Ascii only char toLower ( const char ch ); // convert only one character /** Convert a string in upper case. * \param a string to transform to upper case */ -std::string toUpper ( const std::string &str); -void toUpper ( char *str); +std::string toUpper ( const char *str ); // UTF-8 +std::string toUpper ( const std::string &str); // UTF-8 +void toUpper ( char *str); // Ascii only /** diff --git a/nel/src/gui/string_case.cpp b/nel/src/gui/string_case.cpp index c96e2cc7f..f6218d39a 100644 --- a/nel/src/gui/string_case.cpp +++ b/nel/src/gui/string_case.cpp @@ -19,6 +19,7 @@ #include "stdpch.h" #include "nel/gui/string_case.h" +#include "nel/misc/utf_string_view.h" #ifdef DEBUG_NEW #define new DEBUG_NEW @@ -26,13 +27,33 @@ namespace NLGUI { + inline bool isSeparator (u32char c) + { + return (c == (u32char)' ') || (c == (u32char)'\t') || (c == (u32char)'\n') || (c == (u32char)'\r'); + } + inline bool isSeparator (ucchar c) { return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r'); } + inline bool isSeparator (char c) + { + return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r'); + } + // *************************************************************************** + inline bool isEndSentence (u32char c, u32char lastChar) + { + // Ex: One sentence. Another sentence. + // ^ + // Counterexample: nevrax.com + // ^ + return ((c == (u32char)' ') || (c == (u32char)'\n')) + && (lastChar == (u32char)'.') || (lastChar == (u32char)'!') || (lastChar == (u32char)'?'); + } + inline bool isEndSentence (ucstring& str, uint index) { // Ex: One sentence. Another sentence. @@ -117,6 +138,109 @@ namespace NLGUI } } + void setCase(std::string &str, TCaseMode mode) + { + const uint length = (uint)str.length(); + uint i; + bool newString = true; + bool newSentence = true; + bool newWord = true; + switch (mode) + { + case CaseLower: + str = NLMISC::toLower(str); + break; + case CaseUpper: + str = NLMISC::toUpper(str); + break; + case CaseFirstStringLetterUp: + { + NLMISC::CUtfStringView sv(str); + std::string res; + res.reserve(sv.largestSize()); + for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) + { + u32char c = *it; + if (c < 0x10000) + { + if (!isSeparator(c)) + { + if (newString) + c = NLMISC::toUpper((ucchar)c); + else + c = NLMISC::toLower((ucchar)c); + newString = false; + } + } + NLMISC::CUtfStringView::append(res, c); + } + str = nlmove(res); + break; + } + case CaseFirstSentenceLetterUp: + { + NLMISC::CUtfStringView sv(str); + std::string res; + res.reserve(sv.largestSize()); + u32char lastChar = 0; + for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) + { + u32char c = *it; + if (c < 0x10000) + { + if (isEndSentence(c, lastChar)) + newSentence = true; + else + { + if (newSentence) + c = NLMISC::toUpper((ucchar)c); + else + c = NLMISC::toLower((ucchar)c); + + if (!isSeparator(c)) + newSentence = false; + } + } + NLMISC::CUtfStringView::append(res, c); + lastChar = c; + } + str = nlmove(res); + break; + } + case CaseFirstWordLetterUp: + { + NLMISC::CUtfStringView sv(str); + std::string res; + res.reserve(sv.largestSize()); + u32char lastChar = 0; + for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) + { + u32char c = *it; + if (c < 0x10000) + { + if (isSeparator(c) || isEndSentence(c, lastChar)) + newWord = true; + else + { + if (newWord) + c = NLMISC::toUpper((ucchar)c); + else + c = NLMISC::toLower((ucchar)c); + + newWord = false; + } + } + NLMISC::CUtfStringView::append(res, c); + lastChar = c; + } + str = nlmove(res); + break; + } + default: + break; + } + } + } diff --git a/nel/src/misc/common.cpp b/nel/src/misc/common.cpp index b9e9a7d85..c1bf67efa 100644 --- a/nel/src/misc/common.cpp +++ b/nel/src/misc/common.cpp @@ -594,6 +594,7 @@ NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human rea return true; } +/* std::string toLower(const char *str) { if (!str) return ""; @@ -624,6 +625,7 @@ std::string toLower(const std::string &str) } return res; } +*/ char toLower(const char ch) { @@ -652,6 +654,7 @@ void toLower(char *str) } } +/* std::string toUpper(const std::string &str) { string res; @@ -665,6 +668,7 @@ std::string toUpper(const std::string &str) } return res; } +*/ void toUpper(char *str) { diff --git a/nel/src/misc/unicode.cpp b/nel/src/misc/unicode.cpp index 47a4cdfde..12dfdcad4 100644 --- a/nel/src/misc/unicode.cpp +++ b/nel/src/misc/unicode.cpp @@ -16,6 +16,7 @@ #include "stdmisc.h" #include "nel/misc/ucstring.h" +#include "nel/misc/utf_string_view.h" #ifdef DEBUG_NEW #define new DEBUG_NEW @@ -1949,6 +1950,39 @@ ucchar toLower (ucchar c) // *************************************************************************** +static std::string toLower(CUtfStringView sv) +{ + std::string res; + res.reserve(sv.largestSize()); + for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) + { + u32char c = *it; + if (c < 0x10000) + { + ucchar uc = c; + ucchar *result = toLowerUpperSearch(&uc, UnicodeUpperToLower); + if (result) + c = uc; + } + CUtfStringView::append(res, c); + } + return res; +} + +std::string toLower(const char *str) +{ + return toLower(CUtfStringView(str)); +} + +// *************************************************************************** + +std::string toLower(const std::string &str) +{ + return toLower(CUtfStringView(str)); +} + +// *************************************************************************** + ucstring toUpper (const ucstring &str) { uint i; @@ -1991,4 +2025,37 @@ ucchar toUpper (ucchar c) // *************************************************************************** +static std::string toUpper(CUtfStringView sv) +{ + std::string res; + res.reserve(sv.largestSize()); + for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) + { + u32char c = *it; + if (c < 0x10000) + { + ucchar uc = c; + ucchar *result = toLowerUpperSearch(&uc, UnicodeLowerToUpper); + if (result) + c = uc; + } + CUtfStringView::append(res, c); + } + return res; +} + +std::string toUpper(const char *str) +{ + return toUpper(CUtfStringView(str)); +} + +// *************************************************************************** + +std::string toUpper(const std::string &str) +{ + return toUpper(CUtfStringView(str)); +} + +// *************************************************************************** + } // NLMISC From 506f9f26bde74fe3c82f71bb4aaaf5e493c1fcdf Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 15:07:41 +0800 Subject: [PATCH 059/205] Change CViewText to UTF-8, ryzom/ryzomcore#335 --- nel/include/nel/misc/common.h | 8 ++++---- nel/include/nel/misc/ucstring.h | 6 ++++++ nel/src/gui/string_case.cpp | 4 ++-- nel/src/misc/common.cpp | 4 ---- nel/src/misc/unicode.cpp | 24 ++++++++++++------------ 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/nel/include/nel/misc/common.h b/nel/include/nel/misc/common.h index 7b89bae3b..2f678acef 100644 --- a/nel/include/nel/misc/common.h +++ b/nel/include/nel/misc/common.h @@ -227,8 +227,8 @@ inline double isValidDouble (double v) * \param str a string to transform to lower case */ -std::string toLower ( const char *str ); // UTF-8 -std::string toLower ( const std::string &str ); // UTF-8 +std::string toLower ( const char *str ); // Ascii only +std::string toLower ( const std::string &str ); // Ascii only void toLower ( char *str ); // Ascii only char toLower ( const char ch ); // convert only one character @@ -236,8 +236,8 @@ char toLower ( const char ch ); // convert only one character * \param a string to transform to upper case */ -std::string toUpper ( const char *str ); // UTF-8 -std::string toUpper ( const std::string &str); // UTF-8 +// std::string toUpper ( const char *str ); // Ascii only +std::string toUpper ( const std::string &str); // Ascii only void toUpper ( char *str); // Ascii only diff --git a/nel/include/nel/misc/ucstring.h b/nel/include/nel/misc/ucstring.h index 61f7f416b..8bbcd828d 100644 --- a/nel/include/nel/misc/ucstring.h +++ b/nel/include/nel/misc/ucstring.h @@ -260,6 +260,12 @@ ucstring toUpper(const ucstring &str); void toUpper(ucchar *str); ucchar toUpper(ucchar c); +std::string toLowerAsUtf8(const char *str); +std::string toLowerAsUtf8(const std::string &str); + +std::string toUpperAsUtf8(const char *str); +std::string toUpperAsUtf8(const std::string &str); + }; #endif // NL_UCSTRING_H diff --git a/nel/src/gui/string_case.cpp b/nel/src/gui/string_case.cpp index f6218d39a..d970d1e03 100644 --- a/nel/src/gui/string_case.cpp +++ b/nel/src/gui/string_case.cpp @@ -148,10 +148,10 @@ namespace NLGUI switch (mode) { case CaseLower: - str = NLMISC::toLower(str); + str = NLMISC::toLowerAsUtf8(str); break; case CaseUpper: - str = NLMISC::toUpper(str); + str = NLMISC::toUpperAsUtf8(str); break; case CaseFirstStringLetterUp: { diff --git a/nel/src/misc/common.cpp b/nel/src/misc/common.cpp index c1bf67efa..b9e9a7d85 100644 --- a/nel/src/misc/common.cpp +++ b/nel/src/misc/common.cpp @@ -594,7 +594,6 @@ NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human rea return true; } -/* std::string toLower(const char *str) { if (!str) return ""; @@ -625,7 +624,6 @@ std::string toLower(const std::string &str) } return res; } -*/ char toLower(const char ch) { @@ -654,7 +652,6 @@ void toLower(char *str) } } -/* std::string toUpper(const std::string &str) { string res; @@ -668,7 +665,6 @@ std::string toUpper(const std::string &str) } return res; } -*/ void toUpper(char *str) { diff --git a/nel/src/misc/unicode.cpp b/nel/src/misc/unicode.cpp index 12dfdcad4..6a0bf25c0 100644 --- a/nel/src/misc/unicode.cpp +++ b/nel/src/misc/unicode.cpp @@ -1950,7 +1950,7 @@ ucchar toLower (ucchar c) // *************************************************************************** -static std::string toLower(CUtfStringView sv) +static std::string toLowerAsUtf8(CUtfStringView sv) { std::string res; res.reserve(sv.largestSize()); @@ -1962,23 +1962,23 @@ static std::string toLower(CUtfStringView sv) ucchar uc = c; ucchar *result = toLowerUpperSearch(&uc, UnicodeUpperToLower); if (result) - c = uc; + c = result[1]; } CUtfStringView::append(res, c); } return res; } -std::string toLower(const char *str) +std::string toLowerAsUtf8(const char *str) { - return toLower(CUtfStringView(str)); + return toLowerAsUtf8(CUtfStringView(str)); } // *************************************************************************** -std::string toLower(const std::string &str) +std::string toLowerAsUtf8(const std::string &str) { - return toLower(CUtfStringView(str)); + return toLowerAsUtf8(CUtfStringView(str)); } // *************************************************************************** @@ -2025,7 +2025,7 @@ ucchar toUpper (ucchar c) // *************************************************************************** -static std::string toUpper(CUtfStringView sv) +static std::string toUpperAsUtf8(CUtfStringView sv) { std::string res; res.reserve(sv.largestSize()); @@ -2037,23 +2037,23 @@ static std::string toUpper(CUtfStringView sv) ucchar uc = c; ucchar *result = toLowerUpperSearch(&uc, UnicodeLowerToUpper); if (result) - c = uc; + c = result[1]; } CUtfStringView::append(res, c); } return res; } -std::string toUpper(const char *str) +std::string toUpperAsUtf8(const char *str) { - return toUpper(CUtfStringView(str)); + return toUpperAsUtf8(CUtfStringView(str)); } // *************************************************************************** -std::string toUpper(const std::string &str) +std::string toUpperAsUtf8(const std::string &str) { - return toUpper(CUtfStringView(str)); + return toUpperAsUtf8(CUtfStringView(str)); } // *************************************************************************** From e1195fe34e2d39a6cce0d1a2a42f2138c1717e74 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 15:30:17 +0800 Subject: [PATCH 060/205] Change CDBGroupComboBox to UTF-8, ryzom/ryzomcore#335 --- nel/include/nel/gui/dbgroup_combo_box.h | 28 +++--- nel/src/gui/dbgroup_combo_box.cpp | 96 +++++++++++-------- nel/src/gui/group_html.cpp | 2 +- .../src/interface_v3/action_handler_game.cpp | 26 ++--- .../src/interface_v3/action_handler_help.cpp | 2 +- .../bot_chat_page_dynamic_mission.cpp | 8 +- .../client/src/interface_v3/macrocmd_key.cpp | 11 +-- .../client/src/interface_v3/skill_manager.cpp | 2 +- 8 files changed, 95 insertions(+), 80 deletions(-) diff --git a/nel/include/nel/gui/dbgroup_combo_box.h b/nel/include/nel/gui/dbgroup_combo_box.h index 6f42572bb..61e447f4e 100644 --- a/nel/include/nel/gui/dbgroup_combo_box.h +++ b/nel/include/nel/gui/dbgroup_combo_box.h @@ -60,13 +60,15 @@ namespace NLGUI // Combo Texts void resetTexts(); - void addText(const ucstring &text); - void setText(uint i, const ucstring &text); - void insertText(uint i, const ucstring &text); - const ucstring &getText(uint i) const; + void addText(const std::string &text); + void setText(uint i, const std::string &text); + void insertText(uint i, const std::string &text); + const std::string &getText(uint i) const; + ucstring getTextAsUtf16(uint i) const; uint getTextId(uint i) const; uint getTextPos(uint nId) const; - const ucstring &getTexture(uint i) const; + const std::string &getTexture(uint i) const; + ucstring getTextureAsUtf16(uint i) const; void setGrayed(uint i, bool g); bool getGrayed(uint i) const; void removeText(uint nPos); @@ -87,11 +89,13 @@ namespace NLGUI std::string getSelectionText() const; // view text - void setViewText(const ucstring & text); - ucstring getViewText() const; + void setViewText(const std::string & text); + std::string getViewText() const; + void setViewTextAsUtf16(const ucstring &text) { setViewText(text.toUtf8()); } + ucstring getViewTextAsUtf16() const; CViewText *getViewText(); - void setTexture(uint i, const ucstring &texture); + void setTexture(uint i, const std::string &texture); sint32 evalContentWidth() const; @@ -122,7 +126,7 @@ namespace NLGUI REFLECT_LUA_METHOD("resetTexts", luaResetTexts) REFLECT_SINT32 ("selectionNb", getSelectionNb, setSelectionNb) REFLECT_STRING ("selection_text", getSelectionText, setSelectionText) - REFLECT_UCSTRING ("view_text", getViewText, setViewText) + REFLECT_UCSTRING ("view_text", getViewTextAsUtf16, setViewTextAsUtf16) // FIXME: Better to have UTF-8 REFLECT_EXPORT_END @@ -137,8 +141,8 @@ namespace NLGUI // sint32 CInterfaceProperty _Selection; sint32 _NotLinkedToDBSelection; - std::vector > _Texts; - std::vector _Textures; + std::vector > _Texts; + std::vector _Textures; std::vector _Grayed; // Action Handler called on combo click @@ -155,7 +159,7 @@ namespace NLGUI CCtrlBaseButton *_SelectButton; bool _IsExternViewText; - ucstring _ExternViewText; + std::string _ExternViewText; private: diff --git a/nel/src/gui/dbgroup_combo_box.cpp b/nel/src/gui/dbgroup_combo_box.cpp index f7c49fee8..dd7f2154d 100644 --- a/nel/src/gui/dbgroup_combo_box.cpp +++ b/nel/src/gui/dbgroup_combo_box.cpp @@ -43,9 +43,9 @@ namespace NLGUI void force_link_dbgroup_combo_box_cpp() { } // Compare strings - static inline bool lt_text(const std::pair &s1, const std::pair &s2) + static inline bool lt_text(const std::pair &s1, const std::pair &s2) { - return toLower(s1.second) < toLower(s2.second); + return toLowerAsUtf8(s1.second) < toLowerAsUtf8(s2.second); } std::string CDBGroupComboBox::measureMenu; @@ -183,10 +183,10 @@ namespace NLGUI if (name) { const char *propPtr = name; - ucstring Text = ucstring::makeFromUtf8(propPtr); - if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) - Text = CI18N::get (propPtr); - addText(Text); + if (NLMISC::startsWith(propPtr, "ui")) + addText(CI18N::get(propPtr).toUtf8()); + else + addText(propPtr); } } child = child->next; @@ -240,11 +240,11 @@ namespace NLGUI } else if(_IsExternViewText) { - _ViewText->setText(_ExternViewText.toUtf8()); + _ViewText->setText(_ExternViewText); } else { - _ViewText->setText(_Texts[_CacheSelection].second.toUtf8()); + _ViewText->setText(_Texts[_CacheSelection].second); } } } @@ -274,7 +274,7 @@ namespace NLGUI } // *************************************************************************** - void CDBGroupComboBox::addText(const ucstring &text) + void CDBGroupComboBox::addText(const std::string &text) { dirt(); _Texts.push_back(make_pair((uint)_Texts.size(), text)); @@ -283,7 +283,7 @@ namespace NLGUI } // *************************************************************************** - void CDBGroupComboBox::setText(uint i, const ucstring &text) + void CDBGroupComboBox::setText(uint i, const std::string &text) { dirt(); if(i<_Texts.size()) @@ -291,7 +291,7 @@ namespace NLGUI } // *************************************************************************** - void CDBGroupComboBox::insertText(uint i, const ucstring &text) + void CDBGroupComboBox::insertText(uint i, const std::string &text) { dirt(); if(i<_Texts.size()) @@ -313,7 +313,7 @@ namespace NLGUI } // *************************************************************************** - void CDBGroupComboBox::setTexture(uint i, const ucstring &texture) + void CDBGroupComboBox::setTexture(uint i, const std::string &texture) { dirt(); if(i<_Textures.size()) @@ -351,13 +351,19 @@ namespace NLGUI } // *************************************************************************** - const ucstring &CDBGroupComboBox::getText(uint i) const + const std::string &CDBGroupComboBox::getText(uint i) const { - static ucstring null; - if(i<_Texts.size()) + static const std::string empty; + if (i < _Texts.size()) return _Texts[i].second; else - return null; + return empty; + } + + // *************************************************************************** + ucstring CDBGroupComboBox::getTextAsUtf16(uint i) const + { + return ucstring::makeFromUtf8(getText(i)); } // *************************************************************************** @@ -385,15 +391,21 @@ namespace NLGUI { sort(_Texts.begin(), _Texts.end(), lt_text); } - + // *************************************************************************** - const ucstring &CDBGroupComboBox::getTexture(uint i) const + const std::string &CDBGroupComboBox::getTexture(uint i) const { - static ucstring null; - if(i<_Textures.size()) + static const std::string empty; + if (i < _Textures.size()) return _Textures[i]; else - return null; + return empty; + } + + // *************************************************************************** + ucstring CDBGroupComboBox::getTextureAsUtf16(uint i) const + { + return ucstring::makeFromUtf8(getTexture(i)); } // *************************************************************************** @@ -452,8 +464,7 @@ namespace NLGUI sint32 value; for(uint i=0; isetText(_ExternViewText.toUtf8()); + _ViewText->setText(_ExternViewText); } // *************************************************************************** - ucstring CDBGroupComboBox::getViewText() const + std::string CDBGroupComboBox::getViewText() const + { + return _ViewText->getText(); + } + + // *************************************************************************** + ucstring CDBGroupComboBox::getViewTextAsUtf16() const { return CUtfStringView(_ViewText->getText()).toUtf16(); } @@ -486,18 +503,14 @@ namespace NLGUI // *************************************************************************** std::string CDBGroupComboBox::getSelectionText() const { - ucstring text; if (_LinkedToDB) { - text = getText(_Selection.getSInt32()); + return getText(_Selection.getSInt32()); } else { - text = getText(_NotLinkedToDBSelection); + return getText(_NotLinkedToDBSelection); } - std::string texteS; - text.toString(texteS); - return texteS; } // *************************************************************************** @@ -538,8 +551,7 @@ namespace NLGUI sint32 value; for(uint i=0; iaddLine(getText(i), "combo_box_select_end", toString(i), - "", std::string(), getTexture(i).toString(), checkable); + groupMenu->addLine(ucstring::makeFromUtf8(getText(i)), "combo_box_select_end", toString(i), + "", std::string(), getTexture(i), checkable); groupMenu->setGrayedLine(i, getGrayed(i)); } diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 7d9e48baf..e6b1ba473 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -6437,7 +6437,7 @@ namespace NLGUI if (cb) { uint lineIndex = cb->getNumTexts(); - cb->addText(_SelectOptionStr); + cb->addText(_SelectOptionStr.toUtf8()); if (_Forms.back().Entries.back().sbOptionDisabled == lineIndex) { cb->setGrayed(lineIndex, true); diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 19820be99..44c6e64fb 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -3013,7 +3013,7 @@ void updateVRDevicesComboUI(bool enable) { std::stringstream displayname; displayname << std::string("[") << VRDeviceCache[i].first << "] [" << VRDeviceCache[i].second << "]"; - pCB->addText(ucstring(displayname.str())); + pCB->addText(displayname.str()); if (ClientCfg.VRDisplayDevice == VRDeviceCache[i].first) { if (selectedDevice == -1 || ClientCfg.VRDisplayDeviceId == VRDeviceCache[i].second) @@ -3027,7 +3027,7 @@ void updateVRDevicesComboUI(bool enable) // configured device not found, add a dummy std::stringstream displayname; displayname << std::string("[") << ClientCfg.VRDisplayDevice << "] [" << ClientCfg.VRDisplayDeviceId<< "] [DEVICE NOT FOUND]"; - pCB->addText(ucstring(displayname.str())); + pCB->addText(displayname.str()); selectedDevice = VRDeviceCache.size(); } NLGUI::CDBManager::getInstance()->getDbProp(GAME_CONFIG_VR_DEVICE_DB)->setValue32(-1); @@ -3062,7 +3062,7 @@ public: { pCB->resetTexts(); for (sint j = 0; j < (sint)stringModeList.size(); j++) - pCB->addText(ucstring(stringModeList[j])); + pCB->addText(stringModeList[j]); } // frequencies @@ -3071,7 +3071,7 @@ public: { pCB->resetTexts(); for (sint j = 0; j < (sint)stringFreqList.size(); j++) - pCB->addText(ucstring(stringFreqList[j])); + pCB->addText(stringFreqList[j]); } // -1 is important to indicate we set this value in edit mode @@ -3094,10 +3094,10 @@ public: if( pCB ) { pCB->resetTexts(); - pCB->addText(CI18N::get("uigcLowTextureMode")); - pCB->addText(CI18N::get("uigcNormalTextureMode")); + pCB->addText(CI18N::get("uigcLowTextureMode").toUtf8()); + pCB->addText(CI18N::get("uigcNormalTextureMode").toUtf8()); if(ClientCfg.HDTextureInstalled) - pCB->addText(CI18N::get("uigcHighTextureMode")); + pCB->addText(CI18N::get("uigcHighTextureMode").toUtf8()); } // Anisotropic Filtering @@ -3110,14 +3110,14 @@ public: sint maxAnisotropic = (sint)Driver->getAnisotropicFilterMaximum(); pCB->resetTexts(); - pCB->addText(CI18N::get("uigcFxAnisotropicFilterNone")); + pCB->addText(CI18N::get("uigcFxAnisotropicFilterNone").toUtf8()); sint anisotropic = 2; uint i = 1; while (anisotropic <= maxAnisotropic) { - pCB->addText(ucstring(NLMISC::toString("%dx", anisotropic))); + pCB->addText(NLMISC::toString("%dx", anisotropic)); if (ClientCfg.AnisotropicFilter == anisotropic) nAnisotropic = i; @@ -3222,7 +3222,7 @@ class CHandlerGameConfigMode : public IActionHandler // Get W, H sint w,h; { - string vidModeStr = pCB->getText(nVideModeNb).toString(); + string vidModeStr = pCB->getText(nVideModeNb); string tmp = vidModeStr.substr(0,vidModeStr.find('x')-1); fromString(tmp, w); tmp = vidModeStr.substr(vidModeStr.find('x')+2,vidModeStr.size()); @@ -3262,7 +3262,7 @@ class CHandlerGameConfigMode : public IActionHandler { pCB->resetTexts(); for (j = 0; j < (sint)stringFreqList.size(); j++) - pCB->addText(ucstring(stringFreqList[j]) + " Hz"); + pCB->addText(stringFreqList[j] + " Hz"); } NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_VIDEO_FREQ_DB )->setValue32(nFoundFreq); @@ -3464,7 +3464,7 @@ class CHandlerGameConfigApply : public IActionHandler CDBGroupComboBox *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId( GAME_CONFIG_VIDEO_MODES_COMBO )); if( pCB != NULL ) { - string vidModeStr = pCB->getText(nVideModeNb).toString(); + string vidModeStr = pCB->getText(nVideModeNb); string tmp = vidModeStr.substr(0,vidModeStr.find('x')-1); fromString(tmp, w); tmp = vidModeStr.substr(vidModeStr.find('x')+2,vidModeStr.size()); @@ -3478,7 +3478,7 @@ class CHandlerGameConfigApply : public IActionHandler CDBGroupComboBox *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId( GAME_CONFIG_VIDEO_FREQS_COMBO )); if( pCB != NULL ) { - string vidFreqStr = pCB->getText(nVideoFreqNb).toString(); + string vidFreqStr = pCB->getText(nVideoFreqNb); fromString(vidFreqStr, freq); } } diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index 030d34bfe..6b699f8ee 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -2200,7 +2200,7 @@ static void setupRawMaterialStats(CSheetHelpSetup &setup) if(pIS->canBuildItemPart(faberType)) { - pCB->addText(RM_FABER_TYPE::toLocalString(faberType)); + pCB->addText(RM_FABER_TYPE::toLocalString(faberType).toUtf8()); } } diff --git a/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp b/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp index 1e9d56dc3..0fc03124a 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp @@ -156,7 +156,7 @@ void CBotChatPageDynamicMission::update() { if (ClientCfg.Local) { - _ChoiceCB[k]->setText(l, ucstring(toString("Dynamic mission %d:%d", (int) k, (int) l))); + _ChoiceCB[k]->setText(l, toString("Dynamic mission %d:%d", (int) k, (int) l)); _TextReceived[k][l] = true; } else @@ -167,7 +167,7 @@ void CBotChatPageDynamicMission::update() bool received = CStringManagerClient::instance()->getDynString(textID, result); if (received) { - _ChoiceCB[k]->setText(l, result); + _ChoiceCB[k]->setText(l, result.toUtf8()); _TextReceived[k][l] = true; } } @@ -183,13 +183,13 @@ void CBotChatPageDynamicMission::update() bool received = CStringManagerClient::instance()->getDynString(textID, result); if (received) { - _ChoiceCB[k]->addText(result); + _ChoiceCB[k]->addText(result.toUtf8()); _TextReceived[k][l] = true; } else { // add a text to show the player that the text is being received - _ChoiceCB[k]->addText(NLMISC::CI18N::get("uiWaitingChoiceFromServer")); + _ChoiceCB[k]->addText(NLMISC::CI18N::get("uiWaitingChoiceFromServer").toUtf8()); } } } diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index d9dfce119..9fce02ef8 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -492,7 +492,7 @@ void CModalContainerEditCmd::activate() } if (found) { - pCB->addText( CI18N::get(rVCat[i].LocalizedName) ); + pCB->addText(CI18N::get(rVCat[i].LocalizedName).toUtf8()); CurrentEditCmdCategories.push_back(rVCat[i].Name); } } @@ -1033,7 +1033,7 @@ void CModalContainerEditCmd::onChangeCategory() { if (rBA.isUsableInCurrentContext()) { - pCB->addText( CI18N::get(rBA.LocalizedName) ); + pCB->addText(CI18N::get(rBA.LocalizedName).toUtf8()); } } } @@ -1130,11 +1130,10 @@ void CModalContainerEditCmd::onChangeAction() if (ActionsContext.matchContext(rVal.Contexts)) { - if ((rVal.LocalizedValue.size() >= 2) && - (rVal.LocalizedValue[0] == 'u') && (rVal.LocalizedValue[1] == 'i')) - pCB->addText(CI18N::get(rVal.LocalizedValue)); + if (NLMISC::startsWith(rVal.LocalizedValue, "ui")) + pCB->addText(CI18N::get(rVal.LocalizedValue).toUtf8()); else - pCB->addText(ucstring(rVal.LocalizedValue)); + pCB->addText(rVal.LocalizedValue); } } } diff --git a/ryzom/client/src/interface_v3/skill_manager.cpp b/ryzom/client/src/interface_v3/skill_manager.cpp index c2f242921..5e91f6f6e 100644 --- a/ryzom/client/src/interface_v3/skill_manager.cpp +++ b/ryzom/client/src/interface_v3/skill_manager.cpp @@ -1097,7 +1097,7 @@ public: string titleStr = CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)i); bool womenTitle = (UserEntity && UserEntity->getGender() == GSGENDER::female); const ucstring s(CStringManagerClient::getTitleLocalizedName(titleStr,womenTitle)); - pCB->addText(s); + pCB->addText(s.toUtf8()); pSM->_UIUnblockedTitles.push_back((CHARACTER_TITLE::ECharacterTitle)i); } } From d31eb606eb9e4c16b5a1d5a4a9a1b7201ae24497 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 15:52:55 +0800 Subject: [PATCH 061/205] Fix merge --- nel/src/gui/view_text.cpp | 317 +++++++++++------- .../src/interface_v3/action_handler_item.cpp | 12 +- 2 files changed, 205 insertions(+), 124 deletions(-) diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index 73e88d4f4..367a3182b 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -150,7 +150,7 @@ namespace NLGUI _Color = Color; _Shadow = Shadow; _ShadowOutline = ShadowOutline; - setText(Text); + setHardText(Text); computeFontSize (); CWidgetManager::getInstance()->registerInterfaceScaleWatcher(this); @@ -229,12 +229,12 @@ namespace NLGUI else if( name == "hardtext" ) { - return _Text.toString(); + return getHardText(); } else if( name == "hardtext_format" ) { - return _HardtextFormat; + return _HardTextFormat; } else return CViewBase::getProperty( name ); @@ -650,20 +650,38 @@ namespace NLGUI else if( name == "hardtext" ) { +#if 1 + if (NLMISC::startsWith(value, "ui")) + { + _Text = CI18N::get(value).toUtf8(); + _TextLength = 0; + _HardText = value; + } + else + { + _Text = value; + _TextLength = 0; + _HardText.clear(); + } +#else _Text = value; - setCase( _Text, _CaseMode ); + _TextLength = 0; + _HardText.clear(); + if (NLMISC::startsWith(value, "ui")) + _HardText = _Text; +#endif invalidateContent(); return true; } else if( name == "hardtext_format" ) { - _HardtextFormat = value; + _HardTextFormat = value; if( _MultiLine ) - setTextFormatTaged( _HardtextFormat ); + setTextFormatTaged( _HardTextFormat ); else - setSingleLineTextFormatTaged( _HardtextFormat ); + setSingleLineTextFormatTaged( _HardTextFormat ); return true; } @@ -764,11 +782,9 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "type", BAD_CAST "text" ); serializeTextOptions( node ); - - std::string hs = _Text.toString(); - xmlSetProp( node, BAD_CAST "hardtext", BAD_CAST hs.c_str() ); - xmlSetProp( node, BAD_CAST "hardtext_format", BAD_CAST _HardtextFormat.c_str() ); + xmlSetProp( node, BAD_CAST "hardtext", BAD_CAST _Text.c_str() ); + xmlSetProp( node, BAD_CAST "hardtext_format", BAD_CAST _HardTextFormat.c_str() ); return node; } @@ -962,7 +978,6 @@ namespace NLGUI bool CViewText::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { - // const ucstring* tmp; CXMLAutoPtr prop; //try to get props that can be inherited from groups //if a property is not defined, try to find it in the parent group. @@ -983,25 +998,34 @@ namespace NLGUI { const char *propPtr = prop; if (NLMISC::startsWith(propPtr, "ui")) - _Text = CI18N::get(propPtr); + { + _HardText = propPtr; + _Text = CI18N::get(propPtr).toUtf8(); + _TextLength = 0; + } else - _Text.fromUtf8(propPtr); + { + _HardText.clear(); + _Text = propPtr; + _TextLength = 0; + } setCase(_Text, _CaseMode); + _TextLength = 0; } prop = (char*) xmlGetProp( cur, (xmlChar*)"hardtext_format" ); if (prop) { const char *propPtr = prop; - _HardtextFormat = propPtr; + _HardTextFormat = propPtr; if (_MultiLine) { - setTextFormatTaged(CI18N::get(propPtr)); + setTextFormatTaged(CI18N::get(propPtr).toUtf8()); } else { - setSingleLineTextFormatTaged(CI18N::get(propPtr)); + setSingleLineTextFormatTaged(CI18N::get(propPtr).toUtf8()); } } @@ -1185,7 +1209,7 @@ namespace NLGUI CWord &currWord = currLine.getWord(k); charIndex += currWord.NumSpaces; sint cStart= max(charIndex, (sint)_TextSelectionStart); - sint cEnd= min(charIndex+(sint)currWord.Text.length(), (sint)_TextSelectionEnd); + sint cEnd= min(charIndex+(sint)currWord.Info.StringLength, (sint)_TextSelectionEnd); // range must be valid if(cStart easy cache test if (_FormatTags.empty() && _CaseMode==CaseNormal) { if (text != _Text) { _Text = text; + _TextLength = 0; // no need to call "setCase (_Text, _CaseMode);" since CaseNormal: invalidateContent (); } @@ -1406,22 +1438,24 @@ namespace NLGUI else { // if the view text had some format before, no choice, must recompute all - if(!_FormatTags.empty()) + if (!_FormatTags.empty()) { _Text = text; setCase (_Text, _CaseMode); + _TextLength = 0; invalidateContent (); } // else test if after the case change the cache succeed else { // compute the temp cased text - ucstring tempText= text; - setCase(tempText, _CaseMode); - if(tempText!=_Text) + std::string tempText = text; + setCase (tempText, _CaseMode); + if (tempText != _Text) { _Text = tempText; - invalidateContent (); + _TextLength = 0; + invalidateContent(); } } } @@ -1615,7 +1649,7 @@ namespace NLGUI } // *************************************************************************** - void CViewText::flushWordInLine(ucstring &ucCurrentWord, bool &linePushed, const CFormatInfo &wordFormat) + void CViewText::flushWordInLine(std::string &ucCurrentWord, bool &linePushed, const CFormatInfo &wordFormat) { NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(_FontName); // create a new line? @@ -1634,20 +1668,23 @@ namespace NLGUI // *************************************************************************** void CViewText::updateTextContextMultiLine(float nMaxWidth) { - ucchar ucLetter; + // ucchar ucLetter; UTextContext::CStringInfo si; - uint i; + uint i = 0; // word state - ucstring ucCurrentWord; + std::string ucCurrentWord; CFormatInfo wordFormat; // line state float rWidthCurrentLine = 0; bool linePushed= false; // for all the text - uint textSize= (uint)_Text.size(); + // uint textSize= (uint)_Text.size(); uint formatTagIndex= 0; nMaxWidth *= _Scale; - for (i = 0; i < textSize; ++i) + //for (i = 0; i < textSize; ++i) + CUtfStringView sv(_Text); + u32string ucStrLetter(1, ' '); + for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it, ++i) { if(isFormatTagChange(i, formatTagIndex)) { @@ -1666,8 +1703,7 @@ namespace NLGUI // Parse the letter { - ucLetter = _Text[i]; - if (ucLetter == ucchar('\n')) + if (*it == '\n') { flushWordInLine(ucCurrentWord, linePushed, wordFormat); // reset line state @@ -1676,8 +1712,7 @@ namespace NLGUI } else { - ucstring ucStrLetter; - ucStrLetter= ucLetter; + ucStrLetter[0] = *it; si = TextContext->getStringInfo (ucStrLetter); if ((rWidthCurrentLine + si.StringWidth) > nMaxWidth) { @@ -1686,12 +1721,13 @@ namespace NLGUI // reset line state, and begin with the cut letter linePushed= false; rWidthCurrentLine = si.StringWidth; - ucCurrentWord = ucLetter; + ucCurrentWord.clear(); + CUtfStringView::append(ucCurrentWord, *it); } else { // Grow the current word - ucCurrentWord += ucLetter; + CUtfStringView::append(ucCurrentWord, *it); rWidthCurrentLine += si.StringWidth; } } @@ -1715,7 +1751,7 @@ namespace NLGUI if (!currLine.empty()) { CFormatInfo lineWordFormat= currLine[0].Format; - ucstring lineWord; + std::string lineWord; for(uint i=0;i currLine; // if spaces are not expanded, all words of a line are inserted here (NB: index and stringInfo not filled) - ucstring wordValue; + std::string wordValue; CFormatInfo wordFormat; uint formatTagIndex= 0; // @@ -1775,7 +1809,7 @@ namespace NLGUI float newLineWidth = 0; breakLine = false; // - if (_Text[currPos] == (ucchar) '\n') + if (_Text[currPos] == '\n') { lineFeed = true; } @@ -1783,7 +1817,7 @@ namespace NLGUI { lineFeed = false; // Skip spaces and count them - spaceEnd = _Text.find_first_not_of(spaceStr, currPos); + spaceEnd = _Text.find_first_not_of(" ", currPos); if (spaceEnd == std::string::npos) { spaceEnd = _Text.length(); @@ -1899,7 +1933,7 @@ namespace NLGUI { uint maxNumSpaces = std::max(1U, (uint) (nMaxWidth / _SpaceWidth)); CWord spaceWord; // a word with only spaces in it - spaceWord.build (ucstring (""), *TextContext, maxNumSpaces); + spaceWord.build ("", *TextContext, maxNumSpaces); spaceWord.Format= wordFormat; _Lines.push_back(TLineSPtr(new CLine)); _Lines.back()->addWord(spaceWord, _FontWidth); @@ -1916,16 +1950,17 @@ namespace NLGUI else { float px = numSpaces * _SpaceWidth; - uint currChar = 0; - ucstring oneChar(" "); - for(currChar = 0; currChar < wordValue.length(); ++currChar) + u32string oneChar(1, ' '); + CUtfStringView wsv(wordValue); + CUtfStringView::iterator wit(wsv.begin()), wend(wsv.end()); + for (; wit != wend; ++wit) { - oneChar = wordValue[currChar]; + oneChar[0] = *wit; si = TextContext->getStringInfo(oneChar); if ((uint) (px + si.StringWidth) > nMaxWidth) break; px += si.StringWidth; } - currChar = std::max((uint) 1, currChar); // must fit at least one character otherwise there's an infinite loop + ptrdiff_t currChar = std::max((ptrdiff_t)1, (ptrdiff_t)wit.ptr() - (ptrdiff_t)wsv.ptr()); // must fit at least one character otherwise there's an infinite loop wordValue = _Text.substr(spaceEnd, currChar); CWord word; word.build(wordValue, *TextContext, numSpaces); @@ -2030,7 +2065,7 @@ namespace NLGUI } // if the text ends with \n, must insert the last line ourself - if (!_Text.empty() && _Text[_Text.length() - 1] == (ucchar) '\n') + if (!_Text.empty() && _Text[_Text.length() - 1] == '\n') { _Lines.push_back(TLineSPtr(new CLine)); } @@ -2143,9 +2178,9 @@ namespace NLGUI { TextContext->erase (_Index); - ucchar ucLetter; + // char ucLetter; UTextContext::CStringInfo si; - ucstring ucCurrentLine; + std::string ucCurrentLine; ucCurrentLine.reserve(_Text.size()); // Append ... to the end of line @@ -2162,11 +2197,11 @@ namespace NLGUI // for all the text if (_ClampRight) { - for (uint i = 0; i < _Text.size(); ++i) + CUtfStringView sv(_Text); + u32string ucStrLetter = u32string(1, (u32char)' '); + for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) { - ucLetter= _Text[i]; - ucstring ucStrLetter; - ucStrLetter= ucLetter; + ucStrLetter[0] = *it; si = TextContext->getStringInfo (ucStrLetter); if ((rWidthCurrentLine + si.StringWidth + dotWidth) > fLineMaxW) { @@ -2175,7 +2210,7 @@ namespace NLGUI else { // Grow the current line - ucCurrentLine += ucLetter; + CUtfStringView::append(ucCurrentLine, *it); rWidthCurrentLine += si.StringWidth; } } @@ -2188,11 +2223,12 @@ namespace NLGUI } else { - for (sint i = (sint)_Text.size() - 1; i >= 0; --i) + // FIXME: Optimize reverse UTF iteration + u32string uctext = CUtfStringView(_Text).toUtf32(); + u32string ucStrLetter = u32string(1, (u32char)' '); + for (sint i = (sint)uctext.size() - 1; i >= 0; --i) { - ucLetter= _Text[i]; - ucstring ucStrLetter; - ucStrLetter= ucLetter; + ucStrLetter[0] = uctext[i]; si = TextContext->getStringInfo (ucStrLetter); if ((rWidthCurrentLine + si.StringWidth + dotWidth) > fLineMaxW) { @@ -2201,7 +2237,9 @@ namespace NLGUI else { // Grow the current line - ucCurrentLine = ucLetter + ucCurrentLine; + std::string tmp; + CUtfStringView::append(tmp, uctext[i]); + ucCurrentLine = tmp + ucCurrentLine; rWidthCurrentLine += si.StringWidth; } } @@ -2300,7 +2338,8 @@ namespace NLGUI } charIndex = newCharIndex; } - return (sint)_Lines.size() - 1; + // return (sint)_Lines.size() - 1; + return -1; } else { @@ -2344,16 +2383,36 @@ namespace NLGUI endOfPreviousLine = !_Lines[line]->getLF(); } + // *************************************************************************** + void CViewText::setHardTextAsUtf16(const ucstring &ht) + { + setHardText(ht.toUtf8()); + } + // *************************************************************************** void CViewText::setHardText (const std::string &ht) { - // ucstring Text = ucstring(ht); - ucstring Text; - if ((ht.size()>2) && (ht[0] == 'u') && (ht[1] == 'i')) - Text = CI18N::get (ht); + if (NLMISC::startsWith(ht, "ui")) + { + setText(CI18N::get(ht).toUtf8()); + _HardText = ht; + } else - Text.fromUtf8(ht); - setText(Text); + { + setText(ht); + } + } + + // *************************************************************************** + ucstring CViewText::getTextAsUtf16() const + { + return CUtfStringView(getText()).toUtf16(); + } + + // *************************************************************************** + ucstring CViewText::getHardTextAsUtf16() const + { + return CUtfStringView(getHardText()).toUtf16(); } // *************************************************************************** @@ -2383,7 +2442,9 @@ namespace NLGUI // *************************************************************************** void CViewText::getCharacterPositionFromIndex(sint index, bool cursorAtPreviousLineEnd, float &x, float &y, float &height) const { - NLMISC::clamp(index, 0, (sint) _Text.length()); + if (!_TextLength && _Text.size()) + _TextLength = CUtfStringView(_Text).count(); + NLMISC::clamp(index, 0, (sint)_TextLength); NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(_FontName); TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setShaded (_Shadow); @@ -2401,7 +2462,7 @@ namespace NLGUI uint charIndex = 0; // special case for end of text - if (index == (sint) _Text.length()) + if (index >= (sint)_TextLength) { fy = dy; if (_Lines.empty()) @@ -2456,7 +2517,7 @@ namespace NLGUI for(uint k = 0; k < currLine.getNumWords(); ++k) { CWord &currWord = currLine.getWord(k); - if ((sint) (charIndex + currWord.NumSpaces + currWord.Text.length()) >= index) + if ((sint) (charIndex + currWord.NumSpaces + currWord.Info.StringLength) >= index) { // character is in currWord or the in spaces preceding it // check if the character is in the word @@ -2481,7 +2542,7 @@ namespace NLGUI return; } } - charIndex += (uint)currWord.Text.length() + currWord.NumSpaces; + charIndex += (uint)currWord.Info.StringLength + currWord.NumSpaces; px += currWord.NumSpaces * currLine.getSpaceWidth() + currWord.Info.StringWidth; } } @@ -2501,7 +2562,7 @@ namespace NLGUI // *************************************************************************** // Tool fct : From a word and a x coordinate (font scale), give the matching character index - static uint getCharacterIndex(const ucstring &textValue, float x, NL3D::UTextContext &textContext) + static uint getCharacterIndex(const std::string &textValue, float x, NL3D::UTextContext &textContext) { float px = 0.f; @@ -2532,6 +2593,9 @@ namespace NLGUI { NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(_FontName); + if (!_TextLength && _Text.size()) + _TextLength = CUtfStringView(_Text).count(); + x *= _Scale; y = roundf(y * _Scale); @@ -2552,7 +2616,7 @@ namespace NLGUI float py = 0.f; if (py > y) { - index = (uint)_Text.length(); + index = (uint)_TextLength; cursorAtPreviousLineEnd = false; return; } @@ -2619,7 +2683,7 @@ namespace NLGUI } } px = newPx; - charPos += (uint)currWord.Text.length() + currWord.NumSpaces; + charPos += (uint)currWord.Info.StringLength + currWord.NumSpaces; } index = charPos; return; @@ -2629,7 +2693,7 @@ namespace NLGUI cursorAtPreviousLineEnd = false; if (y < 0) { - index = (uint)_Text.length(); + index = (uint)_TextLength; return; } if (y > (sint) _FontHeight) @@ -2659,23 +2723,25 @@ namespace NLGUI } // *************************************************************************** - void CViewText::setStringSelectionSkipingSpace(uint stringId, const ucstring &text, sint charStart, sint charEnd) + void CViewText::setStringSelectionSkipingSpace(uint stringId, const std::string &text, sint charStart, sint charEnd) { sint quadStart= charStart; sint quadSize= charEnd-charStart; sint j; - for(j=0;jsetStringSelection(stringId, quadStart, quadSize); + CViewRenderer::getTextContext(_FontName)->setStringSelection(stringId, quadStart, quadSize); // FIXME: This assumes spaces are the only empty glyphs! } // *************************************************************************** @@ -2738,7 +2804,7 @@ namespace NLGUI } // *************************************************************************** - void CViewText::CLine::addWord(const ucstring &text, uint numSpaces, const CFormatInfo &wordFormat, float fontWidth, NL3D::UTextContext &textContext) + void CViewText::CLine::addWord(const std::string &text, uint numSpaces, const CFormatInfo &wordFormat, float fontWidth, NL3D::UTextContext &textContext) { CWord word; word.build(text, textContext, numSpaces); @@ -2750,7 +2816,7 @@ namespace NLGUI void CViewText::CLine::addWord(const CWord &word, float fontWidth) { _Words.push_back(word); - _NumChars += word.NumSpaces + uint(word.Text.length()); + _NumChars += word.NumSpaces + uint(word.Info.StringLength); _NumSpaces += word.NumSpaces; if (fabsf(word.Info.StringLine) > fabsf(_StringLine)) { @@ -2785,12 +2851,13 @@ namespace NLGUI } // *************************************************************************** - void CViewText::CWord::build(const ucstring &text, NL3D::UTextContext &textContext, uint numSpaces) + void CViewText::CWord::build(const std::string &text, NL3D::UTextContext &textContext, uint numSpaces) { Text = text; NumSpaces = numSpaces; Index = textContext.textPush(text); Info = textContext.getStringInfo(Index); + nlassert(Info.StringLength == CUtfStringView(text).count()); } // *************************************************************************** @@ -2807,8 +2874,8 @@ namespace NLGUI // *************************************************************************** sint32 CViewText::getMaxUsedW() const { - static const ucstring spaceStr(" \t"); - static const ucstring lineFeedStr("\n"); + static const char *spaceStr(" \t"); + static const char *lineFeedStr("\n"); float maxWidth = 0; NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(_FontName); @@ -2825,13 +2892,13 @@ namespace NLGUI // Get the end of the line float lineWidth = 0; TCharPos lineEnd; - lineEnd = _Text.find_first_of(lineFeedStr, linePos); + lineEnd = _Text.find_first_of("\n", linePos); if (lineEnd == std::string::npos) { lineEnd = _Text.length(); } - ucstring lineValue; + std::string lineValue; lineValue = _Text.substr(linePos, lineEnd - linePos); TCharPos currPos = 0; @@ -2856,7 +2923,7 @@ namespace NLGUI wordEnd = lineValue.length(); } - ucstring wordValue; + std::string wordValue; wordValue = lineValue.substr(spaceEnd, wordEnd - spaceEnd); // compute width of word @@ -2882,7 +2949,7 @@ namespace NLGUI // *************************************************************************** sint32 CViewText::getMinUsedW() const { - static const ucstring spaceOrLineFeedStr(" \n\t"); + static const char *spaceOrLineFeedStr(" \n\t"); float maxWidth = 0.0f; // Not multi line ? Same size than min @@ -2911,7 +2978,7 @@ namespace NLGUI while (currPos < _Text.length()) { // Current word - ucstring wordValue; + std::string wordValue; UTextContext::CStringInfo si; TCharPos wordEnd; @@ -2988,17 +3055,17 @@ namespace NLGUI _FontLegHeight = si.StringLine; // Space width - si = TextContext->getStringInfo(ucstring(" ")); + si = TextContext->getStringInfo(" "); _SpaceWidth = si.StringWidth; // Font Width (used for ) - si = TextContext->getStringInfo(ucstring("_")); + si = TextContext->getStringInfo("_"); _FontWidth = si.StringWidth; } // *************************************************************************** - static inline bool isColorTag(const ucstring &s, uint index, uint textSize) + static inline bool isColorTag(const std::string &s, uint index, uint textSize) { // Format is @{RGBA} if(s[index]=='@') @@ -3022,7 +3089,7 @@ namespace NLGUI // *************************************************************************** // isColorTag must be ok. - static inline CRGBA getColorTag(const ucstring &s, uint &index) + static inline CRGBA getColorTag(const std::string &s, uint &index) { // extract the color string: "FABC" char tmpCol[5]; @@ -3049,7 +3116,7 @@ namespace NLGUI // *************************************************************************** const uint MaxTabDigit= 3; - static inline bool isTabTag(const ucstring &s, uint index, uint textSize) + static inline bool isTabTag(const std::string &s, uint index, uint textSize) { // Format is @{Tvalue}, where value ,1,2,3 digit. if(s[index]=='@') @@ -3075,7 +3142,7 @@ namespace NLGUI // *************************************************************************** // isTabTag must be ok. - static inline sint getTabTag(const ucstring &s, uint &index) + static inline sint getTabTag(const std::string &s, uint &index) { // extract the tab min X value char tmpTab[MaxTabDigit+1]; @@ -3098,7 +3165,7 @@ namespace NLGUI // *************************************************************************** - static inline bool isTooltipTag(const ucstring &s, uint index, uint textSize) + static inline bool isTooltipTag(const std::string &s, uint index, uint textSize) { // Format is @{Huitt*} if(s[index]=='@') @@ -3122,9 +3189,9 @@ namespace NLGUI // *************************************************************************** // isTooltipTag must be ok. - static inline ucstring getTooltipTag(const ucstring &s, uint &index) + static inline std::string getTooltipTag(const std::string &s, uint &index) { - ucstring result; + std::string result; uint i = 3; while (s[index+i] != '}') { @@ -3140,7 +3207,7 @@ namespace NLGUI // *************************************************************************** - void CViewText::buildFormatTagText(const ucstring &text, ucstring &textBuild, std::vector &formatTags, std::vector &tooltips) + void CViewText::buildFormatTagText(const std::string &text, std::string &textBuild, std::vector &formatTags, std::vector &tooltips) { formatTags.clear(); tooltips.clear(); @@ -3213,15 +3280,20 @@ namespace NLGUI } } + // *************************************************************************** + void CViewText::setTextFormatTagedAsUtf16(const ucstring &text) + { + setTextFormatTaged(text.toUtf8()); + } // *************************************************************************** - void CViewText::setTextFormatTaged(const ucstring &text) + void CViewText::setTextFormatTaged(const std::string &text) { if( text.empty() ) return; // to allow cache (avoid infinite recurse in updateCoords() in some case), compute in temp - ucstring tempText; + std::string tempText; // static to avoid reallocation static std::vector tempFormatTags; static std::vector tempTooltips; @@ -3250,7 +3322,8 @@ namespace NLGUI _FormatTags= tempFormatTags; // Copy to Text (preserve Memory) contReset(_Text); - _Text= tempText; + _Text = tempText; + _TextLength = 0; CInterfaceGroup *parent = getParent(); @@ -3271,8 +3344,9 @@ namespace NLGUI pTooltip->setId(_Id+"_tt"+toString(i)); pTooltip->setAvoidResizeParent(avoidResizeParent()); pTooltip->setRenderLayer(getRenderLayer()); - bool isI18N = tempTooltips[i].size() >= 2 && tempTooltips[i][0] == 'u' && tempTooltips[i][1] == 'i'; - pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltips[i].toString()) : tempTooltips[i]); + std::string tempTooltipStr = tempTooltips[i].toUtf8(); + bool isI18N = NLMISC::startsWith(tempTooltipStr, "ui"); + pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltipStr) : ucstring::makeFromUtf8(tempTooltipStr)); pTooltip->setParentPos(this); pTooltip->setParentPosRef(Hotspot_BR); pTooltip->setPosRef(Hotspot_BR); @@ -3300,17 +3374,21 @@ namespace NLGUI // color format is available only if multilined if (!_MultiLine) - nlwarning( toString("ViewText isn't multilined : uc_hardtext_format will not act as wanted !\n%s", text.toString().c_str()).c_str() ); + nlwarning("ViewText isn't multilined : uc_hardtext_format will not act as wanted !\n%s", text.c_str()); } + void CViewText::setSingleLineTextFormatTagedAsUtf16(const ucstring &text) + { + setSingleLineTextFormatTaged(text.toUtf8()); + } - void CViewText::setSingleLineTextFormatTaged(const ucstring &text) + void CViewText::setSingleLineTextFormatTaged(const std::string &text) { if( text.empty() ) return; // to allow cache (avoid infinite recurse in updateCoords() in some case), compute in temp - ucstring tempText; + std::string tempText; static std::vector tempLetterColors; static std::vector tempTooltips; @@ -3354,13 +3432,14 @@ namespace NLGUI // Copy to Text (preserve Memory) contReset(_Text); - _Text= tempText; + _Text = tempText; + _TextLength = 0; invalidateContent (); } // this color format is available only if not multilined if (_MultiLine) - nlwarning( toString("ViewText is multilined : uc_hardtext_single_line_format will not act as wanted !\n%s", text.toString().c_str()).c_str() ); + nlwarning("ViewText is multilined : uc_hardtext_single_line_format will not act as wanted !\n%s", text.c_str()); } @@ -3395,6 +3474,7 @@ namespace NLGUI { _CaseMode = caseMode; setCase (_Text, _CaseMode); + _TextLength = 0; } // *************************************************************************** @@ -3467,21 +3547,22 @@ namespace NLGUI { if (_MultiLine) { - setTextFormatTaged(text); + setTextFormatTaged(text.toUtf8()); } else { - setSingleLineTextFormatTaged(text); + setSingleLineTextFormatTaged(text.toUtf8()); } } else { - setText(text); + setText(text.toUtf8()); } } else { - f.serial(_Text); + ucstring text = CUtfStringView(_Text).toUtf16(); + f.serial(text); } #undef SERIAL_UINT diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 99b9c290c..2d6a7e6f5 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -160,7 +160,7 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() else { if (itemInfo.CustomText.empty()) - display->setTextFormatTaged(ucstring(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id))); + display->setTextFormatTaged(CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)).toUtf8()); else { ucstring text = itemInfo.CustomText; @@ -176,7 +176,7 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() text = text.substr(delimiter, text.size()-delimiter); } - display->setTextFormatTaged(text); + display->setTextFormatTaged(text.toUtf8()); } } } @@ -233,7 +233,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() editBoxShort->setInputString(std::string()); editBoxLarge->setInputString(std::string()); - display->setTextFormatTaged(ucstring()); + display->setTextFormatTaged(std::string()); // Finish the display or add the waiter @@ -291,14 +291,14 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() editBoxShort->setInputString(std::string()); editBoxLarge->setInputString(std::string()); - display->setTextFormatTaged(ucstring()); + display->setTextFormatTaged(std::string()); // Finish the display or add the waiter if (getInventory().isItemInfoUpToDate(ItemSlotId)) { // If we already have item info if (itemInfo.CustomText.empty()) - display->setTextFormatTaged(ucstring(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id))); + display->setTextFormatTaged(CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)).toUtf8()); else { ucstring text = itemInfo.CustomText; @@ -313,7 +313,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() else text = text.substr(delimiter, text.size()-delimiter); } - display->setTextFormatTaged(text); + display->setTextFormatTaged(text.toUtf8()); } } else From 54337b757bfa415bbf83d23a690e651a01456f37 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 15:55:42 +0800 Subject: [PATCH 062/205] Fix merge --- nel/src/gui/view_text.cpp | 320 +++++++++++------- .../src/interface_v3/action_handler_item.cpp | 167 ++------- 2 files changed, 223 insertions(+), 264 deletions(-) diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index 7376cd39a..367a3182b 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -150,7 +150,7 @@ namespace NLGUI _Color = Color; _Shadow = Shadow; _ShadowOutline = ShadowOutline; - setText(Text); + setHardText(Text); computeFontSize (); CWidgetManager::getInstance()->registerInterfaceScaleWatcher(this); @@ -229,12 +229,12 @@ namespace NLGUI else if( name == "hardtext" ) { - return _Text.toString(); + return getHardText(); } else if( name == "hardtext_format" ) { - return _HardtextFormat; + return _HardTextFormat; } else return CViewBase::getProperty( name ); @@ -650,20 +650,38 @@ namespace NLGUI else if( name == "hardtext" ) { +#if 1 + if (NLMISC::startsWith(value, "ui")) + { + _Text = CI18N::get(value).toUtf8(); + _TextLength = 0; + _HardText = value; + } + else + { + _Text = value; + _TextLength = 0; + _HardText.clear(); + } +#else _Text = value; - setCase( _Text, _CaseMode ); + _TextLength = 0; + _HardText.clear(); + if (NLMISC::startsWith(value, "ui")) + _HardText = _Text; +#endif invalidateContent(); return true; } else if( name == "hardtext_format" ) { - _HardtextFormat = value; + _HardTextFormat = value; if( _MultiLine ) - setTextFormatTaged( _HardtextFormat ); + setTextFormatTaged( _HardTextFormat ); else - setSingleLineTextFormatTaged( _HardtextFormat ); + setSingleLineTextFormatTaged( _HardTextFormat ); return true; } @@ -764,11 +782,9 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "type", BAD_CAST "text" ); serializeTextOptions( node ); - - std::string hs = _Text.toString(); - xmlSetProp( node, BAD_CAST "hardtext", BAD_CAST hs.c_str() ); - xmlSetProp( node, BAD_CAST "hardtext_format", BAD_CAST _HardtextFormat.c_str() ); + xmlSetProp( node, BAD_CAST "hardtext", BAD_CAST _Text.c_str() ); + xmlSetProp( node, BAD_CAST "hardtext_format", BAD_CAST _HardTextFormat.c_str() ); return node; } @@ -962,7 +978,6 @@ namespace NLGUI bool CViewText::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { - // const ucstring* tmp; CXMLAutoPtr prop; //try to get props that can be inherited from groups //if a property is not defined, try to find it in the parent group. @@ -983,28 +998,34 @@ namespace NLGUI { const char *propPtr = prop; if (NLMISC::startsWith(propPtr, "ui")) - _Text = CI18N::get(propPtr); + { + _HardText = propPtr; + _Text = CI18N::get(propPtr).toUtf8(); + _TextLength = 0; + } else - _Text.fromUtf8(propPtr); + { + _HardText.clear(); + _Text = propPtr; + _TextLength = 0; + } setCase(_Text, _CaseMode); + _TextLength = 0; } prop = (char*) xmlGetProp( cur, (xmlChar*)"hardtext_format" ); if (prop) { const char *propPtr = prop; - _HardtextFormat = propPtr; + _HardTextFormat = propPtr; if (_MultiLine) { - if (strlen(propPtr) > 2 && propPtr[0] == 'u' && propPtr[1] == ':') - setTextFormatTaged(ucstring::makeFromUtf8(std::string(propPtr).substr(2))); - else - setTextFormatTaged(CI18N::get(propPtr)); + setTextFormatTaged(CI18N::get(propPtr).toUtf8()); } else { - setSingleLineTextFormatTaged(CI18N::get(propPtr)); + setSingleLineTextFormatTaged(CI18N::get(propPtr).toUtf8()); } } @@ -1188,7 +1209,7 @@ namespace NLGUI CWord &currWord = currLine.getWord(k); charIndex += currWord.NumSpaces; sint cStart= max(charIndex, (sint)_TextSelectionStart); - sint cEnd= min(charIndex+(sint)currWord.Text.length(), (sint)_TextSelectionEnd); + sint cEnd= min(charIndex+(sint)currWord.Info.StringLength, (sint)_TextSelectionEnd); // range must be valid if(cStart easy cache test if (_FormatTags.empty() && _CaseMode==CaseNormal) { if (text != _Text) { _Text = text; + _TextLength = 0; // no need to call "setCase (_Text, _CaseMode);" since CaseNormal: invalidateContent (); } @@ -1409,22 +1438,24 @@ namespace NLGUI else { // if the view text had some format before, no choice, must recompute all - if(!_FormatTags.empty()) + if (!_FormatTags.empty()) { _Text = text; setCase (_Text, _CaseMode); + _TextLength = 0; invalidateContent (); } // else test if after the case change the cache succeed else { // compute the temp cased text - ucstring tempText= text; - setCase(tempText, _CaseMode); - if(tempText!=_Text) + std::string tempText = text; + setCase (tempText, _CaseMode); + if (tempText != _Text) { _Text = tempText; - invalidateContent (); + _TextLength = 0; + invalidateContent(); } } } @@ -1618,7 +1649,7 @@ namespace NLGUI } // *************************************************************************** - void CViewText::flushWordInLine(ucstring &ucCurrentWord, bool &linePushed, const CFormatInfo &wordFormat) + void CViewText::flushWordInLine(std::string &ucCurrentWord, bool &linePushed, const CFormatInfo &wordFormat) { NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(_FontName); // create a new line? @@ -1637,20 +1668,23 @@ namespace NLGUI // *************************************************************************** void CViewText::updateTextContextMultiLine(float nMaxWidth) { - ucchar ucLetter; + // ucchar ucLetter; UTextContext::CStringInfo si; - uint i; + uint i = 0; // word state - ucstring ucCurrentWord; + std::string ucCurrentWord; CFormatInfo wordFormat; // line state float rWidthCurrentLine = 0; bool linePushed= false; // for all the text - uint textSize= (uint)_Text.size(); + // uint textSize= (uint)_Text.size(); uint formatTagIndex= 0; nMaxWidth *= _Scale; - for (i = 0; i < textSize; ++i) + //for (i = 0; i < textSize; ++i) + CUtfStringView sv(_Text); + u32string ucStrLetter(1, ' '); + for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it, ++i) { if(isFormatTagChange(i, formatTagIndex)) { @@ -1669,8 +1703,7 @@ namespace NLGUI // Parse the letter { - ucLetter = _Text[i]; - if (ucLetter == ucchar('\n')) + if (*it == '\n') { flushWordInLine(ucCurrentWord, linePushed, wordFormat); // reset line state @@ -1679,8 +1712,7 @@ namespace NLGUI } else { - ucstring ucStrLetter; - ucStrLetter= ucLetter; + ucStrLetter[0] = *it; si = TextContext->getStringInfo (ucStrLetter); if ((rWidthCurrentLine + si.StringWidth) > nMaxWidth) { @@ -1689,12 +1721,13 @@ namespace NLGUI // reset line state, and begin with the cut letter linePushed= false; rWidthCurrentLine = si.StringWidth; - ucCurrentWord = ucLetter; + ucCurrentWord.clear(); + CUtfStringView::append(ucCurrentWord, *it); } else { // Grow the current word - ucCurrentWord += ucLetter; + CUtfStringView::append(ucCurrentWord, *it); rWidthCurrentLine += si.StringWidth; } } @@ -1718,7 +1751,7 @@ namespace NLGUI if (!currLine.empty()) { CFormatInfo lineWordFormat= currLine[0].Format; - ucstring lineWord; + std::string lineWord; for(uint i=0;i currLine; // if spaces are not expanded, all words of a line are inserted here (NB: index and stringInfo not filled) - ucstring wordValue; + std::string wordValue; CFormatInfo wordFormat; uint formatTagIndex= 0; // @@ -1778,7 +1809,7 @@ namespace NLGUI float newLineWidth = 0; breakLine = false; // - if (_Text[currPos] == (ucchar) '\n') + if (_Text[currPos] == '\n') { lineFeed = true; } @@ -1786,7 +1817,7 @@ namespace NLGUI { lineFeed = false; // Skip spaces and count them - spaceEnd = _Text.find_first_not_of(spaceStr, currPos); + spaceEnd = _Text.find_first_not_of(" ", currPos); if (spaceEnd == std::string::npos) { spaceEnd = _Text.length(); @@ -1902,7 +1933,7 @@ namespace NLGUI { uint maxNumSpaces = std::max(1U, (uint) (nMaxWidth / _SpaceWidth)); CWord spaceWord; // a word with only spaces in it - spaceWord.build (ucstring (""), *TextContext, maxNumSpaces); + spaceWord.build ("", *TextContext, maxNumSpaces); spaceWord.Format= wordFormat; _Lines.push_back(TLineSPtr(new CLine)); _Lines.back()->addWord(spaceWord, _FontWidth); @@ -1919,16 +1950,17 @@ namespace NLGUI else { float px = numSpaces * _SpaceWidth; - uint currChar = 0; - ucstring oneChar(" "); - for(currChar = 0; currChar < wordValue.length(); ++currChar) + u32string oneChar(1, ' '); + CUtfStringView wsv(wordValue); + CUtfStringView::iterator wit(wsv.begin()), wend(wsv.end()); + for (; wit != wend; ++wit) { - oneChar = wordValue[currChar]; + oneChar[0] = *wit; si = TextContext->getStringInfo(oneChar); if ((uint) (px + si.StringWidth) > nMaxWidth) break; px += si.StringWidth; } - currChar = std::max((uint) 1, currChar); // must fit at least one character otherwise there's an infinite loop + ptrdiff_t currChar = std::max((ptrdiff_t)1, (ptrdiff_t)wit.ptr() - (ptrdiff_t)wsv.ptr()); // must fit at least one character otherwise there's an infinite loop wordValue = _Text.substr(spaceEnd, currChar); CWord word; word.build(wordValue, *TextContext, numSpaces); @@ -2033,7 +2065,7 @@ namespace NLGUI } // if the text ends with \n, must insert the last line ourself - if (!_Text.empty() && _Text[_Text.length() - 1] == (ucchar) '\n') + if (!_Text.empty() && _Text[_Text.length() - 1] == '\n') { _Lines.push_back(TLineSPtr(new CLine)); } @@ -2146,9 +2178,9 @@ namespace NLGUI { TextContext->erase (_Index); - ucchar ucLetter; + // char ucLetter; UTextContext::CStringInfo si; - ucstring ucCurrentLine; + std::string ucCurrentLine; ucCurrentLine.reserve(_Text.size()); // Append ... to the end of line @@ -2165,11 +2197,11 @@ namespace NLGUI // for all the text if (_ClampRight) { - for (uint i = 0; i < _Text.size(); ++i) + CUtfStringView sv(_Text); + u32string ucStrLetter = u32string(1, (u32char)' '); + for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) { - ucLetter= _Text[i]; - ucstring ucStrLetter; - ucStrLetter= ucLetter; + ucStrLetter[0] = *it; si = TextContext->getStringInfo (ucStrLetter); if ((rWidthCurrentLine + si.StringWidth + dotWidth) > fLineMaxW) { @@ -2178,7 +2210,7 @@ namespace NLGUI else { // Grow the current line - ucCurrentLine += ucLetter; + CUtfStringView::append(ucCurrentLine, *it); rWidthCurrentLine += si.StringWidth; } } @@ -2191,11 +2223,12 @@ namespace NLGUI } else { - for (sint i = (sint)_Text.size() - 1; i >= 0; --i) + // FIXME: Optimize reverse UTF iteration + u32string uctext = CUtfStringView(_Text).toUtf32(); + u32string ucStrLetter = u32string(1, (u32char)' '); + for (sint i = (sint)uctext.size() - 1; i >= 0; --i) { - ucLetter= _Text[i]; - ucstring ucStrLetter; - ucStrLetter= ucLetter; + ucStrLetter[0] = uctext[i]; si = TextContext->getStringInfo (ucStrLetter); if ((rWidthCurrentLine + si.StringWidth + dotWidth) > fLineMaxW) { @@ -2204,7 +2237,9 @@ namespace NLGUI else { // Grow the current line - ucCurrentLine = ucLetter + ucCurrentLine; + std::string tmp; + CUtfStringView::append(tmp, uctext[i]); + ucCurrentLine = tmp + ucCurrentLine; rWidthCurrentLine += si.StringWidth; } } @@ -2303,7 +2338,8 @@ namespace NLGUI } charIndex = newCharIndex; } - return (sint)_Lines.size() - 1; + // return (sint)_Lines.size() - 1; + return -1; } else { @@ -2347,16 +2383,36 @@ namespace NLGUI endOfPreviousLine = !_Lines[line]->getLF(); } + // *************************************************************************** + void CViewText::setHardTextAsUtf16(const ucstring &ht) + { + setHardText(ht.toUtf8()); + } + // *************************************************************************** void CViewText::setHardText (const std::string &ht) { - // ucstring Text = ucstring(ht); - ucstring Text; - if ((ht.size()>2) && (ht[0] == 'u') && (ht[1] == 'i')) - Text = CI18N::get (ht); + if (NLMISC::startsWith(ht, "ui")) + { + setText(CI18N::get(ht).toUtf8()); + _HardText = ht; + } else - Text.fromUtf8(ht); - setText(Text); + { + setText(ht); + } + } + + // *************************************************************************** + ucstring CViewText::getTextAsUtf16() const + { + return CUtfStringView(getText()).toUtf16(); + } + + // *************************************************************************** + ucstring CViewText::getHardTextAsUtf16() const + { + return CUtfStringView(getHardText()).toUtf16(); } // *************************************************************************** @@ -2386,7 +2442,9 @@ namespace NLGUI // *************************************************************************** void CViewText::getCharacterPositionFromIndex(sint index, bool cursorAtPreviousLineEnd, float &x, float &y, float &height) const { - NLMISC::clamp(index, 0, (sint) _Text.length()); + if (!_TextLength && _Text.size()) + _TextLength = CUtfStringView(_Text).count(); + NLMISC::clamp(index, 0, (sint)_TextLength); NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(_FontName); TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setShaded (_Shadow); @@ -2404,7 +2462,7 @@ namespace NLGUI uint charIndex = 0; // special case for end of text - if (index == (sint) _Text.length()) + if (index >= (sint)_TextLength) { fy = dy; if (_Lines.empty()) @@ -2459,7 +2517,7 @@ namespace NLGUI for(uint k = 0; k < currLine.getNumWords(); ++k) { CWord &currWord = currLine.getWord(k); - if ((sint) (charIndex + currWord.NumSpaces + currWord.Text.length()) >= index) + if ((sint) (charIndex + currWord.NumSpaces + currWord.Info.StringLength) >= index) { // character is in currWord or the in spaces preceding it // check if the character is in the word @@ -2484,7 +2542,7 @@ namespace NLGUI return; } } - charIndex += (uint)currWord.Text.length() + currWord.NumSpaces; + charIndex += (uint)currWord.Info.StringLength + currWord.NumSpaces; px += currWord.NumSpaces * currLine.getSpaceWidth() + currWord.Info.StringWidth; } } @@ -2504,7 +2562,7 @@ namespace NLGUI // *************************************************************************** // Tool fct : From a word and a x coordinate (font scale), give the matching character index - static uint getCharacterIndex(const ucstring &textValue, float x, NL3D::UTextContext &textContext) + static uint getCharacterIndex(const std::string &textValue, float x, NL3D::UTextContext &textContext) { float px = 0.f; @@ -2535,6 +2593,9 @@ namespace NLGUI { NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(_FontName); + if (!_TextLength && _Text.size()) + _TextLength = CUtfStringView(_Text).count(); + x *= _Scale; y = roundf(y * _Scale); @@ -2555,7 +2616,7 @@ namespace NLGUI float py = 0.f; if (py > y) { - index = (uint)_Text.length(); + index = (uint)_TextLength; cursorAtPreviousLineEnd = false; return; } @@ -2622,7 +2683,7 @@ namespace NLGUI } } px = newPx; - charPos += (uint)currWord.Text.length() + currWord.NumSpaces; + charPos += (uint)currWord.Info.StringLength + currWord.NumSpaces; } index = charPos; return; @@ -2632,7 +2693,7 @@ namespace NLGUI cursorAtPreviousLineEnd = false; if (y < 0) { - index = (uint)_Text.length(); + index = (uint)_TextLength; return; } if (y > (sint) _FontHeight) @@ -2662,23 +2723,25 @@ namespace NLGUI } // *************************************************************************** - void CViewText::setStringSelectionSkipingSpace(uint stringId, const ucstring &text, sint charStart, sint charEnd) + void CViewText::setStringSelectionSkipingSpace(uint stringId, const std::string &text, sint charStart, sint charEnd) { sint quadStart= charStart; sint quadSize= charEnd-charStart; sint j; - for(j=0;jsetStringSelection(stringId, quadStart, quadSize); + CViewRenderer::getTextContext(_FontName)->setStringSelection(stringId, quadStart, quadSize); // FIXME: This assumes spaces are the only empty glyphs! } // *************************************************************************** @@ -2741,7 +2804,7 @@ namespace NLGUI } // *************************************************************************** - void CViewText::CLine::addWord(const ucstring &text, uint numSpaces, const CFormatInfo &wordFormat, float fontWidth, NL3D::UTextContext &textContext) + void CViewText::CLine::addWord(const std::string &text, uint numSpaces, const CFormatInfo &wordFormat, float fontWidth, NL3D::UTextContext &textContext) { CWord word; word.build(text, textContext, numSpaces); @@ -2753,7 +2816,7 @@ namespace NLGUI void CViewText::CLine::addWord(const CWord &word, float fontWidth) { _Words.push_back(word); - _NumChars += word.NumSpaces + uint(word.Text.length()); + _NumChars += word.NumSpaces + uint(word.Info.StringLength); _NumSpaces += word.NumSpaces; if (fabsf(word.Info.StringLine) > fabsf(_StringLine)) { @@ -2788,12 +2851,13 @@ namespace NLGUI } // *************************************************************************** - void CViewText::CWord::build(const ucstring &text, NL3D::UTextContext &textContext, uint numSpaces) + void CViewText::CWord::build(const std::string &text, NL3D::UTextContext &textContext, uint numSpaces) { Text = text; NumSpaces = numSpaces; Index = textContext.textPush(text); Info = textContext.getStringInfo(Index); + nlassert(Info.StringLength == CUtfStringView(text).count()); } // *************************************************************************** @@ -2810,8 +2874,8 @@ namespace NLGUI // *************************************************************************** sint32 CViewText::getMaxUsedW() const { - static const ucstring spaceStr(" \t"); - static const ucstring lineFeedStr("\n"); + static const char *spaceStr(" \t"); + static const char *lineFeedStr("\n"); float maxWidth = 0; NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(_FontName); @@ -2828,13 +2892,13 @@ namespace NLGUI // Get the end of the line float lineWidth = 0; TCharPos lineEnd; - lineEnd = _Text.find_first_of(lineFeedStr, linePos); + lineEnd = _Text.find_first_of("\n", linePos); if (lineEnd == std::string::npos) { lineEnd = _Text.length(); } - ucstring lineValue; + std::string lineValue; lineValue = _Text.substr(linePos, lineEnd - linePos); TCharPos currPos = 0; @@ -2859,7 +2923,7 @@ namespace NLGUI wordEnd = lineValue.length(); } - ucstring wordValue; + std::string wordValue; wordValue = lineValue.substr(spaceEnd, wordEnd - spaceEnd); // compute width of word @@ -2885,7 +2949,7 @@ namespace NLGUI // *************************************************************************** sint32 CViewText::getMinUsedW() const { - static const ucstring spaceOrLineFeedStr(" \n\t"); + static const char *spaceOrLineFeedStr(" \n\t"); float maxWidth = 0.0f; // Not multi line ? Same size than min @@ -2914,7 +2978,7 @@ namespace NLGUI while (currPos < _Text.length()) { // Current word - ucstring wordValue; + std::string wordValue; UTextContext::CStringInfo si; TCharPos wordEnd; @@ -2991,17 +3055,17 @@ namespace NLGUI _FontLegHeight = si.StringLine; // Space width - si = TextContext->getStringInfo(ucstring(" ")); + si = TextContext->getStringInfo(" "); _SpaceWidth = si.StringWidth; // Font Width (used for ) - si = TextContext->getStringInfo(ucstring("_")); + si = TextContext->getStringInfo("_"); _FontWidth = si.StringWidth; } // *************************************************************************** - static inline bool isColorTag(const ucstring &s, uint index, uint textSize) + static inline bool isColorTag(const std::string &s, uint index, uint textSize) { // Format is @{RGBA} if(s[index]=='@') @@ -3025,7 +3089,7 @@ namespace NLGUI // *************************************************************************** // isColorTag must be ok. - static inline CRGBA getColorTag(const ucstring &s, uint &index) + static inline CRGBA getColorTag(const std::string &s, uint &index) { // extract the color string: "FABC" char tmpCol[5]; @@ -3052,7 +3116,7 @@ namespace NLGUI // *************************************************************************** const uint MaxTabDigit= 3; - static inline bool isTabTag(const ucstring &s, uint index, uint textSize) + static inline bool isTabTag(const std::string &s, uint index, uint textSize) { // Format is @{Tvalue}, where value ,1,2,3 digit. if(s[index]=='@') @@ -3078,7 +3142,7 @@ namespace NLGUI // *************************************************************************** // isTabTag must be ok. - static inline sint getTabTag(const ucstring &s, uint &index) + static inline sint getTabTag(const std::string &s, uint &index) { // extract the tab min X value char tmpTab[MaxTabDigit+1]; @@ -3101,7 +3165,7 @@ namespace NLGUI // *************************************************************************** - static inline bool isTooltipTag(const ucstring &s, uint index, uint textSize) + static inline bool isTooltipTag(const std::string &s, uint index, uint textSize) { // Format is @{Huitt*} if(s[index]=='@') @@ -3125,9 +3189,9 @@ namespace NLGUI // *************************************************************************** // isTooltipTag must be ok. - static inline ucstring getTooltipTag(const ucstring &s, uint &index) + static inline std::string getTooltipTag(const std::string &s, uint &index) { - ucstring result; + std::string result; uint i = 3; while (s[index+i] != '}') { @@ -3143,7 +3207,7 @@ namespace NLGUI // *************************************************************************** - void CViewText::buildFormatTagText(const ucstring &text, ucstring &textBuild, std::vector &formatTags, std::vector &tooltips) + void CViewText::buildFormatTagText(const std::string &text, std::string &textBuild, std::vector &formatTags, std::vector &tooltips) { formatTags.clear(); tooltips.clear(); @@ -3216,15 +3280,20 @@ namespace NLGUI } } + // *************************************************************************** + void CViewText::setTextFormatTagedAsUtf16(const ucstring &text) + { + setTextFormatTaged(text.toUtf8()); + } // *************************************************************************** - void CViewText::setTextFormatTaged(const ucstring &text) + void CViewText::setTextFormatTaged(const std::string &text) { if( text.empty() ) return; // to allow cache (avoid infinite recurse in updateCoords() in some case), compute in temp - ucstring tempText; + std::string tempText; // static to avoid reallocation static std::vector tempFormatTags; static std::vector tempTooltips; @@ -3253,7 +3322,8 @@ namespace NLGUI _FormatTags= tempFormatTags; // Copy to Text (preserve Memory) contReset(_Text); - _Text= tempText; + _Text = tempText; + _TextLength = 0; CInterfaceGroup *parent = getParent(); @@ -3274,8 +3344,9 @@ namespace NLGUI pTooltip->setId(_Id+"_tt"+toString(i)); pTooltip->setAvoidResizeParent(avoidResizeParent()); pTooltip->setRenderLayer(getRenderLayer()); - bool isI18N = tempTooltips[i].size() >= 2 && tempTooltips[i][0] == 'u' && tempTooltips[i][1] == 'i'; - pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltips[i].toString()) : tempTooltips[i]); + std::string tempTooltipStr = tempTooltips[i].toUtf8(); + bool isI18N = NLMISC::startsWith(tempTooltipStr, "ui"); + pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltipStr) : ucstring::makeFromUtf8(tempTooltipStr)); pTooltip->setParentPos(this); pTooltip->setParentPosRef(Hotspot_BR); pTooltip->setPosRef(Hotspot_BR); @@ -3303,17 +3374,21 @@ namespace NLGUI // color format is available only if multilined if (!_MultiLine) - nlwarning( toString("ViewText isn't multilined : uc_hardtext_format will not act as wanted !\n%s", text.toString().c_str()).c_str() ); + nlwarning("ViewText isn't multilined : uc_hardtext_format will not act as wanted !\n%s", text.c_str()); } + void CViewText::setSingleLineTextFormatTagedAsUtf16(const ucstring &text) + { + setSingleLineTextFormatTaged(text.toUtf8()); + } - void CViewText::setSingleLineTextFormatTaged(const ucstring &text) + void CViewText::setSingleLineTextFormatTaged(const std::string &text) { if( text.empty() ) return; // to allow cache (avoid infinite recurse in updateCoords() in some case), compute in temp - ucstring tempText; + std::string tempText; static std::vector tempLetterColors; static std::vector tempTooltips; @@ -3357,13 +3432,14 @@ namespace NLGUI // Copy to Text (preserve Memory) contReset(_Text); - _Text= tempText; + _Text = tempText; + _TextLength = 0; invalidateContent (); } // this color format is available only if not multilined if (_MultiLine) - nlwarning( toString("ViewText is multilined : uc_hardtext_single_line_format will not act as wanted !\n%s", text.toString().c_str()).c_str() ); + nlwarning("ViewText is multilined : uc_hardtext_single_line_format will not act as wanted !\n%s", text.c_str()); } @@ -3398,6 +3474,7 @@ namespace NLGUI { _CaseMode = caseMode; setCase (_Text, _CaseMode); + _TextLength = 0; } // *************************************************************************** @@ -3470,21 +3547,22 @@ namespace NLGUI { if (_MultiLine) { - setTextFormatTaged(text); + setTextFormatTaged(text.toUtf8()); } else { - setSingleLineTextFormatTaged(text); + setSingleLineTextFormatTaged(text.toUtf8()); } } else { - setText(text); + setText(text.toUtf8()); } } else { - f.serial(_Text); + ucstring text = CUtfStringView(_Text).toUtf16(); + f.serial(text); } #undef SERIAL_UINT diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 655ea084f..2d6a7e6f5 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -156,35 +156,27 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() // Select all the text for easier selection editBoxShort->setSelectionAll(); } - group->setActive(true); } else { - ucstring localDesc = ucstring(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)); if (itemInfo.CustomText.empty()) - display->setTextFormatTaged(localDesc); + display->setTextFormatTaged(CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)).toUtf8()); else { ucstring text = itemInfo.CustomText; - if (text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') + string::size_type delimiter = text.find(' '); + if(text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') { CGroupHTML *pGH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html")); if (pGH) - pGH->browse(text.substr(4, text.size()-4).toString().c_str()); - text = localDesc; - } - else if (text.size() > 3 && text[0]=='@' && text[1]=='L' && text[2]=='U' && text[3]=='A') - { - string code = text.substr(4, text.size()-4).toString(); - if (!code.empty()) - CLuaManager::getInstance().executeLuaScript(code); - text = localDesc; - } - if (!text.empty()) - { - display->setTextFormatTaged(text); - group->setActive(true); + pGH->browse(ucstring(text.substr(4, delimiter-4)).toString().c_str()); + if (delimiter == string::npos) + group->setActive(false); + else + text = text.substr(delimiter, text.size()-delimiter); } + + display->setTextFormatTaged(text.toUtf8()); } } } @@ -241,7 +233,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() editBoxShort->setInputString(std::string()); editBoxLarge->setInputString(std::string()); - display->setTextFormatTaged(ucstring()); + display->setTextFormatTaged(std::string()); // Finish the display or add the waiter @@ -295,37 +287,33 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() display->setActive(true); editButtons->setActive(false); closeButton->setActive(true); - group->setActive(false); + group->setActive(true); editBoxShort->setInputString(std::string()); editBoxLarge->setInputString(std::string()); - display->setTextFormatTaged(ucstring()); + display->setTextFormatTaged(std::string()); // Finish the display or add the waiter if (getInventory().isItemInfoUpToDate(ItemSlotId)) { - ucstring localDesc = ucstring(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)); + // If we already have item info if (itemInfo.CustomText.empty()) - display->setTextFormatTaged(localDesc); + display->setTextFormatTaged(CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)).toUtf8()); else { ucstring text = itemInfo.CustomText; - if (text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') + string::size_type delimiter = text.find(' '); + if(text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') { CGroupHTML *pGH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html")); if (pGH) - pGH->browse(text.substr(4, text.size()-4).toString().c_str()); - text = localDesc; + pGH->browse(ucstring(text.substr(4, delimiter-4)).toString().c_str()); + if (delimiter == string::npos) + group->setActive(false); + else + text = text.substr(delimiter, text.size()-delimiter); } - else if (text.size() > 3 && text[0]=='@' && text[1]=='L' && text[2]=='U' && text[3]=='A') - { - string code = text.substr(4, text.size()-4).toString(); - if (!code.empty()) - CLuaManager::getInstance().executeLuaScript(code); - text = localDesc; - } - if (!text.empty()) - display->setTextFormatTaged(text); + display->setTextFormatTaged(text.toUtf8()); } } else @@ -446,7 +434,7 @@ static TStackMode CurrentStackMode; static void validateStackItem(CDBCtrlSheet *src, CDBCtrlSheet *dest, sint32 quantity, TStackMode stackMode); -static void checkItemCommand(const CItemSheet *itemSheet); + //===================================================================================================================== /** Send a swap item msg to the server @@ -1688,10 +1676,6 @@ class CHandlerItemCristalReload : public IActionHandler CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); if (pCS == NULL) return; - const CItemSheet *pIS = pCS->asItemSheet(); - if (pIS && pIS->Scroll.Label.empty()) - checkItemCommand(pIS); - sendToServerEnchantMessage((uint8)pCS->getInventoryIndex(), (uint16)pCS->getIndexInDB()); } }; @@ -1769,7 +1753,6 @@ class CHandlerItemMenuCheck : public IActionHandler CViewTextMenu *pCrisReload = dynamic_cast(pMenu->getView("cris_reload")); CViewTextMenu *pTeleportUse = dynamic_cast(pMenu->getView("teleport_use")); CViewTextMenu *pItemConsume = dynamic_cast(pMenu->getView("item_consume")); - CViewTextMenu *pItemExecute = dynamic_cast(pMenu->getView("item_execute")); CViewTextMenu *pXpCatalyserUse = dynamic_cast(pMenu->getView("xp_catalyser_use")); CViewTextMenu *pDrop = dynamic_cast(pMenu->getView("drop")); CViewTextMenu *pDestroy = dynamic_cast(pMenu->getView("destroy")); @@ -1797,7 +1780,6 @@ class CHandlerItemMenuCheck : public IActionHandler if(pCrisReload) pCrisReload->setActive(false); if(pTeleportUse) pTeleportUse->setActive(false); if(pItemConsume) pItemConsume->setActive(false); - if(pItemExecute) pItemExecute->setActive(false); if(pXpCatalyserUse) pXpCatalyserUse->setActive(false); if(pItemTextDisplay) pItemTextDisplay->setActive(false); if(pItemTextEdition) pItemTextEdition->setActive(false); @@ -1872,61 +1854,6 @@ class CHandlerItemMenuCheck : public IActionHandler { pItemInfos->setActive(true); } - // item has a label? - if (!pIS->Scroll.Label.empty()) - { - CGroupMenu *menu = dynamic_cast( - CWidgetManager::getInstance()->getElementFromId("ui:interface:item_menu_in_bag") - ); - // add the label to default menu - if (!pIS->Scroll.LuaCommand.empty() || !pIS->Scroll.WebCommand.empty()) - menu->setActionHandler(4, menu->getActionHandler(4)); - else - { - // replace default menu and redirect action handler - if (pCrisEnchant && pCrisEnchant->getActive()) - { - pCrisEnchant->setActive(false); - menu->setActionHandler(4, menu->getActionHandler(0)); - } - if (pCrisReload && pCrisReload->getActive()) - { - pCrisReload->setActive(false); - menu->setActionHandler(4, menu->getActionHandler(1)); - } - if (pTeleportUse && pTeleportUse->getActive()) - { - pTeleportUse->setActive(false); - menu->setActionHandler(4, menu->getActionHandler(2)); - } - if (pItemConsume && pItemConsume->getActive()) - { - pItemConsume->setActive(false); - menu->setActionHandler(4, menu->getActionHandler(3)); - } - if (pXpCatalyserUse && pXpCatalyserUse->getActive()) - { - pXpCatalyserUse->setActive(false); - menu->setActionHandler(4, menu->getActionHandler(5)); - } - if (pItemTextDisplay && pItemTextDisplay->getActive()) - { - pItemTextDisplay->setActive(false); - menu->setActionHandler(4, menu->getActionHandler(6)); - menu->setActionHandlerParam(4, menu->getActionHandlerParam(6)); - } - } - if (!bIsLockedByOwner) - { - if (pCS->getInventoryIndex() == INVENTORIES::bag) - pItemExecute->setActive(true); - // enchant and reload can be used from anywhere - if (pIS->Family == ITEMFAMILY::CRYSTALLIZED_SPELL || pIS->Family == ITEMFAMILY::ITEM_SAP_RECHARGE) - pItemExecute->setActive(true); - - pItemExecute->setText(CI18N::get(pIS->Scroll.Label)); - } - } } CInventoryManager &invMngr= getInventory(); @@ -2057,7 +1984,6 @@ class CHandlerItemMenuCheck : public IActionHandler if(pCrisReload) pCrisReload->setGrayed(true); if(pTeleportUse) pTeleportUse->setGrayed(true); if(pItemConsume) pItemConsume->setGrayed(true); - if(pItemExecute) pItemExecute->setGrayed(true); if(pXpCatalyserUse) pXpCatalyserUse->setGrayed(true); if(pDrop) pDrop->setGrayed(true); if(pDestroy) pDestroy->setGrayed(true); @@ -2077,7 +2003,6 @@ class CHandlerItemMenuCheck : public IActionHandler if(pCrisReload) pCrisReload->setGrayed(false); if(pTeleportUse) pTeleportUse->setGrayed(false); if(pItemConsume) pItemConsume->setGrayed(false); - if(pItemExecute) pItemExecute->setGrayed(false); if(pXpCatalyserUse) pXpCatalyserUse->setGrayed(false); if(pDrop) pDrop->setGrayed(false); if(pDestroy) pDestroy->setGrayed(false); @@ -2258,24 +2183,6 @@ static void sendMsgStopUseXpCat( bool isRingCatalyser ) } } -// *************************************************************************** -static void checkItemCommand(const CItemSheet *itemSheet) -{ - if (itemSheet) - { - if (!itemSheet->Scroll.LuaCommand.empty()) - CLuaManager::getInstance().executeLuaScript(itemSheet->Scroll.LuaCommand); - // webig - if (!itemSheet->Scroll.WebCommand.empty()) - { - CGroupHTML *pGH = dynamic_cast( - CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html") - ); - if (pGH) pGH->browse(itemSheet->Scroll.WebCommand.c_str()); - } - } - return; -} // *************************************************************************** class CHandlerTeleportUse : public IActionHandler @@ -2304,8 +2211,6 @@ class CHandlerTeleportUse : public IActionHandler LoadingBackground = TeleportKaravanBackground; break; } - if (pIS->Scroll.Label.empty()) - checkItemCommand(pIS); } } }; @@ -2320,28 +2225,12 @@ class CHandlerItemConsume : public IActionHandler CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); if (pCS == NULL) return; - const CItemSheet *pIS = pCS->asItemSheet(); - if (pIS && pIS->Scroll.Label.empty()) - checkItemCommand(pIS); - // use the item sendMsgUseItem(uint16(pCS->getIndexInDB())); } }; REGISTER_ACTION_HANDLER( CHandlerItemConsume, "item_consume" ); -// *************************************************************************** -class CHandlerItemExecute : public IActionHandler -{ - void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) - { - CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); - if (pCS) - checkItemCommand(pCS->asItemSheet()); - return; - } -}; -REGISTER_ACTION_HANDLER( CHandlerItemExecute, "item_execute" ); // *************************************************************************** class CHandlerValidateItemTextEdition : public IActionHandler @@ -2365,10 +2254,6 @@ class CHandlerItemTextDisplay : public IActionHandler if (pCSItem == NULL || windowName.empty()) return; - const CItemSheet *pIS = pCSItem->asItemSheet(); - if (pIS && pIS->Scroll.Label.empty()) - checkItemCommand(pIS); - CInterfaceItemEdition::getInstance()->setCurrWindow(pCSItem, windowName, false); } }; @@ -2410,10 +2295,6 @@ class CHandlerXpCatalyserUse : public IActionHandler CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); if (pCS == NULL) return; - const CItemSheet *pIS = pCS->asItemSheet(); - if (pIS && pIS->Scroll.Label.empty()) - checkItemCommand(pIS); - // use the item sendMsgUseItem(uint16(pCS->getIndexInDB())); } From 2de4907b83f6015d8ad81ef661806675b40165d9 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 01:54:14 +0800 Subject: [PATCH 063/205] Reimplement toLower and toUpper as UTF-8, ryzom/ryzomcore#335 --- nel/include/nel/misc/common.h | 8 +- nel/include/nel/misc/ucstring.h | 6 - nel/src/gui/dbgroup_combo_box.cpp | 2 +- nel/src/gui/string_case.cpp | 4 +- nel/src/misc/common.cpp | 8 + nel/src/misc/unicode.cpp | 3164 ++++++++++++++++++++++++++++- 6 files changed, 3146 insertions(+), 46 deletions(-) diff --git a/nel/include/nel/misc/common.h b/nel/include/nel/misc/common.h index 2f678acef..7b89bae3b 100644 --- a/nel/include/nel/misc/common.h +++ b/nel/include/nel/misc/common.h @@ -227,8 +227,8 @@ inline double isValidDouble (double v) * \param str a string to transform to lower case */ -std::string toLower ( const char *str ); // Ascii only -std::string toLower ( const std::string &str ); // Ascii only +std::string toLower ( const char *str ); // UTF-8 +std::string toLower ( const std::string &str ); // UTF-8 void toLower ( char *str ); // Ascii only char toLower ( const char ch ); // convert only one character @@ -236,8 +236,8 @@ char toLower ( const char ch ); // convert only one character * \param a string to transform to upper case */ -// std::string toUpper ( const char *str ); // Ascii only -std::string toUpper ( const std::string &str); // Ascii only +std::string toUpper ( const char *str ); // UTF-8 +std::string toUpper ( const std::string &str); // UTF-8 void toUpper ( char *str); // Ascii only diff --git a/nel/include/nel/misc/ucstring.h b/nel/include/nel/misc/ucstring.h index 8bbcd828d..61f7f416b 100644 --- a/nel/include/nel/misc/ucstring.h +++ b/nel/include/nel/misc/ucstring.h @@ -260,12 +260,6 @@ ucstring toUpper(const ucstring &str); void toUpper(ucchar *str); ucchar toUpper(ucchar c); -std::string toLowerAsUtf8(const char *str); -std::string toLowerAsUtf8(const std::string &str); - -std::string toUpperAsUtf8(const char *str); -std::string toUpperAsUtf8(const std::string &str); - }; #endif // NL_UCSTRING_H diff --git a/nel/src/gui/dbgroup_combo_box.cpp b/nel/src/gui/dbgroup_combo_box.cpp index dd7f2154d..6cf911399 100644 --- a/nel/src/gui/dbgroup_combo_box.cpp +++ b/nel/src/gui/dbgroup_combo_box.cpp @@ -45,7 +45,7 @@ namespace NLGUI // Compare strings static inline bool lt_text(const std::pair &s1, const std::pair &s2) { - return toLowerAsUtf8(s1.second) < toLowerAsUtf8(s2.second); + return toLower(s1.second) < toLower(s2.second); } std::string CDBGroupComboBox::measureMenu; diff --git a/nel/src/gui/string_case.cpp b/nel/src/gui/string_case.cpp index d970d1e03..f6218d39a 100644 --- a/nel/src/gui/string_case.cpp +++ b/nel/src/gui/string_case.cpp @@ -148,10 +148,10 @@ namespace NLGUI switch (mode) { case CaseLower: - str = NLMISC::toLowerAsUtf8(str); + str = NLMISC::toLower(str); break; case CaseUpper: - str = NLMISC::toUpperAsUtf8(str); + str = NLMISC::toUpper(str); break; case CaseFirstStringLetterUp: { diff --git a/nel/src/misc/common.cpp b/nel/src/misc/common.cpp index b9e9a7d85..184f550d5 100644 --- a/nel/src/misc/common.cpp +++ b/nel/src/misc/common.cpp @@ -594,6 +594,8 @@ NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human rea return true; } +#if 0 + std::string toLower(const char *str) { if (!str) return ""; @@ -625,6 +627,8 @@ std::string toLower(const std::string &str) return res; } +#endif + char toLower(const char ch) { if( (ch >= 'A') && (ch <= 'Z') ) @@ -652,6 +656,8 @@ void toLower(char *str) } } +#if 0 + std::string toUpper(const std::string &str) { string res; @@ -666,6 +672,8 @@ std::string toUpper(const std::string &str) return res; } +#endif + void toUpper(char *str) { if (str == 0) diff --git a/nel/src/misc/unicode.cpp b/nel/src/misc/unicode.cpp index 6a0bf25c0..50cefbf71 100644 --- a/nel/src/misc/unicode.cpp +++ b/nel/src/misc/unicode.cpp @@ -1950,39 +1950,6 @@ ucchar toLower (ucchar c) // *************************************************************************** -static std::string toLowerAsUtf8(CUtfStringView sv) -{ - std::string res; - res.reserve(sv.largestSize()); - for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) - { - u32char c = *it; - if (c < 0x10000) - { - ucchar uc = c; - ucchar *result = toLowerUpperSearch(&uc, UnicodeUpperToLower); - if (result) - c = result[1]; - } - CUtfStringView::append(res, c); - } - return res; -} - -std::string toLowerAsUtf8(const char *str) -{ - return toLowerAsUtf8(CUtfStringView(str)); -} - -// *************************************************************************** - -std::string toLowerAsUtf8(const std::string &str) -{ - return toLowerAsUtf8(CUtfStringView(str)); -} - -// *************************************************************************** - ucstring toUpper (const ucstring &str) { uint i; @@ -2023,6 +1990,2922 @@ ucchar toUpper (ucchar c) return c; } +// *************************************************************************** +// *************************************************************************** +// *************************************************************************** + +static const char s_Utf8UpperToLowerC2[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xCE', '\xBC', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerC3[64 * 4] = { + '\xC3', '\xA0', '\x00', 0, + '\xC3', '\xA1', '\x00', 0, + '\xC3', '\xA2', '\x00', 0, + '\xC3', '\xA3', '\x00', 0, + '\xC3', '\xA4', '\x00', 0, + '\xC3', '\xA5', '\x00', 0, + '\xC3', '\xA6', '\x00', 0, + '\xC3', '\xA7', '\x00', 0, + '\xC3', '\xA8', '\x00', 0, + '\xC3', '\xA9', '\x00', 0, + '\xC3', '\xAA', '\x00', 0, + '\xC3', '\xAB', '\x00', 0, + '\xC3', '\xAC', '\x00', 0, + '\xC3', '\xAD', '\x00', 0, + '\xC3', '\xAE', '\x00', 0, + '\xC3', '\xAF', '\x00', 0, + '\xC3', '\xB0', '\x00', 0, + '\xC3', '\xB1', '\x00', 0, + '\xC3', '\xB2', '\x00', 0, + '\xC3', '\xB3', '\x00', 0, + '\xC3', '\xB4', '\x00', 0, + '\xC3', '\xB5', '\x00', 0, + '\xC3', '\xB6', '\x00', 0, + 0, 0, 0, 0, + '\xC3', '\xB8', '\x00', 0, + '\xC3', '\xB9', '\x00', 0, + '\xC3', '\xBA', '\x00', 0, + '\xC3', '\xBB', '\x00', 0, + '\xC3', '\xBC', '\x00', 0, + '\xC3', '\xBD', '\x00', 0, + '\xC3', '\xBE', '\x00', 0, + '\xC3', '\x9F', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerC4[64 * 4] = { + '\xC4', '\x81', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x83', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x85', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x87', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x89', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x8B', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x8D', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x8F', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x91', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x93', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x95', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x97', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x99', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x9B', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x9D', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\x9F', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xA1', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xA3', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xA5', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xA7', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xA9', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xAB', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xAD', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xAF', '\x00', 0, + 0, 0, 0, 0, + '\x69', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xB3', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xB5', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xB7', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + '\xC4', '\xBA', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xBC', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xBE', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x80', '\x00', 0, +}; + +static const char s_Utf8UpperToLowerC5[64 * 4] = { + 0, 0, 0, 0, + '\xC5', '\x82', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x84', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x86', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x88', '\x00', 0, + 0, 0, 0, 0, + '\xCA', '\xBC', '\x00', 0, + '\xC5', '\x8B', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x8D', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x8F', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x91', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x93', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x95', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x97', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x99', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x9B', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x9D', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x9F', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xA1', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xA3', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xA5', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xA7', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xA9', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xAB', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xAD', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xAF', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xB1', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xB3', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xB5', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xB7', '\x00', 0, + 0, 0, 0, 0, + '\xC3', '\xBF', '\x00', 0, + '\xC5', '\xBA', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xBC', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\xBE', '\x00', 0, + 0, 0, 0, 0, + '\x73', '\x00', '\x00', 0, +}; + +static const char s_Utf8UpperToLowerC6[64 * 4] = { + 0, 0, 0, 0, + '\xC9', '\x93', '\x00', 0, + '\xC6', '\x83', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\x85', '\x00', 0, + 0, 0, 0, 0, + '\xC9', '\x94', '\x00', 0, + '\xC6', '\x88', '\x00', 0, + 0, 0, 0, 0, + '\xC9', '\x96', '\x00', 0, + '\xC9', '\x97', '\x00', 0, + '\xC6', '\x8C', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xC7', '\x9D', '\x00', 0, + '\xC9', '\x99', '\x00', 0, + '\xC9', '\x9B', '\x00', 0, + '\xC6', '\x92', '\x00', 0, + 0, 0, 0, 0, + '\xC9', '\xA0', '\x00', 0, + '\xC9', '\xA3', '\x00', 0, + 0, 0, 0, 0, + '\xC9', '\xA9', '\x00', 0, + '\xC9', '\xA8', '\x00', 0, + '\xC6', '\x99', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xC9', '\xAF', '\x00', 0, + '\xC9', '\xB2', '\x00', 0, + 0, 0, 0, 0, + '\xC9', '\xB5', '\x00', 0, + '\xC6', '\xA1', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\xA3', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\xA5', '\x00', 0, + 0, 0, 0, 0, + '\xCA', '\x80', '\x00', 0, + '\xC6', '\xA8', '\x00', 0, + 0, 0, 0, 0, + '\xCA', '\x83', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xC6', '\xAD', '\x00', 0, + 0, 0, 0, 0, + '\xCA', '\x88', '\x00', 0, + '\xC6', '\xB0', '\x00', 0, + 0, 0, 0, 0, + '\xCA', '\x8A', '\x00', 0, + '\xCA', '\x8B', '\x00', 0, + '\xC6', '\xB4', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\xB6', '\x00', 0, + 0, 0, 0, 0, + '\xCA', '\x92', '\x00', 0, + '\xC6', '\xB9', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xC6', '\xBD', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerC7[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xC7', '\x86', '\x00', 0, + '\xC7', '\x86', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\x89', '\x00', 0, + '\xC7', '\x89', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\x8C', '\x00', 0, + '\xC7', '\x8C', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\x8E', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\x90', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\x92', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\x94', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\x96', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\x98', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\x9A', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\x9C', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xC7', '\x9F', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xA1', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xA3', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xA5', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xA7', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xA9', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xAB', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xAD', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xAF', '\x00', 0, + 0, 0, 0, 0, + '\x6A', '\x00', '\x00', 0, + '\xC7', '\xB3', '\x00', 0, + '\xC7', '\xB3', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xB5', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\x95', '\x00', 0, + '\xC6', '\xBF', '\x00', 0, + '\xC7', '\xB9', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xBB', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xBD', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xBF', '\x00', 0, + 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerC8[64 * 4] = { + '\xC8', '\x81', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x83', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x85', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x87', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x89', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x8B', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x8D', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x8F', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x91', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x93', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x95', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x97', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x99', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x9B', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x9D', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x9F', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\x9E', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\xA3', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\xA5', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\xA7', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\xA9', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\xAB', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\xAD', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\xAF', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\xB1', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\xB3', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerCD[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xCE', '\xB9', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerCE[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xCE', '\xAC', '\x00', 0, + 0, 0, 0, 0, + '\xCE', '\xAD', '\x00', 0, + '\xCE', '\xAE', '\x00', 0, + '\xCE', '\xAF', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x8C', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x8D', '\x00', 0, + '\xCF', '\x8E', '\x00', 0, + '\xCE', '\xB9', '\x00', 0, + '\xCE', '\xB1', '\x00', 0, + '\xCE', '\xB2', '\x00', 0, + '\xCE', '\xB3', '\x00', 0, + '\xCE', '\xB4', '\x00', 0, + '\xCE', '\xB5', '\x00', 0, + '\xCE', '\xB6', '\x00', 0, + '\xCE', '\xB7', '\x00', 0, + '\xCE', '\xB8', '\x00', 0, + '\xCE', '\xB9', '\x00', 0, + '\xCE', '\xBA', '\x00', 0, + '\xCE', '\xBB', '\x00', 0, + '\xCE', '\xBC', '\x00', 0, + '\xCE', '\xBD', '\x00', 0, + '\xCE', '\xBE', '\x00', 0, + '\xCE', '\xBF', '\x00', 0, + '\xCF', '\x80', '\x00', 0, + '\xCF', '\x81', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x83', '\x00', 0, + '\xCF', '\x84', '\x00', 0, + '\xCF', '\x85', '\x00', 0, + '\xCF', '\x86', '\x00', 0, + '\xCF', '\x87', '\x00', 0, + '\xCF', '\x88', '\x00', 0, + '\xCF', '\x89', '\x00', 0, + '\xCF', '\x8A', '\x00', 0, + '\xCF', '\x8B', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xCF', '\x85', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerCF[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, + '\xCF', '\x83', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xCE', '\xB2', '\x00', 0, + '\xCE', '\xB8', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xCF', '\x86', '\x00', 0, + '\xCF', '\x80', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x99', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x9B', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x9D', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x9F', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xA1', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xA3', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xA5', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xA7', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xA9', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xAB', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xAD', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xAF', '\x00', 0, + 0, 0, 0, 0, + '\xCE', '\xBA', '\x00', 0, + '\xCF', '\x81', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xCE', '\xB8', '\x00', 0, + '\xCE', '\xB5', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xB8', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xB2', '\x00', 0, + '\xCF', '\xBB', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerD0[64 * 4] = { + '\xD1', '\x90', '\x00', 0, + '\xD1', '\x91', '\x00', 0, + '\xD1', '\x92', '\x00', 0, + '\xD1', '\x93', '\x00', 0, + '\xD1', '\x94', '\x00', 0, + '\xD1', '\x95', '\x00', 0, + '\xD1', '\x96', '\x00', 0, + '\xD1', '\x97', '\x00', 0, + '\xD1', '\x98', '\x00', 0, + '\xD1', '\x99', '\x00', 0, + '\xD1', '\x9A', '\x00', 0, + '\xD1', '\x9B', '\x00', 0, + '\xD1', '\x9C', '\x00', 0, + '\xD1', '\x9D', '\x00', 0, + '\xD1', '\x9E', '\x00', 0, + '\xD1', '\x9F', '\x00', 0, + '\xD0', '\xB0', '\x00', 0, + '\xD0', '\xB1', '\x00', 0, + '\xD0', '\xB2', '\x00', 0, + '\xD0', '\xB3', '\x00', 0, + '\xD0', '\xB4', '\x00', 0, + '\xD0', '\xB5', '\x00', 0, + '\xD0', '\xB6', '\x00', 0, + '\xD0', '\xB7', '\x00', 0, + '\xD0', '\xB8', '\x00', 0, + '\xD0', '\xB9', '\x00', 0, + '\xD0', '\xBA', '\x00', 0, + '\xD0', '\xBB', '\x00', 0, + '\xD0', '\xBC', '\x00', 0, + '\xD0', '\xBD', '\x00', 0, + '\xD0', '\xBE', '\x00', 0, + '\xD0', '\xBF', '\x00', 0, + '\xD1', '\x80', '\x00', 0, + '\xD1', '\x81', '\x00', 0, + '\xD1', '\x82', '\x00', 0, + '\xD1', '\x83', '\x00', 0, + '\xD1', '\x84', '\x00', 0, + '\xD1', '\x85', '\x00', 0, + '\xD1', '\x86', '\x00', 0, + '\xD1', '\x87', '\x00', 0, + '\xD1', '\x88', '\x00', 0, + '\xD1', '\x89', '\x00', 0, + '\xD1', '\x8A', '\x00', 0, + '\xD1', '\x8B', '\x00', 0, + '\xD1', '\x8C', '\x00', 0, + '\xD1', '\x8D', '\x00', 0, + '\xD1', '\x8E', '\x00', 0, + '\xD1', '\x8F', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerD1[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xD1', '\xA1', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xA3', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xA5', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xA7', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xA9', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xAB', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xAD', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xAF', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xB1', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xB3', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xB5', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xB7', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xB9', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xBB', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xBD', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xBF', '\x00', 0, + 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerD2[64 * 4] = { + '\xD2', '\x81', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xD2', '\x8B', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x8D', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x8F', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x91', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x93', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x95', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x97', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x99', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x9B', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x9D', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x9F', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xA1', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xA3', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xA5', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xA7', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xA9', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xAB', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xAD', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xAF', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xB1', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xB3', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xB5', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xB7', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xB9', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xBB', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xBD', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xBF', '\x00', 0, + 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerD3[64 * 4] = { + 0, 0, 0, 0, + '\xD3', '\x82', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x84', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x86', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x88', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x8A', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x8C', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x8E', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xD3', '\x91', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x93', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x95', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x97', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x99', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x9B', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x9D', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x9F', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xA1', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xA3', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xA5', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xA7', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xA9', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xAB', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xAD', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xAF', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xB1', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xB3', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xB5', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xD3', '\xB9', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerD4[64 * 4] = { + '\xD4', '\x81', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x83', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x85', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x87', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x89', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x8B', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x8D', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x8F', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + '\xD5', '\xA1', '\x00', 0, + '\xD5', '\xA2', '\x00', 0, + '\xD5', '\xA3', '\x00', 0, + '\xD5', '\xA4', '\x00', 0, + '\xD5', '\xA5', '\x00', 0, + '\xD5', '\xA6', '\x00', 0, + '\xD5', '\xA7', '\x00', 0, + '\xD5', '\xA8', '\x00', 0, + '\xD5', '\xA9', '\x00', 0, + '\xD5', '\xAA', '\x00', 0, + '\xD5', '\xAB', '\x00', 0, + '\xD5', '\xAC', '\x00', 0, + '\xD5', '\xAD', '\x00', 0, + '\xD5', '\xAE', '\x00', 0, + '\xD5', '\xAF', '\x00', 0, +}; + +static const char s_Utf8UpperToLowerD5[64 * 4] = { + '\xD5', '\xB0', '\x00', 0, + '\xD5', '\xB1', '\x00', 0, + '\xD5', '\xB2', '\x00', 0, + '\xD5', '\xB3', '\x00', 0, + '\xD5', '\xB4', '\x00', 0, + '\xD5', '\xB5', '\x00', 0, + '\xD5', '\xB6', '\x00', 0, + '\xD5', '\xB7', '\x00', 0, + '\xD5', '\xB8', '\x00', 0, + '\xD5', '\xB9', '\x00', 0, + '\xD5', '\xBA', '\x00', 0, + '\xD5', '\xBB', '\x00', 0, + '\xD5', '\xBC', '\x00', 0, + '\xD5', '\xBD', '\x00', 0, + '\xD5', '\xBE', '\x00', 0, + '\xD5', '\xBF', '\x00', 0, + '\xD6', '\x80', '\x00', 0, + '\xD6', '\x81', '\x00', 0, + '\xD6', '\x82', '\x00', 0, + '\xD6', '\x83', '\x00', 0, + '\xD6', '\x84', '\x00', 0, + '\xD6', '\x85', '\x00', 0, + '\xD6', '\x86', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerD6[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xD5', '\xA5', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerE1B8[64 * 4] = { + '\xE1', '\xB8', '\x81', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x83', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x85', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x87', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x89', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x8B', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x8D', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x8F', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x91', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x93', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x95', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x97', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x99', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x9B', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x9D', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\x9F', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xA1', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xA3', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xA5', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xA7', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xA9', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xAB', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xAD', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xAF', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xB1', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xB3', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xB5', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xB7', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xB9', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xBB', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xBD', 0, + 0, 0, 0, 0, + '\xE1', '\xB8', '\xBF', 0, + 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerE1B9[64 * 4] = { + '\xE1', '\xB9', '\x81', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x83', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x85', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x87', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x89', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x8B', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x8D', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x8F', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x91', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x93', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x95', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x97', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x99', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x9B', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x9D', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\x9F', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xA1', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xA3', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xA5', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xA7', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xA9', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xAB', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xAD', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xAF', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xB1', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xB3', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xB5', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xB7', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xB9', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xBB', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xBD', 0, + 0, 0, 0, 0, + '\xE1', '\xB9', '\xBF', 0, + 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerE1BA[64 * 4] = { + '\xE1', '\xBA', '\x81', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\x83', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\x85', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\x87', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\x89', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\x8B', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\x8D', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\x8F', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\x91', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\x93', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\x95', 0, + 0, 0, 0, 0, + '\x68', '\x00', '\x00', 0, + '\x74', '\x00', '\x00', 0, + '\x77', '\x00', '\x00', 0, + '\x79', '\x00', '\x00', 0, + '\x61', '\x00', '\x00', 0, + '\xE1', '\xB9', '\xA1', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBA', '\xA1', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xA3', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xA5', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xA7', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xA9', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xAB', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xAD', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xAF', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xB1', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xB3', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xB5', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xB7', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xB9', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xBB', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xBD', 0, + 0, 0, 0, 0, + '\xE1', '\xBA', '\xBF', 0, + 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerE1BB[64 * 4] = { + '\xE1', '\xBB', '\x81', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x83', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x85', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x87', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x89', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x8B', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x8D', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x8F', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x91', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x93', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x95', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x97', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x99', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x9B', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x9D', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\x9F', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xA1', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xA3', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xA5', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xA7', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xA9', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xAB', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xAD', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xAF', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xB1', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xB3', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xB5', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xB7', 0, + 0, 0, 0, 0, + '\xE1', '\xBB', '\xB9', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerE1BC[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBC', '\x80', 0, + '\xE1', '\xBC', '\x81', 0, + '\xE1', '\xBC', '\x82', 0, + '\xE1', '\xBC', '\x83', 0, + '\xE1', '\xBC', '\x84', 0, + '\xE1', '\xBC', '\x85', 0, + '\xE1', '\xBC', '\x86', 0, + '\xE1', '\xBC', '\x87', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBC', '\x90', 0, + '\xE1', '\xBC', '\x91', 0, + '\xE1', '\xBC', '\x92', 0, + '\xE1', '\xBC', '\x93', 0, + '\xE1', '\xBC', '\x94', 0, + '\xE1', '\xBC', '\x95', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBC', '\xA0', 0, + '\xE1', '\xBC', '\xA1', 0, + '\xE1', '\xBC', '\xA2', 0, + '\xE1', '\xBC', '\xA3', 0, + '\xE1', '\xBC', '\xA4', 0, + '\xE1', '\xBC', '\xA5', 0, + '\xE1', '\xBC', '\xA6', 0, + '\xE1', '\xBC', '\xA7', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBC', '\xB0', 0, + '\xE1', '\xBC', '\xB1', 0, + '\xE1', '\xBC', '\xB2', 0, + '\xE1', '\xBC', '\xB3', 0, + '\xE1', '\xBC', '\xB4', 0, + '\xE1', '\xBC', '\xB5', 0, + '\xE1', '\xBC', '\xB6', 0, + '\xE1', '\xBC', '\xB7', 0, +}; + +static const char s_Utf8UpperToLowerE1BD[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBD', '\x80', 0, + '\xE1', '\xBD', '\x81', 0, + '\xE1', '\xBD', '\x82', 0, + '\xE1', '\xBD', '\x83', 0, + '\xE1', '\xBD', '\x84', 0, + '\xE1', '\xBD', '\x85', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xCF', '\x85', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x85', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x85', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x85', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + '\xE1', '\xBD', '\x91', 0, + 0, 0, 0, 0, + '\xE1', '\xBD', '\x93', 0, + 0, 0, 0, 0, + '\xE1', '\xBD', '\x95', 0, + 0, 0, 0, 0, + '\xE1', '\xBD', '\x97', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBD', '\xA0', 0, + '\xE1', '\xBD', '\xA1', 0, + '\xE1', '\xBD', '\xA2', 0, + '\xE1', '\xBD', '\xA3', 0, + '\xE1', '\xBD', '\xA4', 0, + '\xE1', '\xBD', '\xA5', 0, + '\xE1', '\xBD', '\xA6', 0, + '\xE1', '\xBD', '\xA7', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerE1BE[64 * 4] = { + '\xE1', '\xBC', '\x80', 0, + '\xE1', '\xBC', '\x81', 0, + '\xE1', '\xBC', '\x82', 0, + '\xE1', '\xBC', '\x83', 0, + '\xE1', '\xBC', '\x84', 0, + '\xE1', '\xBC', '\x85', 0, + '\xE1', '\xBC', '\x86', 0, + '\xE1', '\xBC', '\x87', 0, + '\xE1', '\xBE', '\x80', 0, + '\xE1', '\xBE', '\x81', 0, + '\xE1', '\xBE', '\x82', 0, + '\xE1', '\xBE', '\x83', 0, + '\xE1', '\xBE', '\x84', 0, + '\xE1', '\xBE', '\x85', 0, + '\xE1', '\xBE', '\x86', 0, + '\xE1', '\xBE', '\x87', 0, + '\xE1', '\xBC', '\xA0', 0, + '\xE1', '\xBC', '\xA1', 0, + '\xE1', '\xBC', '\xA2', 0, + '\xE1', '\xBC', '\xA3', 0, + '\xE1', '\xBC', '\xA4', 0, + '\xE1', '\xBC', '\xA5', 0, + '\xE1', '\xBC', '\xA6', 0, + '\xE1', '\xBC', '\xA7', 0, + '\xE1', '\xBE', '\x90', 0, + '\xE1', '\xBE', '\x91', 0, + '\xE1', '\xBE', '\x92', 0, + '\xE1', '\xBE', '\x93', 0, + '\xE1', '\xBE', '\x94', 0, + '\xE1', '\xBE', '\x95', 0, + '\xE1', '\xBE', '\x96', 0, + '\xE1', '\xBE', '\x97', 0, + '\xE1', '\xBD', '\xA0', 0, + '\xE1', '\xBD', '\xA1', 0, + '\xE1', '\xBD', '\xA2', 0, + '\xE1', '\xBD', '\xA3', 0, + '\xE1', '\xBD', '\xA4', 0, + '\xE1', '\xBD', '\xA5', 0, + '\xE1', '\xBD', '\xA6', 0, + '\xE1', '\xBD', '\xA7', 0, + '\xE1', '\xBE', '\xA0', 0, + '\xE1', '\xBE', '\xA1', 0, + '\xE1', '\xBE', '\xA2', 0, + '\xE1', '\xBE', '\xA3', 0, + '\xE1', '\xBE', '\xA4', 0, + '\xE1', '\xBE', '\xA5', 0, + '\xE1', '\xBE', '\xA6', 0, + '\xE1', '\xBE', '\xA7', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBD', '\xB0', 0, + '\xCE', '\xB1', '\x00', 0, + '\xCE', '\xAC', '\x00', 0, + 0, 0, 0, 0, + '\xCE', '\xB1', '\x00', 0, + '\xCE', '\xB1', '\x00', 0, + '\xE1', '\xBE', '\xB0', 0, + '\xE1', '\xBE', '\xB1', 0, + '\xE1', '\xBD', '\xB0', 0, + '\xE1', '\xBD', '\xB1', 0, + '\xE1', '\xBE', '\xB3', 0, + 0, 0, 0, 0, + '\xCE', '\xB9', '\x00', 0, + 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerE1BF[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBD', '\xB4', 0, + '\xCE', '\xB7', '\x00', 0, + '\xCE', '\xAE', '\x00', 0, + 0, 0, 0, 0, + '\xCE', '\xB7', '\x00', 0, + '\xCE', '\xB7', '\x00', 0, + '\xE1', '\xBD', '\xB2', 0, + '\xE1', '\xBD', '\xB3', 0, + '\xE1', '\xBD', '\xB4', 0, + '\xE1', '\xBD', '\xB5', 0, + '\xE1', '\xBF', '\x83', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xCE', '\xB9', '\x00', 0, + '\xCE', '\xB9', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xCE', '\xB9', '\x00', 0, + '\xCE', '\xB9', '\x00', 0, + '\xE1', '\xBF', '\x90', 0, + '\xE1', '\xBF', '\x91', 0, + '\xE1', '\xBD', '\xB6', 0, + '\xE1', '\xBD', '\xB7', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xCF', '\x85', '\x00', 0, + '\xCF', '\x85', '\x00', 0, + '\xCF', '\x81', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x85', '\x00', 0, + '\xCF', '\x85', '\x00', 0, + '\xE1', '\xBF', '\xA0', 0, + '\xE1', '\xBF', '\xA1', 0, + '\xE1', '\xBD', '\xBA', 0, + '\xE1', '\xBD', '\xBB', 0, + '\xE1', '\xBF', '\xA5', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBD', '\xBC', 0, + '\xCF', '\x89', '\x00', 0, + '\xCF', '\x8E', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x89', '\x00', 0, + '\xCF', '\x89', '\x00', 0, + '\xE1', '\xBD', '\xB8', 0, + '\xE1', '\xBD', '\xB9', 0, + '\xE1', '\xBD', '\xBC', 0, + '\xE1', '\xBD', '\xBD', 0, + '\xE1', '\xBF', '\xB3', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerE284[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xCF', '\x89', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\x6B', '\x00', '\x00', 0, + '\xC3', '\xA5', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerE285[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE2', '\x85', '\xB0', 0, + '\xE2', '\x85', '\xB1', 0, + '\xE2', '\x85', '\xB2', 0, + '\xE2', '\x85', '\xB3', 0, + '\xE2', '\x85', '\xB4', 0, + '\xE2', '\x85', '\xB5', 0, + '\xE2', '\x85', '\xB6', 0, + '\xE2', '\x85', '\xB7', 0, + '\xE2', '\x85', '\xB8', 0, + '\xE2', '\x85', '\xB9', 0, + '\xE2', '\x85', '\xBA', 0, + '\xE2', '\x85', '\xBB', 0, + '\xE2', '\x85', '\xBC', 0, + '\xE2', '\x85', '\xBD', 0, + '\xE2', '\x85', '\xBE', 0, + '\xE2', '\x85', '\xBF', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerE292[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE2', '\x93', '\x90', 0, + '\xE2', '\x93', '\x91', 0, + '\xE2', '\x93', '\x92', 0, + '\xE2', '\x93', '\x93', 0, + '\xE2', '\x93', '\x94', 0, + '\xE2', '\x93', '\x95', 0, + '\xE2', '\x93', '\x96', 0, + '\xE2', '\x93', '\x97', 0, + '\xE2', '\x93', '\x98', 0, + '\xE2', '\x93', '\x99', 0, +}; + +static const char s_Utf8UpperToLowerE293[64 * 4] = { + '\xE2', '\x93', '\x9A', 0, + '\xE2', '\x93', '\x9B', 0, + '\xE2', '\x93', '\x9C', 0, + '\xE2', '\x93', '\x9D', 0, + '\xE2', '\x93', '\x9E', 0, + '\xE2', '\x93', '\x9F', 0, + '\xE2', '\x93', '\xA0', 0, + '\xE2', '\x93', '\xA1', 0, + '\xE2', '\x93', '\xA2', 0, + '\xE2', '\x93', '\xA3', 0, + '\xE2', '\x93', '\xA4', 0, + '\xE2', '\x93', '\xA5', 0, + '\xE2', '\x93', '\xA6', 0, + '\xE2', '\x93', '\xA7', 0, + '\xE2', '\x93', '\xA8', 0, + '\xE2', '\x93', '\xA9', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerEFAC[64 * 4] = { + '\x66', '\x00', '\x00', 0, + '\x66', '\x00', '\x00', 0, + '\x66', '\x00', '\x00', 0, + '\x66', '\x00', '\x00', 0, + '\x66', '\x00', '\x00', 0, + '\x73', '\x00', '\x00', 0, + '\x73', '\x00', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xD5', '\xB4', '\x00', 0, + '\xD5', '\xB4', '\x00', 0, + '\xD5', '\xB4', '\x00', 0, + '\xD5', '\xBE', '\x00', 0, + '\xD5', '\xB4', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8UpperToLowerEFBC[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + '\xEF', '\xBD', '\x81', 0, + '\xEF', '\xBD', '\x82', 0, + '\xEF', '\xBD', '\x83', 0, + '\xEF', '\xBD', '\x84', 0, + '\xEF', '\xBD', '\x85', 0, + '\xEF', '\xBD', '\x86', 0, + '\xEF', '\xBD', '\x87', 0, + '\xEF', '\xBD', '\x88', 0, + '\xEF', '\xBD', '\x89', 0, + '\xEF', '\xBD', '\x8A', 0, + '\xEF', '\xBD', '\x8B', 0, + '\xEF', '\xBD', '\x8C', 0, + '\xEF', '\xBD', '\x8D', 0, + '\xEF', '\xBD', '\x8E', 0, + '\xEF', '\xBD', '\x8F', 0, + '\xEF', '\xBD', '\x90', 0, + '\xEF', '\xBD', '\x91', 0, + '\xEF', '\xBD', '\x92', 0, + '\xEF', '\xBD', '\x93', 0, + '\xEF', '\xBD', '\x94', 0, + '\xEF', '\xBD', '\x95', 0, + '\xEF', '\xBD', '\x96', 0, + '\xEF', '\xBD', '\x97', 0, + '\xEF', '\xBD', '\x98', 0, + '\xEF', '\xBD', '\x99', 0, + '\xEF', '\xBD', '\x9A', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char *s_Utf8UpperToLowerTables[32] = { + 0, 0, + s_Utf8UpperToLowerC2, + s_Utf8UpperToLowerC3, + s_Utf8UpperToLowerC4, + s_Utf8UpperToLowerC5, + s_Utf8UpperToLowerC6, + s_Utf8UpperToLowerC7, + s_Utf8UpperToLowerC8, + 0, 0, 0, 0, + s_Utf8UpperToLowerCD, + s_Utf8UpperToLowerCE, + s_Utf8UpperToLowerCF, + s_Utf8UpperToLowerD0, + s_Utf8UpperToLowerD1, + s_Utf8UpperToLowerD2, + s_Utf8UpperToLowerD3, + s_Utf8UpperToLowerD4, + s_Utf8UpperToLowerD5, + s_Utf8UpperToLowerD6, + 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char *s_Utf8UpperToLowerTablesE1[64] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + s_Utf8UpperToLowerE1B8, + s_Utf8UpperToLowerE1B9, + s_Utf8UpperToLowerE1BA, + s_Utf8UpperToLowerE1BB, + s_Utf8UpperToLowerE1BC, + s_Utf8UpperToLowerE1BD, + s_Utf8UpperToLowerE1BE, + s_Utf8UpperToLowerE1BF, +}; + +static const char *s_Utf8UpperToLowerTablesE2[64] = { + 0, 0, 0, 0, + s_Utf8UpperToLowerE284, + s_Utf8UpperToLowerE285, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + s_Utf8UpperToLowerE292, + s_Utf8UpperToLowerE293, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char *s_Utf8UpperToLowerTablesEF[64] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + s_Utf8UpperToLowerEFAC, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + s_Utf8UpperToLowerEFBC, + 0, 0, 0, +}; + +static const char **s_UtfUpperToLowerMap[16] = { + 0, + s_Utf8UpperToLowerTablesE1, + s_Utf8UpperToLowerTablesE2, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + s_Utf8UpperToLowerTablesEF, +}; + +// *************************************************************************** +// *************************************************************************** +// *************************************************************************** + +static const char s_Utf8LowerToUpperC3[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + '\x41', '\x00', '\x00', 0, + '\x41', '\x00', '\x00', 0, + '\x41', '\x00', '\x00', 0, + '\x41', '\x00', '\x00', 0, + '\x41', '\x00', '\x00', 0, + '\xC3', '\x86', '\x00', 0, + '\x43', '\x00', '\x00', 0, + '\x45', '\x00', '\x00', 0, + '\x45', '\x00', '\x00', 0, + '\x45', '\x00', '\x00', 0, + '\x45', '\x00', '\x00', 0, + '\x49', '\x00', '\x00', 0, + '\x49', '\x00', '\x00', 0, + '\x49', '\x00', '\x00', 0, + '\x49', '\x00', '\x00', 0, + '\xC3', '\x90', '\x00', 0, + '\x4E', '\x00', '\x00', 0, + '\x4F', '\x00', '\x00', 0, + '\x4F', '\x00', '\x00', 0, + '\x4F', '\x00', '\x00', 0, + '\x4F', '\x00', '\x00', 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + '\x55', '\x00', '\x00', 0, + '\x55', '\x00', '\x00', 0, + '\x55', '\x00', '\x00', 0, + '\x55', '\x00', '\x00', 0, + '\x59', '\x00', '\x00', 0, + '\xC3', '\x9E', '\x00', 0, + '\x59', '\x00', '\x00', 0, +}; + +static const char s_Utf8LowerToUpperC4[64 * 4] = { + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x43', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x43', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x43', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x43', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x44', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x44', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x47', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x47', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x47', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x47', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x48', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x48', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\xC4', '\xB2', '\x00', 0, + 0, 0, 0, 0, + '\x4A', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4B', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\x4C', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4C', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4C', '\x00', '\x00', 0, + 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperC5[64 * 4] = { + '\x4C', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4C', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4E', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4E', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4E', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xC5', '\x8A', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\xC5', '\x92', '\x00', 0, + 0, 0, 0, 0, + '\x52', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x52', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x52', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x53', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x53', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x53', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x53', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x54', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x54', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x54', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x57', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x59', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\x5A', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x5A', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x5A', '\x00', '\x00', 0, + 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperC6[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\x42', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\x84', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\x43', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\x44', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\x46', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xC7', '\xB6', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + '\x4B', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\x4E', '\x00', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\xA2', '\x00', 0, + 0, 0, 0, 0, + '\x50', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xC6', '\xA7', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\x54', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\x59', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x5A', '\x00', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + '\xC6', '\xB8', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xC6', '\xBC', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xB7', '\x00', 0, +}; + +static const char s_Utf8LowerToUpperC7[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xC7', '\x84', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + '\xC7', '\x87', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xC7', '\x8A', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + '\xC6', '\x8E', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xA2', '\x00', 0, + 0, 0, 0, 0, + '\x47', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x47', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4B', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xAE', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xC7', '\xB1', '\x00', 0, + 0, 0, 0, 0, + '\x47', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + '\x4E', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\xC7', '\xBC', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, +}; + +static const char s_Utf8LowerToUpperC8[64 * 4] = { + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x52', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x52', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x53', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x54', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\xC8', '\x9C', '\x00', 0, + 0, 0, 0, 0, + '\x48', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xC8', '\xA2', '\x00', 0, + 0, 0, 0, 0, + '\x5A', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x59', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperC9[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\x42', '\x00', '\x00', 0, + '\xC6', '\x86', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\x89', '\x00', 0, + '\x44', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\x8F', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\x90', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\x47', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xC6', '\x94', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + '\xC6', '\x96', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xC6', '\x9C', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\x4E', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperCA[64 * 4] = { + '\xC6', '\xA6', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xC6', '\xA9', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\x54', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\xC6', '\xB1', '\x00', 0, + '\x56', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xC6', '\xB7', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperCE[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xCE', '\x86', '\x00', 0, + '\xCE', '\x88', '\x00', 0, + '\xCE', '\x89', '\x00', 0, + '\xCE', '\x8A', '\x00', 0, + 0, 0, 0, 0, + '\xCE', '\x91', '\x00', 0, + '\xCE', '\x92', '\x00', 0, + '\xCE', '\x93', '\x00', 0, + '\xCE', '\x94', '\x00', 0, + '\xCE', '\x95', '\x00', 0, + '\xCE', '\x96', '\x00', 0, + '\xCE', '\x97', '\x00', 0, + '\xCE', '\x98', '\x00', 0, + '\xCD', '\x85', '\x00', 0, + '\xCE', '\x9A', '\x00', 0, + '\xCE', '\x9B', '\x00', 0, + '\xCE', '\x9C', '\x00', 0, + '\xCE', '\x9D', '\x00', 0, + '\xCE', '\x9E', '\x00', 0, + '\xCE', '\x9F', '\x00', 0, +}; + +static const char s_Utf8LowerToUpperCF[64 * 4] = { + '\xCE', '\xA0', '\x00', 0, + '\xCE', '\xA1', '\x00', 0, + 0, 0, 0, 0, + '\xCE', '\xA3', '\x00', 0, + '\xCE', '\xA4', '\x00', 0, + '\xCE', '\xA5', '\x00', 0, + '\xCE', '\xA6', '\x00', 0, + '\xCE', '\xA7', '\x00', 0, + '\xCE', '\xA8', '\x00', 0, + '\xCE', '\xA9', '\x00', 0, + '\xCE', '\xAA', '\x00', 0, + '\xCE', '\xAB', '\x00', 0, + '\xCE', '\x8C', '\x00', 0, + '\xCE', '\x8E', '\x00', 0, + '\xCE', '\x8F', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + '\xCF', '\x98', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x9A', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x9C', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\x9E', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xA0', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xA2', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xA4', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xA6', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xA8', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xAA', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xAC', '\x00', 0, + 0, 0, 0, 0, + '\xCF', '\xAE', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xCF', '\xB9', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xCF', '\xB7', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + '\xCF', '\xBA', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperD0[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xD0', '\x90', '\x00', 0, + '\xD0', '\x91', '\x00', 0, + '\xD0', '\x92', '\x00', 0, + '\xD0', '\x93', '\x00', 0, + '\xD0', '\x94', '\x00', 0, + '\xD0', '\x95', '\x00', 0, + '\xD0', '\x96', '\x00', 0, + '\xD0', '\x97', '\x00', 0, + '\xD0', '\x98', '\x00', 0, + '\xD0', '\x99', '\x00', 0, + '\xD0', '\x9A', '\x00', 0, + '\xD0', '\x9B', '\x00', 0, + '\xD0', '\x9C', '\x00', 0, + '\xD0', '\x9D', '\x00', 0, + '\xD0', '\x9E', '\x00', 0, + '\xD0', '\x9F', '\x00', 0, +}; + +static const char s_Utf8LowerToUpperD1[64 * 4] = { + '\xD0', '\xA0', '\x00', 0, + '\xD0', '\xA1', '\x00', 0, + '\xD0', '\xA2', '\x00', 0, + '\xD0', '\xA3', '\x00', 0, + '\xD0', '\xA4', '\x00', 0, + '\xD0', '\xA5', '\x00', 0, + '\xD0', '\xA6', '\x00', 0, + '\xD0', '\xA7', '\x00', 0, + '\xD0', '\xA8', '\x00', 0, + '\xD0', '\xA9', '\x00', 0, + '\xD0', '\xAA', '\x00', 0, + '\xD0', '\xAB', '\x00', 0, + '\xD0', '\xAC', '\x00', 0, + '\xD0', '\xAD', '\x00', 0, + '\xD0', '\xAE', '\x00', 0, + '\xD0', '\xAF', '\x00', 0, + '\xD0', '\x80', '\x00', 0, + '\xD0', '\x81', '\x00', 0, + '\xD0', '\x82', '\x00', 0, + '\xD0', '\x83', '\x00', 0, + '\xD0', '\x84', '\x00', 0, + '\xD0', '\x85', '\x00', 0, + '\xD0', '\x86', '\x00', 0, + '\xD0', '\x87', '\x00', 0, + '\xD0', '\x88', '\x00', 0, + '\xD0', '\x89', '\x00', 0, + '\xD0', '\x8A', '\x00', 0, + '\xD0', '\x8B', '\x00', 0, + '\xD0', '\x8C', '\x00', 0, + '\xD0', '\x8D', '\x00', 0, + '\xD0', '\x8E', '\x00', 0, + '\xD0', '\x8F', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xA0', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xA2', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xA4', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xA6', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xA8', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xAA', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xAC', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xAE', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xB0', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xB2', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xB4', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xB6', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xB8', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xBA', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xBC', '\x00', 0, + 0, 0, 0, 0, + '\xD1', '\xBE', '\x00', 0, +}; + +static const char s_Utf8LowerToUpperD2[64 * 4] = { + 0, 0, 0, 0, + '\xD2', '\x80', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xD2', '\x8A', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x8C', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x8E', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x90', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x92', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x94', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x96', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x98', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x9A', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x9C', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\x9E', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xA0', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xA2', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xA4', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xA6', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xA8', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xAA', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xAC', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xAE', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xB0', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xB2', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xB4', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xB6', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xB8', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xBA', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xBC', '\x00', 0, + 0, 0, 0, 0, + '\xD2', '\xBE', '\x00', 0, +}; + +static const char s_Utf8LowerToUpperD3[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, + '\xD3', '\x81', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x83', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x85', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x87', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x89', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x8B', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x8D', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + '\xD3', '\x90', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x92', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x94', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x96', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x98', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x9A', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x9C', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\x9E', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xA0', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xA2', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xA4', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xA6', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xA8', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xAA', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xAC', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xAE', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xB0', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xB2', '\x00', 0, + 0, 0, 0, 0, + '\xD3', '\xB4', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + '\xD3', '\xB8', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperD4[64 * 4] = { + 0, 0, 0, 0, + '\xD4', '\x80', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x82', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x84', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x86', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x88', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x8A', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x8C', '\x00', 0, + 0, 0, 0, 0, + '\xD4', '\x8E', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperD5[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + '\xD4', '\xB1', '\x00', 0, + '\xD4', '\xB2', '\x00', 0, + '\xD4', '\xB3', '\x00', 0, + '\xD4', '\xB4', '\x00', 0, + '\xD4', '\xB5', '\x00', 0, + '\xD4', '\xB6', '\x00', 0, + '\xD4', '\xB7', '\x00', 0, + '\xD4', '\xB8', '\x00', 0, + '\xD4', '\xB9', '\x00', 0, + '\xD4', '\xBA', '\x00', 0, + '\xD4', '\xBB', '\x00', 0, + '\xD4', '\xBC', '\x00', 0, + '\xD4', '\xBD', '\x00', 0, + '\xD4', '\xBE', '\x00', 0, + '\xD4', '\xBF', '\x00', 0, + '\xD5', '\x80', '\x00', 0, + '\xD5', '\x81', '\x00', 0, + '\xD5', '\x82', '\x00', 0, + '\xD5', '\x83', '\x00', 0, + '\xD5', '\x84', '\x00', 0, + '\xD5', '\x85', '\x00', 0, + '\xD5', '\x86', '\x00', 0, + '\xD5', '\x87', '\x00', 0, + '\xD5', '\x88', '\x00', 0, + '\xD5', '\x89', '\x00', 0, + '\xD5', '\x8A', '\x00', 0, + '\xD5', '\x8B', '\x00', 0, + '\xD5', '\x8C', '\x00', 0, + '\xD5', '\x8D', '\x00', 0, + '\xD5', '\x8E', '\x00', 0, + '\xD5', '\x8F', '\x00', 0, +}; + +static const char s_Utf8LowerToUpperD6[64 * 4] = { + '\xD5', '\x90', '\x00', 0, + '\xD5', '\x91', '\x00', 0, + '\xD5', '\x92', '\x00', 0, + '\xD5', '\x93', '\x00', 0, + '\xD5', '\x94', '\x00', 0, + '\xD5', '\x95', '\x00', 0, + '\xD5', '\x96', '\x00', 0, + 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperE1B8[64 * 4] = { + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x42', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x42', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x42', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x43', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x44', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x44', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x44', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x44', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x44', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x46', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x47', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x48', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x48', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x48', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x48', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x48', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4B', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4B', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4B', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4C', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4C', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4C', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4C', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4D', '\x00', '\x00', 0, +}; + +static const char s_Utf8LowerToUpperE1B9[64 * 4] = { + 0, 0, 0, 0, + '\x4D', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4D', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4E', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4E', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4E', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4E', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x50', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x50', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x52', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x52', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x52', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x52', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x53', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x53', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x53', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x53', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x53', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x54', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x54', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x54', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x54', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x56', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x56', '\x00', '\x00', 0, +}; + +static const char s_Utf8LowerToUpperE1BA[64 * 4] = { + 0, 0, 0, 0, + '\x57', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x57', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x57', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x57', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x57', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x58', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x58', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x59', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x5A', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x5A', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x5A', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, +}; + +static const char s_Utf8LowerToUpperE1BB[64 * 4] = { + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x45', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x49', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x4F', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x55', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x59', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x59', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x59', '\x00', '\x00', 0, + 0, 0, 0, 0, + '\x59', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperE1BC[64 * 4] = { + '\xE1', '\xBC', '\x88', 0, + '\xE1', '\xBC', '\x89', 0, + '\xE1', '\xBC', '\x8A', 0, + '\xE1', '\xBC', '\x8B', 0, + '\xE1', '\xBC', '\x8C', 0, + '\xE1', '\xBC', '\x8D', 0, + '\xE1', '\xBC', '\x8E', 0, + '\xE1', '\xBC', '\x8F', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBC', '\x98', 0, + '\xE1', '\xBC', '\x99', 0, + '\xE1', '\xBC', '\x9A', 0, + '\xE1', '\xBC', '\x9B', 0, + '\xE1', '\xBC', '\x9C', 0, + '\xE1', '\xBC', '\x9D', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBC', '\xA8', 0, + '\xE1', '\xBC', '\xA9', 0, + '\xE1', '\xBC', '\xAA', 0, + '\xE1', '\xBC', '\xAB', 0, + '\xE1', '\xBC', '\xAC', 0, + '\xE1', '\xBC', '\xAD', 0, + '\xE1', '\xBC', '\xAE', 0, + '\xE1', '\xBC', '\xAF', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBC', '\xB8', 0, + '\xE1', '\xBC', '\xB9', 0, + '\xE1', '\xBC', '\xBA', 0, + '\xE1', '\xBC', '\xBB', 0, + '\xE1', '\xBC', '\xBC', 0, + '\xE1', '\xBC', '\xBD', 0, + '\xE1', '\xBC', '\xBE', 0, + '\xE1', '\xBC', '\xBF', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperE1BD[64 * 4] = { + '\xE1', '\xBD', '\x88', 0, + '\xE1', '\xBD', '\x89', 0, + '\xE1', '\xBD', '\x8A', 0, + '\xE1', '\xBD', '\x8B', 0, + '\xE1', '\xBD', '\x8C', 0, + '\xE1', '\xBD', '\x8D', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + '\xE1', '\xBD', '\x99', 0, + 0, 0, 0, 0, + '\xE1', '\xBD', '\x9B', 0, + 0, 0, 0, 0, + '\xE1', '\xBD', '\x9D', 0, + 0, 0, 0, 0, + '\xE1', '\xBD', '\x9F', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBD', '\xA8', 0, + '\xE1', '\xBD', '\xA9', 0, + '\xE1', '\xBD', '\xAA', 0, + '\xE1', '\xBD', '\xAB', 0, + '\xE1', '\xBD', '\xAC', 0, + '\xE1', '\xBD', '\xAD', 0, + '\xE1', '\xBD', '\xAE', 0, + '\xE1', '\xBD', '\xAF', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBE', '\xBA', 0, + '\xE1', '\xBE', '\xBB', 0, + '\xE1', '\xBF', '\x88', 0, + '\xE1', '\xBF', '\x89', 0, + '\xE1', '\xBF', '\x8A', 0, + '\xE1', '\xBF', '\x8B', 0, + '\xE1', '\xBF', '\x9A', 0, + '\xE1', '\xBF', '\x9B', 0, + '\xE1', '\xBF', '\xB8', 0, + '\xE1', '\xBF', '\xB9', 0, + '\xE1', '\xBF', '\xAA', 0, + '\xE1', '\xBF', '\xAB', 0, + '\xE1', '\xBF', '\xBA', 0, + '\xE1', '\xBF', '\xBB', 0, + 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperE1BE[64 * 4] = { + '\xE1', '\xBE', '\x88', 0, + '\xE1', '\xBE', '\x89', 0, + '\xE1', '\xBE', '\x8A', 0, + '\xE1', '\xBE', '\x8B', 0, + '\xE1', '\xBE', '\x8C', 0, + '\xE1', '\xBE', '\x8D', 0, + '\xE1', '\xBE', '\x8E', 0, + '\xE1', '\xBE', '\x8F', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBE', '\x98', 0, + '\xE1', '\xBE', '\x99', 0, + '\xE1', '\xBE', '\x9A', 0, + '\xE1', '\xBE', '\x9B', 0, + '\xE1', '\xBE', '\x9C', 0, + '\xE1', '\xBE', '\x9D', 0, + '\xE1', '\xBE', '\x9E', 0, + '\xE1', '\xBE', '\x9F', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBE', '\xA8', 0, + '\xE1', '\xBE', '\xA9', 0, + '\xE1', '\xBE', '\xAA', 0, + '\xE1', '\xBE', '\xAB', 0, + '\xE1', '\xBE', '\xAC', 0, + '\xE1', '\xBE', '\xAD', 0, + '\xE1', '\xBE', '\xAE', 0, + '\xE1', '\xBE', '\xAF', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBE', '\xB8', 0, + '\xE1', '\xBE', '\xB9', 0, + 0, 0, 0, 0, + '\xE1', '\xBE', '\xBC', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperE1BF[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBF', '\x8C', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBF', '\x98', 0, + '\xE1', '\xBF', '\x99', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBF', '\xA8', 0, + '\xE1', '\xBF', '\xA9', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBF', '\xAC', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE1', '\xBF', '\xBC', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperE285[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\xE2', '\x85', '\xA0', 0, + '\xE2', '\x85', '\xA1', 0, + '\xE2', '\x85', '\xA2', 0, + '\xE2', '\x85', '\xA3', 0, + '\xE2', '\x85', '\xA4', 0, + '\xE2', '\x85', '\xA5', 0, + '\xE2', '\x85', '\xA6', 0, + '\xE2', '\x85', '\xA7', 0, + '\xE2', '\x85', '\xA8', 0, + '\xE2', '\x85', '\xA9', 0, + '\xE2', '\x85', '\xAA', 0, + '\xE2', '\x85', '\xAB', 0, + '\xE2', '\x85', '\xAC', 0, + '\xE2', '\x85', '\xAD', 0, + '\xE2', '\x85', '\xAE', 0, + '\xE2', '\x85', '\xAF', 0, +}; + +static const char s_Utf8LowerToUpperE293[64 * 4] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + '\x42', '\x00', '\x00', 0, + '\x43', '\x00', '\x00', 0, + '\x44', '\x00', '\x00', 0, + '\x45', '\x00', '\x00', 0, + '\x46', '\x00', '\x00', 0, + '\x47', '\x00', '\x00', 0, + '\x48', '\x00', '\x00', 0, + '\x49', '\x00', '\x00', 0, + '\x4A', '\x00', '\x00', 0, + '\x4B', '\x00', '\x00', 0, + '\x4C', '\x00', '\x00', 0, + '\x4D', '\x00', '\x00', 0, + '\x4E', '\x00', '\x00', 0, + '\x4F', '\x00', '\x00', 0, + '\x50', '\x00', '\x00', 0, + '\x51', '\x00', '\x00', 0, + '\x52', '\x00', '\x00', 0, + '\x53', '\x00', '\x00', 0, + '\x54', '\x00', '\x00', 0, + '\x55', '\x00', '\x00', 0, + '\x56', '\x00', '\x00', 0, + '\x57', '\x00', '\x00', 0, + '\x58', '\x00', '\x00', 0, + '\x59', '\x00', '\x00', 0, + '\x5A', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char s_Utf8LowerToUpperEFBD[64 * 4] = { + 0, 0, 0, 0, + '\x41', '\x00', '\x00', 0, + '\x42', '\x00', '\x00', 0, + '\x43', '\x00', '\x00', 0, + '\x44', '\x00', '\x00', 0, + '\x45', '\x00', '\x00', 0, + '\x46', '\x00', '\x00', 0, + '\x47', '\x00', '\x00', 0, + '\x48', '\x00', '\x00', 0, + '\x49', '\x00', '\x00', 0, + '\x4A', '\x00', '\x00', 0, + '\x4B', '\x00', '\x00', 0, + '\x4C', '\x00', '\x00', 0, + '\x4D', '\x00', '\x00', 0, + '\x4E', '\x00', '\x00', 0, + '\x4F', '\x00', '\x00', 0, + '\x50', '\x00', '\x00', 0, + '\x51', '\x00', '\x00', 0, + '\x52', '\x00', '\x00', 0, + '\x53', '\x00', '\x00', 0, + '\x54', '\x00', '\x00', 0, + '\x55', '\x00', '\x00', 0, + '\x56', '\x00', '\x00', 0, + '\x57', '\x00', '\x00', 0, + '\x58', '\x00', '\x00', 0, + '\x59', '\x00', '\x00', 0, + '\x5A', '\x00', '\x00', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char *s_Utf8LowerToUpperTables[32] = { + 0, 0, 0, + s_Utf8LowerToUpperC3, + s_Utf8LowerToUpperC4, + s_Utf8LowerToUpperC5, + s_Utf8LowerToUpperC6, + s_Utf8LowerToUpperC7, + s_Utf8LowerToUpperC8, + s_Utf8LowerToUpperC9, + s_Utf8LowerToUpperCA, + 0, 0, 0, + s_Utf8LowerToUpperCE, + s_Utf8LowerToUpperCF, + s_Utf8LowerToUpperD0, + s_Utf8LowerToUpperD1, + s_Utf8LowerToUpperD2, + s_Utf8LowerToUpperD3, + s_Utf8LowerToUpperD4, + s_Utf8LowerToUpperD5, + s_Utf8LowerToUpperD6, + 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char *s_Utf8LowerToUpperTablesE1[64] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + s_Utf8LowerToUpperE1B8, + s_Utf8LowerToUpperE1B9, + s_Utf8LowerToUpperE1BA, + s_Utf8LowerToUpperE1BB, + s_Utf8LowerToUpperE1BC, + s_Utf8LowerToUpperE1BD, + s_Utf8LowerToUpperE1BE, + s_Utf8LowerToUpperE1BF, +}; + +static const char *s_Utf8LowerToUpperTablesE2[64] = { + 0, 0, 0, 0, 0, + s_Utf8LowerToUpperE285, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + s_Utf8LowerToUpperE293, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const char *s_Utf8LowerToUpperTablesEF[64] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + s_Utf8LowerToUpperEFBD, + 0, 0, +}; + +static const char **s_UtfLowerToUpperMap[16] = { + 0, + s_Utf8LowerToUpperTablesE1, + s_Utf8LowerToUpperTablesE2, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + s_Utf8LowerToUpperTablesEF, +}; + +// *************************************************************************** +// *************************************************************************** +// *************************************************************************** + +#if 1 + +NL_FORCE_INLINE void appendToLowerAsUtf8(std::string &res, const char *str, ptrdiff_t &i) +{ + char c = str[i]; + char d, e; + if (c >= 'A' && c <= 'Z') + { + // 1-byte UTF-8 + c += 'a' - 'A'; + } + else if ((c & 0xE0) == 0xC0 && ((d = str[i + 1]) & 0xC0) == 0x80) + { + // 2-byte UTF-8 + const char *table = s_Utf8UpperToLowerTables[c & 0x1F]; + if (table) + { + unsigned char idx = (d & 0x3F) << 2; + if (table[idx]) + { + res += &table[idx]; + ++i; + return; + } + } + } + else if ((c & 0xF0) == 0xE0 && ((d = str[i + 1]) & 0xC0) == 0x80 && ((e = str[i + 2]) & 0xC0) == 0x80) + { + // 3-byte UTF-8 + const char **map = s_UtfUpperToLowerMap[c & 0x0F]; + if (map) + { + const char *table = map[d & 0x3F]; + if (table) + { + unsigned char idx = (d & 0x3F) << 2; + if (table[idx]) + { + res += &table[idx]; + i += 2; + return; + } + } + } + } + res += c; +} + +std::string toLower(const char *str) +{ + // UTF-8 toLower, tables generated from UTF-16 tables + std::string res; + for (ptrdiff_t i = 0; str[i]; ++i) + appendToLowerAsUtf8(res, str, i); + return res; +} + +// *************************************************************************** + +std::string toLower(const std::string &str) +{ + // UTF-8 toLower, tables generated from UTF-16 tables + std::string res; + res.reserve(str.size() + (str.size() >> 2)); + const char *cstr = &str[0]; + for (ptrdiff_t i = 0; i < (ptrdiff_t)str.size(); ++i) + appendToLowerAsUtf8(res, cstr, i); + return res; +} + +// *************************************************************************** +// *************************************************************************** +// *************************************************************************** + +NL_FORCE_INLINE void appendToUpperAsUtf8(std::string &res, const char *str, ptrdiff_t &i) +{ + char c = str[i]; + char d, e; + if (c >= 'a' && c <= 'z') + { + // 1-byte UTF-8 + c -= 'a' - 'A'; + } + else if ((c & 0xE0) == 0xC0 && ((d = str[i + 1]) & 0xC0) == 0x80) + { + // 2-byte UTF-8 + const char *table = s_Utf8LowerToUpperTables[c & 0x1F]; + if (table) + { + unsigned char idx = (d & 0x3F) << 2; + if (table[idx]) + { + res += &table[idx]; + ++i; + return; + } + } + } + else if ((c & 0xF0) == 0xE0 && ((d = str[i + 1]) & 0xC0) == 0x80 && ((e = str[i + 2]) & 0xC0) == 0x80) + { + // 3-byte UTF-8 + const char **map = s_UtfLowerToUpperMap[c & 0x0F]; + if (map) + { + const char *table = map[d & 0x3F]; + if (table) + { + unsigned char idx = (d & 0x3F) << 2; + if (table[idx]) + { + res += &table[idx]; + i += 2; + return; + } + } + } + } + res += c; +} + +// *************************************************************************** + +std::string toUpper(const char *str) +{ + // UTF-8 toLower, tables generated from UTF-16 tables + std::string res; + for (ptrdiff_t i = 0; str[i]; ++i) + appendToUpperAsUtf8(res, str, i); + return res; +} + +// *************************************************************************** + +std::string toUpper(const std::string &str) +{ + // UTF-8 toLower, tables generated from UTF-16 tables + std::string res; + res.reserve(str.size() + (str.size() >> 2)); + const char *cstr = &str[0]; + for (ptrdiff_t i = 0; i < (ptrdiff_t)str.size(); ++i) + appendToUpperAsUtf8(res, cstr, i); + return res; +} + +// *************************************************************************** + +#else + +// *************************************************************************** + +static std::string toLowerAsUtf8(CUtfStringView sv) +{ + // UTF-16 implementation-based + std::string res; + res.reserve(sv.largestSize()); + for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) + { + u32char c = *it; + if (c < 0x10000) + { + ucchar uc = c; + ucchar *result = toLowerUpperSearch(&uc, UnicodeUpperToLower); + if (result) + c = result[1]; + } + CUtfStringView::append(res, c); + } + return res; +} + +std::string toLowerAsUtf8(const char *str) +{ + return toLowerAsUtf8(CUtfStringView(str)); +} + +// *************************************************************************** + +std::string toLowerAsUtf8(const std::string &str) +{ + return toLowerAsUtf8(CUtfStringView(str)); +} + +// *************************************************************************** +// *************************************************************************** // *************************************************************************** static std::string toUpperAsUtf8(CUtfStringView sv) @@ -2044,6 +4927,8 @@ static std::string toUpperAsUtf8(CUtfStringView sv) return res; } +// *************************************************************************** + std::string toUpperAsUtf8(const char *str) { return toUpperAsUtf8(CUtfStringView(str)); @@ -2056,6 +4941,219 @@ std::string toUpperAsUtf8(const std::string &str) return toUpperAsUtf8(CUtfStringView(str)); } +#endif + +// *************************************************************************** +// *************************************************************************** +// *************************************************************************** + +#if 0 + +std::string getUtf8(char32_t c) +{ + std::string res; + if (c < 0x80) + { + // Encode as 1 byte + res += (char)c; + } + else if (c < 0x0800) + { + // Encode as 2 bytes + res += (char)((c & 0x07C0) >> 6) | 0xC0; + res += (char)(c & 0x3F) | 0x80; + } + else + { + // Encode as 3 bytes + res += (char)((c & 0xF000) >> 12) | 0xE0; + res += (char)((c & 0x0FC0) >> 6) | 0x80; + res += (char)(c & 0x3F) | 0x80; + } + return res; +} + +void printStringMap(const std::string &name, std::map &m, bool trim) +{ + std::cout << "static const char " << name << "[" << (trim ? "64" : "256") << " * 4] = {\n"; + bool zero = false; + for (int i = 0; i < (trim ? 64 : 256); ++i) + { + int x = trim ? i + 0x80 : i; + if (m.find(x) == m.end()) + { + if (x % 8 == 7) + { + zero = false; + std::cout << "0, 0, 0, 0,\n"; + } + else + { + zero = true; + std::cout << "0, 0, 0, 0, "; + } + } + else + { + if (zero) std::cout << "\n"; + std::cout << "'\\x" << std::hex << std::setw(2) << std::setfill('0') << std::uppercase << (m[x].length() > 0 ? (unsigned char)m[x][0] : 0) + << "', '\\x" << std::hex << std::setw(2) << std::setfill('0') << std::uppercase << (m[x].length() > 1 ? (unsigned char)m[x][1] : 0) + << "', '\\x" << std::hex << std::setw(2) << std::setfill('0') << std::uppercase << (m[x].length() > 2 ? (unsigned char)m[x][2] : 0) + << "', 0,\n"; + zero = false; + } + } + if (zero) std::cout << "\n"; + std::cout << "};\n\n"; +} + +void printMapMap(const std::string &name, const std::string &strName, std::map> &m, bool trim) +{ + std::cout << "static const char *" << name << "[" << (trim ? "64" : "256") << " * 2] = {\n"; + bool zero = false; + for (int i = 0; i < (trim ? 64 : 256); ++i) + { + int x = trim ? (i + 0x80) : i; + if (m.find(x) == m.end()) + x = trim ? (i + 0xC0) : i; + if (m.find(x) == m.end()) + { + if (x % 32 == 1315) + { + zero = false; + std::cout << "0, \n"; + } + else + { + zero = true; + std::cout << "0, "; + } + } + else + { + if (zero) std::cout << "\n"; + std::stringstream n; + n << strName; + n << std::hex << std::setw(2) << std::setfill('0') << std::uppercase << (unsigned int)x; + std::cout << n.str() << ",\n"; + zero = false; + } + } + if (zero) std::cout << "\n"; + std::cout << "};\n\n"; +} + +void printMapMapMap(const std::string &name, const std::string &mapName, std::map>> &m, bool trim) +{ + std::cout << "static const char **" << name << "[" << (trim ? "64" : "256") << " * 2] = {\n"; + bool zero = false; + for (int i = 0; i < (trim ? 64 : 256); ++i) + { + int x = trim ? (i + 0x80) : i; + if (m.find(x) == m.end()) + x = trim ? (i + 0xC0) : i; + if (m.find(x) == m.end()) + { + if (x % 32 == 1315) + { + zero = false; + std::cout << "0, \n"; + } + else + { + zero = true; + std::cout << "0, "; + } + } + else + { + if (zero) std::cout << "\n"; + std::stringstream n; + n << mapName; + n << std::hex << std::setw(2) << std::setfill('0') << std::uppercase << (unsigned int)x; + std::cout << n.str() << ",\n"; + zero = false; + } + } + if (zero) std::cout << "\n"; + std::cout << "};\n\n"; +} + +void generate() +{ + std::map m1; + std::map> m2; + std::map>> m3; + for (int i = 0; i < sizeof(UnicodeLowerToUpper) / sizeof(UnicodeLowerToUpper[0]); i += 2) + { + std::string from = getUtf8(UnicodeLowerToUpper[i]); + std::string to = getUtf8(UnicodeLowerToUpper[i + 1]); + // assert(from.size() == to.size()); + if (from.length() == 1) + { + m1[from[0]] = to; + } + else if (from.length() == 2) + { + if (m2.find(from[0]) == m2.end()) + m2[from[0]] = std::map(); + m2[from[0]][from[1]] = to; + } + else if (from.length() == 3) + { + if (m3.find(from[0]) == m3.end()) + m3[from[0]] = std::map>(); + if (m3[from[0]].find(from[1]) == m3[from[0]].end()) + m3[from[0]][from[1]] = std::map(); + m3[from[0]][from[1]][from[2]] = to; + } + } + printStringMap("s_Utf8LowerToUpper", m1, false); + for (int i = 0; i < 256; ++i) + { + std::stringstream n; + n << "s_Utf8LowerToUpper"; + if (m2.find(i) != m2.end()) + { + n << std::hex << std::setw(2) << std::setfill('0') << std::uppercase << (unsigned int)i; + printStringMap(n.str(), m2[i], true); + } + else if (m3.find(i) != m3.end()) + { + n << std::hex << std::setw(2) << std::setfill('0') << std::uppercase << (unsigned int)i; + for (int j = 0; j < 256; ++j) + { + if (m3[i].find(j) != m3[i].end()) + { + std::stringstream nn; + nn << n.str(); + nn << std::hex << std::setw(2) << std::setfill('0') << std::uppercase << (unsigned int)j; + printStringMap(nn.str(), m3[i][j], true); + } + } + } + } + printMapMap("s_Utf8LowerToUpperTables", "s_Utf8LowerToUpper", m2, true); + for (int i = 0; i < 256; ++i) + { + std::stringstream n; + n << "s_Utf8LowerToUpperTables"; + std::stringstream nn; + nn << "s_Utf8LowerToUpper"; + if (m3.find(i) != m3.end()) + { + n << std::hex << std::setw(2) << std::setfill('0') << std::uppercase << (unsigned int)i; + nn << std::hex << std::setw(2) << std::setfill('0') << std::uppercase << (unsigned int)i; + printMapMap(n.str(), nn.str(), m3[i], true); + } + } + printMapMapMap("s_UtfLowerToUpperMap", "s_Utf8LowerToUpperTables", m3, true); +} + +#endif + +// *************************************************************************** +// *************************************************************************** // *************************************************************************** } // NLMISC From 2eb088ef1cc5d71ac20a3ef178ee02e3f3e14506 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 01:58:24 +0800 Subject: [PATCH 064/205] Cleanup, ryzom/ryzomcore#335 --- nel/include/nel/gui/string_case.h | 5 -- nel/src/gui/string_case.cpp | 100 +----------------------------- 2 files changed, 1 insertion(+), 104 deletions(-) diff --git a/nel/include/nel/gui/string_case.h b/nel/include/nel/gui/string_case.h index 300d72c76..bd56c7998 100644 --- a/nel/include/nel/gui/string_case.h +++ b/nel/include/nel/gui/string_case.h @@ -25,7 +25,6 @@ namespace NLGUI { - enum TCaseMode { CaseNormal = 0, // Nothing done @@ -37,11 +36,7 @@ namespace NLGUI CaseCount }; - - void setCase( ucstring &str, TCaseMode mode ); void setCase( std::string &str, TCaseMode mode ); - - } #endif diff --git a/nel/src/gui/string_case.cpp b/nel/src/gui/string_case.cpp index f6218d39a..8946a5d1d 100644 --- a/nel/src/gui/string_case.cpp +++ b/nel/src/gui/string_case.cpp @@ -32,18 +32,6 @@ namespace NLGUI return (c == (u32char)' ') || (c == (u32char)'\t') || (c == (u32char)'\n') || (c == (u32char)'\r'); } - inline bool isSeparator (ucchar c) - { - return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r'); - } - - inline bool isSeparator (char c) - { - return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r'); - } - - // *************************************************************************** - inline bool isEndSentence (u32char c, u32char lastChar) { // Ex: One sentence. Another sentence. @@ -54,90 +42,6 @@ namespace NLGUI && (lastChar == (u32char)'.') || (lastChar == (u32char)'!') || (lastChar == (u32char)'?'); } - inline bool isEndSentence (ucstring& str, uint index) - { - // Ex: One sentence. Another sentence. - // ^ - // Counterexample: nevrax.com - // ^ - ucchar c = str[index]; - if ((str[index] == ' ') || (str[index] == '\n')) - { - if (index < 1) - return false; - c = str[index-1]; - return (c == '.') || (c == '!') || (c == '?'); - } - return false; - } - - - void setCase( ucstring &str, TCaseMode mode ) - { - const uint length = (uint)str.length(); - uint i; - bool newString = true; - bool newSentence = true; - bool newWord = true; - switch (mode) - { - case CaseLower: - str = NLMISC::toLower (str); - break; - case CaseUpper: - str = NLMISC::toUpper (str); - break; - case CaseFirstStringLetterUp: - for (i=0; i Date: Thu, 29 Oct 2020 02:15:10 +0800 Subject: [PATCH 065/205] Fix bad value in toUpper table --- nel/src/misc/unicode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nel/src/misc/unicode.cpp b/nel/src/misc/unicode.cpp index 50cefbf71..5597fb68d 100644 --- a/nel/src/misc/unicode.cpp +++ b/nel/src/misc/unicode.cpp @@ -1233,7 +1233,7 @@ static const ucchar UnicodeLowerToUpper[]= 0x03B6, 0x0396, // GREEK CAPITAL LETTER ZETA 0x03B7, 0x0397, // GREEK CAPITAL LETTER ETA 0x03B8, 0x0398, // GREEK CAPITAL LETTER THETA - 0x03B9, 0x0345, // COMBINING GREEK YPOGEGRAMMENI + 0x03B9, 0x0399, // GREEK CAPITAL LETTER IOTA 0x03BA, 0x039A, // GREEK CAPITAL LETTER KAPPA 0x03BB, 0x039B, // GREEK CAPITAL LETTER LAMDA 0x03BC, 0x039C, // GREEK CAPITAL LETTER MU @@ -3819,7 +3819,7 @@ static const char s_Utf8LowerToUpperCE[64 * 4] = { '\xCE', '\x96', '\x00', 0, '\xCE', '\x97', '\x00', 0, '\xCE', '\x98', '\x00', 0, - '\xCD', '\x85', '\x00', 0, + '\xCE', '\x99', '\x00', 0, '\xCE', '\x9A', '\x00', 0, '\xCE', '\x9B', '\x00', 0, '\xCE', '\x9C', '\x00', 0, From 6cd52d7871a86089057ffac3c6aae1339cbf109a Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 02:24:14 +0800 Subject: [PATCH 066/205] Note --- nel/src/misc/unicode.cpp | 3 +++ ryzom/client/src/interface_v3/interface_manager.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nel/src/misc/unicode.cpp b/nel/src/misc/unicode.cpp index 5597fb68d..d28a7c56e 100644 --- a/nel/src/misc/unicode.cpp +++ b/nel/src/misc/unicode.cpp @@ -25,6 +25,9 @@ namespace NLMISC { +// TODO / FIXME: Write tool to regenerate the unicode tables in this file +// See: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt + // Uppercase to lowercase 16 bits unicode. This table must be sorted. First entry must be unique. static const ucchar UnicodeUpperToLower[]= { diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index fdc132030..8a87c7cd4 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -354,7 +354,7 @@ public: if(UserEntity) { ucstring name = UserEntity->getEntityName(); - if (*it == 'P') setCase(name, CaseUpper); + if (*it == 'P') name = toUpper(name); formatedResult += name; } } From 1963bdedcc160cab9ef62da5b15add456eae8afc Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 02:55:15 +0800 Subject: [PATCH 067/205] UTF-8 context help, ryzom/ryzomcore#335 --- nel/include/nel/gui/ctrl_base.h | 15 ++-- nel/include/nel/gui/widget_manager.h | 6 +- nel/src/gui/ctrl_base.cpp | 35 +++++----- nel/src/gui/group_container.cpp | 8 +-- nel/src/gui/group_html.cpp | 10 +-- nel/src/gui/view_text.cpp | 2 +- nel/src/gui/widget_manager.cpp | 2 +- ryzom/client/src/connection.cpp | 2 +- ryzom/client/src/init_main_loop.cpp | 4 +- .../src/interface_v3/action_handler_game.cpp | 26 +++---- .../src/interface_v3/action_handler_help.cpp | 44 ++++++------ .../interface_v3/action_handler_phrase.cpp | 2 +- .../src/interface_v3/action_phrase_faber.cpp | 6 +- .../src/interface_v3/bot_chat_page_trade.cpp | 30 ++++---- .../client/src/interface_v3/dbctrl_sheet.cpp | 29 ++++---- ryzom/client/src/interface_v3/dbctrl_sheet.h | 4 +- .../interface_v3/dbgroup_list_sheet_text.cpp | 12 ++-- .../interface_v3/dbgroup_list_sheet_text.h | 4 +- .../dbgroup_list_sheet_text_phrase.cpp | 6 +- .../dbgroup_list_sheet_text_phrase_id.cpp | 4 +- .../interface_v3/dbgroup_list_sheet_trade.cpp | 68 +++++++++---------- .../client/src/interface_v3/group_compas.cpp | 5 +- .../interface_v3/group_in_scene_bubble.cpp | 4 +- .../interface_v3/group_in_scene_user_info.cpp | 2 +- ryzom/client/src/interface_v3/group_map.cpp | 36 +++++----- .../client/src/interface_v3/guild_manager.cpp | 6 +- .../src/interface_v3/interface_manager.cpp | 4 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 2 +- ryzom/client/src/interface_v3/people_list.cpp | 6 +- .../client/src/r2/displayer_visual_group.cpp | 12 ++-- ryzom/client/src/r2/instance_map_deco.cpp | 7 +- ryzom/client/src/r2/instance_map_deco.h | 2 +- 32 files changed, 206 insertions(+), 199 deletions(-) diff --git a/nel/include/nel/gui/ctrl_base.h b/nel/include/nel/gui/ctrl_base.h index a8bdef85f..39b795252 100644 --- a/nel/include/nel/gui/ctrl_base.h +++ b/nel/include/nel/gui/ctrl_base.h @@ -85,9 +85,10 @@ namespace NLGUI /// Get the ContextHelp for this control. Default is to return _ContextHelp - virtual void getContextHelp(ucstring &help) const {help= _ContextHelp;} + virtual void getContextHelp(std::string &help) const {help= _ContextHelp;} + virtual void getContextHelpAsUtf16(ucstring &help) const {help.fromUtf8(_ContextHelp);} /// Get the ContextHelp for this control, with tooltip specific code. Default behaviour is identical to getContextHelp. - virtual void getContextHelpToolTip(ucstring &help) const { getContextHelp(help); } + virtual void getContextHelpToolTip(std::string &help) const { getContextHelp(help); } // Get the name of the context help window. Default to "context_help" virtual std::string getContextHelpWindowName() const; /// Get the ContextHelp ActionHandler. If "", noop @@ -123,8 +124,10 @@ namespace NLGUI void setToolTipPosRef(THotSpot pos) { _ToolTipPosRef = pos;} /// replace the default contextHelp - ucstring getDefaultContextHelp() const {return _ContextHelp;} - void setDefaultContextHelp(const ucstring &help) {_ContextHelp= help;} + std::string getDefaultContextHelp() const {return _ContextHelp;} + void setDefaultContextHelp(const std::string &help) {_ContextHelp= help;} + ucstring getDefaultContextHelpAsUtf16() const {return ucstring::makeFromUtf8(_ContextHelp);} + void setDefaultContextHelpAsUtf16(const ucstring &help) {_ContextHelp= help.toUtf8();} void setOnContextHelp(const std::string &help) {_OnContextHelp= help;} void setOnContextHelpAHParams(const std::string &p) {_OnContextHelpParams= p;} @@ -158,7 +161,7 @@ namespace NLGUI int luaSetTooltipUtf8(CLuaState &ls); REFLECT_EXPORT_START(CCtrlBase, CViewBase) - REFLECT_UCSTRING("tooltip", getDefaultContextHelp, setDefaultContextHelp); + REFLECT_UCSTRING("tooltip", getDefaultContextHelpAsUtf16, setDefaultContextHelpAsUtf16); // FIXME: Lua UTF-8 REFLECT_LUA_METHOD("setTooltipUtf8", luaSetTooltipUtf8); REFLECT_EXPORT_END @@ -171,7 +174,7 @@ namespace NLGUI protected: // This is the ContextHelp filled by default in parse() - ucstring _ContextHelp; + std::string _ContextHelp; CStringShared _OnContextHelp; CStringShared _OnContextHelpParams; CStringShared _ToolTipSpecialParent; diff --git a/nel/include/nel/gui/widget_manager.h b/nel/include/nel/gui/widget_manager.h index fced74024..e8b4e376c 100644 --- a/nel/include/nel/gui/widget_manager.h +++ b/nel/include/nel/gui/widget_manager.h @@ -333,8 +333,8 @@ namespace NLGUI void updateTooltipCoords(CCtrlBase *newCtrl); /// for ContextHelp action handler only: set the result name - void setContextHelpText( const ucstring &text ){ _ContextHelpText = text; } - ucstring& getContextHelpText(){ return _ContextHelpText; } + void setContextHelpText( const std::string &text ){ _ContextHelpText = text; } + std::string& getContextHelpText(){ return _ContextHelpText; } /// force disable the context help void disableContextHelp(); @@ -626,7 +626,7 @@ namespace NLGUI SInterfaceTimes interfaceTimes; - ucstring _ContextHelpText; + std::string _ContextHelpText; bool _ContextHelpActive; bool inGame; diff --git a/nel/src/gui/ctrl_base.cpp b/nel/src/gui/ctrl_base.cpp index 0124bfdee..75c3024f3 100644 --- a/nel/src/gui/ctrl_base.cpp +++ b/nel/src/gui/ctrl_base.cpp @@ -127,9 +127,9 @@ namespace NLGUI { // Force I18N tooltip if (!editorMode) - _ContextHelp = CI18N::get((const char *)prop); + _ContextHelp = CI18N::get((const char *)prop).toUtf8(); else - _ContextHelp.fromUtf8((const char *)prop); + _ContextHelp = (const char *)prop; } else { @@ -138,9 +138,9 @@ namespace NLGUI if (prop) { if (!editorMode && NLMISC::startsWith((const char *)prop, "ui")) - _ContextHelp = CI18N::get((const char *)prop); + _ContextHelp = CI18N::get((const char *)prop).toUtf8(); else - _ContextHelp.fromUtf8((const char *)prop); + _ContextHelp = (const char *)prop; } } @@ -197,12 +197,12 @@ namespace NLGUI { if( name == "tooltip" ) { - return _ContextHelp.toUtf8(); + return _ContextHelp; } else if( name == "tooltip_i18n" ) { - return _ContextHelp.toUtf8(); + return _ContextHelp; } else if( name == "on_tooltip" ) @@ -259,18 +259,18 @@ namespace NLGUI if( name == "tooltip" ) { if (!editorMode && NLMISC::startsWith(value, "ui")) - _ContextHelp = CI18N::get(value); + _ContextHelp = CI18N::get(value).toUtf8(); else - _ContextHelp.fromUtf8(value); + _ContextHelp = value; return; } else if( name == "tooltip_i18n" ) { if (!editorMode) - _ContextHelp = CI18N::get(value); + _ContextHelp = CI18N::get(value).toUtf8(); else - _ContextHelp.fromUtf8(value); + _ContextHelp = value; return; } else @@ -382,8 +382,8 @@ namespace NLGUI if( node == NULL ) return NULL; - xmlNewProp( node, BAD_CAST "tooltip", BAD_CAST _ContextHelp.toString().c_str() ); - xmlNewProp( node, BAD_CAST "tooltip_i18n", BAD_CAST _ContextHelp.toString().c_str() ); + xmlNewProp( node, BAD_CAST "tooltip", BAD_CAST _ContextHelp.c_str() ); + xmlNewProp( node, BAD_CAST "tooltip_i18n", BAD_CAST _ContextHelp.c_str() ); xmlNewProp( node, BAD_CAST "on_tooltip", BAD_CAST _OnContextHelp.toString().c_str() ); xmlNewProp( node, BAD_CAST "on_tooltip_params", BAD_CAST _OnContextHelpParams.toString().c_str() ); xmlNewProp( node, BAD_CAST "tooltip_parent", BAD_CAST tooltipParentToString( _ToolTipParent ).c_str() ); @@ -476,7 +476,7 @@ namespace NLGUI // *************************************************************************** bool CCtrlBase::emptyContextHelp() const { - ucstring help; + std::string help; getContextHelp(help); std::string sTmp = _OnContextHelp; return help.empty() && sTmp.empty(); @@ -494,12 +494,15 @@ namespace NLGUI void CCtrlBase::serial(NLMISC::IStream &f) { CViewBase::serial(f); + + uint version = f.serialVersion(1); + nlassert(version); + f.serial(_ContextHelp); f.serial(_OnContextHelp); f.serial(_OnContextHelpParams); f.serial(_ToolTipSpecialParent); f.serialEnum(_ToolTipParent); - // THotSpot tmpToolTipParentPosRef = _ToolTipParentPosRef; THotSpot tmpToolTipPosRef = _ToolTipPosRef; @@ -515,7 +518,7 @@ namespace NLGUI _ToolTipPosRef = tmpToolTipPosRef; _ToolTipParentPosRefAlt = tmpToolTipParentPosRefAlt; _ToolTipPosRefAlt = tmpToolTipPosRefAlt; - // + nlSerialBitBool(f, _ToolTipInstant); } @@ -577,7 +580,7 @@ namespace NLGUI CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); std::string tooltip = ls.toString(1); - setDefaultContextHelp(ucstring::makeFromUtf8(tooltip)); + setDefaultContextHelp(tooltip); return 0; } diff --git a/nel/src/gui/group_container.cpp b/nel/src/gui/group_container.cpp index 7bab62820..f0a023c39 100644 --- a/nel/src/gui/group_container.cpp +++ b/nel/src/gui/group_container.cpp @@ -3538,7 +3538,7 @@ namespace NLGUI _RightButton->setTexturePushed (pLayer->getValStr ("right_button_tx_popin")); _RightButton->setTextureOver (pLayer->getValStr ("right_button_tx_over")); _RightButton->setActionOnLeftClick ("ic_popin"); - _RightButton->setDefaultContextHelp(CI18N::get("uiPopinWindow")); + _RightButton->setDefaultContextHelp(CI18N::get("uiPopinWindow").toUtf8()); } else // else the container can be deactivated ? deactivate button { @@ -3546,7 +3546,7 @@ namespace NLGUI _RightButton->setTexturePushed (pLayer->getValStr ("right_button_tx_deactive")); _RightButton->setTextureOver (pLayer->getValStr ("right_button_tx_over")); _RightButton->setActionOnLeftClick ("ic_deactive"); - _RightButton->setDefaultContextHelp(CI18N::get("uiClose")); + _RightButton->setDefaultContextHelp(CI18N::get("uiClose").toUtf8()); } } } @@ -3559,7 +3559,7 @@ namespace NLGUI _RightButton->setTexturePushed (pLayer->getValStr ("right_button_tx_popup")); _RightButton->setTextureOver (pLayer->getValStr ("right_button_tx_over")); _RightButton->setActionOnLeftClick ("ic_popup"); - _RightButton->setDefaultContextHelp(CI18N::get("uiPopupWindow")); + _RightButton->setDefaultContextHelp(CI18N::get("uiPopupWindow").toUtf8()); } _RightButton->setActive(!_Locked); } @@ -3602,7 +3602,7 @@ namespace NLGUI _HelpButton->setTexturePushed (pLayer->getValStr ("help_button_tx")); _HelpButton->setTextureOver (pLayer->getValStr ("help_button_tx_over")); _HelpButton->setActionOnLeftClick ("ic_help"); - _HelpButton->setDefaultContextHelp(CI18N::get("uiHelp")); + _HelpButton->setDefaultContextHelp(CI18N::get("uiHelp").toUtf8()); } // if not layer 0 diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index e6b1ba473..08bf1b7c1 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -2888,7 +2888,7 @@ namespace NLGUI ctrlButton->setModulateGlobalColorAll (false); // Translate the tooltip - ctrlButton->setDefaultContextHelp(ucstring::makeFromUtf8(getLinkTitle())); + ctrlButton->setDefaultContextHelp(getLinkTitle()); ctrlButton->setText(tmpStr); // empty url / button disabled bool disabled = string(getLink()).empty(); @@ -3229,12 +3229,12 @@ namespace NLGUI { if (CI18N::hasTranslation(tooltip)) { - ctrlButton->setDefaultContextHelp(CI18N::get(tooltip)); + ctrlButton->setDefaultContextHelp(CI18N::get(tooltip).toUtf8()); //ctrlButton->setOnContextHelp(CI18N::get(tooltip).toString()); } else { - ctrlButton->setDefaultContextHelp(ucstring::makeFromUtf8(tooltip)); + ctrlButton->setDefaultContextHelp(tooltip); //ctrlButton->setOnContextHelp(string(tooltip)); } @@ -5467,11 +5467,11 @@ namespace NLGUI { if (CI18N::hasTranslation(tooltip)) { - ctrlButton->setDefaultContextHelp(CI18N::get(tooltip)); + ctrlButton->setDefaultContextHelp(CI18N::get(tooltip).toUtf8()); } else { - ctrlButton->setDefaultContextHelp(ucstring::makeFromUtf8(tooltip)); + ctrlButton->setDefaultContextHelp(tooltip); } } diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index 367a3182b..d23d89f87 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -3346,7 +3346,7 @@ namespace NLGUI pTooltip->setRenderLayer(getRenderLayer()); std::string tempTooltipStr = tempTooltips[i].toUtf8(); bool isI18N = NLMISC::startsWith(tempTooltipStr, "ui"); - pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltipStr) : ucstring::makeFromUtf8(tempTooltipStr)); + pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltipStr).toUtf8() : tempTooltipStr); pTooltip->setParentPos(this); pTooltip->setParentPosRef(Hotspot_BR); pTooltip->setPosRef(Hotspot_BR); diff --git a/nel/src/gui/widget_manager.cpp b/nel/src/gui/widget_manager.cpp index 2da9f9bdf..864e4ef5b 100644 --- a/nel/src/gui/widget_manager.cpp +++ b/nel/src/gui/widget_manager.cpp @@ -1516,7 +1516,7 @@ namespace NLGUI CViewText *pTxt = (CViewText*)groupContextHelp->getView("text"); if (pTxt != NULL) { - pTxt->setTextFormatTaged(_ContextHelpText.toUtf8()); + pTxt->setTextFormatTaged(_ContextHelpText); // update only to get correct W/H groupContextHelp->updateCoords (); diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 36df595bf..1ce257f2c 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -2317,7 +2317,7 @@ public: CCtrlBase *pBut = pNewLine->getCtrl("but"); if (pBut != NULL) { - pBut->setDefaultContextHelp(tooltip); + pBut->setDefaultContextHelp(tooltip.toUtf8()); } addGroupInList(pNewLine); } diff --git a/ryzom/client/src/init_main_loop.cpp b/ryzom/client/src/init_main_loop.cpp index deeda2149..9c8890775 100644 --- a/ryzom/client/src/init_main_loop.cpp +++ b/ryzom/client/src/init_main_loop.cpp @@ -1692,7 +1692,7 @@ void initBloomConfigUI() if(!supportBloom) { if(group) - group->setDefaultContextHelp(CI18N::get("uiFxTooltipBloom")); + group->setDefaultContextHelp(CI18N::get("uiFxTooltipBloom").toUtf8()); ClientCfg.writeBool("FXAA", false); ClientCfg.writeBool("Bloom", false); @@ -1702,6 +1702,6 @@ void initBloomConfigUI() else { if(group) - group->setDefaultContextHelp(ucstring("")); + group->setDefaultContextHelp(std::string()); } } diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 44c6e64fb..2901bb261 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2116,7 +2116,7 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler pVBR->setColor(CRGBA(0,0,0,0)); if (pTooltip) - pTooltip->setDefaultContextHelp(ucstring("")); + pTooltip->setDefaultContextHelp(std::string()); return; } @@ -2140,7 +2140,7 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler pVBR->setColor(CRGBA(0,0,0,0)); if (pTooltip) - pTooltip->setDefaultContextHelp(CI18N::get("uittTargetUnknown")); + pTooltip->setDefaultContextHelp(CI18N::get("uittTargetUnknown").toUtf8()); return; } @@ -2169,7 +2169,7 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler pVBR->setColor(CRGBA(0,0,0,0)); if (pTooltip) - pTooltip->setDefaultContextHelp(ucstring("")); + pTooltip->setDefaultContextHelp(std::string()); return; } @@ -2194,7 +2194,7 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler CCtrlBase *tooltip = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:target:header_opened:force")); if (tooltip) { - ucstring str; + string str; if (nForceRegion == 1) nForceRegion = 2; @@ -2205,7 +2205,7 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler sint min = (nForceRegion-2) * 50 + (nLevelForce-1) * 10 + 1; sint max = (nForceRegion-2) * 50 + nLevelForce * 10; - str= CI18N::get("uittTargetLevel"); + str= CI18N::get("uittTargetLevel").toUtf8(); strFindReplace(str, "%min", toString(min)); strFindReplace(str, "%max", toString(max)); } @@ -2214,16 +2214,16 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler { sint n = (nForceRegion-1) * 50; if (pE->isNPC()) - str= CI18N::get("uittTargetGuardBoss"); + str= CI18N::get("uittTargetGuardBoss").toUtf8(); else - str= CI18N::get("uittTargetBoss"); + str= CI18N::get("uittTargetBoss").toUtf8(); strFindReplace(str, "%n", toString("%d", n) ); } // Named else { sint n = (nForceRegion-1) * 50; - str= CI18N::get("uittTargetNamed"); + str= CI18N::get("uittTargetNamed").toUtf8(); strFindReplace(str, "%n", toString("%d", n) ); } @@ -4059,7 +4059,7 @@ public: ucstring str; fillPlayerBarText(str, "HP", SCORES::hit_points, "uittPlayerLifeFormat"); - CWidgetManager::getInstance()->setContextHelpText(str); + CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); } }; REGISTER_ACTION_HANDLER(CHandlerPlayerTTLife, "player_tt_life"); @@ -4076,7 +4076,7 @@ public: ucstring str; fillPlayerBarText(str, "STA", SCORES::stamina, "uittPlayerStaminaFormat"); - CWidgetManager::getInstance()->setContextHelpText(str); + CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); } }; REGISTER_ACTION_HANDLER(CHandlerPlayerTTStamina, "player_tt_stamina"); @@ -4093,7 +4093,7 @@ public: ucstring str; fillPlayerBarText(str, "SAP", SCORES::sap, "uittPlayerSapFormat"); - CWidgetManager::getInstance()->setContextHelpText(str); + CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); } }; REGISTER_ACTION_HANDLER(CHandlerPlayerTTSap, "player_tt_sap"); @@ -4110,7 +4110,7 @@ public: ucstring str; fillPlayerBarText(str, "FOCUS", SCORES::focus, "uittPlayerFocusFormat"); - CWidgetManager::getInstance()->setContextHelpText(str); + CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); } }; REGISTER_ACTION_HANDLER(CHandlerPlayerTTFocus, "player_tt_focus"); @@ -4140,7 +4140,7 @@ public: ucstring str= CI18N::get("uittBulkFormat"); strFindReplace(str, "%v", toString("%.2f", val) ); strFindReplace(str, "%m", toString(maxVal) ); - CWidgetManager::getInstance()->setContextHelpText(str); + CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); } }; REGISTER_ACTION_HANDLER(CHandlerGetTTBulk, "get_tt_bulk"); diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index 6b699f8ee..4e92c67fb 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -3473,76 +3473,76 @@ void setConsoModSuccessTooltip( CDBCtrlSheet *cs ) CInterfaceManager * pIM = CInterfaceManager::getInstance(); CCDBNodeLeaf * nodeSM = NULL; - ucstring ustr; + string ustr; if( CSheetId(cs->getSheetId()).toString() == "mod_melee_success.sbrick" ) { - ustr = CI18N::get("uittModMeleeSuccess"); + ustr = CI18N::get("uittModMeleeSuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:MELEE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_range_success.sbrick" ) { - ustr = CI18N::get("uittModRangeSuccess"); + ustr = CI18N::get("uittModRangeSuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:RANGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_craft_success.sbrick" ) { - ustr = CI18N::get("uittModCraftSuccess"); + ustr = CI18N::get("uittModCraftSuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:CRAFT", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_defense_success.sbrick" ) { - ustr = CI18N::get("uittModDefenseSuccess"); + ustr = CI18N::get("uittModDefenseSuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:DODGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_dodge_success.sbrick" ) { - ustr = CI18N::get("uittModDodgeSuccess"); + ustr = CI18N::get("uittModDodgeSuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:DODGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_parry_success.sbrick" ) { - ustr = CI18N::get("uittModParrySuccess"); + ustr = CI18N::get("uittModParrySuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:PARRY", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_forage_success.sbrick" ) { - ustr = CI18N::get("uittModForageSuccess"); + ustr = CI18N::get("uittModForageSuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::common_ecosystem)+":FORAGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_desert_forage_success.sbrick" ) { - ustr = CI18N::get("uittModDesertForageSuccess"); + ustr = CI18N::get("uittModDesertForageSuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::desert)+":FORAGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_forest_forage_success.sbrick" ) { - ustr = CI18N::get("uittModForestForageSuccess"); + ustr = CI18N::get("uittModForestForageSuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::forest)+":FORAGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_lacustre_forage_success.sbrick" ) { - ustr = CI18N::get("uittModLacustreForageSuccess"); + ustr = CI18N::get("uittModLacustreForageSuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::lacustre)+":FORAGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_jungle_forage_success.sbrick" ) { - ustr = CI18N::get("uittModJungleForageSuccess"); + ustr = CI18N::get("uittModJungleForageSuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::jungle)+":FORAGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_primary_root_forage_success.sbrick" ) { - ustr = CI18N::get("uittModPrimaryRootForageSuccess"); + ustr = CI18N::get("uittModPrimaryRootForageSuccess").toUtf8(); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::primary_root)+":FORAGE", false); } @@ -3576,19 +3576,19 @@ public: // special tooltip? (pvp outpost and xp catalyzer) sint specialTTId= getBonusMalusSpecialTT(cs); if(specialTTId==BONUS_MALUS::XpCatalyser) - CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittXpBonus")); + CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittXpBonus").toUtf8()); else if(specialTTId==BONUS_MALUS::OutpostPVPOn) - CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOn")); + CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOn").toUtf8()); else if(specialTTId==BONUS_MALUS::OutpostPVPOutOfZone) - CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOutOfZone")); + CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOutOfZone").toUtf8()); else if(specialTTId==BONUS_MALUS::OutpostPVPInRound) - CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostInRound")); + CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostInRound").toUtf8()); else if(specialTTId==BONUS_MALUS::DeathPenalty) { CCDBNodeLeaf * node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:DEATH_XP_MALUS", false); if( node ) { - ucstring txt = CI18N::get("uittDeathPenalty"); + string txt = CI18N::get("uittDeathPenalty").toUtf8(); strFindReplace(txt, "%dp", toString((100*node->getValue16())/254)); CWidgetManager::getInstance()->setContextHelpText(txt); } @@ -3597,10 +3597,10 @@ public: else if( getAuraDisabledState(cs) ) { // get the normal string, and append a short info. - ucstring str; + std::string str; cs->getContextHelp(str); - str+= CI18N::get("uittAuraDisabled"); + str+= CI18N::get("uittAuraDisabled").toUtf8(); // and replace the context help that is required. CWidgetManager::getInstance()->setContextHelpText(str); @@ -3630,7 +3630,7 @@ public: CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:NAME", index)); if (node && CStringManagerClient::instance()->getDynString(node->getValue32(), txt)) { - CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt)); + CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt).toUtf8()); } } }; @@ -3676,7 +3676,7 @@ public: str += toString(minTimeRemaining); // replace the context help that is required. - CWidgetManager::getInstance()->setContextHelpText(str); + CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); } }; REGISTER_ACTION_HANDLER( CHandlerAnimalDeadPopupTooltip, "animal_dead_popup_tooltip"); diff --git a/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/ryzom/client/src/interface_v3/action_handler_phrase.cpp index dcc55f9ea..a73d884e8 100644 --- a/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1699,7 +1699,7 @@ public: else strFindReplace(str, "%comp", CI18N::get("uittPhraseCombatRestrictOK")); - CWidgetManager::getInstance()->setContextHelpText(str); + CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); } }; REGISTER_ACTION_HANDLER( CHandlerCombatRestrictTooltip, "phrase_combat_restrict_tooltip"); diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index fcef685c5..22a30b424 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -1810,12 +1810,12 @@ void CActionPhraseFaber::updateItemResult() // display something only for magic/protect stat if( RM_FABER_STAT_TYPE::isMagicResistStat(RM_FABER_STAT_TYPE::TRMStatType(i)) || RM_FABER_STAT_TYPE::isMagicProtectStat(RM_FABER_STAT_TYPE::TRMStatType(i)) ) - statToolTip->setDefaultContextHelp(CI18N::get("uiFaberStatActive")); + statToolTip->setDefaultContextHelp(CI18N::get("uiFaberStatActive").toUtf8()); else - statToolTip->setDefaultContextHelp(ucstring()); + statToolTip->setDefaultContextHelp(std::string()); } else - statToolTip->setDefaultContextHelp(CI18N::get("uiFaberStatGrayed")); + statToolTip->setDefaultContextHelp(CI18N::get("uiFaberStatGrayed").toUtf8()); } } diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 352ff65f4..913e47c2e 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -600,12 +600,12 @@ void CBotChatPageTrade::updateTradeModal() if (_BuyMean == MoneyGuildXP) { if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughMoney")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughMoney")); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughMoney").toUtf8()); } else { if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughGuildMoney")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildMoney")); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildMoney").toUtf8()); } return; } @@ -616,7 +616,7 @@ void CBotChatPageTrade::updateTradeModal() if (confirmTradeGroup) confirmTradeGroup->setActive(false); if (cantTradeGroup) cantTradeGroup->setActive(true); if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughGuildXP")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildXP")); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildXP").toUtf8()); return; } } @@ -677,7 +677,7 @@ void CBotChatPageTrade::updateTradeModal() if (cantTradeGroup) cantTradeGroup->setActive(true); // can't sell more than what is in inventory if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBCNotAvailable")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBCNotAvailable")); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBCNotAvailable").toUtf8()); ok= false; } @@ -692,7 +692,7 @@ void CBotChatPageTrade::updateTradeModal() if (cantTradeGroup) cantTradeGroup->setActive(true); // can't sell more than what is in inventory if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBadQuantity")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadQuantity")); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadQuantity").toUtf8()); ok= false; } } @@ -710,7 +710,7 @@ void CBotChatPageTrade::updateTradeModal() if (confirmTradeGroup) confirmTradeGroup->setActive(false); if (cantTradeGroup) cantTradeGroup->setActive(true); if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughMoney")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughMoney")); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughMoney").toUtf8()); } else if (_BuyMean == MoneyFactionPoints) { @@ -722,7 +722,7 @@ void CBotChatPageTrade::updateTradeModal() confirmTradeGroup->setActive(false); cantTradeGroup->setActive(true); cantTradeButton->setText(CI18N::get("uiNotEnoughFP_"+PVP_CLAN::toString(fpType))); - cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughFP_"+PVP_CLAN::toString(fpType))); + cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughFP_"+PVP_CLAN::toString(fpType)).toUtf8()); } else { @@ -745,7 +745,7 @@ void CBotChatPageTrade::updateTradeModal() if (confirmTradeGroup) confirmTradeGroup->setActive(false); if (cantTradeGroup) cantTradeGroup->setActive(true); if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughSkillPoints")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughSkillPoints")); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughSkillPoints").toUtf8()); } else { @@ -761,7 +761,7 @@ void CBotChatPageTrade::updateTradeModal() if (confirmTradeGroup) confirmTradeGroup->setActive(false); if (cantTradeGroup) cantTradeGroup->setActive(true); if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughGuildXP")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildXP")); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildXP").toUtf8()); } else { @@ -780,7 +780,7 @@ void CBotChatPageTrade::updateTradeModal() if (cantTradeGroup) cantTradeGroup->setActive(true); // can't sell less than the basic price if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBadResalePrice")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadResalePrice")); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadResalePrice").toUtf8()); } // else ok, can resell else @@ -812,7 +812,7 @@ void CBotChatPageTrade::updateTradeModal() if (_SellDlgOn && priceWithoutFame == 0) { if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiWontBuyThis")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittWontBuyThis")); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittWontBuyThis").toUtf8()); } else if (_SellDlgOn && priceWithoutFame == std::numeric_limits::max()) { @@ -821,7 +821,7 @@ void CBotChatPageTrade::updateTradeModal() else if (quantity == 0 || quantity == std::numeric_limits::max()) { if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBadQuantity")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadQuantity")); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadQuantity").toUtf8()); } } } @@ -893,7 +893,7 @@ void CBotChatPageTrade::startBuyDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCall { confirmButton->setActive( true ); // no need any context help because too simple - confirmButton->setDefaultContextHelp(ucstring()); + confirmButton->setDefaultContextHelp(std::string()); if(isItem) { CItemSheet * itemSheet = dynamic_cast ( SheetMngr.get( CSheetId( sheet->getSheetId() ) ) ); @@ -1003,7 +1003,7 @@ void CBotChatPageTrade::startSellDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCal { confirmButton->setActive( !sheet->getLockedByOwner() ); confirmButton->setText(CI18N::get("uiSellImmediately")); - confirmButton->setDefaultContextHelp(CI18N::get("uittDirectSellButton")); + confirmButton->setDefaultContextHelp(CI18N::get("uittDirectSellButton").toUtf8()); } // set item or skill name @@ -2428,7 +2428,7 @@ public: void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) { // \todo yoyo: for now disable tooltip - CWidgetManager::getInstance()->setContextHelpText(ucstring()); + CWidgetManager::getInstance()->setContextHelpText(std::string()); } }; REGISTER_ACTION_HANDLER(CHandlerBotChatTTItemType, "botchat_tt_item_type"); diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 81d34447d..669ee62c2 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -3379,13 +3379,13 @@ void CDBCtrlSheet::setupItemInfoWaiter() } // *************************************************************************** -void CDBCtrlSheet::getContextHelp(ucstring &help) const +void CDBCtrlSheet::getContextHelp(std::string &help) const { if (getType() == CCtrlSheetInfo::SheetType_Skill) { // just show the name of the skill // the sheet id is interpreted as a skill enum - help= STRING_MANAGER::CStringManagerClient::getSkillLocalizedName( (SKILLS::ESkills)_SheetId.getSInt32() ); + help= CUtfStringView(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName( (SKILLS::ESkills)_SheetId.getSInt32() )).toUtf8(); } else if(getType() == CCtrlSheetInfo::SheetType_Macro) { @@ -3432,7 +3432,7 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const strFindReplace(dispText, ucstring("%n"), macroName); strFindReplace(dispText, ucstring("%k"), assignedTo); strFindReplace(dispText, ucstring("%c"), dispCommands); - help = dispText; + help = dispText.toUtf8(); } else if(getType() == CCtrlSheetInfo::SheetType_Item) { @@ -3443,10 +3443,10 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const { // call lua function to update tooltip window _ItemInfoWaiter.sendRequest(); - help = _ItemInfoWaiter.infoValidated(); + help = _ItemInfoWaiter.infoValidated().toUtf8(); // its expected to get at least item name back if (help.empty()) - help = getItemActualName(); + help = getItemActualName().toUtf8(); } else if (!_ContextHelp.empty()) { @@ -3454,7 +3454,7 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const } else { - help = getItemActualName(); + help = getItemActualName().toUtf8();; } } else @@ -3485,7 +3485,7 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const CSBrickManager *pBM= CSBrickManager::getInstance(); CSBrickSheet *brick= pBM->getBrick(CSheetId(getSheetId())); if(brick) - help= STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(brick->Id); + help= CUtfStringView(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(brick->Id)).toUtf8(); else help= _ContextHelp; } @@ -3494,7 +3494,7 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const sint32 phraseId= getSheetId(); if (phraseId == 0) { - help = ucstring(); + help = std::string(); } else { @@ -3512,10 +3512,11 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const game = game["game"]; game.callMethodByNameNoThrow("updatePhraseTooltip", 1, 1); // retrieve result from stack - help = ucstring(); + ucstring tmpHelp; if (!ls->empty()) { - CLuaIHM::pop(*ls, help); + CLuaIHM::pop(*ls, tmpHelp); // FIXME: Lua UTF-8 + help = tmpHelp.toUtf8(); } else { @@ -3548,7 +3549,7 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const { CSPhraseSheet *phrase= dynamic_cast(SheetMngr.get(CSheetId(getSheetId()))); if(phrase) - help= STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(phrase->Id); + help= CUtfStringView(STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(phrase->Id)).toUtf8(); else help= _ContextHelp; } @@ -3556,14 +3557,14 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const { const COutpostBuildingSheet *outpost = asOutpostBuildingSheet(); if (outpost) - help = CStringManagerClient::getOutpostBuildingLocalizedName(CSheetId(_SheetId.getSInt32())); + help = CUtfStringView(CStringManagerClient::getOutpostBuildingLocalizedName(CSheetId(_SheetId.getSInt32()))).toUtf8(); else help = _ContextHelp; } } // *************************************************************************** -void CDBCtrlSheet::getContextHelpToolTip(ucstring &help) const +void CDBCtrlSheet::getContextHelpToolTip(std::string &help) const { // Special case for buff items and spell crystals, only for tooltips if (getType() == CCtrlSheetInfo::SheetType_Item) @@ -3574,7 +3575,7 @@ void CDBCtrlSheet::getContextHelpToolTip(ucstring &help) const if (useItemInfoForFamily(item->Family)) { _ItemInfoWaiter.sendRequest(); - help = _ItemInfoWaiter.infoValidated(); + help = _ItemInfoWaiter.infoValidated().toUtf8(); return; } } diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.h b/ryzom/client/src/interface_v3/dbctrl_sheet.h index e6ed7587b..b662d86af 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -393,9 +393,9 @@ public: NLMISC::CRGBA getSheetColor() const {return _SheetColor;} /// Special ContextHelp for ctrl sheet. - virtual void getContextHelp(ucstring &help) const; + virtual void getContextHelp(std::string &help) const; - virtual void getContextHelpToolTip(ucstring &help) const; + virtual void getContextHelpToolTip(std::string &help) const; /** true if an item of another ctrlSheet can be dropped on this slot. diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp index 8483e9925..fed48d1ac 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp @@ -1051,14 +1051,14 @@ void CDBGroupListSheetText::CSheetChild::updateViewTextAsItem() if(Ctrl && Text && Ctrl->getSheetCategory() == CDBCtrlSheet::Item) { // get the text - ucstring text; + std::string text; Ctrl->getContextHelp(text); // Text color red if requirement not met if(Ctrl->getType() == CCtrlSheetInfo::SheetType_Item) { if(!Ctrl->checkItemRequirement()) - text= CI18N::get("uiItemCannotUseColor") + text; + text= CI18N::get("uiItemCannotUseColor").toUtf8() + text; } // For item, add some information @@ -1075,18 +1075,18 @@ void CDBGroupListSheetText::CSheetChild::updateViewTextAsItem() if(ipList.empty()) { if(pIS->isUsedAsCraftRequirement()) - text+= "\n" + CI18N::get("uiItemMpCraftRequirement"); + text+= "\n" + CI18N::get("uiItemMpCraftRequirement").toUtf8(); else - text+= "\n" + CI18N::get("uiItemMpNoCraft"); + text+= "\n" + CI18N::get("uiItemMpNoCraft").toUtf8(); } else - text+= "\n" + CI18N::get("uiItemMpCanCraft") + ipList; + text+= "\n" + CI18N::get("uiItemMpCanCraft").toUtf8() + ipList.toUtf8(); } } } // set text - Text->setTextFormatTaged(text.toUtf8()); + Text->setTextFormatTaged(text); } } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h index d9a495635..3d308d582 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h @@ -133,9 +133,9 @@ public: // Called at updateCoords to remake the text virtual void updateViewText(CDBGroupListSheetText * /* pFather */) { - ucstring text; + std::string text; Ctrl->getContextHelp(text); - Text->setText(text.toUtf8()); + Text->setText(text); } // create a CViewText object that is displayed next to the item. This is the opportunnity to create diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp index 3cdf24ca8..02f8fb6ae 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp @@ -77,7 +77,7 @@ void CDBGroupListSheetTextPhrase::CSheetChildPhrase::init(CDBGroupListSheetText // *************************************************************************** void CDBGroupListSheetTextPhrase::CSheetChildPhrase::updateViewText(CDBGroupListSheetText * /* pFather */) { - ucstring text; + std::string text; if(Ctrl->getType()!=CCtrlSheetInfo::SheetType_SPhrase) return; @@ -87,14 +87,14 @@ void CDBGroupListSheetTextPhrase::CSheetChildPhrase::updateViewText(CDBGroupList // append the level if possible if(LevelDB) { - ucstring fmt= CI18N::get("uiPhraseLevelFmt"); + std::string fmt= CI18N::get("uiPhraseLevelFmt").toUtf8(); strFindReplace(fmt, "%d", toString(LevelCache)); text+= "\n" + fmt; } #endif // set - Text->setText(text.toUtf8()); + Text->setText(text); } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp index 6e98afc5c..bc812bbc5 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp @@ -41,14 +41,14 @@ CDBGroupListSheetTextPhraseId::CSheetChildPhrase::CSheetChildPhrase() // *************************************************************************** void CDBGroupListSheetTextPhraseId::CSheetChildPhrase::updateViewText(CDBGroupListSheetText * /* pFather */) { - ucstring text; + std::string text; if(Ctrl->getType()!=CCtrlSheetInfo::SheetType_SPhraseId) return; // Get the User Name of the phrase Ctrl->getContextHelp(text); - Text->setText(text.toUtf8()); + Text->setText(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 b0924f0af..0005d80f4 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -248,16 +248,16 @@ void CDBGroupListSheetTrade::CSheetChildTrade::update(CDBGroupListSheetText *pFa void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetText *pFather) { H_AUTO(CDBGroupListSheetTrade_updateViewText); - ucstring text; + std::string text; Ctrl->getContextHelp(text); // Append first the type of the sheet to select switch ( Ctrl->getSheetCategory() ) { case CDBCtrlSheet::Item: break; // none for item. consider useless - case CDBCtrlSheet::Pact: text= CI18N::get("uiBotChatPact") + text; break; - case CDBCtrlSheet::Skill: text= CI18N::get("uiBotChatSkill") + text; break; - case CDBCtrlSheet::GuildFlag: text= CI18N::get("uiBotChatSkill") + text; break; - case CDBCtrlSheet::Phrase: text= CI18N::get("uiBotChatPhrase") + text; break; + case CDBCtrlSheet::Pact: text= CI18N::get("uiBotChatPact").toUtf8() + text; break; + case CDBCtrlSheet::Skill: text= CI18N::get("uiBotChatSkill").toUtf8() + text; break; + case CDBCtrlSheet::GuildFlag: text= CI18N::get("uiBotChatSkill").toUtf8() + text; break; + case CDBCtrlSheet::Phrase: text= CI18N::get("uiBotChatPhrase").toUtf8() + text; break; default: break; } @@ -268,11 +268,11 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if (pOBS != NULL) { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - text += string("\n") + pSMC->getOutpostBuildingLocalizedDescription(CSheetId(Ctrl->getSheetId())); - text += "\n" + CI18N::get("uiBotChatPrice") + NLMISC::formatThousands(toString(pOBS->CostDapper)); - text += CI18N::get("uiBotChatTime") + toString(pOBS->CostTime/60) + CI18N::get("uiBotChatTimeMinute"); + text += string("\n") + CUtfStringView(pSMC->getOutpostBuildingLocalizedDescription(CSheetId(Ctrl->getSheetId()))).toUtf8(); + text += "\n" + CI18N::get("uiBotChatPrice").toUtf8() + NLMISC::formatThousands(toString(pOBS->CostDapper)); + text += CI18N::get("uiBotChatTime").toUtf8() + toString(pOBS->CostTime/60) + CI18N::get("uiBotChatTimeMinute").toUtf8(); if ((pOBS->CostTime % 60) != 0) - text += toString(pOBS->CostTime%60) + CI18N::get("uiBotChatTimeSecond"); + text += toString(pOBS->CostTime%60) + CI18N::get("uiBotChatTimeSecond").toUtf8(); } } @@ -288,16 +288,16 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if(!weaponRestriction.empty() && weaponRestriction!=CI18N::get("uiawrSF")) { weaponRestriction= CI18N::get("uiPhraseWRHeader") + weaponRestriction; - text+= "\n" + weaponRestriction; + text+= "\n" + weaponRestriction.toUtf8(); } } // Get the Text color - ucstring colorTag("@{FFFF}"); + std::string colorTag("@{FFFF}"); if(Ctrl->getType() == CCtrlSheetInfo::SheetType_Item) { if(!Ctrl->checkItemRequirement()) - colorTag= CI18N::get("uiItemCannotUseColor"); + colorTag= CI18N::get("uiItemCannotUseColor").toUtf8(); } // For item, add some information @@ -314,12 +314,12 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if(ipList.empty()) { if(pIS->isUsedAsCraftRequirement()) - text+= "\n" + CI18N::get("uiItemMpCraftRequirement"); + text+= "\n" + CI18N::get("uiItemMpCraftRequirement").toUtf8(); else - text+= "\n" + CI18N::get("uiItemMpNoCraft"); + text+= "\n" + CI18N::get("uiItemMpNoCraft").toUtf8(); } else - text+= "\n" + CI18N::get("uiItemMpCanCraft") + ipList; + text+= "\n" + CI18N::get("uiItemMpCanCraft").toUtf8() + ipList.toUtf8(); } } } @@ -331,9 +331,9 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if(Ctrl->getSheetCategory() == CDBCtrlSheet::Phrase) { if (LastPrice != -1) - text+= "\n" + CI18N::get("uiBotChatSkillPointCost") + toString(LastPrice); + text+= "\n" + CI18N::get("uiBotChatSkillPointCost").toUtf8() + toString(LastPrice); else - text+= "\n" + CI18N::get("uiBotChatSkillPointCostNotReceived"); + text+= "\n" + CI18N::get("uiBotChatSkillPointCostNotReceived").toUtf8(); } else { @@ -345,8 +345,8 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT const CItemSheet *pIS = Ctrl->asItemSheet(); if (pIS && pIS->Family == ITEMFAMILY::GUILD_OPTION) { - text+= "\n" + CI18N::get("uiBotChatSkillPointCost") + toString(pIS->GuildOption.XPCost); - text+= "\n" + CI18N::get("uiBotChatPrice") + NLMISC::formatThousands(toString(pIS->GuildOption.MoneyCost)); + text+= "\n" + CI18N::get("uiBotChatSkillPointCost").toUtf8() + toString(pIS->GuildOption.XPCost); + text+= "\n" + CI18N::get("uiBotChatPrice").toUtf8() + NLMISC::formatThousands(toString(pIS->GuildOption.MoneyCost)); guildOption= true; } } @@ -381,10 +381,10 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if (LastPrice > 0) { if(displayMulPrice) - text+= "\n" + CI18N::get("uiBotChatPrice") + NLMISC::formatThousands(toString(sint32(LastPrice * priceFactor))) + " (" + text+= "\n" + CI18N::get("uiBotChatPrice").toUtf8() + NLMISC::formatThousands(toString(sint32(LastPrice * priceFactor))) + " (" + NLMISC::formatThousands(toString( sint32(factor) * sint32(LastPrice * priceFactor) )) + ")"; else - text+= "\n" + CI18N::get("uiBotChatPrice") + NLMISC::formatThousands(toString( sint32(factor * LastPrice * priceFactor) )); + text+= "\n" + CI18N::get("uiBotChatPrice").toUtf8() + NLMISC::formatThousands(toString( sint32(factor * LastPrice * priceFactor) )); } if ((LastFactionPointPrice != 0) && (LastFactionType >= PVP_CLAN::BeginClans) && (LastFactionType <= PVP_CLAN::EndClans)) @@ -394,8 +394,8 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT else text+= "\n"; - text+= CI18N::get("uiBotChatFactionType") + PVP_CLAN::toString((PVP_CLAN::TPVPClan)LastFactionType) - + CI18N::get("uiBotChatFactionPointPrice") + NLMISC::formatThousands(toString(LastFactionPointPrice)); + text+= CI18N::get("uiBotChatFactionType").toUtf8() + PVP_CLAN::toString((PVP_CLAN::TPVPClan)LastFactionType) + + CI18N::get("uiBotChatFactionPointPrice").toUtf8() + NLMISC::formatThousands(toString(LastFactionPointPrice)); } // some additional info for resale @@ -407,31 +407,31 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT { // append price if(pIS && pIS->Stackable>1 && zeFather->getMultiplyPriceByQuantityFlag()) - text+= CI18N::get("uiBotChatRetirePrice") + NLMISC::formatThousands(toString(LastPriceRetire)) + " (" + text+= CI18N::get("uiBotChatRetirePrice").toUtf8() + NLMISC::formatThousands(toString(LastPriceRetire)) + " (" + NLMISC::formatThousands(toString(factor * LastPriceRetire)) + ")"; else - text+= CI18N::get("uiBotChatRetirePrice") + NLMISC::formatThousands(toString(factor * LastPriceRetire)); + text+= CI18N::get("uiBotChatRetirePrice").toUtf8() + NLMISC::formatThousands(toString(factor * LastPriceRetire)); // set resale time left - ucstring fmt= CI18N::get("uiBotChatResaleTimeLeft"); + std::string fmt= CI18N::get("uiBotChatResaleTimeLeft").toUtf8(); strFindReplace(fmt, "%d", toString(LastResaleTimeLeft/RYZOM_DAY_IN_HOUR)); strFindReplace(fmt, "%h", toString(LastResaleTimeLeft%RYZOM_DAY_IN_HOUR)); text+= "\n" + fmt; // force special color (according if retirable or not) if(LastSellerType == BOTCHATTYPE::UserRetirable || LastSellerType == BOTCHATTYPE::ResaleAndUserRetirable) - colorTag= CI18N::get("uiItemUserSellColor"); + colorTag= CI18N::get("uiItemUserSellColor").toUtf8(); else - colorTag= CI18N::get("uiItemUserSellColorNotRetirable"); + colorTag= CI18N::get("uiItemUserSellColorNotRetirable").toUtf8(); } // Append (NPC) tag if NPC item if(LastSellerType == BOTCHATTYPE::NPC) { - text+= "\n" + CI18N::get("uiBotChatNPCTag"); + text+= "\n" + CI18N::get("uiBotChatNPCTag").toUtf8(); } // else display the name of the vendor (not if this is the player himself, to avoid flood) else if (LastSellerType == BOTCHATTYPE::Resale) { - text+= "\n" + CI18N::get("uiBotChatVendorTag") + VendorNameString; + text+= "\n" + CI18N::get("uiBotChatVendorTag").toUtf8() + VendorNameString.toUtf8(); } } } @@ -441,14 +441,14 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if(zeFather->sellerTypeWanted() && (LastSellerType == BOTCHATTYPE::User || LastSellerType == BOTCHATTYPE::UserRetirable) ) { - text+= "\n" + CI18N::get("uiItemSold"); + text+= "\n" + CI18N::get("uiItemSold").toUtf8(); // force special color - colorTag= CI18N::get("uiItemSoldColor"); + colorTag= CI18N::get("uiItemSoldColor").toUtf8(); } // error case else { - text+= "\n" + CI18N::get("uiPriceNotReceived"); + text+= "\n" + CI18N::get("uiPriceNotReceived").toUtf8(); } } } @@ -457,7 +457,7 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT // setup color and text text= colorTag + text; - Text->setTextFormatTaged(text.toUtf8()); + Text->setTextFormatTaged(text); } // *************************************************************************** diff --git a/ryzom/client/src/interface_v3/group_compas.cpp b/ryzom/client/src/interface_v3/group_compas.cpp index 3c18eb22c..f00b72cb2 100644 --- a/ryzom/client/src/interface_v3/group_compas.cpp +++ b/ryzom/client/src/interface_v3/group_compas.cpp @@ -424,11 +424,10 @@ void CGroupCompas::draw() CCtrlBase *toolTip = getCtrl("tt"); if (toolTip) { - ucstring text; if (displayedTarget.getType() != CCompassTarget::North) - toolTip->setDefaultContextHelp(CI18N::get("uittCompassDistance")); + toolTip->setDefaultContextHelp(CI18N::get("uittCompassDistance").toUtf8()); else - toolTip->setDefaultContextHelp(text); + toolTip->setDefaultContextHelp(std::string()); } if (displayedTarget.Name != _CurrTargetName) 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 f070d3224..b6b0195ef 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -759,7 +759,7 @@ CGroupInSceneBubbleManager::CPopupContext *CGroupInSceneBubbleManager::buildCont void CGroupInSceneBubbleManager::addContextHelp (const ucstring &message, const string &targetName, uint time) { - ucstring finalMessage = message; + std::string finalMessage = message.toUtf8(); CInterfaceElement *target; CPopupContext *context = CGroupInSceneBubbleManager::buildContextHelp ("context_help_", targetName, target, time); if (context) @@ -787,7 +787,7 @@ void CGroupInSceneBubbleManager::addContextHelp (const ucstring &message, const } } - text->setText(finalMessage.toUtf8()); + text->setText(finalMessage); } } context->Group->setActive(true); diff --git a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index fe846038c..e18cf0cc9 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -1122,7 +1122,7 @@ void CGroupInSceneUserInfo::updateDynamicData () { CInterfaceGroup *group = getGroup ("right"); CForageSourceCL *forageSource = static_cast(_Entity); - ucstring txt( CI18N::get( "uittForageContent" ) + toString( ": %u", forageSource->getCurrentQuantity() ) ); + string txt( CI18N::get( "uittForageContent" ).toUtf8() + toString( ": %u", forageSource->getCurrentQuantity() ) ); CCtrlBase *toolTip = group->getCtrl ("tt1"); if ( toolTip ) toolTip->setDefaultContextHelp( txt ); diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index 4315b1b8b..cdda9e915 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -697,7 +697,7 @@ bool CGroupMap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { _HomeLM->setParent(this); addCtrl(_HomeLM); - _HomeLM->setDefaultContextHelp(NLMISC::CI18N::get("uiHome")); + _HomeLM->setDefaultContextHelp(NLMISC::CI18N::get("uiHome").toUtf8()); } // create animals Landmark: pack Animals. @@ -709,7 +709,7 @@ bool CGroupMap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { _AnimalLM[i]->setParent(this); addCtrl(_AnimalLM[i]); - _AnimalLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(NLMISC::toString("uiPATitleMount%d", i+1))); + _AnimalLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(NLMISC::toString("uiPATitleMount%d", i+1)).toUtf8()); } } @@ -722,7 +722,7 @@ bool CGroupMap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { _TeammateLM[i]->setParent(this); addCtrl(_TeammateLM[i]); - _TeammateLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(NLMISC::toString("uittLMTeam%d",i))); + _TeammateLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(NLMISC::toString("uittLMTeam%d",i)).toUtf8()); } } } @@ -1179,7 +1179,7 @@ void CGroupMap::checkCoords() ucstring result; if (STRING_MANAGER::CStringManagerClient::instance()->getDynString(_MissionTargetTextIDs[k], result)) { - _MissionLM[k]->setDefaultContextHelp(result); + _MissionLM[k]->setDefaultContextHelp(result.toUtf8()); _MissionTargetTextReceived[k] = true; } } @@ -1201,7 +1201,7 @@ void CGroupMap::checkCoords() CEntityCL *sel = EntitiesMngr.entity(UserEntity->selection()); if (sel) { - _TargetLM->setDefaultContextHelp(NLMISC::CI18N::get("uiTargetTwoPoint") + sel->removeTitleAndShardFromName(sel->getEntityName())); + _TargetLM->setDefaultContextHelp(NLMISC::CI18N::get("uiTargetTwoPoint").toUtf8() + sel->removeTitleAndShardFromName(sel->getEntityName()).toUtf8()); } } } @@ -1374,7 +1374,7 @@ void CGroupMap::checkCoords() case ANIMAL_TYPE::Packer: sPrefix = "uiPATitlePacker"; break; case ANIMAL_TYPE::Demon: sPrefix = "uiPATitleDemon"; break; } - _AnimalLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(sPrefix+toString(i+1))); + _AnimalLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(sPrefix+toString(i+1)).toUtf8()); } } } @@ -1408,7 +1408,7 @@ void CGroupMap::checkCoords() if (pSMC->getString(val,res)) { res = CEntityCL::removeTitleAndShardFromName(res); - _TeammateLM[i]->setDefaultContextHelp(res); + _TeammateLM[i]->setDefaultContextHelp(res.toUtf8()); } } updateLMPosFromDBPos(_TeammateLM[i], px, py); @@ -2811,7 +2811,7 @@ void CGroupMap::addLandMark(TLandMarkButtonVect &destList, const NLMISC::CVector CLandMarkButton *lmb = createLandMarkButton(options); lmb->setParent(this); lmb->Pos = pos; - lmb->setDefaultContextHelp(title); + lmb->setDefaultContextHelp(title.toUtf8()); destList.push_back(lmb); addCtrl(lmb); } @@ -2937,7 +2937,7 @@ void CGroupMap::updateUserLandMark(CCtrlButton *button, const ucstring &newTitle _CurContinent->UserLandMarks[k].Type = (uint8)lmType; updateLandMarkButton(_UserLM[k], getUserLandMarkOptions(k)); - button->setDefaultContextHelp(newTitle); + button->setDefaultContextHelp(newTitle.toUtf8()); CInterfaceManager::getInstance()->saveLandmarks(); return; @@ -3199,7 +3199,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) if (it != _ContinentLM.end()) { ct.setType(CCompassTarget::ContinentLandMark); - (*it)->getContextHelp(ct.Name); + (*it)->getContextHelpAsUtf16(ct.Name); mapToWorld(ct.Pos, (*it)->Pos); found = true; } @@ -3212,7 +3212,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) if (it != _MissionLM.end()) { ct.setPositionState(_MissionPosStates[it - _MissionLM.begin()]); - (*it)->getContextHelp(ct.Name); + (*it)->getContextHelpAsUtf16(ct.Name); mapToWorld(ct.Pos, (*it)->Pos); found = true; } @@ -3226,7 +3226,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) if (it != _UserLM.end()) { ct.setType(CCompassTarget::UserLandMark); - (*it)->getContextHelp(ct.Name); + (*it)->getContextHelpAsUtf16(ct.Name); mapToWorld(ct.Pos, (*it)->Pos); found = true; } @@ -3254,7 +3254,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) if (!isIsland()) { ct.setType(CCompassTarget::Respawn); - (*it)->getContextHelp(ct.Name); + (*it)->getContextHelpAsUtf16(ct.Name); mapToWorld(ct.Pos, (*it)->Pos); found = true; } @@ -3300,7 +3300,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) { if(_AnimalLM[i]==lm) { - _AnimalLM[i]->getContextHelp(ct.Name); + _AnimalLM[i]->getContextHelpAsUtf16(ct.Name); // copy The Animal Pos retriever into the compass ct.setPositionState(_AnimalPosStates[i]); found = true; @@ -3318,7 +3318,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) { if(_TeammateLM[i]==lm) { - _TeammateLM[i]->getContextHelp(ct.Name); + _TeammateLM[i]->getContextHelpAsUtf16(ct.Name); // copy The Animal Pos retriever into the compass ct.setPositionState(_TeammatePosStates[i]); found = true; @@ -3380,7 +3380,7 @@ CGroupMap::CLandMarkButton* CGroupMap::findClosestLandmark(const CVector2f ¢ for(TLandMarkButtonVect::const_iterator it = landmarks.begin(); it != landmarks.end(); ++it) { ucstring lc; - (*it)->getContextHelp(lc); + (*it)->getContextHelpAsUtf16(lc); if(filterLandmark(lc, keywords, startsWith)) { CVector2f pos; mapToWorld(pos, (*it)->Pos); @@ -3442,7 +3442,7 @@ bool CGroupMap::targetLandmarkByName(const ucstring &search, bool startsWith) co { ct.setType(CCompassTarget::UserLandMark); mapToWorld(ct.Pos, lm->Pos); - lm->getContextHelp(ct.Name); + lm->getContextHelpAsUtf16(ct.Name); closest = dist; found = true; } @@ -3455,7 +3455,7 @@ bool CGroupMap::targetLandmarkByName(const ucstring &search, bool startsWith) co { ct.setType(CCompassTarget::ContinentLandMark); mapToWorld(ct.Pos, lm->Pos); - lm->getContextHelp(ct.Name); + lm->getContextHelpAsUtf16(ct.Name); closest = dist; found = true; } diff --git a/ryzom/client/src/interface_v3/guild_manager.cpp b/ryzom/client/src/interface_v3/guild_manager.cpp index 3a25c0198..a6b24e670 100644 --- a/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/ryzom/client/src/interface_v3/guild_manager.cpp @@ -857,17 +857,17 @@ class CAHGuildSheetOpen : public IActionHandler case ccs_online: onlineView->setTexture("w_online.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnline")); + toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnline").toUtf8()); break; case ccs_online_abroad: onlineView->setTexture("w_online_abroad.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnlineAbroad")); + toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnlineAbroad").toUtf8()); break; default: onlineView->setTexture("w_offline.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOffline")); + toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOffline").toUtf8()); break; } } diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 8a87c7cd4..949a599b4 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1535,8 +1535,8 @@ void CInterfaceManager::updateFrameEvents() CCtrlBase *pTooltip= dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather_tt")); if (pTooltip != NULL) { - ucstring tt = toString("%02d", WeatherManager.getNextWeatherHour()) + CI18N::get("uiMissionTimerHour") + - " - " + CI18N::get("uiHumidity") + " " + + string tt = toString("%02d", WeatherManager.getNextWeatherHour()) + CI18N::get("uiMissionTimerHour").toUtf8() + + " - " + CI18N::get("uiHumidity").toUtf8() + " " + toString("%d", (uint)(roundWeatherValue(WeatherManager.getNextWeatherValue()) * 100.f)) + "%"; pTooltip->setDefaultContextHelp(tt); } diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index ec754de33..e4dbb0f44 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -2879,7 +2879,7 @@ std::string CLuaIHMRyzom::getDefine(const std::string &def) // *************************************************************************** void CLuaIHMRyzom::setContextHelpText(const ucstring &text) { - CWidgetManager::getInstance()->setContextHelpText(text); + CWidgetManager::getInstance()->setContextHelpText(text.toUtf8()); } // *************************************************************************** diff --git a/ryzom/client/src/interface_v3/people_list.cpp b/ryzom/client/src/interface_v3/people_list.cpp index 1b4c7ea5e..b380c12b0 100644 --- a/ryzom/client/src/interface_v3/people_list.cpp +++ b/ryzom/client/src/interface_v3/people_list.cpp @@ -759,17 +759,17 @@ void CPeopleList::setOnline(uint index, TCharConnectionState online) case ccs_online: onlineView->setTexture("w_online.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOnline")); + toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOnline").toUtf8()); break; case ccs_online_abroad: onlineView->setTexture("w_online_abroad.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOnlineAbroad")); + toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOnlineAbroad").toUtf8()); break; default: onlineView->setTexture("w_offline.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOffline")); + toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOffline").toUtf8()); break; } } diff --git a/ryzom/client/src/r2/displayer_visual_group.cpp b/ryzom/client/src/r2/displayer_visual_group.cpp index 0edc18880..a84c6bfa4 100644 --- a/ryzom/client/src/r2/displayer_visual_group.cpp +++ b/ryzom/client/src/r2/displayer_visual_group.cpp @@ -73,10 +73,10 @@ public: return CCtrlPolygon::contains(CVector2f(mouseXInWindow + 0.5f, mouseYInWindow + 0.5f)); } // tooltip - virtual void getContextHelp(::ucstring &help) const + virtual void getContextHelp(std::string &help) const { - help = Instance.getDisplayName(); - if (std::operator==(help, NLMISC::CI18N::get("uiR2EDNoName") )) + help = Instance.getDisplayName().toUtf8(); + if (help == NLMISC::CI18N::get("uiR2EDNoName").toUtf8()) help.clear(); } bool emptyContextHelp() const { return true; } @@ -122,10 +122,10 @@ public: return CCtrlQuad::contains(CVector2f(mouseXInWindow + 0.5f, mouseYInWindow + 0.5f)); } // tooltip - virtual void getContextHelp(ucstring &help) const + virtual void getContextHelp(std::string &help) const { - help = Instance.getDisplayName(); - if (std::operator==(help, NLMISC::CI18N::get("uiR2EDNoName"))) + help = Instance.getDisplayName().toUtf8(); + if (help == NLMISC::CI18N::get("uiR2EDNoName").toUtf8()) help.clear(); } bool emptyContextHelp() const { return true; } diff --git a/ryzom/client/src/r2/instance_map_deco.cpp b/ryzom/client/src/r2/instance_map_deco.cpp index cdc792dc5..8ec630686 100644 --- a/ryzom/client/src/r2/instance_map_deco.cpp +++ b/ryzom/client/src/r2/instance_map_deco.cpp @@ -40,11 +40,12 @@ namespace R2 { // ********************************************************************************************************* -void CInstanceMapDeco::CCtrlButtonEntity::getContextHelp(ucstring &help) const +void CInstanceMapDeco::CCtrlButtonEntity::getContextHelp(std::string &help) const { //H_AUTO(R2_CCtrlButtonEntity_getContextHelp) - help = _Instance.getDisplayName(); - if (help == NLMISC::CI18N::get("uiR2EDNoName")) help.clear(); + help = _Instance.getDisplayName().toUtf8(); + if (help == NLMISC::CI18N::get("uiR2EDNoName").toUtf8()) + help.clear(); } // ********************************************************************************************************* diff --git a/ryzom/client/src/r2/instance_map_deco.h b/ryzom/client/src/r2/instance_map_deco.h index cf1a2352c..9be099c19 100644 --- a/ryzom/client/src/r2/instance_map_deco.h +++ b/ryzom/client/src/r2/instance_map_deco.h @@ -91,7 +91,7 @@ private: private: CInstance &_Instance; protected: - virtual void getContextHelp(ucstring &help) const; + virtual void getContextHelp(std::string &help) const; bool emptyContextHelp() const { return true; } bool wantInstantContextHelp() const { return true; } virtual bool isCapturable() const { return false; } From 051c46b95a8b34cfefae37e6fcb11eee26f511c7 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 03:55:30 +0800 Subject: [PATCH 068/205] UTF-8 CI18N, ryzom/ryzomcore#335 --- nel/include/nel/misc/i18n.h | 21 ++-- nel/src/gui/ctrl_base.cpp | 8 +- nel/src/gui/ctrl_text_button.cpp | 2 +- nel/src/gui/dbgroup_combo_box.cpp | 2 +- nel/src/gui/dbview_quantity.cpp | 2 +- nel/src/gui/group_container.cpp | 8 +- nel/src/gui/group_html.cpp | 4 +- nel/src/gui/lua_ihm.cpp | 2 +- nel/src/gui/view_text.cpp | 12 +- nel/src/misc/common.cpp | 2 +- nel/src/misc/i18n.cpp | 106 +++++++++++++----- ryzom/client/src/bg_downloader_access.cpp | 16 +-- ryzom/client/src/client_chat_manager.cpp | 18 ++- ryzom/client/src/client_sheets/item_sheet.cpp | 2 +- ryzom/client/src/client_sheets/item_sheet.h | 2 +- ryzom/client/src/commands.cpp | 6 +- ryzom/client/src/connection.cpp | 26 ++--- ryzom/client/src/debug_client.cpp | 2 +- ryzom/client/src/init.cpp | 10 +- ryzom/client/src/init_main_loop.cpp | 2 +- .../src/interface_v3/action_handler_game.cpp | 18 +-- .../src/interface_v3/action_handler_help.cpp | 48 ++++---- .../src/interface_v3/action_phrase_faber.cpp | 6 +- .../bot_chat_page_dynamic_mission.cpp | 2 +- .../src/interface_v3/bot_chat_page_trade.cpp | 30 ++--- ryzom/client/src/interface_v3/chat_window.cpp | 20 ++-- ryzom/client/src/interface_v3/chat_window.h | 2 +- .../src/interface_v3/dbgroup_build_phrase.cpp | 4 +- .../interface_v3/dbgroup_list_sheet_text.cpp | 10 +- .../interface_v3/dbgroup_list_sheet_trade.cpp | 62 +++++----- .../client/src/interface_v3/group_compas.cpp | 2 +- .../interface_v3/group_in_scene_user_info.cpp | 2 +- ryzom/client/src/interface_v3/group_map.cpp | 10 +- .../client/src/interface_v3/guild_manager.cpp | 14 +-- .../src/interface_v3/interface_manager.cpp | 94 ++++++++-------- .../src/interface_v3/interface_manager.h | 2 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 4 +- .../client/src/interface_v3/macrocmd_key.cpp | 14 +-- .../src/interface_v3/macrocmd_manager.cpp | 4 +- .../client/src/interface_v3/music_player.cpp | 4 +- ryzom/client/src/interface_v3/people_list.cpp | 31 +++-- .../client/src/interface_v3/skill_manager.cpp | 2 +- .../src/interface_v3/task_bar_manager.cpp | 2 +- ryzom/client/src/login_patch.cpp | 6 +- ryzom/client/src/main_loop_debug.cpp | 2 +- ryzom/client/src/net_manager.cpp | 10 +- ryzom/client/src/progress.cpp | 8 +- ryzom/client/src/r2/auto_group.cpp | 2 +- .../client/src/r2/displayer_visual_entity.cpp | 4 +- .../client/src/r2/displayer_visual_group.cpp | 4 +- ryzom/client/src/r2/editor.cpp | 10 +- ryzom/client/src/r2/instance_map_deco.cpp | 2 +- ryzom/client/src/r2/tool_select_move.cpp | 4 +- ryzom/client/src/session_browser_impl.cpp | 2 +- ryzom/common/src/game_share/rm_family.cpp | 18 +-- ryzom/common/src/game_share/rm_family.h | 16 +-- ryzom/common/src/game_share/roles.cpp | 2 +- ryzom/common/src/game_share/roles.h | 2 +- 58 files changed, 392 insertions(+), 340 deletions(-) diff --git a/nel/include/nel/misc/i18n.h b/nel/include/nel/misc/i18n.h index e8b00385b..28df54c5e 100644 --- a/nel/include/nel/misc/i18n.h +++ b/nel/include/nel/misc/i18n.h @@ -99,7 +99,7 @@ public: /// Return a vector with all language available. The vector contains the name of the language. /// The index in the vector is used in \c load() function - static const std::vector &getLanguageNames(); + static const std::vector &getLanguageNames(); /** Return a vector with all language code available. * Code are ISO 639-2 compliant. @@ -122,7 +122,7 @@ public: static void loadFromFilename (const std::string &filename, bool reload); /// Returns the name of the language in the language name (English, Francais, ...) - static ucstring getCurrentLanguageName (); + static std::string getCurrentLanguageName (); /// Returns the code of the language ("fr", "en", ...) static std::string getCurrentLanguageCode (); @@ -134,7 +134,10 @@ public: static bool setSystemLanguageCode (const std::string &languageCode); /// Find a string in the selected language and return his association. - static const ucstring &get (const std::string &label); + static const ucstring &getAsUtf16 (const std::string &label); + + /// Find a string in the selected language and return his association. + static const std::string &get (const std::string &label); // Test if a string has a translation in the selected language. // NB : The empty string is considered to have a translation @@ -219,24 +222,28 @@ public: private: - typedef std::map StrMapContainer; + typedef std::map StrMapContainer; + typedef std::map StrMapContainer16; static ILoadProxy *_LoadProxy; static StrMapContainer _StrMap; + static StrMapContainer16 _StrMap16; static bool _StrMapLoaded; // the alternative language that will be used if the sentence is not found in the original language static StrMapContainer _StrMapFallback; + static StrMapContainer16 _StrMapFallback16; static std::vector _LanguageCodes; - static std::vector _LanguageNames; + static std::vector _LanguageNames; static std::string _SystemLanguageCode; static bool _LanguagesNamesLoaded; static std::string _SelectedLanguageCode; - static const ucstring _NotTranslatedValue; + static const ucstring _NotTranslatedValue16; + static const std::string _NotTranslatedValue; /** Structure to hold contextual info during * read of preprocessed file @@ -256,7 +263,7 @@ private: /// Init _LanguageCodes and _LanguageNames static void initLanguages(); - static bool loadFileIntoMap(const std::string &filename, StrMapContainer &dest); + static bool loadFileIntoMap(const std::string &filename, StrMapContainer &dest, StrMapContainer16 &dest16); /// The internal read function, it does the real job of readTextFile static void _readTextFile(const std::string &filename, diff --git a/nel/src/gui/ctrl_base.cpp b/nel/src/gui/ctrl_base.cpp index 75c3024f3..1f652031b 100644 --- a/nel/src/gui/ctrl_base.cpp +++ b/nel/src/gui/ctrl_base.cpp @@ -127,7 +127,7 @@ namespace NLGUI { // Force I18N tooltip if (!editorMode) - _ContextHelp = CI18N::get((const char *)prop).toUtf8(); + _ContextHelp = CI18N::get((const char *)prop); else _ContextHelp = (const char *)prop; } @@ -138,7 +138,7 @@ namespace NLGUI if (prop) { if (!editorMode && NLMISC::startsWith((const char *)prop, "ui")) - _ContextHelp = CI18N::get((const char *)prop).toUtf8(); + _ContextHelp = CI18N::get((const char *)prop); else _ContextHelp = (const char *)prop; } @@ -259,7 +259,7 @@ namespace NLGUI if( name == "tooltip" ) { if (!editorMode && NLMISC::startsWith(value, "ui")) - _ContextHelp = CI18N::get(value).toUtf8(); + _ContextHelp = CI18N::get(value); else _ContextHelp = value; return; @@ -268,7 +268,7 @@ namespace NLGUI if( name == "tooltip_i18n" ) { if (!editorMode) - _ContextHelp = CI18N::get(value).toUtf8(); + _ContextHelp = CI18N::get(value); else _ContextHelp = value; return; diff --git a/nel/src/gui/ctrl_text_button.cpp b/nel/src/gui/ctrl_text_button.cpp index 1bd32be27..154d41633 100644 --- a/nel/src/gui/ctrl_text_button.cpp +++ b/nel/src/gui/ctrl_text_button.cpp @@ -598,7 +598,7 @@ namespace NLGUI const char *propPtr = prop; std::string text; if (NLMISC::startsWith(propPtr, "ui")) - text = CI18N::get(propPtr).toUtf8(); + text = CI18N::get(propPtr); else text = propPtr; _ViewText->setText(text); diff --git a/nel/src/gui/dbgroup_combo_box.cpp b/nel/src/gui/dbgroup_combo_box.cpp index 6cf911399..66d3220a0 100644 --- a/nel/src/gui/dbgroup_combo_box.cpp +++ b/nel/src/gui/dbgroup_combo_box.cpp @@ -184,7 +184,7 @@ namespace NLGUI { const char *propPtr = name; if (NLMISC::startsWith(propPtr, "ui")) - addText(CI18N::get(propPtr).toUtf8()); + addText(CI18N::get(propPtr)); else addText(propPtr); } diff --git a/nel/src/gui/dbview_quantity.cpp b/nel/src/gui/dbview_quantity.cpp index 0f90d598e..192b0a936 100644 --- a/nel/src/gui/dbview_quantity.cpp +++ b/nel/src/gui/dbview_quantity.cpp @@ -148,7 +148,7 @@ namespace NLGUI { const char *propPtr = ptr; if (NLMISC::startsWith(propPtr, "ui")) - _EmptyText = CI18N::get(propPtr).toUtf8(); + _EmptyText = CI18N::get(propPtr); else _EmptyText = propPtr; } diff --git a/nel/src/gui/group_container.cpp b/nel/src/gui/group_container.cpp index f0a023c39..7bab62820 100644 --- a/nel/src/gui/group_container.cpp +++ b/nel/src/gui/group_container.cpp @@ -3538,7 +3538,7 @@ namespace NLGUI _RightButton->setTexturePushed (pLayer->getValStr ("right_button_tx_popin")); _RightButton->setTextureOver (pLayer->getValStr ("right_button_tx_over")); _RightButton->setActionOnLeftClick ("ic_popin"); - _RightButton->setDefaultContextHelp(CI18N::get("uiPopinWindow").toUtf8()); + _RightButton->setDefaultContextHelp(CI18N::get("uiPopinWindow")); } else // else the container can be deactivated ? deactivate button { @@ -3546,7 +3546,7 @@ namespace NLGUI _RightButton->setTexturePushed (pLayer->getValStr ("right_button_tx_deactive")); _RightButton->setTextureOver (pLayer->getValStr ("right_button_tx_over")); _RightButton->setActionOnLeftClick ("ic_deactive"); - _RightButton->setDefaultContextHelp(CI18N::get("uiClose").toUtf8()); + _RightButton->setDefaultContextHelp(CI18N::get("uiClose")); } } } @@ -3559,7 +3559,7 @@ namespace NLGUI _RightButton->setTexturePushed (pLayer->getValStr ("right_button_tx_popup")); _RightButton->setTextureOver (pLayer->getValStr ("right_button_tx_over")); _RightButton->setActionOnLeftClick ("ic_popup"); - _RightButton->setDefaultContextHelp(CI18N::get("uiPopupWindow").toUtf8()); + _RightButton->setDefaultContextHelp(CI18N::get("uiPopupWindow")); } _RightButton->setActive(!_Locked); } @@ -3602,7 +3602,7 @@ namespace NLGUI _HelpButton->setTexturePushed (pLayer->getValStr ("help_button_tx")); _HelpButton->setTextureOver (pLayer->getValStr ("help_button_tx_over")); _HelpButton->setActionOnLeftClick ("ic_help"); - _HelpButton->setDefaultContextHelp(CI18N::get("uiHelp").toUtf8()); + _HelpButton->setDefaultContextHelp(CI18N::get("uiHelp")); } // if not layer 0 diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 08bf1b7c1..15bd47a68 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -3229,7 +3229,7 @@ namespace NLGUI { if (CI18N::hasTranslation(tooltip)) { - ctrlButton->setDefaultContextHelp(CI18N::get(tooltip).toUtf8()); + ctrlButton->setDefaultContextHelp(CI18N::get(tooltip)); //ctrlButton->setOnContextHelp(CI18N::get(tooltip).toString()); } else @@ -5467,7 +5467,7 @@ namespace NLGUI { if (CI18N::hasTranslation(tooltip)) { - ctrlButton->setDefaultContextHelp(CI18N::get(tooltip).toUtf8()); + ctrlButton->setDefaultContextHelp(CI18N::get(tooltip)); } else { diff --git a/nel/src/gui/lua_ihm.cpp b/nel/src/gui/lua_ihm.cpp index cf60444a6..908898e74 100644 --- a/nel/src/gui/lua_ihm.cpp +++ b/nel/src/gui/lua_ihm.cpp @@ -1691,7 +1691,7 @@ namespace NLGUI // inside i18n table luabind::module(L, "i18n") [ - luabind::def("get", &CI18N::get), + luabind::def("get", &CI18N::getAsUtf16), // FIXME: Lua UTF-8 luabind::def("hasTranslation", &CI18N::hasTranslation) ]; // inside 'nlfile' table diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index d23d89f87..69b117330 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -653,7 +653,7 @@ namespace NLGUI #if 1 if (NLMISC::startsWith(value, "ui")) { - _Text = CI18N::get(value).toUtf8(); + _Text = CI18N::get(value); _TextLength = 0; _HardText = value; } @@ -1000,7 +1000,7 @@ namespace NLGUI if (NLMISC::startsWith(propPtr, "ui")) { _HardText = propPtr; - _Text = CI18N::get(propPtr).toUtf8(); + _Text = CI18N::get(propPtr); _TextLength = 0; } else @@ -1021,11 +1021,11 @@ namespace NLGUI if (_MultiLine) { - setTextFormatTaged(CI18N::get(propPtr).toUtf8()); + setTextFormatTaged(CI18N::get(propPtr)); } else { - setSingleLineTextFormatTaged(CI18N::get(propPtr).toUtf8()); + setSingleLineTextFormatTaged(CI18N::get(propPtr)); } } @@ -2394,7 +2394,7 @@ namespace NLGUI { if (NLMISC::startsWith(ht, "ui")) { - setText(CI18N::get(ht).toUtf8()); + setText(CI18N::get(ht)); _HardText = ht; } else @@ -3346,7 +3346,7 @@ namespace NLGUI pTooltip->setRenderLayer(getRenderLayer()); std::string tempTooltipStr = tempTooltips[i].toUtf8(); bool isI18N = NLMISC::startsWith(tempTooltipStr, "ui"); - pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltipStr).toUtf8() : tempTooltipStr); + pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltipStr) : tempTooltipStr); pTooltip->setParentPos(this); pTooltip->setParentPosRef(Hotspot_BR); pTooltip->setPosRef(Hotspot_BR); diff --git a/nel/src/misc/common.cpp b/nel/src/misc/common.cpp index 184f550d5..cbc6ee070 100644 --- a/nel/src/misc/common.cpp +++ b/nel/src/misc/common.cpp @@ -884,7 +884,7 @@ std::string formatThousands(const std::string& s) { sint i, k; sint remaining = (sint)s.length() - 1; - static std::string separator = NLMISC::CI18N::get("uiThousandsSeparator").toUtf8(); + static std::string separator = NLMISC::CI18N::get("uiThousandsSeparator"); // Don't add separator if the number is < 10k if (remaining < 4) return s; diff --git a/nel/src/misc/i18n.cpp b/nel/src/misc/i18n.cpp index 27a47c2e4..729234f56 100644 --- a/nel/src/misc/i18n.cpp +++ b/nel/src/misc/i18n.cpp @@ -38,15 +38,18 @@ using namespace std; namespace NLMISC { -CI18N::StrMapContainer CI18N::_StrMap; -CI18N::StrMapContainer CI18N::_StrMapFallback; -bool CI18N::_StrMapLoaded = false; -const ucstring CI18N::_NotTranslatedValue(""); +CI18N::StrMapContainer CI18N::_StrMap; +CI18N::StrMapContainer CI18N::_StrMapFallback; +CI18N::StrMapContainer16 CI18N::_StrMap16; +CI18N::StrMapContainer16 CI18N::_StrMapFallback16; +bool CI18N::_StrMapLoaded = false; +const ucstring CI18N::_NotTranslatedValue16(""); +const std::string CI18N::_NotTranslatedValue(""); bool CI18N::_LanguagesNamesLoaded = false; string CI18N::_SelectedLanguageCode; CI18N::ILoadProxy *CI18N::_LoadProxy = 0; vector CI18N::_LanguageCodes; -vector CI18N::_LanguageNames; +vector CI18N::_LanguageNames; std::string CI18N::_SystemLanguageCode; bool CI18N::noResolution = false; @@ -65,17 +68,17 @@ void CI18N::initLanguages() _LanguageCodes.push_back("ru"); _LanguageCodes.push_back("es"); - _LanguageNames.push_back(ucstring("English")); - _LanguageNames.push_back(ucstring("French")); - _LanguageNames.push_back(ucstring("German")); - _LanguageNames.push_back(ucstring("Russian")); - _LanguageNames.push_back(ucstring("Spanish")); + _LanguageNames.push_back("English"); + _LanguageNames.push_back("French"); + _LanguageNames.push_back("German"); + _LanguageNames.push_back("Russian"); + _LanguageNames.push_back("Spanish"); _LanguagesNamesLoaded = true; } } -const std::vector &CI18N::getLanguageNames() +const std::vector &CI18N::getLanguageNames() { initLanguages(); @@ -91,19 +94,27 @@ const std::vector &CI18N::getLanguageCodes() void CI18N::load (const string &languageCode, const string &fallbackLanguageCode) { - if (_StrMapLoaded) _StrMap.clear (); - else _StrMapLoaded = true; + if (_StrMapLoaded) + { + _StrMap.clear(); + _StrMap16.clear(); + } + else + { + _StrMapLoaded = true; + } _SelectedLanguageCode = languageCode; - loadFileIntoMap(languageCode + ".uxt", _StrMap); + loadFileIntoMap(languageCode + ".uxt", _StrMap, _StrMap16); _StrMapFallback.clear(); + _StrMapFallback16.clear(); if(!fallbackLanguageCode.empty()) { - loadFileIntoMap(fallbackLanguageCode + ".uxt", _StrMapFallback); + loadFileIntoMap(fallbackLanguageCode + ".uxt", _StrMapFallback, _StrMapFallback16); } } -bool CI18N::loadFileIntoMap(const string &fileName, StrMapContainer &destMap) +bool CI18N::loadFileIntoMap(const string &fileName, StrMapContainer &destMap, StrMapContainer16 &destMap16) { ucstring text; // read in the text @@ -138,11 +149,12 @@ bool CI18N::loadFileIntoMap(const string &fileName, StrMapContainer &destMap) // ok, a line read. pair::iterator, bool> ret; - ret = destMap.insert(make_pair(label, ucs)); + ret = destMap16.insert(make_pair(label, ucs)); if (!ret.second) { nlwarning("I18N: Error in %s, the label %s exists twice !", fileName.c_str(), label.c_str()); } + destMap.insert(make_pair(label, ucs.toUtf8())); skipWhiteSpace(first, last); } @@ -152,13 +164,15 @@ bool CI18N::loadFileIntoMap(const string &fileName, StrMapContainer &destMap) { nlwarning("I18N: In file %s, missing LanguageName translation (should be first in file)", fileName.c_str()); } + nlassert(destMap.size() == destMap16.size()); return true; } void CI18N::loadFromFilename(const string &filename, bool reload) { StrMapContainer destMap; - if (!loadFileIntoMap(filename, destMap)) + StrMapContainer16 destMap16; + if (!loadFileIntoMap(filename, destMap, destMap16)) { return; } @@ -167,16 +181,52 @@ void CI18N::loadFromFilename(const string &filename, bool reload) { if (!reload) { - if (_StrMap.count(it->first)) + if (_StrMap16.count(it->first)) { nlwarning("I18N: Error in %s, the label %s exist twice !", filename.c_str(), it->first.c_str()); } } + _StrMap16[it->first] = ucstring::makeFromUtf8(it->second); _StrMap[it->first] = it->second; } } -const ucstring &CI18N::get (const string &label) +const std::string &CI18N::get(const string &label) +{ + if (noResolution) + { + return label; + } + + if (label.empty()) + { + static const std::string empty; + return empty; + } + + StrMapContainer::iterator it(_StrMap.find(label)); + + if (it != _StrMap.end()) + return it->second; + + static CHashSet missingStrings; + if (missingStrings.find(label) == missingStrings.end()) + { + nlwarning("I18N: The string %s did not exist in language %s (display once)", label.c_str(), _SelectedLanguageCode.c_str()); + missingStrings.insert(label); + } + + // use the fall back language if it exists + it = _StrMapFallback.find(label); + if (it != _StrMapFallback.end()) + return it->second; + + static std::string badString; + badString = string(""; + return badString; +} + +const ucstring &CI18N::getAsUtf16 (const string &label) { if( noResolution ) { @@ -187,13 +237,13 @@ const ucstring &CI18N::get (const string &label) if (label.empty()) { - static ucstring emptyString; + static const ucstring emptyString; return emptyString; } - StrMapContainer::iterator it(_StrMap.find(label)); + StrMapContainer16::iterator it(_StrMap16.find(label)); - if (it != _StrMap.end()) + if (it != _StrMap16.end()) return it->second; static CHashSet missingStrings; @@ -204,8 +254,8 @@ const ucstring &CI18N::get (const string &label) } // use the fall back language if it exists - it = _StrMapFallback.find(label); - if (it != _StrMapFallback.end()) + it = _StrMapFallback16.find(label); + if (it != _StrMapFallback16.end()) return it->second; static ucstring badString; @@ -229,7 +279,7 @@ bool CI18N::hasTranslation(const string &label) return false; } -ucstring CI18N::getCurrentLanguageName () +std::string CI18N::getCurrentLanguageName () { return get("LanguageName"); } @@ -379,7 +429,7 @@ std::string CI18N::getSystemLanguageCode () // locales names are different under Windows, for example: French_France.1252 for(uint i = 0; i < _LanguageNames.size(); ++i) { - std::string name = _LanguageNames[i].toUtf8(); + std::string name = _LanguageNames[i]; // so we compare the language name with the supported ones if (lang.compare(0, name.length(), name) == 0) @@ -439,7 +489,7 @@ bool CI18N::setSystemLanguageCode (const std::string &languageCode) // check if language name is supported for(uint i = 0; i < _LanguageNames.size(); ++i) { - std::string name = NLMISC::toLower(_LanguageNames[i].toUtf8()); + std::string name = NLMISC::toLower(_LanguageNames[i]); if (name == lang) { diff --git a/ryzom/client/src/bg_downloader_access.cpp b/ryzom/client/src/bg_downloader_access.cpp index 61364ea5f..2a0e2d73a 100644 --- a/ryzom/client/src/bg_downloader_access.cpp +++ b/ryzom/client/src/bg_downloader_access.cpp @@ -230,7 +230,7 @@ void CBGDownloaderAccess::CDownloadCoTask::run() // that the downloader is still running and in slave mode if (!isDownloaderProcessRunning() && getDownloaderMode() != DownloaderMode_Slave) { - throw EDownloadException(CI18N::get("uiBGD_DownloaderStopped").toUtf8()); + throw EDownloadException(CI18N::get("uiBGD_DownloaderStopped")); } } else @@ -429,7 +429,7 @@ void CBGDownloaderAccess::CDownloadCoTask::createDownloaderProcess() BOOL ok = NLMISC::launchProgram(BGDownloaderName, Parent->_CommandLine); if (!ok) { - throw EDownloadException(CI18N::get("uiBGD_LaunchError").toUtf8()); + throw EDownloadException(CI18N::get("uiBGD_LaunchError")); } } else @@ -458,7 +458,7 @@ void CBGDownloaderAccess::CDownloadCoTask::restartDownloader() { nlwarning("CBGDownloaderAccess::CDownloadCoTask : detected shared memory segment, with NULL pid"); // some problem here ... - throw EDownloadException(CI18N::get("uiBGD_MultipleRyzomInstance").toUtf8()); + throw EDownloadException(CI18N::get("uiBGD_MultipleRyzomInstance")); } } bool ok = NLMISC::CWinProcess::terminateProcess(*(DWORD *) ryzomInstPIDPtr); @@ -467,7 +467,7 @@ void CBGDownloaderAccess::CDownloadCoTask::restartDownloader() { nlwarning("CBGDownloaderAccess::CDownloadCoTask : detected shared memory segment, with good pid, but couldn't stop the process"); // couldn't stop the other client ... - throw EDownloadException(CI18N::get("uiBGD_MultipleRyzomInstance").toUtf8()); + throw EDownloadException(CI18N::get("uiBGD_MultipleRyzomInstance")); } } // write our pid into shared mem @@ -475,7 +475,7 @@ void CBGDownloaderAccess::CDownloadCoTask::restartDownloader() if (!Parent->_RyzomInstPIDPtr) { // really, really bad luck ... - throw EDownloadException(CI18N::get("uiBGD_MultipleRyzomInstance").toUtf8()); + throw EDownloadException(CI18N::get("uiBGD_MultipleRyzomInstance")); } *(uint32 *) Parent->_RyzomInstPIDPtr = (uint32) GetCurrentProcessId(); @@ -514,7 +514,7 @@ void CBGDownloaderAccess::CDownloadCoTask::restartDownloader() const uint32 totalTries = 7; while (waitTime <= 32000) { - Parent->_CurrentMessage.fromUtf8(toString(CI18N::get("uiBGD_HandShaking").toUtf8().c_str(), tryIndex, totalTries)); + Parent->_CurrentMessage.fromUtf8(toString(CI18N::get("uiBGD_HandShaking").c_str(), tryIndex, totalTries)); sendSimpleMsg(CL_Probe); NLMISC::CMemStream dummyMsg; @@ -758,7 +758,7 @@ void CBGDownloaderAccess::CDownloadCoTask::waitMsg(BGDownloader::TMsgType wanted if (msgType != wantedMsgType) { nlwarning("BG DOWNLOADER PROTOCOL ERROR ! Bad message type received. Expected type is '%d', received type is '%d'", (int) wantedMsgType, (int) msgType); - throw EDownloadException(CI18N::get("uiBGD_ProtocolError").toUtf8()); + throw EDownloadException(CI18N::get("uiBGD_ProtocolError")); } } @@ -816,7 +816,7 @@ void CBGDownloaderAccess::CDownloadCoTask::checkDownloaderAlive() { if (!Parent->_DownloaderMsgQueue.connected() || !isDownloaderProcessRunning()) { - throw EDownloadException(CI18N::get("uiBGD_DownloaderDisconnected").toUtf8()); + throw EDownloadException(CI18N::get("uiBGD_DownloaderDisconnected")); } } diff --git a/ryzom/client/src/client_chat_manager.cpp b/ryzom/client/src/client_chat_manager.cpp index a61c21701..09b1140d4 100644 --- a/ryzom/client/src/client_chat_manager.cpp +++ b/ryzom/client/src/client_chat_manager.cpp @@ -1176,9 +1176,9 @@ class CHandlerTell : public IActionHandler void execute (CCtrlBase *pCaller, const std::string &sParams) { string receiver = getParam (sParams, "player"); - ucstring message; - message.fromUtf8(getParam (sParams, "text")); -// message = getParam (sParams, "text"); + string message; + message = getParam (sParams, "text"); + if (receiver.empty() || message.empty()) return; @@ -1194,10 +1194,10 @@ class CHandlerTell : public IActionHandler // display in the good window CInterfaceProperty prop; prop.readRGBA("UI:SAVE:CHAT:COLORS:SPEAKER"," "); - ucstring finalMsg; + string finalMsg; CChatWindow::encodeColorTag(prop.getRGBA(), finalMsg, false); - ucstring csr(CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""); + string csr(CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""); finalMsg += csr + CI18N::get("youTell") + ": "; prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); CChatWindow::encodeColorTag(prop.getRGBA(), finalMsg, true); @@ -1206,7 +1206,7 @@ class CHandlerTell : public IActionHandler // TDataSetIndex dsi; // not used .... PeopleInterraction.ChatInput.Tell.displayTellMessage(/*dsi, */finalMsg, receiver, prop.getRGBA()); - ucstring s = CI18N::get("youTellPlayer"); + string s = CI18N::get("youTellPlayer"); strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); @@ -1341,9 +1341,7 @@ class CHandlerTalk : public IActionHandler // Param uint mode; fromString(getParam (sParams, "mode"), mode); - ucstring text; - text.fromUtf8 (getParam (sParams, "text")); -// text = getParam (sParams, "text"); + string text = getParam (sParams, "text"); // Parse any tokens in the text if ( ! CInterfaceManager::parseTokens(text)) @@ -1356,7 +1354,7 @@ class CHandlerTalk : public IActionHandler { if(text[0] == '/') { - string str = text.toUtf8(); + string str = text; string cmdWithArgs = str.substr(1); // Get the command name from the string, can contain spaces diff --git a/ryzom/client/src/client_sheets/item_sheet.cpp b/ryzom/client/src/client_sheets/item_sheet.cpp index 04d0737e1..25d66acce 100644 --- a/ryzom/client/src/client_sheets/item_sheet.cpp +++ b/ryzom/client/src/client_sheets/item_sheet.cpp @@ -983,7 +983,7 @@ bool CItemSheet::canExchangeOrGive(bool botChatGift) const } // *************************************************************************** -void CItemSheet::getItemPartListAsText(ucstring &ipList) const +void CItemSheet::getItemPartListAsText(std::string &ipList) const { bool all= true; for(uint i=0;i string sys; - sys = "Language "+CI18N::getCurrentLanguageName().toString() +" "; + sys = "Language "+CI18N::getCurrentLanguageName() +" "; if (!args.empty()) { @@ -1306,9 +1306,9 @@ NLMISC_COMMAND(execScript, "Execute a script file (.cmd)","") inComment++; if(inComment<=0) { - ucstring ucline(line); + string ucline(line); CInterfaceManager::parseTokens(ucline); - ICommand::execute(ucline.toUtf8(), g_log); + ICommand::execute(ucline, g_log); } if(strncmp(line, "*/", 2)==0) inComment--; diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 1ce257f2c..39493495f 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -1021,7 +1021,7 @@ TInterfaceState globalMenu() // Display the firewall alert string CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:outgame:connecting:title")); if (pVT != NULL) - pVT->setText(CI18N::get("uiFirewallAlert").toUtf8() + "..."); + pVT->setText(CI18N::get("uiFirewallAlert") + "..."); // The mouse and fullscreen mode should be unlocked for the user to set the firewall permission nlSleep( 30 ); // 'nice' the client, and prevent to make too many send attempts @@ -1237,8 +1237,8 @@ TInterfaceState globalMenu() if (pVT != NULL) { pVT->setMultiLine( true ); - pVT->setText(CI18N::get("uiFirewallFail").toUtf8()+".\n"+ - CI18N::get("uiFirewallAlert").toUtf8()+"."); + pVT->setText(CI18N::get("uiFirewallFail")+".\n"+ + CI18N::get("uiFirewallAlert")+"."); } } } @@ -1319,7 +1319,7 @@ public: if (pVT == NULL) return; if (rCS.Name.empty()) - pVT->setText(CI18N::get("uiEmptySlot").toUtf8()); + pVT->setText(CI18N::get("uiEmptySlot")); else pVT->setText(rCS.Name.toUtf8()); } @@ -1328,7 +1328,7 @@ public: { CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sPath+":text"+NLMISC::toString(i))); if (pVT == NULL) return; - pVT->setText(CI18N::get("uiEmptySlot").toUtf8()); + pVT->setText(CI18N::get("uiEmptySlot")); } } }; @@ -2682,7 +2682,7 @@ class CAHScenarioControl : public IActionHandler CViewText* viewText = dynamic_cast(result); if(viewText) { - viewText->setText(R2::getEditor().isInitialized()?CI18N::get("uiR2EDScenarioName").toUtf8():CI18N::get("uiR2EDScenarioFileName").toUtf8()); + viewText->setText(R2::getEditor().isInitialized()?CI18N::get("uiR2EDScenarioName"):CI18N::get("uiR2EDScenarioFileName")); } } @@ -2694,9 +2694,9 @@ class CAHScenarioControl : public IActionHandler if(okButton) { if(R2::getEditor().getAccessMode()!=R2::CEditor::AccessDM) - okButton->setHardText(CI18N::get("uiR2EDLaunchScenario").toString()); + okButton->setHardText(CI18N::get("uiR2EDLaunchScenario")); else - okButton->setHardText(CI18N::get("uiR2EDApplyScenarioFilters").toString()); + okButton->setHardText(CI18N::get("uiR2EDApplyScenarioFilters")); } } @@ -3184,9 +3184,9 @@ class CAHLoadScenario : public IActionHandler // -------------------------- TRuleType ruleType(TRuleType::rt_strict); - if(rules==CI18N::get("uiR2EDliberal").toString()) + if(rules==CI18N::get("uiR2EDliberal")) ruleType = TRuleType(TRuleType::rt_liberal); - else if(rules == CI18N::get("uiR2EDstrict").toString()) + else if(rules == CI18N::get("uiR2EDstrict")) ruleType = TRuleType(TRuleType::rt_strict); volatile static bool override = false; if (override) @@ -3250,7 +3250,7 @@ class CAHLoadScenario : public IActionHandler { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningFreeTrial").toUtf8()); + pVT->setText(CI18N::get("uiRingWarningFreeTrial")); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); return; @@ -3331,7 +3331,7 @@ class CAHLoadScenario : public IActionHandler { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningFreeTrial").toUtf8()); + pVT->setText(CI18N::get("uiRingWarningFreeTrial")); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); } @@ -3360,7 +3360,7 @@ class CAHLoadScenario : public IActionHandler { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningInviteFreeTrial").toUtf8()); + pVT->setText(CI18N::get("uiRingWarningInviteFreeTrial")); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); } } diff --git a/ryzom/client/src/debug_client.cpp b/ryzom/client/src/debug_client.cpp index dd182f3c9..30e2645bf 100644 --- a/ryzom/client/src/debug_client.cpp +++ b/ryzom/client/src/debug_client.cpp @@ -529,7 +529,7 @@ string getDebugInformation() str += toString("ServerTick: %u\n", NetMngr.getCurrentServerTick()); str += toString("ConnectState: %s\n", NetMngr.getConnectionStateCStr()); str += toString("LocalAddress: %s\n", NetMngr.getAddress().asString().c_str()); - str += toString("Language: %s\n", CI18N::getCurrentLanguageName().toString().c_str()); + str += toString("Language: %s\n", CI18N::getCurrentLanguageName().c_str()); str += toString("ClientVersion: %s\n", getDebugVersion().c_str()); if (ClientCfg.R2Mode) { diff --git a/ryzom/client/src/init.cpp b/ryzom/client/src/init.cpp index 5e7b03549..28d14dc7b 100644 --- a/ryzom/client/src/init.cpp +++ b/ryzom/client/src/init.cpp @@ -578,7 +578,7 @@ void checkDriverDepth () #else if (mode.Depth != 16 && mode.Depth != 24 && mode.Depth != 32) #endif - ExitClientError (CI18N::get ("uiDesktopNotIn32").toUtf8().c_str ()); + ExitClientError (CI18N::get ("uiDesktopNotIn32").c_str ()); } } @@ -1058,7 +1058,7 @@ void prelogInit() if(Driver == NULL) { - ExitClientError (CI18N::get ("Can_t_load_the_display_driver").toUtf8().c_str ()); + ExitClientError (CI18N::get ("Can_t_load_the_display_driver").c_str ()); // ExitClientError() call exit() so the code after is never called return; } @@ -1149,14 +1149,14 @@ void prelogInit() string msg; if (mode.Windowed) { - msg = CI18N::get ("can_t_create_a_window_display").toUtf8(); + msg = CI18N::get ("can_t_create_a_window_display"); } else { - msg = CI18N::get ("can_t_create_a_fullscreen_display").toUtf8(); + msg = CI18N::get ("can_t_create_a_fullscreen_display"); } msg += " (%dx%d %d "; - msg += CI18N::get ("bits").toUtf8 (); + msg += CI18N::get ("bits"); msg += ")"; ExitClientError (msg.c_str (), mode.Width, mode.Height, mode.Depth); // ExitClientError() call exit() so the code after is never called diff --git a/ryzom/client/src/init_main_loop.cpp b/ryzom/client/src/init_main_loop.cpp index 9c8890775..a1caef841 100644 --- a/ryzom/client/src/init_main_loop.cpp +++ b/ryzom/client/src/init_main_loop.cpp @@ -1692,7 +1692,7 @@ void initBloomConfigUI() if(!supportBloom) { if(group) - group->setDefaultContextHelp(CI18N::get("uiFxTooltipBloom").toUtf8()); + group->setDefaultContextHelp(CI18N::get("uiFxTooltipBloom")); ClientCfg.writeBool("FXAA", false); ClientCfg.writeBool("Bloom", false); diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 2901bb261..4281181a9 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2140,7 +2140,7 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler pVBR->setColor(CRGBA(0,0,0,0)); if (pTooltip) - pTooltip->setDefaultContextHelp(CI18N::get("uittTargetUnknown").toUtf8()); + pTooltip->setDefaultContextHelp(CI18N::get("uittTargetUnknown")); return; } @@ -2205,7 +2205,7 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler sint min = (nForceRegion-2) * 50 + (nLevelForce-1) * 10 + 1; sint max = (nForceRegion-2) * 50 + nLevelForce * 10; - str= CI18N::get("uittTargetLevel").toUtf8(); + str= CI18N::get("uittTargetLevel"); strFindReplace(str, "%min", toString(min)); strFindReplace(str, "%max", toString(max)); } @@ -2214,16 +2214,16 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler { sint n = (nForceRegion-1) * 50; if (pE->isNPC()) - str= CI18N::get("uittTargetGuardBoss").toUtf8(); + str= CI18N::get("uittTargetGuardBoss"); else - str= CI18N::get("uittTargetBoss").toUtf8(); + str= CI18N::get("uittTargetBoss"); strFindReplace(str, "%n", toString("%d", n) ); } // Named else { sint n = (nForceRegion-1) * 50; - str= CI18N::get("uittTargetNamed").toUtf8(); + str= CI18N::get("uittTargetNamed"); strFindReplace(str, "%n", toString("%d", n) ); } @@ -3094,10 +3094,10 @@ public: if( pCB ) { pCB->resetTexts(); - pCB->addText(CI18N::get("uigcLowTextureMode").toUtf8()); - pCB->addText(CI18N::get("uigcNormalTextureMode").toUtf8()); + pCB->addText(CI18N::get("uigcLowTextureMode")); + pCB->addText(CI18N::get("uigcNormalTextureMode")); if(ClientCfg.HDTextureInstalled) - pCB->addText(CI18N::get("uigcHighTextureMode").toUtf8()); + pCB->addText(CI18N::get("uigcHighTextureMode")); } // Anisotropic Filtering @@ -3110,7 +3110,7 @@ public: sint maxAnisotropic = (sint)Driver->getAnisotropicFilterMaximum(); pCB->resetTexts(); - pCB->addText(CI18N::get("uigcFxAnisotropicFilterNone").toUtf8()); + pCB->addText(CI18N::get("uigcFxAnisotropicFilterNone")); sint anisotropic = 2; uint i = 1; diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index 4e92c67fb..0eb240b7d 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -992,9 +992,7 @@ class CHandlerBrowse : public IActionHandler } } - ucstring ucparams(params); - CInterfaceManager::parseTokens(ucparams); - params = ucparams.toUtf8(); + CInterfaceManager::parseTokens(params); // go. NB: the action handler himself may translate params from utf8 CAHManager::getInstance()->runActionHandler(action, elementGroup, params); @@ -2014,7 +2012,7 @@ void getItemText (CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS) if(pIS->canBuildSomeItemPart()) { ucstring fmt= CI18N::get("uihelpItemMPCraft"); - ucstring ipList; + std::string ipList; pIS->getItemPartListAsText(ipList); strFindReplace(fmt, "%ip", ipList); strFindReplace(itemText, "%craft", fmt); @@ -2200,7 +2198,7 @@ static void setupRawMaterialStats(CSheetHelpSetup &setup) if(pIS->canBuildItemPart(faberType)) { - pCB->addText(RM_FABER_TYPE::toLocalString(faberType).toUtf8()); + pCB->addText(RM_FABER_TYPE::toLocalString(faberType)); } } @@ -3165,7 +3163,7 @@ void setupListBrickHeader(CSheetHelpSetup &setup) if(view) { view->setActive(true); - view->setTextFormatTaged(CI18N::get("uihelpPhraseHeaderBricks").toUtf8()); + view->setTextFormatTaged(CI18N::get("uihelpPhraseHeaderBricks")); } } @@ -3476,73 +3474,73 @@ void setConsoModSuccessTooltip( CDBCtrlSheet *cs ) string ustr; if( CSheetId(cs->getSheetId()).toString() == "mod_melee_success.sbrick" ) { - ustr = CI18N::get("uittModMeleeSuccess").toUtf8(); + ustr = CI18N::get("uittModMeleeSuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:MELEE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_range_success.sbrick" ) { - ustr = CI18N::get("uittModRangeSuccess").toUtf8(); + ustr = CI18N::get("uittModRangeSuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:RANGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_craft_success.sbrick" ) { - ustr = CI18N::get("uittModCraftSuccess").toUtf8(); + ustr = CI18N::get("uittModCraftSuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:CRAFT", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_defense_success.sbrick" ) { - ustr = CI18N::get("uittModDefenseSuccess").toUtf8(); + ustr = CI18N::get("uittModDefenseSuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:DODGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_dodge_success.sbrick" ) { - ustr = CI18N::get("uittModDodgeSuccess").toUtf8(); + ustr = CI18N::get("uittModDodgeSuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:DODGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_parry_success.sbrick" ) { - ustr = CI18N::get("uittModParrySuccess").toUtf8(); + ustr = CI18N::get("uittModParrySuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:PARRY", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_forage_success.sbrick" ) { - ustr = CI18N::get("uittModForageSuccess").toUtf8(); + ustr = CI18N::get("uittModForageSuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::common_ecosystem)+":FORAGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_desert_forage_success.sbrick" ) { - ustr = CI18N::get("uittModDesertForageSuccess").toUtf8(); + ustr = CI18N::get("uittModDesertForageSuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::desert)+":FORAGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_forest_forage_success.sbrick" ) { - ustr = CI18N::get("uittModForestForageSuccess").toUtf8(); + ustr = CI18N::get("uittModForestForageSuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::forest)+":FORAGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_lacustre_forage_success.sbrick" ) { - ustr = CI18N::get("uittModLacustreForageSuccess").toUtf8(); + ustr = CI18N::get("uittModLacustreForageSuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::lacustre)+":FORAGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_jungle_forage_success.sbrick" ) { - ustr = CI18N::get("uittModJungleForageSuccess").toUtf8(); + ustr = CI18N::get("uittModJungleForageSuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::jungle)+":FORAGE", false); } else if( CSheetId(cs->getSheetId()).toString() == "mod_primary_root_forage_success.sbrick" ) { - ustr = CI18N::get("uittModPrimaryRootForageSuccess").toUtf8(); + ustr = CI18N::get("uittModPrimaryRootForageSuccess"); nodeSM = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SUCCESS_MODIFIER:ECO:"+toString((uint8)ECOSYSTEM::primary_root)+":FORAGE", false); } @@ -3576,19 +3574,19 @@ public: // special tooltip? (pvp outpost and xp catalyzer) sint specialTTId= getBonusMalusSpecialTT(cs); if(specialTTId==BONUS_MALUS::XpCatalyser) - CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittXpBonus").toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittXpBonus")); else if(specialTTId==BONUS_MALUS::OutpostPVPOn) - CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOn").toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOn")); else if(specialTTId==BONUS_MALUS::OutpostPVPOutOfZone) - CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOutOfZone").toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOutOfZone")); else if(specialTTId==BONUS_MALUS::OutpostPVPInRound) - CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostInRound").toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostInRound")); else if(specialTTId==BONUS_MALUS::DeathPenalty) { CCDBNodeLeaf * node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:DEATH_XP_MALUS", false); if( node ) { - string txt = CI18N::get("uittDeathPenalty").toUtf8(); + string txt = CI18N::get("uittDeathPenalty"); strFindReplace(txt, "%dp", toString((100*node->getValue16())/254)); CWidgetManager::getInstance()->setContextHelpText(txt); } @@ -3600,7 +3598,7 @@ public: std::string str; cs->getContextHelp(str); - str+= CI18N::get("uittAuraDisabled").toUtf8(); + str+= CI18N::get("uittAuraDisabled"); // and replace the context help that is required. CWidgetManager::getInstance()->setContextHelpText(str); @@ -3838,7 +3836,7 @@ static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const s CViewText *statTitle= dynamic_cast(groupStat->getElement(groupStat->getId()+":text" )); CDBViewBar *statValue= dynamic_cast(groupStat->getElement(groupStat->getId()+":bar" )); if(statTitle) - statTitle->setText(RM_FABER_STAT_TYPE::toLocalString(statType).toUtf8()); + statTitle->setText(RM_FABER_STAT_TYPE::toLocalString(statType)); if(statValue) statValue->setValue(itemPart.Stats[i]); } diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index 22a30b424..6591472d4 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -1790,7 +1790,7 @@ void CActionPhraseFaber::updateItemResult() uint sv= uint(statArray[i]*100); if(statTitle) { - statTitle->setText(RM_FABER_STAT_TYPE::toLocalString(statType).toUtf8()); + statTitle->setText(RM_FABER_STAT_TYPE::toLocalString(statType)); statTitle->setColor(usageColor); } if(statValueBar) @@ -1810,12 +1810,12 @@ void CActionPhraseFaber::updateItemResult() // display something only for magic/protect stat if( RM_FABER_STAT_TYPE::isMagicResistStat(RM_FABER_STAT_TYPE::TRMStatType(i)) || RM_FABER_STAT_TYPE::isMagicProtectStat(RM_FABER_STAT_TYPE::TRMStatType(i)) ) - statToolTip->setDefaultContextHelp(CI18N::get("uiFaberStatActive").toUtf8()); + statToolTip->setDefaultContextHelp(CI18N::get("uiFaberStatActive")); else statToolTip->setDefaultContextHelp(std::string()); } else - statToolTip->setDefaultContextHelp(CI18N::get("uiFaberStatGrayed").toUtf8()); + statToolTip->setDefaultContextHelp(CI18N::get("uiFaberStatGrayed")); } } diff --git a/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp b/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp index 0fc03124a..e5f8cf1e4 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp @@ -189,7 +189,7 @@ void CBotChatPageDynamicMission::update() else { // add a text to show the player that the text is being received - _ChoiceCB[k]->addText(NLMISC::CI18N::get("uiWaitingChoiceFromServer").toUtf8()); + _ChoiceCB[k]->addText(NLMISC::CI18N::get("uiWaitingChoiceFromServer")); } } } diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 913e47c2e..8fa8bd08e 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -600,12 +600,12 @@ void CBotChatPageTrade::updateTradeModal() if (_BuyMean == MoneyGuildXP) { if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughMoney")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughMoney").toUtf8()); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughMoney")); } else { if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughGuildMoney")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildMoney").toUtf8()); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildMoney")); } return; } @@ -616,7 +616,7 @@ void CBotChatPageTrade::updateTradeModal() if (confirmTradeGroup) confirmTradeGroup->setActive(false); if (cantTradeGroup) cantTradeGroup->setActive(true); if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughGuildXP")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildXP").toUtf8()); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildXP")); return; } } @@ -677,7 +677,7 @@ void CBotChatPageTrade::updateTradeModal() if (cantTradeGroup) cantTradeGroup->setActive(true); // can't sell more than what is in inventory if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBCNotAvailable")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBCNotAvailable").toUtf8()); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBCNotAvailable")); ok= false; } @@ -692,7 +692,7 @@ void CBotChatPageTrade::updateTradeModal() if (cantTradeGroup) cantTradeGroup->setActive(true); // can't sell more than what is in inventory if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBadQuantity")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadQuantity").toUtf8()); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadQuantity")); ok= false; } } @@ -710,7 +710,7 @@ void CBotChatPageTrade::updateTradeModal() if (confirmTradeGroup) confirmTradeGroup->setActive(false); if (cantTradeGroup) cantTradeGroup->setActive(true); if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughMoney")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughMoney").toUtf8()); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughMoney")); } else if (_BuyMean == MoneyFactionPoints) { @@ -722,7 +722,7 @@ void CBotChatPageTrade::updateTradeModal() confirmTradeGroup->setActive(false); cantTradeGroup->setActive(true); cantTradeButton->setText(CI18N::get("uiNotEnoughFP_"+PVP_CLAN::toString(fpType))); - cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughFP_"+PVP_CLAN::toString(fpType)).toUtf8()); + cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughFP_"+PVP_CLAN::toString(fpType))); } else { @@ -745,7 +745,7 @@ void CBotChatPageTrade::updateTradeModal() if (confirmTradeGroup) confirmTradeGroup->setActive(false); if (cantTradeGroup) cantTradeGroup->setActive(true); if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughSkillPoints")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughSkillPoints").toUtf8()); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughSkillPoints")); } else { @@ -761,7 +761,7 @@ void CBotChatPageTrade::updateTradeModal() if (confirmTradeGroup) confirmTradeGroup->setActive(false); if (cantTradeGroup) cantTradeGroup->setActive(true); if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughGuildXP")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildXP").toUtf8()); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildXP")); } else { @@ -780,7 +780,7 @@ void CBotChatPageTrade::updateTradeModal() if (cantTradeGroup) cantTradeGroup->setActive(true); // can't sell less than the basic price if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBadResalePrice")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadResalePrice").toUtf8()); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadResalePrice")); } // else ok, can resell else @@ -812,7 +812,7 @@ void CBotChatPageTrade::updateTradeModal() if (_SellDlgOn && priceWithoutFame == 0) { if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiWontBuyThis")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittWontBuyThis").toUtf8()); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittWontBuyThis")); } else if (_SellDlgOn && priceWithoutFame == std::numeric_limits::max()) { @@ -821,7 +821,7 @@ void CBotChatPageTrade::updateTradeModal() else if (quantity == 0 || quantity == std::numeric_limits::max()) { if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBadQuantity")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadQuantity").toUtf8()); + if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadQuantity")); } } } @@ -865,7 +865,7 @@ void CBotChatPageTrade::startBuyDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCall CViewText *priceLabel = dynamic_cast(ig->getView( "standard_price:total_price_header" )); if ( _BuyMean == Money && priceLabel ) { - priceLabel->setText( CI18N::get( "uiPrice" ).toUtf8() ); + priceLabel->setText( CI18N::get( "uiPrice" ) ); priceLabel->setActive(true); } else @@ -977,7 +977,7 @@ void CBotChatPageTrade::startSellDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCal CViewText *priceLabel = dynamic_cast(ig->getView( "standard_price:total_price_header" )); if ( priceLabel ) { - priceLabel->setText( CI18N::get( "uiImmediatePrice" ).toUtf8() ); + priceLabel->setText( CI18N::get( "uiImmediatePrice" ) ); priceLabel->setActive(true); } @@ -1003,7 +1003,7 @@ void CBotChatPageTrade::startSellDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCal { confirmButton->setActive( !sheet->getLockedByOwner() ); confirmButton->setText(CI18N::get("uiSellImmediately")); - confirmButton->setDefaultContextHelp(CI18N::get("uittDirectSellButton").toUtf8()); + confirmButton->setDefaultContextHelp(CI18N::get("uittDirectSellButton")); } // set item or skill name diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index 72a877cb7..354a4c833 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -472,25 +472,25 @@ void CChatWindow::setHeaderColor(const std::string &n) //================================================================================= void CChatWindow::displayLocalPlayerTell(const ucstring &receiver, const ucstring &msg, uint numBlinks /*= 0*/) { - ucstring finalMsg; + string finalMsg; CInterfaceProperty prop; prop.readRGBA("UI:SAVE:CHAT:COLORS:SPEAKER"," "); encodeColorTag(prop.getRGBA(), finalMsg, false); - ucstring csr(CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""); + string csr(CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""); finalMsg += csr + CI18N::get("youTell") + ": "; prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); encodeColorTag(prop.getRGBA(), finalMsg, true); - finalMsg += msg; + finalMsg += msg.toUtf8(); - ucstring s = CI18N::get("youTellPlayer"); - strFindReplace(s, "%name", receiver); + string s = CI18N::get("youTellPlayer"); + strFindReplace(s, "%name", receiver.toUtf8()); strFindReplace(finalMsg, CI18N::get("youTell"), s); displayMessage(finalMsg, prop.getRGBA(), CChatGroup::tell, 0, numBlinks); CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); } -void CChatWindow::encodeColorTag(const NLMISC::CRGBA &color, ucstring &text, bool append) +void CChatWindow::encodeColorTag(const NLMISC::CRGBA &color, std::string &text, bool append) { // WARNING : The lookup table MUST contains 17 element (with the last doubled) // because we add 7 to the 8 bit color before shifting to right in order to match color @@ -498,8 +498,8 @@ void CChatWindow::encodeColorTag(const NLMISC::CRGBA &color, ucstring &text, boo // Have 17 entry remove the need for a %16 for each color component. // By the way, this comment is more longer to type than to add the %16... // - static ucchar ConvTable[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'F'}; - ucstring str; + static char ConvTable[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'F'}; + string str; if (append) { str.reserve(7 + str.size()); @@ -1273,7 +1273,7 @@ public: { CGroupEditBox *pEB = dynamic_cast(pCaller); if (pEB == NULL) return; - ucstring text = pEB->getInputStringAsUtf16(); + string text = pEB->getInputString(); // If the line is empty, do nothing if(text.empty()) return; @@ -1297,7 +1297,7 @@ public: if(text[0] == '/') { CChatWindow::_ChatWindowLaunchingCommand = chat; - string str = text.toUtf8(); + string str = text; string cmdWithArgs = str.substr(1); // Get the command name from the string, can contain spaces diff --git a/ryzom/client/src/interface_v3/chat_window.h b/ryzom/client/src/interface_v3/chat_window.h index 278824753..0c8811842 100644 --- a/ryzom/client/src/interface_v3/chat_window.h +++ b/ryzom/client/src/interface_v3/chat_window.h @@ -156,7 +156,7 @@ public: void displayLocalPlayerTell(const ucstring &receiver, const ucstring &msg, uint numBlinks = 0); /// Encode a color tag '@{RGBA}' in the text. If append is true, append at end of text, otherwise, replace the text - static void encodeColorTag(const NLMISC::CRGBA &color, ucstring &text, bool append=true); + static void encodeColorTag(const NLMISC::CRGBA &color, std::string &text, bool append=true); /////////////////////////////////////////////////////////////////////////////////////// protected: diff --git a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp index c75dc3af3..5a1952735 100644 --- a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp @@ -1119,10 +1119,10 @@ void CDBGroupBuildPhrase::updateAllDisplay(const CSPhraseCom &phrase) { word.InfoView->setActive(true); if(i==0) - word.InfoView->setText( CI18N::get("uiTextHelpSelectRootBrick").toUtf8() ); + word.InfoView->setText( CI18N::get("uiTextHelpSelectRootBrick") ); else // start effect index at 1 (human readable :) ) - word.InfoView->setText( CI18N::get("uiTextHelpSelectEffectBrick").toUtf8() + toString(i) ); + word.InfoView->setText( CI18N::get("uiTextHelpSelectEffectBrick") + toString(i) ); } } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp index fed48d1ac..0a474b650 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp @@ -1058,7 +1058,7 @@ void CDBGroupListSheetText::CSheetChild::updateViewTextAsItem() if(Ctrl->getType() == CCtrlSheetInfo::SheetType_Item) { if(!Ctrl->checkItemRequirement()) - text= CI18N::get("uiItemCannotUseColor").toUtf8() + text; + text= CI18N::get("uiItemCannotUseColor") + text; } // For item, add some information @@ -1070,17 +1070,17 @@ void CDBGroupListSheetText::CSheetChild::updateViewTextAsItem() // Add craft info for MP if(pIS->Family==ITEMFAMILY::RAW_MATERIAL) { - ucstring ipList; + string ipList; pIS->getItemPartListAsText(ipList); if(ipList.empty()) { if(pIS->isUsedAsCraftRequirement()) - text+= "\n" + CI18N::get("uiItemMpCraftRequirement").toUtf8(); + text+= "\n" + CI18N::get("uiItemMpCraftRequirement"); else - text+= "\n" + CI18N::get("uiItemMpNoCraft").toUtf8(); + text+= "\n" + CI18N::get("uiItemMpNoCraft"); } else - text+= "\n" + CI18N::get("uiItemMpCanCraft").toUtf8() + ipList.toUtf8(); + text+= "\n" + CI18N::get("uiItemMpCanCraft") + ipList; } } } 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 0005d80f4..aec03653b 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -254,10 +254,10 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT switch ( Ctrl->getSheetCategory() ) { case CDBCtrlSheet::Item: break; // none for item. consider useless - case CDBCtrlSheet::Pact: text= CI18N::get("uiBotChatPact").toUtf8() + text; break; - case CDBCtrlSheet::Skill: text= CI18N::get("uiBotChatSkill").toUtf8() + text; break; - case CDBCtrlSheet::GuildFlag: text= CI18N::get("uiBotChatSkill").toUtf8() + text; break; - case CDBCtrlSheet::Phrase: text= CI18N::get("uiBotChatPhrase").toUtf8() + text; break; + case CDBCtrlSheet::Pact: text= CI18N::get("uiBotChatPact") + text; break; + case CDBCtrlSheet::Skill: text= CI18N::get("uiBotChatSkill") + text; break; + case CDBCtrlSheet::GuildFlag: text= CI18N::get("uiBotChatSkill") + text; break; + case CDBCtrlSheet::Phrase: text= CI18N::get("uiBotChatPhrase") + text; break; default: break; } @@ -269,10 +269,10 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); text += string("\n") + CUtfStringView(pSMC->getOutpostBuildingLocalizedDescription(CSheetId(Ctrl->getSheetId()))).toUtf8(); - text += "\n" + CI18N::get("uiBotChatPrice").toUtf8() + NLMISC::formatThousands(toString(pOBS->CostDapper)); - text += CI18N::get("uiBotChatTime").toUtf8() + toString(pOBS->CostTime/60) + CI18N::get("uiBotChatTimeMinute").toUtf8(); + text += "\n" + CI18N::get("uiBotChatPrice") + NLMISC::formatThousands(toString(pOBS->CostDapper)); + text += CI18N::get("uiBotChatTime") + toString(pOBS->CostTime/60) + CI18N::get("uiBotChatTimeMinute"); if ((pOBS->CostTime % 60) != 0) - text += toString(pOBS->CostTime%60) + CI18N::get("uiBotChatTimeSecond").toUtf8(); + text += toString(pOBS->CostTime%60) + CI18N::get("uiBotChatTimeSecond"); } } @@ -285,7 +285,7 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT bool melee,range; pPM->getCombatWeaponRestriction(weaponRestriction, Ctrl->getSheetId(),melee,range); // don't add also if no combat restriction - if(!weaponRestriction.empty() && weaponRestriction!=CI18N::get("uiawrSF")) + if(!weaponRestriction.empty() && weaponRestriction!=CI18N::getAsUtf16("uiawrSF")) { weaponRestriction= CI18N::get("uiPhraseWRHeader") + weaponRestriction; text+= "\n" + weaponRestriction.toUtf8(); @@ -297,7 +297,7 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if(Ctrl->getType() == CCtrlSheetInfo::SheetType_Item) { if(!Ctrl->checkItemRequirement()) - colorTag= CI18N::get("uiItemCannotUseColor").toUtf8(); + colorTag= CI18N::get("uiItemCannotUseColor"); } // For item, add some information @@ -309,17 +309,17 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT // Add craft info for MP if(pIS->Family==ITEMFAMILY::RAW_MATERIAL) { - ucstring ipList; + string ipList; pIS->getItemPartListAsText(ipList); if(ipList.empty()) { if(pIS->isUsedAsCraftRequirement()) - text+= "\n" + CI18N::get("uiItemMpCraftRequirement").toUtf8(); + text+= "\n" + CI18N::get("uiItemMpCraftRequirement"); else - text+= "\n" + CI18N::get("uiItemMpNoCraft").toUtf8(); + text+= "\n" + CI18N::get("uiItemMpNoCraft"); } else - text+= "\n" + CI18N::get("uiItemMpCanCraft").toUtf8() + ipList.toUtf8(); + text+= "\n" + CI18N::get("uiItemMpCanCraft") + ipList; } } } @@ -331,9 +331,9 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if(Ctrl->getSheetCategory() == CDBCtrlSheet::Phrase) { if (LastPrice != -1) - text+= "\n" + CI18N::get("uiBotChatSkillPointCost").toUtf8() + toString(LastPrice); + text+= "\n" + CI18N::get("uiBotChatSkillPointCost") + toString(LastPrice); else - text+= "\n" + CI18N::get("uiBotChatSkillPointCostNotReceived").toUtf8(); + text+= "\n" + CI18N::get("uiBotChatSkillPointCostNotReceived"); } else { @@ -345,8 +345,8 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT const CItemSheet *pIS = Ctrl->asItemSheet(); if (pIS && pIS->Family == ITEMFAMILY::GUILD_OPTION) { - text+= "\n" + CI18N::get("uiBotChatSkillPointCost").toUtf8() + toString(pIS->GuildOption.XPCost); - text+= "\n" + CI18N::get("uiBotChatPrice").toUtf8() + NLMISC::formatThousands(toString(pIS->GuildOption.MoneyCost)); + text+= "\n" + CI18N::get("uiBotChatSkillPointCost") + toString(pIS->GuildOption.XPCost); + text+= "\n" + CI18N::get("uiBotChatPrice") + NLMISC::formatThousands(toString(pIS->GuildOption.MoneyCost)); guildOption= true; } } @@ -381,10 +381,10 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if (LastPrice > 0) { if(displayMulPrice) - text+= "\n" + CI18N::get("uiBotChatPrice").toUtf8() + NLMISC::formatThousands(toString(sint32(LastPrice * priceFactor))) + " (" + text+= "\n" + CI18N::get("uiBotChatPrice") + NLMISC::formatThousands(toString(sint32(LastPrice * priceFactor))) + " (" + NLMISC::formatThousands(toString( sint32(factor) * sint32(LastPrice * priceFactor) )) + ")"; else - text+= "\n" + CI18N::get("uiBotChatPrice").toUtf8() + NLMISC::formatThousands(toString( sint32(factor * LastPrice * priceFactor) )); + text+= "\n" + CI18N::get("uiBotChatPrice") + NLMISC::formatThousands(toString( sint32(factor * LastPrice * priceFactor) )); } if ((LastFactionPointPrice != 0) && (LastFactionType >= PVP_CLAN::BeginClans) && (LastFactionType <= PVP_CLAN::EndClans)) @@ -394,8 +394,8 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT else text+= "\n"; - text+= CI18N::get("uiBotChatFactionType").toUtf8() + PVP_CLAN::toString((PVP_CLAN::TPVPClan)LastFactionType) - + CI18N::get("uiBotChatFactionPointPrice").toUtf8() + NLMISC::formatThousands(toString(LastFactionPointPrice)); + text+= CI18N::get("uiBotChatFactionType") + PVP_CLAN::toString((PVP_CLAN::TPVPClan)LastFactionType) + + CI18N::get("uiBotChatFactionPointPrice") + NLMISC::formatThousands(toString(LastFactionPointPrice)); } // some additional info for resale @@ -407,31 +407,31 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT { // append price if(pIS && pIS->Stackable>1 && zeFather->getMultiplyPriceByQuantityFlag()) - text+= CI18N::get("uiBotChatRetirePrice").toUtf8() + NLMISC::formatThousands(toString(LastPriceRetire)) + " (" + text+= CI18N::get("uiBotChatRetirePrice") + NLMISC::formatThousands(toString(LastPriceRetire)) + " (" + NLMISC::formatThousands(toString(factor * LastPriceRetire)) + ")"; else - text+= CI18N::get("uiBotChatRetirePrice").toUtf8() + NLMISC::formatThousands(toString(factor * LastPriceRetire)); + text+= CI18N::get("uiBotChatRetirePrice") + NLMISC::formatThousands(toString(factor * LastPriceRetire)); // set resale time left - std::string fmt= CI18N::get("uiBotChatResaleTimeLeft").toUtf8(); + std::string fmt= CI18N::get("uiBotChatResaleTimeLeft"); strFindReplace(fmt, "%d", toString(LastResaleTimeLeft/RYZOM_DAY_IN_HOUR)); strFindReplace(fmt, "%h", toString(LastResaleTimeLeft%RYZOM_DAY_IN_HOUR)); text+= "\n" + fmt; // force special color (according if retirable or not) if(LastSellerType == BOTCHATTYPE::UserRetirable || LastSellerType == BOTCHATTYPE::ResaleAndUserRetirable) - colorTag= CI18N::get("uiItemUserSellColor").toUtf8(); + colorTag= CI18N::get("uiItemUserSellColor"); else - colorTag= CI18N::get("uiItemUserSellColorNotRetirable").toUtf8(); + colorTag= CI18N::get("uiItemUserSellColorNotRetirable"); } // Append (NPC) tag if NPC item if(LastSellerType == BOTCHATTYPE::NPC) { - text+= "\n" + CI18N::get("uiBotChatNPCTag").toUtf8(); + text+= "\n" + CI18N::get("uiBotChatNPCTag"); } // else display the name of the vendor (not if this is the player himself, to avoid flood) else if (LastSellerType == BOTCHATTYPE::Resale) { - text+= "\n" + CI18N::get("uiBotChatVendorTag").toUtf8() + VendorNameString.toUtf8(); + text+= "\n" + CI18N::get("uiBotChatVendorTag") + VendorNameString.toUtf8(); } } } @@ -441,14 +441,14 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if(zeFather->sellerTypeWanted() && (LastSellerType == BOTCHATTYPE::User || LastSellerType == BOTCHATTYPE::UserRetirable) ) { - text+= "\n" + CI18N::get("uiItemSold").toUtf8(); + text+= "\n" + CI18N::get("uiItemSold"); // force special color - colorTag= CI18N::get("uiItemSoldColor").toUtf8(); + colorTag= CI18N::get("uiItemSoldColor"); } // error case else { - text+= "\n" + CI18N::get("uiPriceNotReceived").toUtf8(); + text+= "\n" + CI18N::get("uiPriceNotReceived"); } } } diff --git a/ryzom/client/src/interface_v3/group_compas.cpp b/ryzom/client/src/interface_v3/group_compas.cpp index f00b72cb2..b43f50a89 100644 --- a/ryzom/client/src/interface_v3/group_compas.cpp +++ b/ryzom/client/src/interface_v3/group_compas.cpp @@ -425,7 +425,7 @@ void CGroupCompas::draw() if (toolTip) { if (displayedTarget.getType() != CCompassTarget::North) - toolTip->setDefaultContextHelp(CI18N::get("uittCompassDistance").toUtf8()); + toolTip->setDefaultContextHelp(CI18N::get("uittCompassDistance")); else toolTip->setDefaultContextHelp(std::string()); } diff --git a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index e18cf0cc9..bd339d19d 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -1122,7 +1122,7 @@ void CGroupInSceneUserInfo::updateDynamicData () { CInterfaceGroup *group = getGroup ("right"); CForageSourceCL *forageSource = static_cast(_Entity); - string txt( CI18N::get( "uittForageContent" ).toUtf8() + toString( ": %u", forageSource->getCurrentQuantity() ) ); + string txt( CI18N::get( "uittForageContent" ) + toString( ": %u", forageSource->getCurrentQuantity() ) ); CCtrlBase *toolTip = group->getCtrl ("tt1"); if ( toolTip ) toolTip->setDefaultContextHelp( txt ); diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index cdda9e915..ac70c57cc 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -697,7 +697,7 @@ bool CGroupMap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { _HomeLM->setParent(this); addCtrl(_HomeLM); - _HomeLM->setDefaultContextHelp(NLMISC::CI18N::get("uiHome").toUtf8()); + _HomeLM->setDefaultContextHelp(NLMISC::CI18N::get("uiHome")); } // create animals Landmark: pack Animals. @@ -709,7 +709,7 @@ bool CGroupMap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { _AnimalLM[i]->setParent(this); addCtrl(_AnimalLM[i]); - _AnimalLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(NLMISC::toString("uiPATitleMount%d", i+1)).toUtf8()); + _AnimalLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(NLMISC::toString("uiPATitleMount%d", i+1))); } } @@ -722,7 +722,7 @@ bool CGroupMap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { _TeammateLM[i]->setParent(this); addCtrl(_TeammateLM[i]); - _TeammateLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(NLMISC::toString("uittLMTeam%d",i)).toUtf8()); + _TeammateLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(NLMISC::toString("uittLMTeam%d",i))); } } } @@ -1201,7 +1201,7 @@ void CGroupMap::checkCoords() CEntityCL *sel = EntitiesMngr.entity(UserEntity->selection()); if (sel) { - _TargetLM->setDefaultContextHelp(NLMISC::CI18N::get("uiTargetTwoPoint").toUtf8() + sel->removeTitleAndShardFromName(sel->getEntityName()).toUtf8()); + _TargetLM->setDefaultContextHelp(NLMISC::CI18N::get("uiTargetTwoPoint") + sel->removeTitleAndShardFromName(sel->getEntityName()).toUtf8()); } } } @@ -1374,7 +1374,7 @@ void CGroupMap::checkCoords() case ANIMAL_TYPE::Packer: sPrefix = "uiPATitlePacker"; break; case ANIMAL_TYPE::Demon: sPrefix = "uiPATitleDemon"; break; } - _AnimalLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(sPrefix+toString(i+1)).toUtf8()); + _AnimalLM[i]->setDefaultContextHelp(NLMISC::CI18N::get(sPrefix+toString(i+1))); } } } diff --git a/ryzom/client/src/interface_v3/guild_manager.cpp b/ryzom/client/src/interface_v3/guild_manager.cpp index a6b24e670..331b0ebfe 100644 --- a/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/ryzom/client/src/interface_v3/guild_manager.cpp @@ -837,13 +837,13 @@ class CAHGuildSheetOpen : public IActionHandler if (pViewGrade != NULL) { if (rGuildMembers[i].Grade == EGSPD::CGuildGrade::Leader) - pViewGrade->setText (CI18N::get("uiGuildLeader").toUtf8()); + pViewGrade->setText (CI18N::get("uiGuildLeader")); else if (rGuildMembers[i].Grade == EGSPD::CGuildGrade::HighOfficer) - pViewGrade->setText (CI18N::get("uiGuildHighOfficer").toUtf8()); + pViewGrade->setText (CI18N::get("uiGuildHighOfficer")); else if (rGuildMembers[i].Grade == EGSPD::CGuildGrade::Officer) - pViewGrade->setText (CI18N::get("uiGuildOfficer").toUtf8()); + pViewGrade->setText (CI18N::get("uiGuildOfficer")); else - pViewGrade->setText (CI18N::get("uiGuildMember").toUtf8()); + pViewGrade->setText (CI18N::get("uiGuildMember")); } // online? @@ -857,17 +857,17 @@ class CAHGuildSheetOpen : public IActionHandler case ccs_online: onlineView->setTexture("w_online.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnline").toUtf8()); + toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnline")); break; case ccs_online_abroad: onlineView->setTexture("w_online_abroad.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnlineAbroad").toUtf8()); + toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnlineAbroad")); break; default: onlineView->setTexture("w_offline.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOffline").toUtf8()); + toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOffline")); break; } } diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 949a599b4..3bae5ccbc 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1535,8 +1535,8 @@ void CInterfaceManager::updateFrameEvents() CCtrlBase *pTooltip= dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather_tt")); if (pTooltip != NULL) { - string tt = toString("%02d", WeatherManager.getNextWeatherHour()) + CI18N::get("uiMissionTimerHour").toUtf8() + - " - " + CI18N::get("uiHumidity").toUtf8() + " " + + string tt = toString("%02d", WeatherManager.getNextWeatherHour()) + CI18N::get("uiMissionTimerHour") + + " - " + CI18N::get("uiHumidity") + " " + toString("%d", (uint)(roundWeatherValue(WeatherManager.getNextWeatherValue()) * 100.f)) + "%"; pTooltip->setDefaultContextHelp(tt); } @@ -4040,11 +4040,11 @@ char* CInterfaceManager::getTimestampHuman(const char* format /* "[%H:%M:%S] " * * * All \d's in default parameter remove a following character. */ -bool CInterfaceManager::parseTokens(ucstring& ucstr) +bool CInterfaceManager::parseTokens(string& ucstr) { - ucstring str = ucstr; - ucstring start_token("$"); - ucstring end_token("$"); + string str = ucstr; + string start_token("$"); + string end_token("$"); size_t start_pos = 0; size_t end_pos = 1; @@ -4061,8 +4061,8 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) // Get the whole token substring first end_pos = str.find(end_token, start_pos + 1); - if ((start_pos == ucstring::npos) || - (end_pos == ucstring::npos) || + if ((start_pos == string::npos) || + (end_pos == string::npos) || (end_pos <= start_pos + 1)) { // Wrong formatting; give up on this one. @@ -4080,19 +4080,19 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) continue; } - ucstring token_whole = str.luabind_substr(start_pos, end_pos - start_pos + 1); - ucstring token_string = token_whole.luabind_substr(1, token_whole.length() - 2); - ucstring token_replacement = token_whole; - ucstring token_default = token_whole; + string token_whole = str.substr(start_pos, end_pos - start_pos + 1); + string token_string = token_whole.substr(1, token_whole.length() - 2); + string token_replacement = token_whole; + string token_default = token_whole; - ucstring token_subject; - ucstring token_param; + string token_subject; + string token_param; // Does the token have a parameter? // If not it is 'name' by default - vector token_vector; - vector param_vector; - splitUCString(token_string, ucstring("."), token_vector); + vector token_vector; + vector param_vector; + splitString(token_string, ".", token_vector); if (token_vector.empty()) { // Wrong formatting; give up on this one. @@ -4102,23 +4102,23 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) token_subject = token_vector[0]; if (token_vector.size() == 1) { - splitUCString(token_subject, ucstring("/"), param_vector); - token_subject = !param_vector.empty() ? param_vector[0] : ucstring(""); - token_param = ucstring("name"); + splitString(token_subject, "/", param_vector); + token_subject = !param_vector.empty() ? param_vector[0] : string(); + token_param = string("name"); } else if (token_vector.size() > 1) { token_param = token_vector[1]; - if (token_param.luabind_substr(0, 3) != ucstring("gs(")) + if (token_param.substr(0, 3) != "gs(") { - splitUCString(token_vector[1], ucstring("/"), param_vector); - token_param = !param_vector.empty() ? param_vector[0] : ucstring(""); + splitString(token_vector[1], "/", param_vector); + token_param = !param_vector.empty() ? param_vector[0] : string(); } } // Get any default value, if not gs sint extra_replacement = 0; - if (token_param.luabind_substr(0, 3) != ucstring("gs(")) + if (token_param.substr(0, 3) != "gs(") { if (param_vector.size() == 2) { @@ -4126,9 +4126,9 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) token_replacement = param_vector[1]; // Delete following chars for every '\d' in default string::size_type token_replacement_pos; - while ((token_replacement_pos = token_replacement.find(ucstring("\\d"))) != string::npos) + while ((token_replacement_pos = token_replacement.find(string("\\d"))) != string::npos) { - token_replacement.replace(token_replacement_pos, 2, ucstring("")); + token_replacement.replace(token_replacement_pos, 2, string()); extra_replacement++; } token_default = token_replacement; @@ -4137,17 +4137,17 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) CEntityCL *pTokenSubjectEntity = NULL; - if (token_subject == ucstring("me")) + if (token_subject == "me") { pTokenSubjectEntity = static_cast(UserEntity); } - else if (token_subject == ucstring("t")) + else if (token_subject == "t") { // Target uint targetSlot = UserEntity->targetSlot(); pTokenSubjectEntity = EntitiesMngr.entity(targetSlot); } - else if (token_subject == ucstring("tt")) + else if (token_subject == "tt") { // Target's target uint targetSlot = UserEntity->targetSlot(); @@ -4165,11 +4165,11 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) } } else if ((token_subject.length() == 3) && - (token_subject.luabind_substr(0, 2) == ucstring("tm"))) + (token_subject.substr(0, 2) == "tm")) { // Teammate uint indexInTeam = 0; - fromString(token_subject.luabind_substr(2, 1).toString(), indexInTeam); + fromString(token_subject.substr(2, 1), indexInTeam); // Make 0-based --indexInTeam; @@ -4205,22 +4205,22 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) if (pTokenSubjectEntity != NULL) { // Parse the parameter - if (token_param == ucstring("name")) + if (token_param == "name") { - ucstring name = pTokenSubjectEntity->getDisplayName(); + string name = pTokenSubjectEntity->getDisplayName().toUtf8(); // special case where there is only a title, very rare case for some NPC if (name.empty()) { - name = pTokenSubjectEntity->getTitle(); + name = pTokenSubjectEntity->getTitle().toUtf8(); } token_replacement = name.empty() ? token_replacement : name; } - else if (token_param == ucstring("title")) + else if (token_param == "title") { - ucstring title = pTokenSubjectEntity->getTitle(); + string title = pTokenSubjectEntity->getTitle().toUtf8(); token_replacement = title.empty() ? token_replacement : title; } - else if (token_param == ucstring("race")) + else if (token_param == "race") { CCharacterCL *pC = dynamic_cast(pTokenSubjectEntity); if (pC) @@ -4228,27 +4228,27 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) EGSPD::CPeople::TPeople race = pC->people(); if (race >= EGSPD::CPeople::Playable && race <= EGSPD::CPeople::EndPlayable) { - ucstring srace = NLMISC::CI18N::get("io" + EGSPD::CPeople::toString(race)); + string srace = NLMISC::CI18N::get("io" + EGSPD::CPeople::toString(race)); token_replacement = srace.empty() ? token_replacement : srace; } } } - else if (token_param == ucstring("guild")) + else if (token_param == "guild") { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); ucstring ucGuildName; if (pSMC->getString(pTokenSubjectEntity->getGuildNameID(), ucGuildName)) { - token_replacement = ucGuildName.empty() ? token_replacement : ucGuildName; + token_replacement = ucGuildName.empty() ? token_replacement : ucGuildName.toUtf8(); } } - else if (token_param.luabind_substr(0, 3) == ucstring("gs(") && - token_param.luabind_substr(token_param.length() - 1 , 1) == ucstring(")")) + else if (token_param.substr(0, 3) == "gs(" && + token_param.substr(token_param.length() - 1 , 1) == ")") { // Gender string - vector strList; - ucstring gender_string = token_param.luabind_substr(3, token_param.length() - 4); - splitUCString(gender_string, ucstring("/"), strList); + vector strList; + string gender_string = token_param.substr(3, token_param.length() - 4); + splitString(gender_string, "/", strList); if (strList.size() <= 1) { @@ -4277,8 +4277,8 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) { // Nothing to replace; show message and exit CInterfaceManager *im = CInterfaceManager::getInstance(); - ucstring message = ucstring(CI18N::get("uiUntranslatedToken")); - message.replace(message.find(ucstring("%s")), 2, token_whole); + string message = CI18N::get("uiUntranslatedToken"); + message.replace(message.find("%s"), 2, token_whole); im->displaySystemInfo(message); return false; } diff --git a/ryzom/client/src/interface_v3/interface_manager.h b/ryzom/client/src/interface_v3/interface_manager.h index 0b89584bc..342b8a7be 100644 --- a/ryzom/client/src/interface_v3/interface_manager.h +++ b/ryzom/client/src/interface_v3/interface_manager.h @@ -448,7 +448,7 @@ public: /** Parses any tokens in the ucstring like $t$ or $g()$ */ - static bool parseTokens(ucstring& ucstr); + static bool parseTokens(std::string& ucstr); // ------------------------------------------------------------------------------------------------ private: diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index e4dbb0f44..b36d51866 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -1050,7 +1050,7 @@ int CLuaIHMRyzom::initEmotesMenu(CLuaState &ls) // Create a line pMenu->addLine(CI18N::get(sTmp), "lua", luaParams + "('" + sEmoteId + "', '" + toString(CI18N::get(sTmp)) + "')", sTmp); - emoteList[sEmoteId] = (toLower(CI18N::get(sTmp))).toUtf8(); + emoteList[sEmoteId] = (toLower(CI18N::get(sTmp))); } } @@ -3629,7 +3629,7 @@ void CLuaIHMRyzom::tell(const ucstring &player, const ucstring &msg) if (!msg.empty()) { // Parse any tokens in the message. - ucstring msg_modified = msg; + string msg_modified = msg.toUtf8(); // Parse any tokens in the text if (! CInterfaceManager::parseTokens(msg_modified)) diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index 9fce02ef8..d62a8746a 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -492,7 +492,7 @@ void CModalContainerEditCmd::activate() } if (found) { - pCB->addText(CI18N::get(rVCat[i].LocalizedName).toUtf8()); + pCB->addText(CI18N::get(rVCat[i].LocalizedName)); CurrentEditCmdCategories.push_back(rVCat[i].Name); } } @@ -689,7 +689,7 @@ void CModalContainerEditCmd::activateFrom (const std::string &cmdName, const std if (noParam == 0) sText = WinName+VIEW_EDITCMD_FIRST_PARAM_NAME; else sText = WinName+VIEW_EDITCMD_SECOND_PARAM_NAME; CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sText)); - if (pVT != NULL) pVT->setText(CI18N::get(pBA->Parameters[i].LocalizedName).toUtf8()); + if (pVT != NULL) pVT->setText(CI18N::get(pBA->Parameters[i].LocalizedName)); noParam++; } } @@ -778,7 +778,7 @@ void CModalContainerEditCmd::invalidCurrentCommand() { // Dont display key shortcut if we are in creation mode pVT= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( WinName+VIEW_EDITCMD_TEXT_KEY )); - if (pVT != NULL) pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT).toUtf8()); + if (pVT != NULL) pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT)); // Deactivate the key definer text pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+VIEW_EDITCMD_TEXT_KEY)); @@ -897,7 +897,7 @@ void CModalContainerEditCmd::validCurrentCommand() CurrentEditCmdLine.Combo.Key = KeyCount; CurrentEditCmdLine.Combo.KeyButtons = noKeyButton; // Display not assigned text - pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT).toUtf8()); + pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT)); // Do not display the ok button CCtrlBaseButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+CTRL_EDITCMD_BUTTON_OK)); if (pCB != NULL) pCB->setFrozen (true); @@ -1033,7 +1033,7 @@ void CModalContainerEditCmd::onChangeCategory() { if (rBA.isUsableInCurrentContext()) { - pCB->addText(CI18N::get(rBA.LocalizedName).toUtf8()); + pCB->addText(CI18N::get(rBA.LocalizedName)); } } } @@ -1111,7 +1111,7 @@ void CModalContainerEditCmd::onChangeAction() pViewParamName = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sViewText)); if (pViewParamName != NULL) - pViewParamName->setText (CI18N::get(rP.LocalizedName).toUtf8()); + pViewParamName->setText (CI18N::get(rP.LocalizedName)); } if (rP.Type == CBaseAction::CParameter::Constant) @@ -1131,7 +1131,7 @@ void CModalContainerEditCmd::onChangeAction() if (ActionsContext.matchContext(rVal.Contexts)) { if (NLMISC::startsWith(rVal.LocalizedValue, "ui")) - pCB->addText(CI18N::get(rVal.LocalizedValue).toUtf8()); + pCB->addText(CI18N::get(rVal.LocalizedValue)); else pCB->addText(rVal.LocalizedValue); } diff --git a/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/ryzom/client/src/interface_v3/macrocmd_manager.cpp index 12b066fff..4b0d2fee9 100644 --- a/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -895,7 +895,7 @@ public: if (pVT != NULL) { if (pMCM->CurrentEditMacro.Combo.Key == KeyCount) - pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT).toUtf8()); + pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT)); else pVT->setText(pMCM->CurrentEditMacro.Combo.toUCString().toUtf8()); } @@ -1005,7 +1005,7 @@ void addMacroLine (CGroupList *pParent, uint macNb, const CMacroCmd ¯o) if (macro.Combo.Key != KeyCount) pVT->setText(macro.Combo.toUCString().toUtf8()); else - pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT).toUtf8()); + pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT)); } pNewMacro->setParent (pParent); diff --git a/ryzom/client/src/interface_v3/music_player.cpp b/ryzom/client/src/interface_v3/music_player.cpp index a0a7aed66..f7f9e05f2 100644 --- a/ryzom/client/src/interface_v3/music_player.cpp +++ b/ryzom/client/src/interface_v3/music_player.cpp @@ -492,7 +492,7 @@ void CMusicPlayer::clearPlayingInfo() { if (_Songs.empty()) { - updatePlayingInfo(CI18N::get("uiNoFiles").toUtf8()); + updatePlayingInfo(CI18N::get("uiNoFiles")); } else { @@ -632,7 +632,7 @@ void CMusicPlayer::createPlaylistFromMusic() join(extensions, ", ", extlist); extlist += ", m3u, m3u8"; - std::string msg(CI18N::get("uiMk_system6").toUtf8()); + std::string msg(CI18N::get("uiMk_system6")); msg += ": " + newPath + " (" + extlist + ")"; CInterfaceManager::getInstance()->displaySystemInfo(ucstring::makeFromUtf8(msg), "SYS"); nlinfo("%s", msg.c_str()); diff --git a/ryzom/client/src/interface_v3/people_list.cpp b/ryzom/client/src/interface_v3/people_list.cpp index b380c12b0..30a468975 100644 --- a/ryzom/client/src/interface_v3/people_list.cpp +++ b/ryzom/client/src/interface_v3/people_list.cpp @@ -471,14 +471,14 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c return; } - ucstring csr(CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""); - ucstring finalMsg = csr + CI18N::get("youTell") + ": " + msg; + string csr = CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""; + string finalMsg = csr + CI18N::get("youTell") + ": " + msg.toUtf8(); // display msg with good color CInterfaceProperty prop; prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); - ucstring s = CI18N::get("youTellPlayer"); - strFindReplace(s, "%name", receiver); + string s = CI18N::get("youTellPlayer"); + strFindReplace(s, "%name", receiver.toUtf8()); strFindReplace(finalMsg, CI18N::get("youTell"), s); gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA())); CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); @@ -759,17 +759,17 @@ void CPeopleList::setOnline(uint index, TCharConnectionState online) case ccs_online: onlineView->setTexture("w_online.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOnline").toUtf8()); + toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOnline")); break; case ccs_online_abroad: onlineView->setTexture("w_online_abroad.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOnlineAbroad").toUtf8()); + toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOnlineAbroad")); break; default: onlineView->setTexture("w_offline.tga"); if (toolTip) - toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOffline").toUtf8()); + toolTip->setDefaultContextHelp(CI18N::get("uittFriendsOffline")); break; } } @@ -876,7 +876,7 @@ class CHandlerContactEntry : public IActionHandler { CGroupEditBox *pEB = dynamic_cast(pCaller); if (pEB == NULL) return; - ucstring text = pEB->getInputStringAsUtf16(); + string text = pEB->getInputString(); // If the line is empty, do nothing if(text.empty()) return; @@ -892,8 +892,7 @@ class CHandlerContactEntry : public IActionHandler if(text[0] == '/') { CChatWindow::_ChatWindowLaunchingCommand = NULL; // no CChatWindow instance there .. - // TODO : have NLMISC::ICommand accept unicode strings - std::string str = text.toUtf8().substr(1); + std::string str = text.substr(1); NLMISC::ICommand::execute( str, g_log ); pEB->setInputString (std::string()); return; @@ -904,10 +903,10 @@ class CHandlerContactEntry : public IActionHandler CGroupContainer *gc = static_cast< CGroupContainer* >( pCaller->getParent()->getEnclosingContainer() ); // title gives the name of the player - ucstring playerName = gc->getUCTitle(); + string playerName = gc->getUCTitle().toUtf8(); // Simply do a tell on the player - ChatMngr.tell(playerName.toString(), text); + ChatMngr.tell(playerName, text); pEB->setInputString (std::string()); if (gc) { @@ -940,18 +939,18 @@ class CHandlerContactEntry : public IActionHandler CChatGroupWindow *pWin = PeopleInterraction.getChatGroupWindow(); CInterfaceProperty prop; prop.readRGBA("UI:SAVE:CHAT:COLORS:SPEAKER"," "); - ucstring final; + string final; CChatWindow::encodeColorTag(prop.getRGBA(), final, false); - ucstring csr(CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""); + string csr(CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""); final += csr + CI18N::get("youTell")+": "; prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); CChatWindow::encodeColorTag(prop.getRGBA(), final, true); final += text; pWin->displayTellMessage(final, prop.getRGBA(), pWin->getFreeTellerName(str)); - ucstring s = CI18N::get("youTellPlayer"); - strFindReplace(s, "%name", pWin->getFreeTellerName(str)); + string s = CI18N::get("youTellPlayer"); + strFindReplace(s, "%name", pWin->getFreeTellerName(str).toUtf8()); strFindReplace(final, CI18N::get("youTell"), s); CInterfaceManager::getInstance()->log(final, CChatGroup::groupTypeToString(CChatGroup::tell)); } diff --git a/ryzom/client/src/interface_v3/skill_manager.cpp b/ryzom/client/src/interface_v3/skill_manager.cpp index 5e91f6f6e..936db39a7 100644 --- a/ryzom/client/src/interface_v3/skill_manager.cpp +++ b/ryzom/client/src/interface_v3/skill_manager.cpp @@ -588,7 +588,7 @@ void CSkillManager::checkTitleUnblocked(CHARACTER_TITLE::ECharacterTitle i, bool string titleStr = CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)i); bool womenTitle = (UserEntity && UserEntity->getGender() == GSGENDER::female); const ucstring newtitle(CStringManagerClient::getTitleLocalizedName(titleStr, womenTitle)); - CAHManager::getInstance()->runActionHandler("message_popup", NULL, "text1="+newtitle.toUtf8()+"|text0="+CI18N::get("uiNewTitleBold").toUtf8()); + CAHManager::getInstance()->runActionHandler("message_popup", NULL, "text1="+newtitle.toUtf8()+"|text0="+CI18N::get("uiNewTitleBold")); } else { diff --git a/ryzom/client/src/interface_v3/task_bar_manager.cpp b/ryzom/client/src/interface_v3/task_bar_manager.cpp index 7c9bb2a45..fcc4c30f2 100644 --- a/ryzom/client/src/interface_v3/task_bar_manager.cpp +++ b/ryzom/client/src/interface_v3/task_bar_manager.cpp @@ -182,7 +182,7 @@ public: if (it != acmap.end()) pVT->setText(it->second.toUCString().toUtf8()); else - pVT->setText(CI18N::get("uiNotAssigned").toUtf8()); + pVT->setText(CI18N::get("uiNotAssigned")); } } } diff --git a/ryzom/client/src/login_patch.cpp b/ryzom/client/src/login_patch.cpp index 926ed61b1..3d7a8a4c8 100644 --- a/ryzom/client/src/login_patch.cpp +++ b/ryzom/client/src/login_patch.cpp @@ -1931,9 +1931,9 @@ int CPatchManager::validateProgress(void *foo, double t, double d, double /* ult if (units.empty()) { - units.push_back(CI18N::get("uiByte").toUtf8()); - units.push_back(CI18N::get("uiKb").toUtf8()); - units.push_back(CI18N::get("uiMb").toUtf8()); + units.push_back(CI18N::get("uiByte")); + units.push_back(CI18N::get("uiKb")); + units.push_back(CI18N::get("uiMb")); } CPatchManager *pPM = CPatchManager::getInstance(); diff --git a/ryzom/client/src/main_loop_debug.cpp b/ryzom/client/src/main_loop_debug.cpp index ac29a3984..70616e1f7 100644 --- a/ryzom/client/src/main_loop_debug.cpp +++ b/ryzom/client/src/main_loop_debug.cpp @@ -716,7 +716,7 @@ static std::string getActionKey(const char* name, const char* param = "") if (ite != acmap.end()) return ite->second.toUCString().toString(); - return CI18N::get("uiNotAssigned").toString(); + return CI18N::get("uiNotAssigned"); } //--------------------------------------------------- diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index d1744f3ff..8d743074d 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -614,23 +614,23 @@ static CInterfaceChatDisplayer InterfaceChatDisplayer; void CInterfaceChatDisplayer::colorizeSender(ucstring &text, const ucstring &senderName, CRGBA baseColor) { // find the sender/text separator to put color tags - ucstring::size_type pos = senderName.length() - 1; + ucstring::size_type pos = senderName.toUtf8().length() - 1; if (pos != ucstring::npos) { - ucstring str; + string str; CInterfaceProperty prop; prop.readRGBA("UI:SAVE:CHAT:COLORS:SPEAKER"," "); CChatWindow::encodeColorTag(prop.getRGBA(), str, false); - str += text.substr(0, pos+1); + str += text.toUtf8().substr(0, pos+1); CChatWindow::encodeColorTag(baseColor, str, true); - str += text.substr(pos+1); + str += text.toUtf8().substr(pos+1); - text.swap(str); + text.fromUtf8(str); } } diff --git a/ryzom/client/src/progress.cpp b/ryzom/client/src/progress.cpp index 133f5abd2..48d642aea 100644 --- a/ryzom/client/src/progress.cpp +++ b/ryzom/client/src/progress.cpp @@ -354,12 +354,12 @@ void CProgress::internalProgress (float value) // Print some more info uint32 day = RT.getRyzomDay(); - str = toString (CI18N::get ("uiTipsTeleport").toUtf8().c_str(), - CI18N::get (LoadingContinent->LocalizedName).toUtf8().c_str(), + str = toString (CI18N::get ("uiTipsTeleport").c_str(), + CI18N::get (LoadingContinent->LocalizedName).c_str(), day, (uint)RT.getRyzomTime(), - CI18N::get ("uiSeason"+toStringEnum(CRyzomTime::getSeasonByDay(day))).toUtf8().c_str(), - CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName).toUtf8().c_str()); + CI18N::get ("uiSeason"+toStringEnum(CRyzomTime::getSeasonByDay(day))).c_str(), + CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName).c_str()); ucstring ucstr; ucstr.fromUtf8 (str); TextContext->setHotSpot(UTextContext::MiddleBottom); diff --git a/ryzom/client/src/r2/auto_group.cpp b/ryzom/client/src/r2/auto_group.cpp index 7372d6e48..7bbeb39d3 100644 --- a/ryzom/client/src/r2/auto_group.cpp +++ b/ryzom/client/src/r2/auto_group.cpp @@ -281,7 +281,7 @@ void CAutoGroup::group(CObject *newEntityDesc, const NLMISC::CVectorD &createPos R2::getEditor().getEnv()["PaletteIdToGroupTranslation"][newEntityDesc->getAttr("Base")->toString()].push(); if (ls.isString(-1)) readableName.fromUtf8(ls.toString(-1)); - ucstring ucGroupName = ucstring(readableName + " " + CI18N::get("uiR2EDNameGroup").toUtf8()); + ucstring ucGroupName = ucstring(readableName + " " + CI18N::get("uiR2EDNameGroup")); newGroup->set("Name", getEditor().genInstanceName(ucGroupName).toUtf8()); getEditor().getDMC().requestInsertNode(destGroup->getParentAct()->getId(), diff --git a/ryzom/client/src/r2/displayer_visual_entity.cpp b/ryzom/client/src/r2/displayer_visual_entity.cpp index 6e09e580e..344d2a8fa 100644 --- a/ryzom/client/src/r2/displayer_visual_entity.cpp +++ b/ryzom/client/src/r2/displayer_visual_entity.cpp @@ -994,7 +994,7 @@ void CDisplayerVisualEntity::updateName() } std::string firstPart; if(actNb>0) - firstPart = CI18N::get("uiR2EDDefaultActTitle").toString() + " " + NLMISC::toString(actNb); + firstPart = CI18N::get("uiR2EDDefaultActTitle") + " " + NLMISC::toString(actNb); if (act->isString("Name")) actName = act->toString("Name"); @@ -1006,7 +1006,7 @@ void CDisplayerVisualEntity::updateName() } else { - actName = CI18N::get("uiR2EDBaseAct").toString(); + actName = CI18N::get("uiR2EDBaseAct"); } actName = NLMISC::toString(" [%s]", actName.c_str()); diff --git a/ryzom/client/src/r2/displayer_visual_group.cpp b/ryzom/client/src/r2/displayer_visual_group.cpp index a84c6bfa4..5cf2c542d 100644 --- a/ryzom/client/src/r2/displayer_visual_group.cpp +++ b/ryzom/client/src/r2/displayer_visual_group.cpp @@ -76,7 +76,7 @@ public: virtual void getContextHelp(std::string &help) const { help = Instance.getDisplayName().toUtf8(); - if (help == NLMISC::CI18N::get("uiR2EDNoName").toUtf8()) + if (help == NLMISC::CI18N::get("uiR2EDNoName")) help.clear(); } bool emptyContextHelp() const { return true; } @@ -125,7 +125,7 @@ public: virtual void getContextHelp(std::string &help) const { help = Instance.getDisplayName().toUtf8(); - if (help == NLMISC::CI18N::get("uiR2EDNoName").toUtf8()) + if (help == NLMISC::CI18N::get("uiR2EDNoName")) help.clear(); } bool emptyContextHelp() const { return true; } diff --git a/ryzom/client/src/r2/editor.cpp b/ryzom/client/src/r2/editor.cpp index a708bc2a4..d3611067a 100644 --- a/ryzom/client/src/r2/editor.cpp +++ b/ryzom/client/src/r2/editor.cpp @@ -1761,7 +1761,7 @@ void CEditor::waitScenarioScreen() // Display the firewall alert string CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:r2ed_connecting:title")); if (pVT != NULL) - pVT->setText(CI18N::get("uiFirewallAlert").toUtf8()+"..."); + pVT->setText(CI18N::get("uiFirewallAlert")+"..."); // The mouse and fullscreen mode should be unlocked for the user to set the firewall permission nlSleep( 30 ); // 'nice' the client, and prevent to make too many send attempts @@ -1853,8 +1853,8 @@ void CEditor::waitScenarioScreen() if (pVT != NULL) { pVT->setMultiLine( true ); - pVT->setText(CI18N::get("uiFirewallFail").toUtf8()+".\n"+ - CI18N::get("uiFirewallAlert").toUtf8()+"."); + pVT->setText(CI18N::get("uiFirewallFail")+".\n"+ + CI18N::get("uiFirewallAlert")+"."); } } } @@ -6468,7 +6468,7 @@ void CEditor::connectionMsg(const std::string &stringId) CViewText *vt = dynamic_cast(r2ConnectWindow->getView("connexionMsg")); if (vt) { - vt->setText(CI18N::get(stringId).toUtf8()); + vt->setText(CI18N::get(stringId)); } } } @@ -7497,7 +7497,7 @@ class CAHInviteCharacter : public IActionHandler { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningInviteFreeTrial").toUtf8()); + pVT->setText(CI18N::get("uiRingWarningInviteFreeTrial")); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); } diff --git a/ryzom/client/src/r2/instance_map_deco.cpp b/ryzom/client/src/r2/instance_map_deco.cpp index 8ec630686..ae3857990 100644 --- a/ryzom/client/src/r2/instance_map_deco.cpp +++ b/ryzom/client/src/r2/instance_map_deco.cpp @@ -44,7 +44,7 @@ void CInstanceMapDeco::CCtrlButtonEntity::getContextHelp(std::string &help) cons { //H_AUTO(R2_CCtrlButtonEntity_getContextHelp) help = _Instance.getDisplayName().toUtf8(); - if (help == NLMISC::CI18N::get("uiR2EDNoName").toUtf8()) + if (help == NLMISC::CI18N::get("uiR2EDNoName")) help.clear(); } diff --git a/ryzom/client/src/r2/tool_select_move.cpp b/ryzom/client/src/r2/tool_select_move.cpp index f9b9b9a1a..d16b45ced 100644 --- a/ryzom/client/src/r2/tool_select_move.cpp +++ b/ryzom/client/src/r2/tool_select_move.cpp @@ -417,9 +417,9 @@ void CToolSelectMove::commitAction(CInstance &instance) } else { - ucstring instanceName = instance.getDisplayName(); + string instanceName = instance.getDisplayName().toUtf8(); if(instanceName == CI18N::get("uiR2EDNoName")) - instanceName = ucstring(instance.getClassName()); + instanceName = instance.getClassName(); //getDMC().newAction(CI18N::get("uiR2EDMoveAction") + instance.getDisplayName()); getDMC().newAction(CI18N::get("uiR2EDMoveAction") + instanceName); diff --git a/ryzom/client/src/session_browser_impl.cpp b/ryzom/client/src/session_browser_impl.cpp index f11c24a54..9f3cc77a9 100644 --- a/ryzom/client/src/session_browser_impl.cpp +++ b/ryzom/client/src/session_browser_impl.cpp @@ -230,7 +230,7 @@ int CSessionBrowserImpl::luaJoinRingSession(CLuaState &ls) { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningFreeTrial").toUtf8()); + pVT->setText(CI18N::get("uiRingWarningFreeTrial")); CAHManager::getInstance()->runActionHandler("enter_modal", NULL, "group=ui:interface:warning_free_trial"); } diff --git a/ryzom/common/src/game_share/rm_family.cpp b/ryzom/common/src/game_share/rm_family.cpp index a45793aad..5351b00b7 100644 --- a/ryzom/common/src/game_share/rm_family.cpp +++ b/ryzom/common/src/game_share/rm_family.cpp @@ -118,7 +118,7 @@ namespace RM_FABER_TYPE } /// Client: use the CI18N - const ucstring& toLocalString( TRMFType e ) + const std::string& toLocalString( TRMFType e ) { return CI18N::get("mpft" + toString(e)); } @@ -134,7 +134,7 @@ namespace RM_FABER_TYPE namespace RM_FAMILY { /// Get the Localized UCString - const ucstring& toLocalString( TRMFamily e ) + const std::string& toLocalString( TRMFamily e ) { return CI18N::get("mpfam" + toString(e)); } @@ -144,7 +144,7 @@ namespace RM_FAMILY namespace RM_GROUP { /// Get the Localized UCString - const ucstring& toLocalString( TRMGroup e ) + const std::string& toLocalString( TRMGroup e ) { return CI18N::get("mpgroup" + toString(e)); } @@ -154,7 +154,7 @@ namespace RM_GROUP namespace RM_FABER_PROPERTY { /// Get the Localized UCString - const ucstring& toLocalString( TRMFProperty e ) + const std::string& toLocalString( TRMFProperty e ) { return CI18N::get("mpprop" + toString(e)); } @@ -188,7 +188,7 @@ namespace RM_FABER_QUALITY } /// Client: use the CI18N - const ucstring& toLocalString( TFaberQuality e ) + const std::string& toLocalString( TFaberQuality e ) { return CI18N::get("mpfq" + toString(e)); } @@ -224,7 +224,7 @@ namespace RM_COLOR } /// Get the Localized UCString - const ucstring& toLocalString( sint value ) + const std::string& toLocalString( sint value ) { return CI18N::get("mpcol" + toString(value)); } @@ -283,7 +283,7 @@ namespace RM_FABER_STAT_TYPE return conversion.toString(stats); } - const ucstring& toLocalString( TRMStatType stats ) + const std::string& toLocalString( TRMStatType stats ) { // must change en.uxt nlctassert(NumRMStatType == sizeof(stringTable)/sizeof(stringTable[0])); @@ -663,9 +663,9 @@ namespace RM_FABER_STAT_TYPE namespace RM_CLASS_TYPE { -const ucstring &toLocalString(TRMClassType classType) +const std::string &toLocalString(TRMClassType classType) { - return CI18N::get(toString("uiItemRMClass%d", classType).c_str()); + return CI18N::get(toString("uiItemRMClass%d", classType)); } diff --git a/ryzom/common/src/game_share/rm_family.h b/ryzom/common/src/game_share/rm_family.h index a69a51517..9f9048531 100644 --- a/ryzom/common/src/game_share/rm_family.h +++ b/ryzom/common/src/game_share/rm_family.h @@ -85,7 +85,7 @@ namespace RM_FABER_TYPE const std::string &faberTypeToSheetEntry(TRMFType type); /// Get the Localized UCString - const ucstring& toLocalString( TRMFType e ); + const std::string& toLocalString( TRMFType e ); /// For Client Interface, return the define name of the type (eg: "item_part_icon_MpL") std::string toIconDefineString( TRMFType e ); @@ -101,7 +101,7 @@ namespace RM_FAMILY const TRMFamily Unknown = 0; /// Get the Localized UCString - const ucstring& toLocalString( TRMFamily e ); + const std::string& toLocalString( TRMFamily e ); /// Debug string inline std::string toString( TRMFamily e ) { return NLMISC::toString(e); } @@ -119,7 +119,7 @@ namespace RM_GROUP const TRMGroup Unknown = 0; /// Get the Localized UCString - const ucstring& toLocalString( TRMGroup e ); + const std::string& toLocalString( TRMGroup e ); // Note: the group names are accessible on server by CMP::rmGroupToString() @@ -138,7 +138,7 @@ namespace RM_FABER_PROPERTY const TRMFProperty Unknown = 0; /// Get the Localized UCString - const ucstring& toLocalString( TRMFProperty e ); + const std::string& toLocalString( TRMFProperty e ); /// Debug string inline std::string toString( TRMFProperty e ) { return NLMISC::toString(e); } @@ -178,7 +178,7 @@ namespace RM_FABER_QUALITY TFaberQuality toFaberQuality( const std::string& str ); /// Get the Localized UCString - const ucstring& toLocalString( TFaberQuality e ); + const std::string& toLocalString( TFaberQuality e ); } @@ -199,7 +199,7 @@ namespace RM_COLOR const std::string& toString( sint value ); /// Get the Localized UCString - const ucstring& toLocalString( sint value ); + const std::string& toLocalString( sint value ); }; @@ -251,7 +251,7 @@ namespace RM_FABER_STAT_TYPE const std::string& toString( TRMStatType stats ); /// Get the Localized UCString - const ucstring& toLocalString( TRMStatType stats ); + const std::string& toLocalString( TRMStatType stats ); /// For each Raw material faber type, does this Stat is relevant? bool isStatRelevant(RM_FABER_TYPE::TRMFType ft, TRMStatType fs); @@ -309,7 +309,7 @@ namespace RM_CLASS_TYPE }; /// Get the Localized UCString - const ucstring& toLocalString( TRMClassType classType ); + const std::string& toLocalString( TRMClassType classType ); /// return the item class for a given stat energy [0..100] inline TRMClassType getItemClass(uint32 energy) diff --git a/ryzom/common/src/game_share/roles.cpp b/ryzom/common/src/game_share/roles.cpp index 57ccfdcd4..578096b44 100644 --- a/ryzom/common/src/game_share/roles.cpp +++ b/ryzom/common/src/game_share/roles.cpp @@ -73,7 +73,7 @@ ERole toRoleId( const std::string& Role ) } // Return the Translated name of the Job -const ucstring &roleToUCString (ERole r) +const std::string &roleToUCString(ERole r) { return NLMISC::CI18N::get( toString( r ) ); } diff --git a/ryzom/common/src/game_share/roles.h b/ryzom/common/src/game_share/roles.h index 9164a3254..8b6dfd5b2 100644 --- a/ryzom/common/src/game_share/roles.h +++ b/ryzom/common/src/game_share/roles.h @@ -60,7 +60,7 @@ const std::string& toString( ERole r ); ERole toRoleId( const std::string& Role ); // Return the Translated name of the Job -const ucstring &roleToUCString (ERole r); +const std::string &roleToUCString (ERole r); } // ROLES From 079f9dff25c5f524467a6f9032fe091330e083d2 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 04:01:13 +0800 Subject: [PATCH 069/205] Fix --- nel/src/3d/text_context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nel/src/3d/text_context.cpp b/nel/src/3d/text_context.cpp index ba40904b3..b31a82959 100644 --- a/nel/src/3d/text_context.cpp +++ b/nel/src/3d/text_context.cpp @@ -77,7 +77,7 @@ uint32 CTextContext::textPush (const char *format, ...) char *str; NLMISC_CONVERT_VARGS (str, format, NLMISC::MaxCStringSize); - return textPush(str); + return textPush(NLMISC::CUtfStringView(str)); } // ------------------------------------------------------------------------------------------------ From 0b191bc6db4b87bcbd4c33eccb3f109db8a4271b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 05:36:13 +0800 Subject: [PATCH 070/205] More UTF-8, ryzom/ryzomcore#335 --- nel/include/nel/gui/ctrl_text_button.h | 8 ++- nel/include/nel/gui/group_container.h | 4 +- nel/include/nel/gui/group_list.h | 4 +- nel/include/nel/gui/group_menu.h | 15 ++--- nel/include/nel/gui/group_paragraph.h | 4 +- nel/include/nel/gui/group_tree.h | 10 +-- nel/include/nel/gui/interface_expr.h | 6 +- nel/include/nel/gui/view_pointer.h | 6 +- nel/include/nel/gui/view_text.h | 2 +- nel/include/nel/gui/view_text_formated.h | 10 +-- nel/include/nel/gui/view_text_id.h | 6 +- nel/include/nel/gui/view_text_id_formated.h | 6 +- nel/src/gui/ctrl_text_button.cpp | 19 +++++- nel/src/gui/dbgroup_combo_box.cpp | 2 +- nel/src/gui/group_container.cpp | 32 +++++----- nel/src/gui/group_html.cpp | 14 ++-- nel/src/gui/group_list.cpp | 14 ++-- nel/src/gui/group_menu.cpp | 52 +++++---------- nel/src/gui/group_paragraph.cpp | 10 +-- nel/src/gui/group_tree.cpp | 4 +- nel/src/gui/interface_expr.cpp | 28 +++----- nel/src/gui/interface_expr_user_fct.cpp | 20 +++--- nel/src/gui/interface_link.cpp | 2 +- nel/src/gui/lua_ihm.cpp | 30 +-------- nel/src/gui/view_pointer.cpp | 12 ++-- nel/src/gui/view_text.cpp | 10 +-- nel/src/gui/view_text_formated.cpp | 29 +++++---- nel/src/gui/view_text_id.cpp | 12 ++-- nel/src/gui/view_text_id_formated.cpp | 27 ++++---- ryzom/client/src/connection.cpp | 2 +- ryzom/client/src/contextual_cursor.cpp | 2 +- .../src/interface_v3/action_handler_game.cpp | 4 +- .../src/interface_v3/action_handler_item.cpp | 6 +- .../interface_v3/action_handler_phrase.cpp | 2 +- .../src/interface_v3/bot_chat_page_trade.cpp | 8 +-- .../dbgroup_list_sheet_mission.cpp | 2 +- .../src/interface_v3/encyclopedia_manager.cpp | 4 +- .../client/src/interface_v3/group_compas.cpp | 20 +++--- ryzom/client/src/interface_v3/group_map.cpp | 2 +- .../group_phrase_skill_filter.cpp | 2 +- .../client/src/interface_v3/group_skills.cpp | 10 +-- .../interface_expr_user_fct_game.cpp | 64 +++++++++---------- .../interface_expr_user_fct_items.cpp | 14 ++-- .../src/interface_v3/interface_manager.cpp | 39 +++++------ .../client/src/interface_v3/lua_ihm_ryzom.cpp | 2 +- .../src/interface_v3/people_interraction.cpp | 10 +-- ryzom/client/src/string_manager_client.h | 1 + 47 files changed, 276 insertions(+), 316 deletions(-) diff --git a/nel/include/nel/gui/ctrl_text_button.h b/nel/include/nel/gui/ctrl_text_button.h index 25fc9eeac..74e1c1291 100644 --- a/nel/include/nel/gui/ctrl_text_button.h +++ b/nel/include/nel/gui/ctrl_text_button.h @@ -96,8 +96,10 @@ namespace NLGUI bool getTextModulateGlobalColorOver() const {return _TextModulateGlobalColorOver;} void setTextModulateGlobalColorOver(bool v) {_TextModulateGlobalColorOver= v;} // Set text (noop if text id) - void setText (const ucstring &text); - ucstring getText () const; + void setText (const std::string &text); + std::string getText () const; + void setTextAsUtf16 (const ucstring &text); + ucstring getTextAsUtf16 () const; void setHardText (const std::string &text); std::string getHardText () const; @@ -130,7 +132,7 @@ namespace NLGUI int luaGetViewText(CLuaState &ls); REFLECT_EXPORT_START(CCtrlTextButton, CCtrlBaseButton) - REFLECT_UCSTRING("uc_hardtext", getText, setText); + REFLECT_UCSTRING("uc_hardtext", getTextAsUtf16, setTextAsUtf16); REFLECT_STRING("hardtext", getHardText, setHardText); REFLECT_SINT32("text_x", getTextX, setTextX) REFLECT_SINT32("wmargin", getWMargin, setWMargin) diff --git a/nel/include/nel/gui/group_container.h b/nel/include/nel/gui/group_container.h index 742dfcfb2..399f9c056 100644 --- a/nel/include/nel/gui/group_container.h +++ b/nel/include/nel/gui/group_container.h @@ -477,8 +477,8 @@ namespace NLGUI float _CurrentRolloverAlphaContainer; float _CurrentRolloverAlphaContent; sint32 _LayerSetup; - ucstring _TitleTextOpened; - ucstring _TitleTextClosed; + std::string _TitleTextOpened; + std::string _TitleTextClosed; CViewText *_TitleOpened; CViewText *_TitleClosed; sint32 _TitleDeltaMaxW; diff --git a/nel/include/nel/gui/group_list.h b/nel/include/nel/gui/group_list.h index 58af530b5..6e7587e34 100644 --- a/nel/include/nel/gui/group_list.h +++ b/nel/include/nel/gui/group_list.h @@ -67,13 +67,13 @@ namespace NLGUI * \param line : text to be added * \param color : text color */ - void addTextChild (const ucstring& line,const NLMISC::CRGBA &textColor, bool multiLine = true); + void addTextChild (const std::string& line,const NLMISC::CRGBA &textColor, bool multiLine = true); /** * add a text child element to the group, using the text template * \param line : text to be added */ - void addTextChild (const ucstring& line, bool multiLine = true); + void addTextChild (const std::string& line, bool multiLine = true); /// Same as adding a text child but the text will be taken from the string manager void addTextChildID (uint32 id, bool multiLine = true); diff --git a/nel/include/nel/gui/group_menu.h b/nel/include/nel/gui/group_menu.h index 21a740d84..f304a3d60 100644 --- a/nel/include/nel/gui/group_menu.h +++ b/nel/include/nel/gui/group_menu.h @@ -122,12 +122,12 @@ namespace NLGUI // retrieve the index of a line from its id (-1 if not found) sint getLineFromId(const std::string &id); - CViewTextMenu* addLine (const ucstring &name, const std::string &ah, + CViewTextMenu* addLine (const std::string &name, const std::string &ah, const std::string ¶ms, const std::string &id="", const std::string &cond = std::string(), const std::string &texture="", bool checkable = false, bool checked = false, bool formatted = false ); - CViewTextMenu* addLineAtIndex(uint index, const ucstring &name, const std::string &ah, + CViewTextMenu* addLineAtIndex(uint index, const std::string &name, const std::string &ah, const std::string ¶ms, const std::string &id="", const std::string &cond = std::string(), const std::string &texture="", bool checkable = false, bool checked = false, bool formatted = false @@ -332,12 +332,7 @@ namespace NLGUI virtual void setActive (bool state); virtual bool isWindowUnder (sint32 x, sint32 y); - - // add line with a string, for backward compatibility - void addLine (const std::string &name, const std::string &ah, const std::string ¶ms, - const std::string &id = std::string(), - const std::string &cond = std::string(), const std::string &texture="", - bool checkable = false, bool checked = false); + uint getNumLine() const; void deleteLine(uint index); const std::string getActionHandler(uint lineIndex) const; @@ -350,12 +345,12 @@ namespace NLGUI void setRightClickHandler(uint lineIndex, const std::string &ah = ""); void setRightClickHandlerParam(uint lineIndex, const std::string ¶ms = ""); - void addLine (const ucstring &name, const std::string &ah = "", const std::string ¶ms = "", + void addLine (const std::string &name, const std::string &ah = "", const std::string ¶ms = "", const std::string &id = std::string(), const std::string &cond = std::string(), const std::string &texture="", bool checkable = false, bool checked = false ); - void addLineAtIndex (uint index, const ucstring &name, const std::string &ah = "", const std::string ¶ms = "", + void addLineAtIndex (uint index, const std::string &name, const std::string &ah = "", const std::string ¶ms = "", const std::string &id = std::string(), const std::string &cond = std::string(), const std::string &texture="", bool checkable = false, bool checked = false diff --git a/nel/include/nel/gui/group_paragraph.h b/nel/include/nel/gui/group_paragraph.h index 6142bc33b..0e1898633 100644 --- a/nel/include/nel/gui/group_paragraph.h +++ b/nel/include/nel/gui/group_paragraph.h @@ -84,13 +84,13 @@ namespace NLGUI * \param line : text to be added * \param color : text color */ - void addTextChild (const ucstring& line,const NLMISC::CRGBA &textColor, bool multiLine = true); + void addTextChild (const std::string& line,const NLMISC::CRGBA &textColor, bool multiLine = true); /** * add a text child element to the group, using the text template * \param line : text to be added */ - void addTextChild (const ucstring& line, bool multiLine = true); + void addTextChild (const std::string& line, bool multiLine = true); /// Same as adding a text child but the text will be taken from the string manager void addTextChildID (uint32 id, bool multiLine = true); diff --git a/nel/include/nel/gui/group_tree.h b/nel/include/nel/gui/group_tree.h index 266e7e23f..d7518a68d 100644 --- a/nel/include/nel/gui/group_tree.h +++ b/nel/include/nel/gui/group_tree.h @@ -60,7 +60,7 @@ namespace NLGUI bool Show; // If false, the node is not displayed (true default, Root ignored) sint32 YDecal; // Text - ucstring Text; // Internationalized displayed text + std::string Text; // Internationalized displayed text sint32 FontSize; // If -1 (default), then take the groupTree one NLMISC::CRGBA Color; // Template @@ -112,8 +112,10 @@ namespace NLGUI std::string getBitmap() const { return Bitmap; } void setOpened(bool opened) { Opened = opened; } bool getOpened() const { return Opened; } - void setText(const ucstring &text) { Text = text; } - const ucstring& getText() const { return Text; } + void setText(const std::string &text) { Text = text; } + const std::string& getText() const { return Text; } + void setTextAsUtf16(const ucstring &text) { Text = text.toUtf8(); } + ucstring getTextAsUtf16() const { return ucstring::makeFromUtf8(Text); } sint32 getFontSize() const { return FontSize; } void setFontSize(sint32 value) { FontSize = value; } sint32 getYDecal() const { return YDecal; } @@ -181,7 +183,7 @@ namespace NLGUI REFLECT_STRING("AHParamsClose", getAHParamsClose, setAHParamsClose); REFLECT_BOOL("Opened", getOpened, setOpened); REFLECT_BOOL("Show", getShow, setShow); - REFLECT_UCSTRING_REF("Text", getText, setText); + REFLECT_UCSTRING("Text", getTextAsUtf16, setTextAsUtf16); // FIXME: Lua UTF-8 // lua REFLECT_LUA_METHOD("getNumChildren", luaGetNumChildren); REFLECT_LUA_METHOD("getChild", luaGetChild); diff --git a/nel/include/nel/gui/interface_expr.h b/nel/include/nel/gui/interface_expr.h index b967ef7ab..0a9d9b4e9 100644 --- a/nel/include/nel/gui/interface_expr.h +++ b/nel/include/nel/gui/interface_expr.h @@ -59,16 +59,14 @@ namespace NLGUI bool getBool() const; sint64 getInteger() const; double getDouble() const; - std::string getString() const; + const std::string &getString() const; NLMISC::CRGBA getRGBA() const; - const ucstring &getUCString() const; CInterfaceExprUserType *getUserType() const; // set void setBool(bool value) { clean(); _Type = Boolean; _BoolValue = value; } void setInteger(sint64 value) { clean(); _Type = Integer; _IntegerValue = value; } void setDouble(double value) { clean(); _Type = Double; _DoubleValue = value; } void setString(const std::string &value) { clean(); _Type = String; _StringValue = value; } - void setUCString(const ucstring &value) { clean(); _Type = String; _StringValue = value; } void setRGBA(NLMISC::CRGBA value) { clean(); _Type = RGBA; _RGBAValue = (uint32)(value.R+(value.G<<8)+(value.B<<16)+(value.A<<24)); } void setUserType(CInterfaceExprUserType *value); // reset this object to initial state (no type) @@ -99,7 +97,7 @@ namespace NLGUI CInterfaceExprUserType *_UserTypeValue; uint32 _RGBAValue; }; - ucstring _StringValue; // well, can't fit in union, unless we do some horrible hack.. + std::string _StringValue; // well, can't fit in union, unless we do some horrible hack.. private: const char *evalBoolean(const char *expr); const char *evalNumber(const char *expr); diff --git a/nel/include/nel/gui/view_pointer.h b/nel/include/nel/gui/view_pointer.h index cb550e44a..bc605a717 100644 --- a/nel/include/nel/gui/view_pointer.h +++ b/nel/include/nel/gui/view_pointer.h @@ -55,7 +55,7 @@ namespace NLGUI bool getStringMode() const {return _StringMode;} // Set cursor string - void setString (const ucstring &str); + void setString (const std::string &str); // TEMP PATCH void setCursor (const std::string &name) @@ -126,14 +126,14 @@ namespace NLGUI bool _ForceStringMode; CInterfaceGroup *_StringCursor; CInterfaceGroup *_StringCursorHardware; - ucstring _ContextString; + std::string _ContextString; // draw current cursor with the given texture, or, if in hardware mode, change the hardware cursor shape void drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot); private: // set the string into frame for software or hardware version - void setString (const ucstring &str, CInterfaceGroup *target); + void setString(const std::string &str, CInterfaceGroup *target); static bool hwMouse; diff --git a/nel/include/nel/gui/view_text.h b/nel/include/nel/gui/view_text.h index 2ffaa8d49..933f9a747 100644 --- a/nel/include/nel/gui/view_text.h +++ b/nel/include/nel/gui/view_text.h @@ -465,7 +465,7 @@ namespace NLGUI void addDontClipWordLine(std::vector &currLine); // FormatTag build. - static void buildFormatTagText(const std::string &text, std::string &textBuild, std::vector &formatTags, std::vector &tooltips); + static void buildFormatTagText(const std::string &text, std::string &textBuild, std::vector &formatTags, std::vector &tooltips); // FormatTag parsing. bool isFormatTagChange(uint textIndex, uint ctIndex) const; void getFormatTagChange(uint textIndex, uint &ctIndex, CFormatInfo &wordFormat) const; diff --git a/nel/include/nel/gui/view_text_formated.h b/nel/include/nel/gui/view_text_formated.h index 43a7eb9a8..f6a3cf443 100644 --- a/nel/include/nel/gui/view_text_formated.h +++ b/nel/include/nel/gui/view_text_formated.h @@ -45,7 +45,7 @@ namespace NLGUI { public: virtual ~IViewTextFormatter(){} - virtual ucstring formatString( const ucstring &inputString, const ucstring ¶mString ) = 0; + virtual std::string formatString( const std::string &inputString, const std::string ¶mString ) = 0; }; CViewTextFormated (const TCtorParam ¶m) : CViewText(param) @@ -55,15 +55,15 @@ namespace NLGUI xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup); virtual void checkCoords(); - const ucstring &getFormatString() const { return _FormatString; } - void setFormatString(const ucstring &format); + const std::string &getFormatString() const { return _FormatString; } + void setFormatString(const std::string &format); - static ucstring formatString(const ucstring &inputString, const ucstring ¶mString); + static std::string formatString(const std::string &inputString, const std::string ¶mString); static void setFormatter( IViewTextFormatter *formatter ){ textFormatter = formatter; } private: - ucstring _FormatString; + std::string _FormatString; static IViewTextFormatter *textFormatter; }; diff --git a/nel/include/nel/gui/view_text_id.h b/nel/include/nel/gui/view_text_id.h index 1e46de062..8c012f319 100644 --- a/nel/include/nel/gui/view_text_id.h +++ b/nel/include/nel/gui/view_text_id.h @@ -58,8 +58,10 @@ namespace NLGUI { public: virtual ~IViewTextProvider(){} - virtual bool getString( uint32 stringId, ucstring &result ) = 0; - virtual bool getDynString( uint32 dynStringId, ucstring &result ) = 0; + bool getString(uint32 stringId, std::string &result) { ucstring temp; bool res = getString(stringId, temp); result = temp.toUtf8(); return res; } + bool getDynString(uint32 dynStringId, std::string &result) { ucstring temp; bool res = getDynString(dynStringId, temp); result = temp.toUtf8(); return res; } + virtual bool getString( uint32 stringId, ucstring &result ) = 0; // TODO: UTF-8 + virtual bool getDynString( uint32 dynStringId, ucstring &result ) = 0; // TODO: UTF-8 }; CViewTextID(const TCtorParam ¶m) : CViewText(param) diff --git a/nel/include/nel/gui/view_text_id_formated.h b/nel/include/nel/gui/view_text_id_formated.h index cbc494dc1..dfd11d0d4 100644 --- a/nel/include/nel/gui/view_text_id_formated.h +++ b/nel/include/nel/gui/view_text_id_formated.h @@ -49,10 +49,10 @@ namespace NLGUI xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup); virtual void checkCoords(); - const ucstring &getFormatString() const { return _FormatString; } - void setFormatString(const ucstring &format); + const std::string &getFormatString() const { return _FormatString; } + void setFormatString(const std::string &format); private: - ucstring _FormatString; + std::string _FormatString; }; } diff --git a/nel/src/gui/ctrl_text_button.cpp b/nel/src/gui/ctrl_text_button.cpp index 154d41633..5cc89c9a7 100644 --- a/nel/src/gui/ctrl_text_button.cpp +++ b/nel/src/gui/ctrl_text_button.cpp @@ -1041,14 +1041,29 @@ namespace NLGUI // *************************************************************************** - void CCtrlTextButton::setText (const ucstring &text) + void CCtrlTextButton::setText (const std::string &text) + { + if (_ViewText && !_IsViewTextId) + _ViewText->setText(text); + } + + // *************************************************************************** + std::string CCtrlTextButton::getText () const + { + if (_ViewText && !_IsViewTextId) + return _ViewText->getText(); + return std::string(); + } + + // *************************************************************************** + void CCtrlTextButton::setTextAsUtf16 (const ucstring &text) { if (_ViewText && !_IsViewTextId) _ViewText->setText(text.toUtf8()); } // *************************************************************************** - ucstring CCtrlTextButton::getText () const + ucstring CCtrlTextButton::getTextAsUtf16 () const { if (_ViewText && !_IsViewTextId) return CUtfStringView(_ViewText->getText()).toUtf16(); diff --git a/nel/src/gui/dbgroup_combo_box.cpp b/nel/src/gui/dbgroup_combo_box.cpp index 66d3220a0..b13005b33 100644 --- a/nel/src/gui/dbgroup_combo_box.cpp +++ b/nel/src/gui/dbgroup_combo_box.cpp @@ -668,7 +668,7 @@ namespace NLGUI { checkable = true; } - groupMenu->addLine(ucstring::makeFromUtf8(getText(i)), "combo_box_select_end", toString(i), + groupMenu->addLine(getText(i), "combo_box_select_end", toString(i), "", std::string(), getTexture(i), checkable); groupMenu->setGrayedLine(i, getGrayed(i)); } diff --git a/nel/src/gui/group_container.cpp b/nel/src/gui/group_container.cpp index 7bab62820..e6b69326b 100644 --- a/nel/src/gui/group_container.cpp +++ b/nel/src/gui/group_container.cpp @@ -1338,19 +1338,19 @@ namespace NLGUI if( name == "title" ) { if( _TitleTextOpened == _TitleTextClosed ) - return _TitleTextOpened.toString(); + return _TitleTextOpened; else return ""; } else if( name == "title_opened" ) { - return _TitleTextOpened.toString(); + return _TitleTextOpened; } else if( name == "title_closed" ) { - return _TitleTextClosed.toString(); + return _TitleTextClosed; } else if( name == "header_active" ) @@ -1997,12 +1997,12 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "content_y_offset", BAD_CAST toString( _ContentYOffset ).c_str() ); if( _TitleTextOpened == _TitleTextClosed ) - xmlSetProp( node, BAD_CAST "title", BAD_CAST _TitleTextOpened.toString().c_str() ); + xmlSetProp( node, BAD_CAST "title", BAD_CAST _TitleTextOpened.c_str() ); else xmlSetProp( node, BAD_CAST "title", BAD_CAST "" ); - xmlSetProp( node, BAD_CAST "title_opened", BAD_CAST _TitleTextOpened.toString().c_str() ); - xmlSetProp( node, BAD_CAST "title_closed", BAD_CAST _TitleTextClosed.toString().c_str() ); + xmlSetProp( node, BAD_CAST "title_opened", BAD_CAST _TitleTextOpened.c_str() ); + xmlSetProp( node, BAD_CAST "title_closed", BAD_CAST _TitleTextClosed.c_str() ); xmlSetProp( node, BAD_CAST "header_active", BAD_CAST toString( _HeaderActive ).c_str() ); if( _HeaderColor.getNodePtr() != NULL ) @@ -3712,7 +3712,7 @@ namespace NLGUI { CViewTextID *vti= new CViewTextID(CViewBase::TCtorParam()); // the title here is actually the DB path - vti->setDBTextID(_TitleTextOpened.toString()); + vti->setDBTextID(_TitleTextOpened); vti->setDynamicString(_TitleClass==TitleTextDynString); _TitleOpened = vti; } @@ -3744,7 +3744,7 @@ namespace NLGUI _TitleOpened->setY (pLayer->getValSInt32 ("title_offset_y")); } _TitleOpened->setFontSize (pLayer->getValSInt32 ("title_font_size")); - if (_TitleClass==TitleText) _TitleOpened->setText (_TitleTextOpened.toUtf8()); + if (_TitleClass==TitleText) _TitleOpened->setText (_TitleTextOpened); _TitleOpened->setActive (_Opened); // Title when the container is closed @@ -3764,7 +3764,7 @@ namespace NLGUI { CViewTextID *vti= new CViewTextID(CViewBase::TCtorParam()); // the title here is actually the DB path - vti->setDBTextID(_TitleTextClosed.toString()); + vti->setDBTextID(_TitleTextClosed); vti->setDynamicString(_TitleClass==TitleTextDynString); _TitleClosed = vti; } @@ -3796,7 +3796,7 @@ namespace NLGUI _TitleClosed->setY (pLayer->getValSInt32 ("title_offset_y")); } _TitleClosed->setFontSize (pLayer->getValSInt32 ("title_font_size")); - if (_TitleClass==TitleText) _TitleClosed->setText (_TitleTextClosed.toUtf8()); + if (_TitleClass==TitleText) _TitleClosed->setText (_TitleTextClosed); _TitleClosed->setActive(!_Opened); @@ -3949,7 +3949,7 @@ namespace NLGUI // *************************************************************************** std::string CGroupContainer::getTitle () const { - return _TitleTextOpened.toString(); + return _TitleTextOpened; } // *************************************************************************** @@ -3962,7 +3962,7 @@ namespace NLGUI // *************************************************************************** std::string CGroupContainer::getTitleOpened () const { - return _TitleTextOpened.toString(); + return _TitleTextOpened; } // *************************************************************************** @@ -3975,7 +3975,7 @@ namespace NLGUI // *************************************************************************** std::string CGroupContainer::getTitleClosed () const { - return _TitleTextClosed.toString(); + return _TitleTextClosed; } // *************************************************************************** @@ -3988,7 +3988,7 @@ namespace NLGUI // *************************************************************************** void CGroupContainer::setUCTitleOpened(const ucstring &title) { - _TitleTextOpened = title; + _TitleTextOpened = title.toUtf8(); if (_TitleOpened != NULL) _TitleOpened->setText (title.toUtf8()); invalidateCoords(); @@ -3997,9 +3997,9 @@ namespace NLGUI // *************************************************************************** void CGroupContainer::setUCTitleClosed(const ucstring &title) { - _TitleTextClosed = title; + _TitleTextClosed = title.toUtf8(); if (_TitleClosed != NULL) - _TitleClosed->setText (_TitleTextClosed.toUtf8()); + _TitleClosed->setText (_TitleTextClosed); invalidateCoords(); } diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 15bd47a68..b559b409f 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -2755,11 +2755,11 @@ namespace NLGUI void CGroupHTML::addString(const ucstring &str) { - ucstring tmpStr = str; + string tmpStr = str.toUtf8(); if (_Localize) { - string _str = tmpStr.toString(); + string _str = tmpStr; string::size_type p = _str.find('#'); if (p == string::npos) { @@ -2800,7 +2800,7 @@ namespace NLGUI } else if (_Object) { - _ObjectScript += tmpStr.toString(); + _ObjectScript += tmpStr; } else if (_SelectOption) { @@ -2853,7 +2853,7 @@ namespace NLGUI (style.GlobalColor == _CurrentViewLink->getModulateGlobalColor())) { // Concat the text - _CurrentViewLink->setText(_CurrentViewLink->getText()+tmpStr.toUtf8()); + _CurrentViewLink->setText(_CurrentViewLink->getText()+tmpStr); _CurrentViewLink->invalidateContent(); added = true; } @@ -2916,7 +2916,7 @@ namespace NLGUI newLink->setParamsOnLeftClick("name=" + getId() + "|url=" + newLink->Link); } } - newLink->setText(tmpStr.toUtf8()); + newLink->setText(tmpStr); newLink->setMultiLineSpace((uint)((float)(style.FontSize)*LineSpaceFontFactor)); newLink->setMultiLine(true); newLink->setModulateGlobalColor(style.GlobalColor); @@ -5475,7 +5475,7 @@ namespace NLGUI } } - ctrlButton->setText(ucstring::makeFromUtf8(value)); + ctrlButton->setText(value); setTextButtonStyle(ctrlButton, _Style.Current); } @@ -6449,7 +6449,7 @@ namespace NLGUI if (sb) { uint lineIndex = sb->getNumLine(); - sb->addLine(_SelectOptionStr, "", ""); + sb->addLine(_SelectOptionStr.toUtf8(), "", ""); if (_Forms.back().Entries.back().sbOptionDisabled == lineIndex) { diff --git a/nel/src/gui/group_list.cpp b/nel/src/gui/group_list.cpp index 4e04501a8..b94ff6a5f 100644 --- a/nel/src/gui/group_list.cpp +++ b/nel/src/gui/group_list.cpp @@ -521,7 +521,7 @@ namespace NLGUI if (NLMISC::startsWith(propPtr, "ui")) addTextChild(CI18N::get(propPtr)); else - addTextChild(ucstring::makeFromUtf8(propPtr)); + addTextChild(propPtr); } else { @@ -539,7 +539,7 @@ namespace NLGUI // ---------------------------------------------------------------------------- - void CGroupList::addTextChild(const ucstring& line, bool multiLine /*= true*/) + void CGroupList::addTextChild(const std::string& line, bool multiLine /*= true*/) { const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); @@ -548,7 +548,7 @@ namespace NLGUI view->setMultiLine (multiLine); view->setTextMode(_Templ.getTextMode()); if (multiLine) view->setMultiLineSpace (_Space); - view->setText (line.toUtf8()); + view->setText (line); // Herit global-coloring view->setModulateGlobalColor(getModulateGlobalColor()); addChild(view); @@ -558,7 +558,7 @@ namespace NLGUI // ---------------------------------------------------------------------------- - void CGroupList::addTextChild(const ucstring& line, const CRGBA& textColor, bool multiLine /*= true*/) + void CGroupList::addTextChild(const std::string& line, const CRGBA& textColor, bool multiLine /*= true*/) { const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); @@ -566,7 +566,7 @@ namespace NLGUI view->_Parent = this; view->setMultiLine (multiLine); if (multiLine) view->setMultiLineSpace (_Space); - view->setText (line.toUtf8()); + view->setText (line); view->setColor (textColor); // Herit global-coloring view->setModulateGlobalColor(getModulateGlobalColor()); @@ -1289,7 +1289,7 @@ namespace NLGUI ucstring text; if(CLuaIHM::pop(ls, text)) { - addTextChild(text); + addTextChild(text.toUtf8()); // FIXME: Lua UTF-8 } return 0; } @@ -1313,7 +1313,7 @@ namespace NLGUI uint b = (uint) ls.toInteger(4); uint a = (uint) ls.toInteger(5); - addTextChild(ucText, CRGBA(r, g, b, a)); + addTextChild(ucText.toUtf8(), CRGBA(r, g, b, a)); // FIXME: Lua UTF-8 return 0; } diff --git a/nel/src/gui/group_menu.cpp b/nel/src/gui/group_menu.cpp index 109baf278..77f73e18e 100644 --- a/nel/src/gui/group_menu.cpp +++ b/nel/src/gui/group_menu.cpp @@ -275,7 +275,7 @@ namespace NLGUI if (stricmp((char*)cur->name, "action") == 0) { string strId, strAh, strParams, strCond, strTexture; - ucstring ucstrName; + string ucstrName; if (id) strId = (const char*)id; CXMLAutoPtr name((const char*) xmlGetProp (cur, (xmlChar*)"name")); @@ -286,7 +286,7 @@ namespace NLGUI if (NLMISC::startsWith(ptrName, "ui")) ucstrName = CI18N::get(ptrName); else - ucstrName.fromUtf8(ptrName); + ucstrName = ptrName; } CXMLAutoPtr ah((const char*) xmlGetProp (cur, (xmlChar*)"handler")); @@ -1215,7 +1215,7 @@ namespace NLGUI // ------------------------------------------------------------------------------------------------ - CViewTextMenu* CGroupSubMenu::addLine (const ucstring &name, const std::string &ah, + CViewTextMenu* CGroupSubMenu::addLine (const std::string &name, const std::string &ah, const std::string ¶ms, const std::string &id, const std::string &cond, const std::string &texture, bool checkable /*= false*/, bool checked /*= false*/, bool formatted /*= false */ @@ -1231,11 +1231,11 @@ namespace NLGUI { pV->setMultiLine (true); pV->setMultiLineMaxWOnly (true); - pV->setTextFormatTaged (name.toUtf8()); + pV->setTextFormatTaged (name); } else { - pV->setText (name.toUtf8()); + pV->setText (name); } pV->setColor (_GroupMenu->_Color); pV->setFontSize (_GroupMenu->_FontSize, _GroupMenu->_FontSizeCoef); @@ -1296,7 +1296,7 @@ namespace NLGUI return pV; } - CViewTextMenu* CGroupSubMenu::addLineAtIndex(uint index, const ucstring &name, const std::string &ah, + CViewTextMenu* CGroupSubMenu::addLineAtIndex(uint index, const std::string &name, const std::string &ah, const std::string ¶ms, const std::string &id /*=""*/, const std::string &cond /*=std::string()*/, const std::string &texture, bool checkable /*= false*/, bool checked /*= false*/, bool formatted /*= false */ @@ -1319,11 +1319,11 @@ namespace NLGUI { pV->setMultiLine (true); pV->setMultiLineMaxWOnly (true); - pV->setTextFormatTaged (name.toUtf8()); + pV->setTextFormatTaged (name); } else { - pV->setText (name.toUtf8()); + pV->setText (name); } pV->setColor (_GroupMenu->_Color); @@ -1602,7 +1602,7 @@ namespace NLGUI texture = _Lines[k].ViewText->getCheckBox()->getTexture(); } CViewTextMenu *pV = NULL; - pV = copyMenu->addLine (CUtfStringView(_Lines[k].ViewText->getText()).toUtf16(), _Lines[k].AHName, _Lines[k].AHParams, _Lines[k].Id, _Lines[k].Cond, + pV = copyMenu->addLine (_Lines[k].ViewText->getText(), _Lines[k].AHName, _Lines[k].AHParams, _Lines[k].Id, _Lines[k].Cond, texture, _Lines[k].ViewText->getCheckable(), _Lines[k].ViewText->getChecked(), _Lines[k].ViewText->getFormatted ()); copyMenu->_Lines[k].Selectable = _Lines[k].Selectable; pV->setGrayed(_Lines[k].ViewText->getGrayed()); @@ -1858,8 +1858,8 @@ namespace NLGUI CLuaIHM::checkArgType(ls, funcName, 3, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING); ucstring arg1; - nlverify(CLuaIHM::getUCStringOnStack(ls, 1, arg1)); - addLine(arg1, ls.toString(2), ls.toString(3), ls.toString(4)); + nlverify(CLuaIHM::getUCStringOnStack(ls, 1, arg1)); // FIXME: Lua UTF-8 + addLine(arg1.toUtf8(), ls.toString(2), ls.toString(3), ls.toString(4)); return 0; } @@ -1874,8 +1874,8 @@ namespace NLGUI CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING); ucstring arg1; - nlverify(CLuaIHM::getUCStringOnStack(ls, 1, arg1)); - addLine(arg1, ls.toString(2), ls.toString(3), ls.toString(4), string(), ls.toString(5)); + nlverify(CLuaIHM::getUCStringOnStack(ls, 1, arg1)); // FIXME: Lua UTF-8 + addLine(arg1.toUtf8(), ls.toString(2), ls.toString(3), ls.toString(4), string(), ls.toString(5)); return 0; } @@ -1890,8 +1890,8 @@ namespace NLGUI CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING); ucstring arg2; - nlverify(CLuaIHM::getUCStringOnStack(ls, 2, arg2)); - addLineAtIndex((uint) ls.toInteger(1), arg2, ls.toString(3), ls.toString(4), ls.toString(5)); + nlverify(CLuaIHM::getUCStringOnStack(ls, 2, arg2)); // FIXME: Lua UTF-8 + addLineAtIndex((uint) ls.toInteger(1), arg2.toUtf8(), ls.toString(3), ls.toString(4), ls.toString(5)); return 0; } @@ -2532,25 +2532,7 @@ namespace NLGUI } // ------------------------------------------------------------------------------------------------ - void CGroupMenu::addLine (const string &name, const string &ah, const string ¶ms, - const std::string &id/*=std::string()*/, - const std::string &cond /*= std::string()*/, const std::string &texture, - bool checkable /*= false*/, bool checked /*= false*/ - ) - { - if (_RootMenu == NULL) - { - _RootMenu = new CGroupSubMenu(CViewText::TCtorParam()); - _RootMenu->_GroupMenu = this; - _RootMenu->setSerializable( false ); - addGroup (_RootMenu); - } - - _RootMenu->addLine (name, ah, params, id, cond, texture, checkable, checked, _Formatted); - } - - // ------------------------------------------------------------------------------------------------ - void CGroupMenu::addLine(const ucstring &name, const std::string &ah, const std::string ¶ms, + void CGroupMenu::addLine(const std::string &name, const std::string &ah, const std::string ¶ms, const std::string &id /* = std::string()*/, const std::string &cond /*= std::string()*/, const std::string &texture, bool checkable /*= false*/, bool checked /*= false*/ @@ -2566,7 +2548,7 @@ namespace NLGUI _RootMenu->addLine (name, ah, params, id, cond, texture, checkable, checked, _Formatted); } // ------------------------------------------------------------------------------------------------ - void CGroupMenu::addLineAtIndex(uint index, const ucstring &name, const std::string &ah, + void CGroupMenu::addLineAtIndex(uint index, const std::string &name, const std::string &ah, const std::string ¶ms, const std::string &id /*=std::string()*/, const std::string &cond /*=std::string()*/, const std::string &texture, bool checkable /*=false*/, bool checked /*=false*/) diff --git a/nel/src/gui/group_paragraph.cpp b/nel/src/gui/group_paragraph.cpp index f2027a404..a4c2a6da7 100644 --- a/nel/src/gui/group_paragraph.cpp +++ b/nel/src/gui/group_paragraph.cpp @@ -479,7 +479,7 @@ namespace NLGUI if (NLMISC::startsWith(propPtr, "ui")) addTextChild(CI18N::get(propPtr)); else - addTextChild(ucstring::makeFromUtf8(propPtr)); + addTextChild(propPtr); } else { @@ -495,7 +495,7 @@ namespace NLGUI } // ---------------------------------------------------------------------------- - void CGroupParagraph::addTextChild(const ucstring& line, bool multiLine /*= true*/) + void CGroupParagraph::addTextChild(const std::string& line, bool multiLine /*= true*/) { const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); @@ -503,7 +503,7 @@ namespace NLGUI view->setMultiLine (multiLine); view->setTextMode(_Templ.getTextMode()); if (multiLine) view->setMultiLineSpace (_Space); - view->setText (line.toUtf8()); + view->setText (line); // Herit global-coloring view->setModulateGlobalColor(getModulateGlobalColor()); addChild (view); @@ -513,14 +513,14 @@ namespace NLGUI // ---------------------------------------------------------------------------- - void CGroupParagraph::addTextChild(const ucstring& line, const CRGBA& textColor, bool multiLine /*= true*/) + void CGroupParagraph::addTextChild(const std::string& line, const CRGBA& textColor, bool multiLine /*= true*/) { const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); view->_Parent = this; view->setMultiLine (multiLine); if (multiLine) view->setMultiLineSpace (_Space); - view->setText (line.toUtf8()); + view->setText (line); view->setColor (textColor); // Herit global-coloring view->setModulateGlobalColor(getModulateGlobalColor()); diff --git a/nel/src/gui/group_tree.cpp b/nel/src/gui/group_tree.cpp index 93e9880bb..674da9546 100644 --- a/nel/src/gui/group_tree.cpp +++ b/nel/src/gui/group_tree.cpp @@ -309,7 +309,7 @@ namespace NLGUI if (NLMISC::startsWith(ptrName, "ui")) Text = CI18N::get(ptrName); else - ucstring::makeFromUtf8(ptrName); + Text = ptrName; } CXMLAutoPtr color((const char*) xmlGetProp (cur, (xmlChar*)"color")); @@ -1292,7 +1292,7 @@ namespace NLGUI CViewText *pVT = new CViewText(TCtorParam()); line.TextOrTemplate = pVT; pVT->setId("t"+toString(_Lines.size())); - pVT->setText(pNode->Text.toUtf8()); + pVT->setText(pNode->Text); pVT->setColor(pNode->Color); if(pNode->FontSize==-1) pVT->setFontSize(_FontSize); diff --git a/nel/src/gui/interface_expr.cpp b/nel/src/gui/interface_expr.cpp index 813962526..c83c1d722 100644 --- a/nel/src/gui/interface_expr.cpp +++ b/nel/src/gui/interface_expr.cpp @@ -548,7 +548,7 @@ namespace NLGUI case Boolean: return true; case Integer: setBool(_IntegerValue != 0); return true; case Double: setBool(_DoubleValue != 0); return true; - case String: return evalBoolean(_StringValue.toString().c_str()) != NULL; + case String: return evalBoolean(_StringValue.c_str()) != NULL; default: break; } return false; @@ -564,7 +564,7 @@ namespace NLGUI case Integer: return true; case Double: setInteger((sint64) _DoubleValue); return true; case String: - if (evalNumber(_StringValue.toString().c_str())) return toInteger(); + if (evalNumber(_StringValue.c_str())) return toInteger(); return false; case RGBA: setInteger((sint64) _RGBAValue); return true; default: break; @@ -581,7 +581,7 @@ namespace NLGUI case Integer: setDouble((double) _IntegerValue); return true; case Double: return true; case String: - if (evalNumber(_StringValue.toString().c_str())) return toBool(); + if (evalNumber(_StringValue.c_str())) return toBool(); return false; case RGBA: setDouble((double) _RGBAValue); return true; default: break; @@ -627,7 +627,7 @@ namespace NLGUI return true; case String: - setRGBA( NLMISC::CRGBA::stringToRGBA(_StringValue.toString().c_str())); + setRGBA( NLMISC::CRGBA::stringToRGBA(_StringValue.c_str())); return true; default: @@ -869,14 +869,15 @@ namespace NLGUI } //================================================================== - std::string CInterfaceExprValue::getString() const + const std::string &CInterfaceExprValue::getString() const { if (_Type != String) { nlwarning(" bad type!"); - return ""; + static const std::string empty; + return empty; } - return _StringValue.toString(); + return _StringValue; } //================================================================== @@ -895,19 +896,6 @@ namespace NLGUI return col; } - - //================================================================== - const ucstring &CInterfaceExprValue::getUCString() const - { - if (_Type != String) - { - nlwarning(" bad type!"); - static ucstring emptyString; - return emptyString; - } - return _StringValue; - } - //================================================================== CInterfaceExprUserType *CInterfaceExprValue::getUserType() const { diff --git a/nel/src/gui/interface_expr_user_fct.cpp b/nel/src/gui/interface_expr_user_fct.cpp index d0c687d26..7fc097f48 100644 --- a/nel/src/gui/interface_expr_user_fct.cpp +++ b/nel/src/gui/interface_expr_user_fct.cpp @@ -359,13 +359,13 @@ namespace NLGUI { if (!args.empty()) { - ucstring res; + string res; for (uint32 i = 0; i < args.size(); ++i) { args[i].toString(); - res += args[i].getUCString(); + res += args[i].getString(); } - result.setUCString (res); + result.setString (res); return true; } @@ -553,13 +553,13 @@ namespace NLGUI result.setString ((elem->*(pRP->GetMethod.GetString))()); break; case CReflectedProperty::UCString: - result.setUCString ((elem->*(pRP->GetMethod.GetUCString))()); + result.setString ((elem->*(pRP->GetMethod.GetUCString))().toUtf8()); break; case CReflectedProperty::StringRef: result.setString ((elem->*(pRP->GetMethod.GetStringRef))()); break; case CReflectedProperty::UCStringRef: - result.setUCString ((elem->*(pRP->GetMethod.GetUCStringRef))()); + result.setString ((elem->*(pRP->GetMethod.GetUCStringRef))().toUtf8()); break; case CReflectedProperty::RGBA: result.setRGBA ((elem->*(pRP->GetMethod.GetRGBA))()); @@ -1072,7 +1072,7 @@ namespace NLGUI } sint64 nVal = args[0].getInteger(); - ucstring sTmp; + string sTmp; if (nVal < 0) nVal = 0; @@ -1099,7 +1099,7 @@ namespace NLGUI } } - result.setUCString(sTmp); + result.setString(sTmp); return true; } @@ -1121,7 +1121,7 @@ namespace NLGUI } sint64 nVal = args[0].getInteger(); - ucstring sTmp; + string sTmp; if (nVal < 0) nVal = 0; @@ -1150,7 +1150,7 @@ namespace NLGUI } } - result.setUCString(sTmp); + result.setString(sTmp); return true; } @@ -1186,7 +1186,7 @@ namespace NLGUI nlwarning("localize : 1 arg required"); return false; } - result.setUCString(CI18N::get(args[0].getString())); + result.setString(CI18N::get(args[0].getString())); return true; } REGISTER_INTERFACE_USER_FCT("localize", localize); diff --git a/nel/src/gui/interface_link.cpp b/nel/src/gui/interface_link.cpp index 03a1212d3..1cad39c94 100644 --- a/nel/src/gui/interface_link.cpp +++ b/nel/src/gui/interface_link.cpp @@ -121,7 +121,7 @@ namespace NLGUI case CReflectedProperty::UCStringRef: if (valueToAffect.toString()) { - (destElem.*(property.SetMethod.SetUCString))(valueToAffect.getUCString()); + (destElem.*(property.SetMethod.SetUCString))(ucstring::makeFromUtf8(valueToAffect.getString())); } else { diff --git a/nel/src/gui/lua_ihm.cpp b/nel/src/gui/lua_ihm.cpp index 908898e74..c915a8671 100644 --- a/nel/src/gui/lua_ihm.cpp +++ b/nel/src/gui/lua_ihm.cpp @@ -1145,34 +1145,8 @@ namespace NLGUI ls.push(value.getDouble()); break; case CInterfaceExprValue::String: - { - ucstring ucstr= value.getUCString(); - // Yoyo: dynamically decide whether must return a string or a ucstring - bool mustUseUCString= false; - for (uint i = 0; i < ucstr.size (); i++) - { - if (ucstr[i] > 255) - { - mustUseUCString= true; - break; - } - } - // push a ucstring? - if(mustUseUCString) - { - #if LUABIND_VERSION > 600 - luabind::detail::push(ls.getStatePointer(), ucstr); - #else - luabind::object obj(ls.getStatePointer(), ucstr); - obj.pushvalue(); - #endif - } - else - { - ls.push(ucstr.toString()); - } - break; - } + ls.push(value.getString()); + break; case CInterfaceExprValue::RGBA: { CRGBA color = value.getRGBA(); diff --git a/nel/src/gui/view_pointer.cpp b/nel/src/gui/view_pointer.cpp index 973708aa6..3c319c228 100644 --- a/nel/src/gui/view_pointer.cpp +++ b/nel/src/gui/view_pointer.cpp @@ -250,7 +250,7 @@ namespace NLGUI if (vLink->getMouseOverShape(tooltip, rot, col)) { - setString(ucstring::makeFromUtf8(tooltip)); + setString(tooltip); sint32 texId = rVR.getTextureIdFromName ("curs_pick.tga"); CInterfaceGroup *stringCursor = hwMouse ? _StringCursorHardware : _StringCursor; @@ -406,7 +406,7 @@ namespace NLGUI splitString(tooltipInfos, "@", tooltipInfosList); texName = tooltipInfosList[0]; tooltip = tooltipInfosList[1]; - setString(ucstring::makeFromUtf8(tooltip)); + setString(tooltip); CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 texId = rVR.getTextureIdFromName (texName); @@ -449,7 +449,7 @@ namespace NLGUI } // -------------------------------------------------------------------------------------------------------------------- - void CViewPointer::setString (const ucstring &str, CInterfaceGroup *target) + void CViewPointer::setString(const std::string &str, CInterfaceGroup *target) { if (target) { @@ -458,14 +458,14 @@ namespace NLGUI { CViewText *text = dynamic_cast (element); if (text) - text->setText(str.toUtf8()); + text->setText(str); } element = target->getView ("real_txt"); if (element) { CViewText *text = dynamic_cast (element); if (text) - text->setText(str.toUtf8()); + text->setText(str); } target->updateCoords(); target->updateCoords(); @@ -475,7 +475,7 @@ namespace NLGUI // -------------------------------------------------------------------------------------------------------------------- - void CViewPointer::setString (const ucstring &str) + void CViewPointer::setString (const std::string &str) { if (_ContextString != str) { diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index 69b117330..b5744925f 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -3207,7 +3207,7 @@ namespace NLGUI // *************************************************************************** - void CViewText::buildFormatTagText(const std::string &text, std::string &textBuild, std::vector &formatTags, std::vector &tooltips) + void CViewText::buildFormatTagText(const std::string &text, std::string &textBuild, std::vector &formatTags, std::vector &tooltips) { formatTags.clear(); tooltips.clear(); @@ -3243,7 +3243,7 @@ namespace NLGUI // get old tag. CViewText::CFormatTag ct= precTag; // get new Tab and skip tag. - ucstring uitt = getTooltipTag(text, i); + string uitt = getTooltipTag(text, i); if (uitt.empty()) { ct.IndexTt= -1; @@ -3296,7 +3296,7 @@ namespace NLGUI std::string tempText; // static to avoid reallocation static std::vector tempFormatTags; - static std::vector tempTooltips; + static std::vector tempTooltips; buildFormatTagText(text, tempText, tempFormatTags, tempTooltips); setCase (tempText, _CaseMode); @@ -3344,7 +3344,7 @@ namespace NLGUI pTooltip->setId(_Id+"_tt"+toString(i)); pTooltip->setAvoidResizeParent(avoidResizeParent()); pTooltip->setRenderLayer(getRenderLayer()); - std::string tempTooltipStr = tempTooltips[i].toUtf8(); + std::string tempTooltipStr = tempTooltips[i]; bool isI18N = NLMISC::startsWith(tempTooltipStr, "ui"); pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltipStr) : tempTooltipStr); pTooltip->setParentPos(this); @@ -3390,7 +3390,7 @@ namespace NLGUI // to allow cache (avoid infinite recurse in updateCoords() in some case), compute in temp std::string tempText; static std::vector tempLetterColors; - static std::vector tempTooltips; + static std::vector tempTooltips; // parse text buildFormatTagText(text, tempText, tempLetterColors, tempTooltips); diff --git a/nel/src/gui/view_text_formated.cpp b/nel/src/gui/view_text_formated.cpp index 87cfc12bb..dfd57eadf 100644 --- a/nel/src/gui/view_text_formated.cpp +++ b/nel/src/gui/view_text_formated.cpp @@ -38,7 +38,7 @@ namespace NLGUI { if (name == "format") { - return getFormatString().toUtf8(); + return getFormatString(); } else return CViewText::getProperty(name); @@ -48,7 +48,7 @@ namespace NLGUI { if (name == "format") { - setFormatString(ucstring::makeFromUtf8(value)); + setFormatString(value); return; } else @@ -62,7 +62,7 @@ namespace NLGUI return NULL; xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_formated" ); - xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().toUtf8().c_str() ); + xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().c_str() ); return NULL; } @@ -73,9 +73,9 @@ namespace NLGUI if (!CViewText::parse(cur, parentGroup)) return false; CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"format" )); if (prop) - setFormatString(ucstring::makeFromUtf8((const char *)prop)); + setFormatString((const char *)prop); else - setFormatString(ucstring("$t")); + setFormatString("$t"); return true; } @@ -83,26 +83,27 @@ namespace NLGUI void CViewTextFormated::checkCoords() { if (!getActive()) return; - ucstring formatedResult; - formatedResult = formatString(_FormatString, ucstring("")); + std::string formatedResult; + formatedResult = formatString(_FormatString, std::string()); // - setText (formatedResult.toUtf8()); + setText (formatedResult); CViewText::checkCoords(); } // **************************************************************************** - void CViewTextFormated::setFormatString(const ucstring &format) + void CViewTextFormated::setFormatString(const std::string &format) { - _FormatString = format; - if ( (_FormatString.size()>2) && (_FormatString[0] == 'u') && (_FormatString[1] == 'i')) - _FormatString = NLMISC::CI18N::get (format.toString()); + if (NLMISC::startsWith(format, "ui")) + _FormatString = NLMISC::CI18N::get(format); + else + _FormatString = format; } // **************************************************************************** - ucstring CViewTextFormated::formatString(const ucstring &inputString, const ucstring ¶mString) + std::string CViewTextFormated::formatString(const std::string &inputString, const std::string ¶mString) { - ucstring formatedResult; + std::string formatedResult; if( textFormatter == NULL ) formatedResult = inputString; diff --git a/nel/src/gui/view_text_id.cpp b/nel/src/gui/view_text_id.cpp index 065d02e71..1f1ac5440 100644 --- a/nel/src/gui/view_text_id.cpp +++ b/nel/src/gui/view_text_id.cpp @@ -204,7 +204,7 @@ namespace NLGUI if (!_Initialized) { // String result - ucstring result; + string result; if( textProvider != NULL ) { @@ -218,8 +218,8 @@ namespace NLGUI // Remove all {break} for(;;) { - ucstring::size_type index = result.find (ucstring("{break}")); - if (index == ucstring::npos) break; + string::size_type index = result.find("{break}"); + if (index == string::npos) break; result = result.substr (0, index) + result.substr(index+7, result.size()); } @@ -229,13 +229,13 @@ namespace NLGUI // Modify the text? if(_StringModifier) - _StringModifier->onReceiveTextId(result); + _StringModifier->onReceiveTextId(ucstring::makeFromUtf8(result)); // Set the Text if(_IsTextFormatTaged) - setTextFormatTaged(result.toUtf8()); + setTextFormatTaged(result); else - setText (result.toUtf8()); + setText(result); } CViewText::checkCoords(); } diff --git a/nel/src/gui/view_text_id_formated.cpp b/nel/src/gui/view_text_id_formated.cpp index 5b1dd2a14..88f9a58e0 100644 --- a/nel/src/gui/view_text_id_formated.cpp +++ b/nel/src/gui/view_text_id_formated.cpp @@ -37,7 +37,7 @@ namespace NLGUI { if (name == "format") { - return getFormatString().toUtf8(); + return getFormatString(); } else return CViewTextID::getProperty(name); @@ -47,7 +47,7 @@ namespace NLGUI { if (name == "format") { - setFormatString(ucstring::makeFromUtf8(value)); + setFormatString(value); return; } else @@ -61,7 +61,7 @@ namespace NLGUI return NULL; xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_id_formated" ); - xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().toUtf8().c_str() ); + xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().c_str() ); return node; } @@ -72,9 +72,9 @@ namespace NLGUI if (!CViewTextID::parse(cur, parentGroup)) return false; CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"format" )); if (prop) - setFormatString(ucstring::makeFromUtf8((const char *)prop)); + setFormatString((const char *)prop); else - setFormatString(ucstring("$t")); + setFormatString("$t"); return true; } @@ -89,15 +89,15 @@ namespace NLGUI if (!_Initialized) { - ucstring result, formatedResult; + std::string result, formatedResult; bool bValid; if( CViewTextID::getTextProvider() == NULL ) { if(!_DBPath.empty()) - result = ucstring(_DBPath); + result = _DBPath; else - result = ucstring("Text ID = " + NLMISC::toString(_TextId)); + result = "Text ID = " + NLMISC::toString(_TextId); bValid = true; } else @@ -106,7 +106,7 @@ namespace NLGUI } formatedResult = CViewTextFormated::formatString(_FormatString, result); // - setText (formatedResult.toUtf8()); + setText (formatedResult); // if (bValid) { @@ -117,12 +117,13 @@ namespace NLGUI } // **************************************************************************** - void CViewTextIDFormated::setFormatString(const ucstring &format) + void CViewTextIDFormated::setFormatString(const std::string &format) { _Initialized = false; - _FormatString = format; - if ( (_FormatString.size()>2) && (_FormatString[0] == 'u') && (_FormatString[1] == 'i')) - _FormatString = NLMISC::CI18N::get (format.toString()); + if (NLMISC::startsWith(format, "ui")) + _FormatString = NLMISC::CI18N::get(format); + else + _FormatString = format; } } diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 39493495f..b6370602e 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -1350,7 +1350,7 @@ void setTarget(CCtrlBase *ctrl, const string &targetName, ucstring &value) if (ig) { CInterfaceExprValue exprValue; - exprValue.setUCString(value); + exprValue.setString(value.toUtf8()); CInterfaceLink::splitLinkTargets(targetName, ig, targets); for(uint k = 0; k < targets.size(); ++k) diff --git a/ryzom/client/src/contextual_cursor.cpp b/ryzom/client/src/contextual_cursor.cpp index 15dd6a17a..11398f620 100644 --- a/ryzom/client/src/contextual_cursor.cpp +++ b/ryzom/client/src/contextual_cursor.cpp @@ -162,7 +162,7 @@ bool CContextualCursor::context(const std::string &contextName, float dist, cons if(cursName.empty()) cursor->setString(CI18N::get(functions.cursor)); else - cursor->setString(cursName); + cursor->setString(cursName.toUtf8()); } } } diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 4281181a9..dacb6f100 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2074,9 +2074,9 @@ class CActionHandlerSetTargetName : public IActionHandler // Set to target CInterfaceExprValue evUCStr; TargetName = STRING_MANAGER::CStringManagerClient::getLocalizedName(TargetName); - evUCStr.setUCString(TargetName); + evUCStr.setString(TargetName.toUtf8()); CInterfaceLink::setTargetProperty(sNameTarget, evUCStr); - evUCStr.setUCString(TargetTitle); + evUCStr.setString(TargetTitle.toUtf8()); CInterfaceLink::setTargetProperty(sTitleTarget, evUCStr); } } diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 2d6a7e6f5..23992f4f6 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -2046,9 +2046,7 @@ class CHandlerItemMenuCheck : public IActionHandler std::string name = groupNames[i]; std::string ahParams = "name=" + name; //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(name); - pGroupMenu->addLine(nameUC, "", "", name); + pGroupMenu->addLine(name, "", "", name); CGroupSubMenu* pNewSubMenu = new CGroupSubMenu(CViewBase::TCtorParam()); pGroupMenu->setSubMenu(pGroupMenu->getNumLine()-1, pNewSubMenu); if(pNewSubMenu) @@ -2074,7 +2072,7 @@ class CHandlerItemMenuCheck : public IActionHandler { //there is an offset of 1 because TInventory names are pet_animal1/2/3/4 std::string dst = toString("destination=pet_animal%d|", j + 1); - CViewTextMenu* tmp = pNewSubMenu->addLine(ucstring(pMoveToPa[j]->getHardText()),"item_group_move", dst + ahParams, name + toString("_pa%d", j + 1)); + CViewTextMenu* tmp = pNewSubMenu->addLine(pMoveToPa[j]->getHardText(),"item_group_move", dst + ahParams, name + toString("_pa%d", j + 1)); if(tmp) tmp->setGrayed(pMoveToPa[j]->getGrayed()); } } diff --git a/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/ryzom/client/src/interface_v3/action_handler_phrase.cpp index a73d884e8..f55d376bd 100644 --- a/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1668,7 +1668,7 @@ static DECLARE_INTERFACE_USER_FCT(getSPhraseName) return false; sint sphraseId= (sint)args[0].getInteger(); CSPhraseManager *pPM= CSPhraseManager::getInstance(); - result.setUCString(pPM->getPhrase(sphraseId).Name); + result.setString(pPM->getPhrase(sphraseId).Name.toUtf8()); return true; } else diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 8fa8bd08e..4c67b70b3 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -2575,11 +2575,11 @@ static DECLARE_INTERFACE_USER_FCT(getPriceWithFame) sint value= (sint)args[0].getInteger(); sint valueFame= (sint)args[1].getInteger(); if(value==-1) - result.setUCString(CI18N::get("uiBadPrice")); + result.setString(CI18N::get("uiBadPrice")); else if(value==valueFame) - result.setUCString(NLMISC::formatThousands(toString(value))); + result.setString(NLMISC::formatThousands(toString(value))); else - result.setUCString(NLMISC::formatThousands(toString(valueFame)) + " (" + NLMISC::formatThousands(toString(value)) + ")"); + result.setString(NLMISC::formatThousands(toString(valueFame)) + " (" + NLMISC::formatThousands(toString(value)) + ")"); return true; } @@ -2595,7 +2595,7 @@ static DECLARE_INTERFACE_USER_FCT(getBonusOnResale) sint valueHigh= (sint)args[0].getInteger(); sint valueLow= (sint)args[1].getInteger(); sint diff = valueHigh - valueLow; - result.setUCString("+" + NLMISC::formatThousands(toString(diff))); + result.setString("+" + NLMISC::formatThousands(toString(diff))); return true; } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp index da46e9e7b..f008c32f1 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp @@ -56,7 +56,7 @@ CViewText *CDBGroupListSheetMission::CSheetChildMission::createViewText() const CViewTextIDFormated *vti = new CViewTextIDFormated(CViewBase::TCtorParam()); if (Ctrl) vti->setDBLeaf(dynamic_cast(Ctrl->getRootBranch()->getNode(ICDBNode::CTextId("TEXT")))); else vti->setDBLeaf(NULL); - vti->setFormatString(ucstring("$t")); + vti->setFormatString("$t"); return vti; } diff --git a/ryzom/client/src/interface_v3/encyclopedia_manager.cpp b/ryzom/client/src/interface_v3/encyclopedia_manager.cpp index 6ab68522d..c9912325f 100644 --- a/ryzom/client/src/interface_v3/encyclopedia_manager.cpp +++ b/ryzom/client/src/interface_v3/encyclopedia_manager.cpp @@ -205,7 +205,7 @@ void CEncyclopediaManager::rebuildAlbumList() if (_Albums[i].Name == _AlbumNameSelected) pAlb->Opened = true; if (pSMC->getDynString(_Albums[i].Name, res)) - pAlb->Text = res; + pAlb->Text = res.toUtf8(); else nlwarning("try to construct album without name"); @@ -217,7 +217,7 @@ void CEncyclopediaManager::rebuildAlbumList() pThm->AHName = "ency_click_thema"; pThm->AHParams = toString(_Albums[i].Themas[j].Name); if (pSMC->getDynString(_Albums[i].Themas[j].Name, res)) - pThm->Text = res; + pThm->Text = res.toUtf8(); else nlwarning("try to construct thema without name"); diff --git a/ryzom/client/src/interface_v3/group_compas.cpp b/ryzom/client/src/interface_v3/group_compas.cpp index b43f50a89..f7418e868 100644 --- a/ryzom/client/src/interface_v3/group_compas.cpp +++ b/ryzom/client/src/interface_v3/group_compas.cpp @@ -710,7 +710,7 @@ void CGroupCompasMenu::setActive (bool state) ct.setType(CCompassTarget::North); ct.Name = CI18N::get("uiNorth"); Targets.push_back(ct); - getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); // Home CCDBNodeLeaf *pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":HOME_POINT"); sint32 px = (sint32) (pos->getValue64() >> 32); @@ -720,7 +720,7 @@ void CGroupCompasMenu::setActive (bool state) ct.setType(CCompassTarget::Home); ct.Name = CI18N::get("uiHome"); Targets.push_back(ct); - getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); } // Respawn pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":BIND_POINT"); @@ -731,7 +731,7 @@ void CGroupCompasMenu::setActive (bool state) ct.setType(CCompassTarget::Respawn); ct.Name = CI18N::get("uiRespawn"); Targets.push_back(ct); - getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); } // As of 6/5/2007 : The option to point the selection is always proposed even if no slot is currently targeted @@ -741,7 +741,7 @@ void CGroupCompasMenu::setActive (bool state) if (entity != NULL) {*/ //ucstring targetName = CI18N::get("uiTargetTwoPoint") + entity->removeTitleAndShardFromName(entity->getEntityName()); - ucstring targetName = CI18N::get("uiTarget"); + std::string targetName = CI18N::get("uiTarget"); ct.setType(CCompassTarget::Selection); ct.Name = targetName; Targets.push_back(ct); @@ -789,7 +789,7 @@ void CGroupCompasMenu::setActive (bool state) ct.setPositionState(tracker); ct.Name = name; Targets.push_back(ct); - missionSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + missionSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } @@ -846,7 +846,7 @@ void CGroupCompasMenu::setActive (bool state) ct.Pos = currCont->ContLandMarks[k].Pos; ct.Name = CStringManagerClient::getPlaceLocalizedName(currCont->ContLandMarks[k].TitleTextID); Targets.push_back(ct); - landMarkSubMenu->addLineAtIndex(contLandMarkIndex++, ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + landMarkSubMenu->addLineAtIndex(contLandMarkIndex++, ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } // separator? @@ -869,7 +869,7 @@ void CGroupCompasMenu::setActive (bool state) ct.Pos = sortedLandmarks[k].Pos; ct.Name = sortedLandmarks[k].Title; Targets.push_back(ct); - landMarkSubMenus[sortedLandmarks[k].Type]->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + landMarkSubMenus[sortedLandmarks[k].Type]->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } @@ -900,7 +900,7 @@ void CGroupCompasMenu::setActive (bool state) if (buildCompassTargetFromTeamMember(ct, k)) { Targets.push_back(ct); - teamSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + teamSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } @@ -923,7 +923,7 @@ void CGroupCompasMenu::setActive (bool state) if (buildCompassTargetFromAnimalMember(ct, k)) { Targets.push_back(ct); - animalSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + animalSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } @@ -951,7 +951,7 @@ void CGroupCompasMenu::setActive (bool state) CSmartPtr tracker = new CDialogEntityPositionState( i ); ct.setPositionState(tracker); Targets.push_back(ct); - dialogsSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + dialogsSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index ac70c57cc..d7d68477f 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -3811,7 +3811,7 @@ void CGroupMap::updateClosestLandMarkMenu(const std::string &menu, const NLMISC: std::string lineId = toString("%s:lmcosest%d", menu.c_str(), i); std::string ahParams = toString("type=user|map=%s|index=%d", _Id.c_str(), index); - CViewTextMenu* vt = rootMenu->addLine(ucstring(""), "map_landmark_by_index", ahParams, lineId.c_str(), "", "", false, false, false); + CViewTextMenu* vt = rootMenu->addLine(std::string(), "map_landmark_by_index", ahParams, lineId.c_str(), "", "", false, false, false); if (!vt) break; vt->setSingleLineTextFormatTaged(name.toUtf8()); diff --git a/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp b/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp index 04d05e6f2..62d96280f 100644 --- a/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp +++ b/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp @@ -224,7 +224,7 @@ void CGroupPhraseSkillFilter::rebuild() // just text pNode->DisplayText = true; pNode->Template = NULL; - pNode->Text= STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i);; + pNode->Text = CUtfStringView(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i)).toUtf8(); // Action handler? if(!_AHCtrlNode.empty()) diff --git a/ryzom/client/src/interface_v3/group_skills.cpp b/ryzom/client/src/interface_v3/group_skills.cpp index 053bddf86..4248ea898 100644 --- a/ryzom/client/src/interface_v3/group_skills.cpp +++ b/ryzom/client/src/interface_v3/group_skills.cpp @@ -245,11 +245,11 @@ static DECLARE_INTERFACE_USER_FCT(getSkillBaseText) if(skillValue!=skillBase) { - result.setUCString( toString("(%d)", skillBase) ); + result.setString( toString("(%d)", skillBase) ); } else { - result.setUCString( ucstring() ); + result.setString( std::string() ); } return true; @@ -335,7 +335,7 @@ void CGroupSkills::createAllTreeNodes() // local variable (avoid realloc in loop) vector< pair > tempVec(2); - ucstring sSkillName; + string sSkillName; while ((!bQuit) && (nCounter < 32)) // Counter is used to not infinitly loop { @@ -365,7 +365,7 @@ void CGroupSkills::createAllTreeNodes() pNode->Id = NLMISC::toString(i); // get Skill Name - sSkillName = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i); + sSkillName = CUtfStringView(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i)).toUtf8(); // just text or template? if(_TemplateSkill.empty()) @@ -387,7 +387,7 @@ void CGroupSkills::createAllTreeNodes() // Set Skill Name CViewText *pViewSkillName = dynamic_cast(pIG->getView("name")); if (pViewSkillName != NULL) - pViewSkillName->setText (sSkillName.toUtf8()); + pViewSkillName->setText (sSkillName); // Set Skill Max Value CViewText *pViewSkillMax = dynamic_cast(pIG->getView("max")); if (pViewSkillMax != NULL) diff --git a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp index 30126c0d9..82b928211 100644 --- a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp +++ b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp @@ -176,7 +176,7 @@ static DECLARE_INTERFACE_USER_FCT(getCompassText) "uiWNW", }; - result.setUCString( CI18N::get(txts[direction]) ); + result.setString( CI18N::get(txts[direction]) ); return true; } REGISTER_INTERFACE_USER_FCT("getCompassText", getCompassText); @@ -251,7 +251,7 @@ static DECLARE_INTERFACE_USER_FCT(getDifficultyText) } SENTENCE_APPRAISAL::ESentenceAppraisal sa = (SENTENCE_APPRAISAL::ESentenceAppraisal)args[0].getInteger(); - result.setUCString (CI18N::get(SENTENCE_APPRAISAL::toString(sa))); + result.setString (CI18N::get(SENTENCE_APPRAISAL::toString(sa))); return true; } @@ -665,14 +665,14 @@ static DECLARE_INTERFACE_USER_FCT(getKey) CActionsManager::TActionComboMap::const_iterator it = acmap.find(CAction::CName(name.c_str(),param.c_str())); if (it != acmap.end()) { - result.setUCString (it->second.toUCString()); + result.setString (it->second.toUCString().toUtf8()); } else { if (notna) - result.setUCString (ucstring("")); + result.setString (std::string()); else - result.setUCString (CI18N::get("uiNotAssigned")); + result.setString (CI18N::get("uiNotAssigned")); } return true; @@ -1025,9 +1025,9 @@ static DECLARE_INTERFACE_USER_FCT(getBotChatBuyFilterMPText) RM_FABER_TYPE::TRMFType faberType= (RM_FABER_TYPE::TRMFType)args[0].getInteger(); if(faberType>=RM_FABER_TYPE::Unknown) - result.setUCString(CI18N::get("uittBCNoItemPartFilter")); + result.setString(CI18N::get("uittBCNoItemPartFilter")); else - result.setUCString(RM_FABER_TYPE::toLocalString(faberType)); + result.setString(RM_FABER_TYPE::toLocalString(faberType)); return true; } @@ -1076,15 +1076,15 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostName) uint32 nSheet = (uint32)args[0].getInteger(); if (nSheet == 0) { - result.setUCString(string("")); + result.setString(string()); return true; } // get sheet name STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - const ucstring name(pSMC->getOutpostLocalizedName(CSheetId(nSheet))); + const std::string name = CUtfStringView(pSMC->getOutpostLocalizedName(CSheetId(nSheet))).toUtf8(); - result.setUCString(name); + result.setString(name); return true; } @@ -1103,15 +1103,15 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostDesc) uint32 nSheet = (uint32)args[0].getInteger(); if (nSheet == 0) { - result.setUCString(string("")); + result.setString(string()); return true; } // get sheet name STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - const ucstring name(pSMC->getOutpostLocalizedDescription(CSheetId(nSheet))); + const string name = CUtfStringView(pSMC->getOutpostLocalizedDescription(CSheetId(nSheet))).toUtf8(); - result.setUCString(name); + result.setString(name); return true; } @@ -1130,15 +1130,15 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostBuildingName) uint32 nSheet = (uint32)args[0].getInteger(); if (nSheet == 0) { - result.setUCString(string("")); + result.setString(string()); return true; } // get sheet name STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - const ucstring name(pSMC->getOutpostBuildingLocalizedName(CSheetId(nSheet))); + const string name = CUtfStringView(pSMC->getOutpostBuildingLocalizedName(CSheetId(nSheet))).toUtf8(); - result.setUCString(name); + result.setString(name); return true; } @@ -1157,12 +1157,12 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostBuildingDesc) uint32 nSheet = (uint32)args[0].getInteger(); if (nSheet == 0) { - result.setUCString(string("")); + result.setString(string()); return true; } // get sheet name - ucstring name; + string name; CEntitySheet *pSheet= SheetMngr.get(CSheetId(nSheet)); COutpostBuildingSheet *pOBS = dynamic_cast(pSheet); if (pOBS && pOBS->OBType == COutpostBuildingSheet::OB_Empty) @@ -1173,11 +1173,11 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostBuildingDesc) else { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - name = pSMC->getOutpostBuildingLocalizedDescription(CSheetId(nSheet)); + name = CUtfStringView(pSMC->getOutpostBuildingLocalizedDescription(CSheetId(nSheet))).toUtf8(); } - result.setUCString(name); + result.setString(name); return true; } @@ -1196,15 +1196,15 @@ static DECLARE_INTERFACE_USER_FCT(getSquadName) uint32 nSheet = (uint32)args[0].getInteger(); if (nSheet == 0) { - result.setUCString(string("")); + result.setString(string()); return true; } // get sheet name STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - const ucstring name(pSMC->getSquadLocalizedName(CSheetId(nSheet))); + const string name = CUtfStringView(pSMC->getSquadLocalizedName(CSheetId(nSheet))).toUtf8(); - result.setUCString(name); + result.setString(name); return true; } @@ -1223,15 +1223,15 @@ static DECLARE_INTERFACE_USER_FCT(getSquadDesc) uint32 nSheet = (uint32)args[0].getInteger(); if (nSheet == 0) { - result.setUCString(string("")); + result.setString(string()); return true; } // get sheet name STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - const ucstring name(pSMC->getSquadLocalizedDescription(CSheetId(nSheet))); + const string name = CUtfStringView(pSMC->getSquadLocalizedDescription(CSheetId(nSheet))).toUtf8(); - result.setUCString(name); + result.setString(name); return true; } @@ -1284,7 +1284,7 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostPeriod) // if status wanted is peace or unknow, then "N/A", because there is no attack period in peace mode if( status==OUTPOSTENUMS::Peace || status==OUTPOSTENUMS::UnknownOutpostState ) { - result.setUCString(string(" - ")); + result.setString(string(" - ")); return true; } @@ -1292,7 +1292,7 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostPeriod) if( (isAttackPeriod && status>OUTPOSTENUMS::AttackRound) || (!isAttackPeriod && status>OUTPOSTENUMS::DefenseRound) ) { - result.setUCString(CI18N::get("uiOutpostPeriodEnded")); + result.setString(CI18N::get("uiOutpostPeriodEnded")); return true; } @@ -1312,7 +1312,7 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostPeriod) tstruct= gmtime(&tval); if(!tstruct) { - result.setUCString(string("Bad Date Received")); + result.setString(string("Bad Date Received")); return true; } dname= tstruct->tm_wday; // 0-6 (Sunday==0!!) @@ -1325,21 +1325,21 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostPeriod) tstruct= gmtime(&tval); if(!tstruct) { - result.setUCString(string("Bad Date Received")); + result.setString(string("Bad Date Received")); return true; } hend= tstruct->tm_hour; // 0-23 mend= tstruct->tm_min; // 0-59 // translate - ucstring res= CI18N::get("uiOutpostPeriodFormat"); + string res= CI18N::get("uiOutpostPeriodFormat"); strFindReplace( res, "%dayname", CI18N::get(toString("uiDay%d", dname)) ); strFindReplace( res, "%daynumber", toString(dnumber) ); strFindReplace( res, "%month", CI18N::get(toString("uiMonth%02d", month+1)) ); strFindReplace( res, "%timestart", toString("%02d:%02d", hstart, mstart) ); strFindReplace( res, "%timeend", toString("%02d:%02d", hend, mend) ); - result.setUCString(res); + result.setString(res); return true; } REGISTER_INTERFACE_USER_FCT("getOutpostPeriod", getOutpostPeriod) diff --git a/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp b/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp index 9aeec4e5f..b686db2be 100644 --- a/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp +++ b/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp @@ -312,16 +312,16 @@ static DECLARE_INTERFACE_USER_FCT(getSheetName) // if from ctrlSheet, then take the correct ACTUAL name (ie from NAMEID if not 0) if(ctrlSheet) { - result.setUCString(ctrlSheet->getItemActualName()); + result.setString(ctrlSheet->getItemActualName().toUtf8()); return true; } // Standard (but less accurate) way else { const CItemSheet *itemSheet = getItemSheet(args); - ucstring tmp; - if (itemSheet != NULL) tmp = STRING_MANAGER::CStringManagerClient::getItemLocalizedName(itemSheet->Id); - result.setUCString(tmp); + string tmp; + if (itemSheet != NULL) tmp = CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedName(itemSheet->Id)).toUtf8(); + result.setString(tmp); return true; } } @@ -345,9 +345,9 @@ static DECLARE_INTERFACE_USER_FCT(getItemTranslatedName) return false; } - ucstring tmp; - tmp = STRING_MANAGER::CStringManagerClient::getItemLocalizedName(sheet); - result.setUCString(tmp); + string tmp; + tmp = CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedName(sheet)).toUtf8(); + result.setString(tmp); return true; } REGISTER_INTERFACE_USER_FCT("getItemTranslatedName", getItemTranslatedName) diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 3bae5ccbc..089dc39d0 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -324,12 +324,12 @@ class CStringManagerTextProvider : public CViewTextID::IViewTextProvider class CRyzomTextFormatter : public CViewTextFormated::IViewTextFormatter { public: - ucstring formatString( const ucstring &inputString, const ucstring ¶mString ) + std::string formatString( const std::string &inputString, const std::string ¶mString ) { - ucstring formatedResult; + std::string formatedResult; // Apply the format - for(ucstring::const_iterator it = inputString.begin(); it != inputString.end();) + for(std::string::const_iterator it = inputString.begin(); it != inputString.end();) { if (*it == '$') { @@ -347,13 +347,14 @@ public: case 'p': // add player name if (ClientCfg.Local) { - formatedResult += ucstring("player"); + if (*it == 'P') formatedResult += "PLAYER"; + else formatedResult += "Player"; } else { if(UserEntity) { - ucstring name = UserEntity->getEntityName(); + std::string name = UserEntity->getEntityName().toUtf8(); if (*it == 'P') name = toUpper(name); formatedResult += name; } @@ -363,11 +364,11 @@ public: case 's': case 'b': // add bot name { - ucstring botName; + string botName; bool womanTitle = false; if (ClientCfg.Local) { - botName = ucstring("NPC"); + botName = "NPC"; } else { @@ -387,7 +388,7 @@ public: } else { - botName = entity->getDisplayName(); + botName = entity->getDisplayName().toUtf8(); } CCharacterCL *pChar = dynamic_cast(entity); if (pChar != NULL) @@ -396,40 +397,40 @@ public: } } // get the title translated - ucstring sTitleTranslated = botName; + ucstring sTitleTranslated = botName; // FIXME: UTF-8 CStringPostProcessRemoveName spprn; spprn.Woman = womanTitle; spprn.cbIDStringReceived(sTitleTranslated); - botName = CEntityCL::removeTitleAndShardFromName(botName); + botName = CEntityCL::removeTitleAndShardFromName(botName).toUtf8(); // short name (with no title such as 'guard', 'merchant' ...) if (*it == 's') { // But if there is no name, display only the title if (botName.empty()) - botName = sTitleTranslated; + botName = sTitleTranslated.toUtf8(); } else { // Else we want the title ! if (!botName.empty()) botName += " "; - botName += sTitleTranslated; + botName += sTitleTranslated.toUtf8(); } formatedResult += botName; } break; default: - formatedResult += (ucchar) '$'; + formatedResult += '$'; break; } ++it; } else { - formatedResult += (ucchar) *it; + formatedResult += *it; ++it; } } @@ -2302,7 +2303,7 @@ void CInterfaceManager::addServerString (const std::string &sTarget, uint32 id, if (id == 0) { CInterfaceExprValue val; - val.setUCString (ucstring("")); + val.setString (std::string()); CInterfaceLink::setTargetProperty (sTarget, val); return; } @@ -2320,7 +2321,7 @@ void CInterfaceManager::addServerID (const std::string &sTarget, uint32 id, IStr if (id == 0) { CInterfaceExprValue val; - val.setUCString (ucstring("")); + val.setString (std::string()); CInterfaceLink::setTargetProperty (sTarget, val); return; } @@ -2367,7 +2368,7 @@ void CInterfaceManager::processServerIDString() if (bValid) { ucstrToAffect = STRING_MANAGER::CStringManagerClient::getLocalizedName(ucstrToAffect); - val.setUCString (ucstrToAffect); + val.setString (ucstrToAffect.toUtf8()); CInterfaceLink::setTargetProperty (pISW->Target, val); } @@ -3336,7 +3337,7 @@ void CInterfaceManager::initEmotes() translateEmote(sTmp, sTranslatedName, sCommandName, sCommandNameAlt); // Create a line - pMenu->addLine (sTranslatedName + " (/" + ucstring::makeFromUtf8(sCommandName) + ")", "emote", + pMenu->addLine (sTranslatedName.toUtf8() + " (/" + sCommandName + ")", "emote", "nb="+toString(nEmoteNb)+"|behav="+toString(nBehav), sTmp); } } @@ -3392,7 +3393,7 @@ void CInterfaceManager::initEmotes() { // Yeah that's a quick emote too; set command pMenu->addLineAtIndex (i, - "@{FFFF}/" + ucstring::makeFromUtf8(sCommandName), + "@{FFFF}/" + sCommandName, "emote", "nb="+toString(nEmoteNb)+"|behav="+toString(nBehav), "", "", "", false, false, true); diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index b36d51866..2efdf339b 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -269,7 +269,7 @@ static DECLARE_INTERFACE_USER_FCT(lua) if (CLuaIHM::pop(ls, ucstrVal)) { - result.setUCString(ucstrVal); + result.setString(ucstrVal.toUtf8()); ok = true; } diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index e285bbaf9..3d23e31f2 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -2593,7 +2593,7 @@ public: { for(uint l = 0; l < pl.PartyChats.size(); ++l) { - menu->addLineAtIndex(insertionIndex, pl.PartyChats[l].Window->getTitle(), "chat_target_selected", toString(pl.PartyChats[l].ID)); + menu->addLineAtIndex(insertionIndex, pl.PartyChats[l].Window->getTitle().toUtf8(), "chat_target_selected", toString(pl.PartyChats[l].ID)); ++ insertionIndex; } } @@ -2640,8 +2640,8 @@ public: STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); // replace dynamic channel name and shortcut - ucstring res = CI18N::get("uiFilterMenuDynamic"); - strFindReplace(res, "%channel", title); + string res = CI18N::get("uiFilterMenuDynamic"); + strFindReplace(res, "%channel", title.toUtf8()); strFindReplace(res, "%shortcut", s); pMenu->addLineAtIndex(5 + insertion_index, res, "chat_target_selected", "dyn"+s, "dyn"+s); @@ -2940,7 +2940,7 @@ class CHandlerSelectChatSource : public IActionHandler { if (pc[l].Filter != NULL) { - menu->addLineAtIndex(insertionIndex, pc[l].Window->getTitle(), FILTER_TOGGLE, toString(pc[l].ID)); + menu->addLineAtIndex(insertionIndex, pc[l].Window->getTitle().toUtf8(), FILTER_TOGGLE, toString(pc[l].ID)); menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, toString(pc[l].ID), pc[l].Filter->isListeningWindow(cw))); ++ insertionIndex; } @@ -2956,7 +2956,7 @@ class CHandlerSelectChatSource : public IActionHandler { ucstring title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); - menu->addLineAtIndex(insertionIndex, "["+s+"] " + title, FILTER_TOGGLE, "dyn"+s); + menu->addLineAtIndex(insertionIndex, "["+s+"] " + title.toUtf8(), FILTER_TOGGLE, "dyn"+s); menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, "dyn"+s, pi.ChatInput.DynamicChat[i].isListeningWindow(cw))); ++insertionIndex; } diff --git a/ryzom/client/src/string_manager_client.h b/ryzom/client/src/string_manager_client.h index c977a8380..021d9f433 100644 --- a/ryzom/client/src/string_manager_client.h +++ b/ryzom/client/src/string_manager_client.h @@ -60,6 +60,7 @@ public: // Force the cache to be saved void flushStringCache(); + bool getString(uint32 stringId, std::string &result) { ucstring temp; getString(stringId, temp); result = temp.toUtf8(); } // FIXME: UTF-8 bool getString(uint32 stringId, ucstring &result); void waitString(uint32 stringId, const IStringWaiterRemover *premover, ucstring *result); void waitString(uint32 stringId, IStringWaitCallback *pcallback); From ac799e444dcf322f8306096c62dfaea8e2020410 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 09:10:20 +0800 Subject: [PATCH 071/205] More UTF-8, ryzom/ryzomcore#335 --- nel/samples/misc/i18n/main.cpp | 6 +++--- nel/src/misc/unicode.cpp | 18 ++++++++++++------ nel/src/misc/utf_string_view.cpp | 14 +++++++------- ryzom/client/src/string_manager_client.h | 2 +- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/nel/samples/misc/i18n/main.cpp b/nel/samples/misc/i18n/main.cpp index 1c8ddabb9..5456c1325 100644 --- a/nel/samples/misc/i18n/main.cpp +++ b/nel/samples/misc/i18n/main.cpp @@ -44,9 +44,9 @@ int main (int argc, char **argv) // load the language CI18N::load(langName); - InfoLog->displayRawNL(CI18N::get("Hi").toString().c_str()); - InfoLog->displayRawNL(CI18N::get("PresentI18N").toString().c_str(), "Nevrax"); - InfoLog->displayRawNL(CI18N::get("ExitStr").toString().c_str()); + InfoLog->displayRawNL(CI18N::get("Hi").c_str()); + InfoLog->displayRawNL(CI18N::get("PresentI18N").c_str(), "Nevrax"); + InfoLog->displayRawNL(CI18N::get("ExitStr").c_str()); getchar(); return EXIT_SUCCESS; diff --git a/nel/src/misc/unicode.cpp b/nel/src/misc/unicode.cpp index d28a7c56e..c6780db54 100644 --- a/nel/src/misc/unicode.cpp +++ b/nel/src/misc/unicode.cpp @@ -4731,10 +4731,13 @@ NL_FORCE_INLINE void appendToLowerAsUtf8(std::string &res, const char *str, ptrd { char c = str[i]; char d, e; - if (c >= 'A' && c <= 'Z') + if (c < 0x80) { - // 1-byte UTF-8 - c += 'a' - 'A'; + if (c >= 'A' && c <= 'Z') + { + // 1-byte UTF-8 + c += 'a' - 'A'; + } } else if ((c & 0xE0) == 0xC0 && ((d = str[i + 1]) & 0xC0) == 0x80) { @@ -4803,10 +4806,13 @@ NL_FORCE_INLINE void appendToUpperAsUtf8(std::string &res, const char *str, ptrd { char c = str[i]; char d, e; - if (c >= 'a' && c <= 'z') + if (c < 0x80) { - // 1-byte UTF-8 - c -= 'a' - 'A'; + if (c >= 'a' && c <= 'z') + { + // 1-byte UTF-8 + c -= 'a' - 'A'; + } } else if ((c & 0xE0) == 0xC0 && ((d = str[i + 1]) & 0xC0) == 0x80) { diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp index 9f4057b66..06dcb5e76 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -72,7 +72,7 @@ std::string CUtfStringView::toUtf8(bool reEncode) const return std::string((const char *)m_Str, (const char *)((ptrdiff_t)m_Str + m_Size)); std::string res; res.reserve(m_Size); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) { appendUtf8(res, *it); } @@ -85,7 +85,7 @@ ucstring CUtfStringView::toUtf16(bool reEncode) const return ucstring((const ucchar *)m_Str, (const ucchar *)((ptrdiff_t)m_Str + m_Size)); ucstring res; res.reserve(m_Size << 1); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) { u32char c = *it; if (c < 0x10000) @@ -110,7 +110,7 @@ u32string CUtfStringView::toUtf32() const return u32string((const u32char *)m_Str, (const u32char *)((ptrdiff_t)m_Str + m_Size)); u32string res; res.reserve(m_Size << 2); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) res += *it; return res; } @@ -119,7 +119,7 @@ std::string CUtfStringView::toAscii() const { std::string res; res.reserve(m_Size); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) { u32char c = *it; if (c < 0x80) @@ -137,7 +137,7 @@ std::wstring CUtfStringView::toWide() const return std::wstring((const wchar_t *)m_Str, (const wchar_t *)((ptrdiff_t)m_Str + m_Size)); std::wstring res; res.reserve(m_Size << 1); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) { u32char c = *it; if (c < 0x10000) @@ -157,7 +157,7 @@ std::wstring CUtfStringView::toWide() const return std::wstring((const wchar_t *)m_Str, (const wchar_t *)((ptrdiff_t)m_Str + m_Size)); std::wstring res; res.reserve(m_Size << 2); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) res += *it; return res; #endif @@ -166,7 +166,7 @@ std::wstring CUtfStringView::toWide() const size_t CUtfStringView::count() const { size_t res = 0; - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) ++res; return res; } diff --git a/ryzom/client/src/string_manager_client.h b/ryzom/client/src/string_manager_client.h index 021d9f433..c553f7c57 100644 --- a/ryzom/client/src/string_manager_client.h +++ b/ryzom/client/src/string_manager_client.h @@ -60,7 +60,7 @@ public: // Force the cache to be saved void flushStringCache(); - bool getString(uint32 stringId, std::string &result) { ucstring temp; getString(stringId, temp); result = temp.toUtf8(); } // FIXME: UTF-8 + bool getString(uint32 stringId, std::string &result) { ucstring temp; bool res = getString(stringId, temp); result = temp.toUtf8(); return res; } // FIXME: UTF-8 bool getString(uint32 stringId, ucstring &result); void waitString(uint32 stringId, const IStringWaiterRemover *premover, ucstring *result); void waitString(uint32 stringId, IStringWaitCallback *pcallback); From 376dd2aff1b199aa9f1329dce8d7720522d87782 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 10:34:24 +0800 Subject: [PATCH 072/205] More UTF-8, ryzom/ryzomcore#335 --- nel/include/nel/gui/css_parser.h | 46 +++---- nel/include/nel/gui/event_descriptor.h | 8 +- nel/include/nel/gui/group_container.h | 19 ++- nel/include/nel/gui/group_editbox.h | 52 ++++---- nel/include/nel/gui/group_html.h | 20 +-- nel/include/nel/gui/view_text.h | 6 +- nel/include/nel/misc/events.h | 8 +- nel/include/nel/misc/utf_string_view.h | 4 +- .../3d/driver/direct3d/driver_direct3d.cpp | 4 + .../3d/driver/opengl/driver_opengl_window.cpp | 4 + .../3d/driver/opengl/unix_event_emitter.cpp | 6 +- nel/src/gui/css_parser.cpp | 74 +++++------ nel/src/gui/group_container.cpp | 68 +++++++--- nel/src/gui/group_editbox.cpp | 70 +++++----- nel/src/gui/group_html.cpp | 123 ++++++++---------- nel/src/gui/view_text.cpp | 47 +++---- nel/src/misc/inter_window_msg_queue.cpp | 3 + nel/src/misc/utf_string_view.cpp | 6 +- nel/src/misc/win_event_emitter.cpp | 8 ++ ryzom/client/src/actions.cpp | 4 +- ryzom/client/src/actions.h | 2 +- .../src/interface_v3/action_handler_edit.cpp | 14 +- ryzom/client/src/interface_v3/chat_window.cpp | 4 +- .../client/src/interface_v3/dbctrl_sheet.cpp | 2 +- .../src/interface_v3/group_modal_get_key.cpp | 2 +- .../src/interface_v3/group_quick_help.cpp | 2 +- .../interface_expr_user_fct_game.cpp | 2 +- .../client/src/interface_v3/macrocmd_key.cpp | 10 +- .../src/interface_v3/macrocmd_manager.cpp | 4 +- .../src/interface_v3/task_bar_manager.cpp | 2 +- ryzom/client/src/main_loop_debug.cpp | 2 +- 31 files changed, 344 insertions(+), 282 deletions(-) diff --git a/nel/include/nel/gui/css_parser.h b/nel/include/nel/gui/css_parser.h index a6dc92022..65b6a11b0 100644 --- a/nel/include/nel/gui/css_parser.h +++ b/nel/include/nel/gui/css_parser.h @@ -38,7 +38,7 @@ namespace NLGUI private: // stylesheet currently parsed - ucstring _Style; + std::string _Style; // keep track of current position in _Style size_t _Position; @@ -70,49 +70,49 @@ namespace NLGUI void preprocess(); // parse selectors + combinators - std::vector parse_selector(const ucstring &sel, std::string &pseudoElement) const; + std::vector parse_selector(const std::string &sel, std::string &pseudoElement) const; // parse selector and style - void parseRule(const ucstring &selectorString, const ucstring &styleString); + void parseRule(const std::string &selectorString, const std::string &styleString); inline bool is_eof() const { return _Position >= _Style.size(); } - inline bool is_whitespace(ucchar ch) const + inline bool is_whitespace(char ch) const { - return (ch == (ucchar)' ' || ch == (ucchar)'\t' || ch == (ucchar)'\n'); + return (ch == ' ' || ch == '\t' || ch == '\n'); } - inline bool is_hex(ucchar ch) const + inline bool is_hex(char ch) const { - return ((ch >= (ucchar)'0' && ch <= (ucchar)'9') || - (ch >= (ucchar)'a' && ch <= (ucchar)'f') || - (ch >= (ucchar)'A' && ch <= (ucchar)'F')); + return ((ch >= '0' && ch <= '9') || + (ch >= 'a' && ch <= 'f') || + (ch >= 'A' && ch <= 'F')); } inline bool maybe_escape() const { // escaping newline (\n) only allowed inside strings - return (_Style.size() - _Position) >= 1 && _Style[_Position] == (ucchar)'\\' && _Style[_Position+1] != '\n'; + return (_Style.size() - _Position) >= 1 && _Style[_Position] == '\\' && _Style[_Position+1] != '\n'; } - inline bool is_quote(ucchar ch) const + inline bool is_quote(char ch) const { - return ch== (ucchar)'"' || ch == (ucchar)'\''; + return ch== '"' || ch == '\''; } - inline bool is_block_open(ucchar ch) const + inline bool is_block_open(char ch) const { - return ch == (ucchar)'{' || ch == (ucchar)'[' || ch == (ucchar)'('; + return ch == (char)'{' || ch == (char)'[' || ch == (char)'('; } - inline bool is_block_close(ucchar ch, ucchar open) const + inline bool is_block_close(char ch, char open) const { - return ((open == '{' && ch == (ucchar)'}') || - (open == '[' && ch == (ucchar)']') || - (open == '(' && ch == (ucchar)')')); + return ((open == '{' && ch == (char)'}') || + (open == '[' && ch == (char)']') || + (open == '(' && ch == (char)')')); } inline bool is_comment_open() const @@ -120,25 +120,25 @@ namespace NLGUI if (_Position+1 > _Style.size()) return false; - return _Style[_Position] == (ucchar)'/' && _Style[_Position+1] == (ucchar)'*'; + return _Style[_Position] == (char)'/' && _Style[_Position+1] == (char)'*'; } - inline bool is_nonascii(ucchar ch) const + inline bool is_nonascii(char ch) const { return ch >= 0x80 /*&& ch <= 255*/; } - inline bool is_alpha(ucchar ch) const + inline bool is_alpha(char ch) const { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); } - inline bool is_digit(ucchar ch) const + inline bool is_digit(char ch) const { return ch >= '0' && ch <= '9'; } - inline bool is_nmchar(ucchar ch) const + inline bool is_nmchar(char ch) const { // checking escape here does not check if next char is '\n' or not return ch == '_' || ch == '-' || is_alpha(ch) || is_digit(ch) || is_nonascii(ch) || ch == '\\'/*is_escape(ch)*/; diff --git a/nel/include/nel/gui/event_descriptor.h b/nel/include/nel/gui/event_descriptor.h index 95bdad212..dd2ae19c4 100644 --- a/nel/include/nel/gui/event_descriptor.h +++ b/nel/include/nel/gui/event_descriptor.h @@ -82,13 +82,13 @@ public: return _Key; } // return the char that has been pressed. The key event type MUST be 'keychar', else => assert - ucchar getChar() const + u32char getChar() const { nlassert(_KeyEvent == keychar); return _Char; } // return the string that has been sent. The key event type MUST be 'keystring', else => assert - ucstring getString() const + std::string getString() const { nlassert(_KeyEvent == keystring); return _String; @@ -141,9 +141,9 @@ private: union { NLMISC::TKey _Key; - ucchar _Char; + u32char _Char; }; - ucstring _String; + std::string _String; }; // ---------------------------------------------------------------------------- diff --git a/nel/include/nel/gui/group_container.h b/nel/include/nel/gui/group_container.h index 399f9c056..361ae70b9 100644 --- a/nel/include/nel/gui/group_container.h +++ b/nel/include/nel/gui/group_container.h @@ -248,6 +248,13 @@ namespace NLGUI // Get the header color draw. NB: depends if grayed, and if active. NLMISC::CRGBA getDrawnHeaderColor () const; + std::string getTitleRaw () const; + void setTitleRaw (const std::string &title); + std::string getTitleOpenedRaw () const; + void setTitleOpenedRaw (const std::string &title); + std::string getTitleClosedRaw () const; + void setTitleClosedRaw (const std::string &title); + ucstring getUCTitleOpened () const; void setUCTitleOpened (const ucstring &title); ucstring getUCTitleClosed () const; @@ -287,9 +294,15 @@ namespace NLGUI REFLECT_STRING("title", getTitle, setTitle); REFLECT_STRING("title_opened", getTitleOpened, setTitleOpened); REFLECT_STRING("title_closed", getTitleClosed, setTitleClosed); - REFLECT_UCSTRING("uc_title_opened", getUCTitleOpened, setUCTitleOpened); - REFLECT_UCSTRING("uc_title_closed", getUCTitleClosed, setUCTitleClosed); - REFLECT_UCSTRING("uc_title", getUCTitle, setUCTitle); + + REFLECT_STRING("title_raw", getTitleRaw, setTitleRaw); + REFLECT_STRING("title_opened_raw", getTitleOpenedRaw, setTitleOpenedRaw); + REFLECT_STRING("title_closed_raw", getTitleClosedRaw, setTitleClosedRaw); + + REFLECT_UCSTRING("uc_title_opened", getUCTitleOpened, setUCTitleOpened); // FIXME: Lua UTF-8 + REFLECT_UCSTRING("uc_title_closed", getUCTitleClosed, setUCTitleClosed); // FIXME: Lua UTF-8 + REFLECT_UCSTRING("uc_title", getUCTitle, setUCTitle); // FIXME: Lua UTF-8 + REFLECT_STRING("title_color", getTitleColorAsString, setTitleColorAsString); REFLECT_SINT32("pop_min_h", getPopupMinH, setPopupMinH); REFLECT_SINT32("pop_max_h", getPopupMaxH, setPopupMaxH); diff --git a/nel/include/nel/gui/group_editbox.h b/nel/include/nel/gui/group_editbox.h index 36b8d63b4..9b2998be0 100644 --- a/nel/include/nel/gui/group_editbox.h +++ b/nel/include/nel/gui/group_editbox.h @@ -65,15 +65,15 @@ namespace NLGUI /// Accessors std::string getInputString() const; std::string getPrompt() const; - const u32string &getInputStringRef() const { return _InputString; } - const u32string &getPromptRef() const { return _Prompt; } + const ::u32string &getInputStringRef() const { return _InputString; } + const ::u32string &getPromptRef() const { return _Prompt; } /** Set the prompt * NB : line returns are encoded as '\n', not '\r\n' */ void setPrompt(const std::string &s); void setInputString(const std::string &str); - void setInputStringRef(const u32string &str) {_InputString = str; }; + void setInputStringRef(const ::u32string &str) {_InputString = str; }; void setInputStringAsInt(sint32 val); sint32 getInputStringAsInt() const; void setInputStringAsInt64(sint64 val); @@ -82,8 +82,8 @@ namespace NLGUI float getInputStringAsFloat() const; void setInputStringAsUtf16(const ucstring &str); ucstring getInputStringAsUtf16() const; - void setInputStringAsUtf32(const u32string &str); - u32string getInputStringAsUtf32() const { return _InputString; } + void setInputStringAsUtf32(const ::u32string &str); + ::u32string getInputStringAsUtf32() const { return _InputString; } void setColor(NLMISC::CRGBA col); @@ -98,7 +98,7 @@ namespace NLGUI static CGroupEditBox *getMenuFather() { return _MenuFather; } - void setCommand(const ucstring &command, bool execute); + void setCommand(const std::string &command, bool execute); // Stop parent from blinking void stopParentBlink() { if (_Parent) _Parent->disableBlink(); } @@ -122,7 +122,7 @@ namespace NLGUI sint32 getMaxHistoric() const {return _MaxHistoric;} sint32 getCurrentHistoricIndex () const {return _CurrentHistoricIndex;} void setCurrentHistoricIndex (sint32 index) {_CurrentHistoricIndex=index;} - const u32string &getHistoric(uint32 index) const {return _Historic[index];} + const ::u32string &getHistoric(uint32 index) const {return _Historic[index];} uint32 getNumHistoric() const {return (uint32)_Historic.size ();} // Get on change action handler @@ -140,7 +140,7 @@ namespace NLGUI // Paste the selection into buffer void paste(); // Write the string into buffer - void writeString(const ucstring &str, bool replace = true, bool atEnd = true); + void writeString(const ucstring &str, bool replace = true, bool atEnd = true); // UTF-16 because of Clipboard implementation // Expand the expression (true if there was a '/' at the start of the line) bool expand(); @@ -171,7 +171,7 @@ namespace NLGUI virtual void onKeyboardCaptureLost(); // set the input string as "default". will be reseted at first click (used for user information) - void setDefaultInputString(const ucstring &str); + void setDefaultInputString(const std::string &str); // For Interger and PositiveInteger, can specify min and max values void setIntegerMinValue(sint32 minValue) {_IntegerMinValue=minValue;} @@ -229,17 +229,17 @@ namespace NLGUI NLMISC::CRGBA _BackSelectColor; // Text info - u32string _Prompt; - u32string _InputString; + ::u32string _Prompt; + ::u32string _InputString; CViewText *_ViewText; // undo / redo - u32string _StartInputString; // value of the input string when focus was acuired first - u32string _ModifiedInputString; + ::u32string _StartInputString; // value of the input string when focus was acuired first + ::u32string _ModifiedInputString; // Historic info - typedef std::deque THistoric; + typedef std::deque<::u32string> THistoric; THistoric _Historic; uint32 _MaxHistoric; sint32 _CurrentHistoricIndex; @@ -276,7 +276,7 @@ namespace NLGUI bool _CanRedo : 1; bool _CanUndo : 1; - std::vector _NegativeFilter; + std::vector _NegativeFilter; sint _CursorTexID; sint32 _CursorWidth; @@ -299,13 +299,13 @@ namespace NLGUI void handleEventString(const NLGUI::CEventDescriptorKey &event); void setup(); void triggerOnChangeAH(); - void appendStringFromClipboard(const ucstring &str); + void appendStringFromClipboard(const ucstring &str); // UTF-16 because of Clipboard implementation - ucstring getSelection(); + ucstring getSelection(); // UTF-16 because of Clipboard implementation static CGroupEditBox *_MenuFather; - static bool isValidAlphaNumSpace(ucchar c) + static bool isValidAlphaNumSpace(u32char c) { if (c > 255) return false; char ac = (char) c; @@ -315,7 +315,7 @@ namespace NLGUI ac==' '; } - static bool isValidAlphaNum(ucchar c) + static bool isValidAlphaNum(u32char c) { if (c > 255) return false; char ac = (char) c; @@ -324,7 +324,7 @@ namespace NLGUI (ac >= 'A' && ac <= 'Z'); } - static bool isValidAlpha(ucchar c) + static bool isValidAlpha(u32char c) { if (c > 255) return false; char ac = (char) c; @@ -332,13 +332,13 @@ namespace NLGUI (ac >= 'A' && ac <= 'Z'); } - static bool isValidPlayerNameChar(ucchar c) + static bool isValidPlayerNameChar(u32char c) { // valid player name (with possible shard prefix / suffix format return isValidAlpha(c) || c=='.' || c=='(' || c==')'; } - static bool isValidFilenameChar(ucchar c) + static bool isValidFilenameChar(u32char c) { if (c == '\\' || c == '/' || @@ -352,12 +352,12 @@ namespace NLGUI return true; } // - bool isFiltered(ucchar c) + bool isFiltered(u32char c) { - uint length = (uint)_NegativeFilter.size(); - for (uint k = 0; k < length; ++k) + ptrdiff_t length = _NegativeFilter.size(); + for (ptrdiff_t k = 0; k < length; ++k) { - if ((ucchar) _NegativeFilter[k] == c) return true; + if (_NegativeFilter[k] == c) return true; } return false; } diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index 1013a8b10..56605c0cc 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -320,16 +320,16 @@ namespace NLGUI void clearContext(); // Translate a char - bool translateChar(ucchar &output, ucchar input, ucchar lastChar) const; + bool translateChar(u32char &output, u32char input, u32char lastChar) const; // Add a string in the current paragraph - void addString(const ucstring &str); + void addString(const std::string &str); // Add an image in the current paragraph void addImage(const std::string &id, const std::string &img, bool reloadImg=false, const CStyleParams &style = CStyleParams()); // Add a text area in the current paragraph - CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content, uint maxlength); + CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const std::string &content, uint maxlength); // Add a combo box in the current paragraph CDBGroupComboBox *addComboBox(const std::string &templateName, const char *name); @@ -350,9 +350,9 @@ namespace NLGUI void flushString(); // Set the title - void setTitle (const ucstring &title); void setTitle (const std::string &title); std::string getTitle() const; + void setTitleRaw (const std::string &title); // Lookup a url in local file system bool lookupLocalFile (std::string &result, const char *url, bool isUrl); @@ -392,10 +392,10 @@ namespace NLGUI bool _TrustedDomain; // Title prefix - ucstring _TitlePrefix; + std::string _TitlePrefix; // Title string - ucstring _TitleString; + std::string _TitleString; // Need to browse next update coords.. bool _BrowseNextTime; @@ -644,7 +644,7 @@ namespace NLGUI std::string Name; // Variable value - ucstring Value; + std::string Value; // Text area group CInterfaceGroup *TextArea; @@ -747,7 +747,7 @@ namespace NLGUI // Current node is a text area bool _TextArea; std::string _TextAreaTemplate; - ucstring _TextAreaContent; + std::string _TextAreaContent; std::string _TextAreaName; uint _TextAreaRow; uint _TextAreaCols; @@ -755,7 +755,7 @@ namespace NLGUI // current mode is in select option bool _SelectOption; - ucstring _SelectOptionStr; + std::string _SelectOptionStr; // Current node is a object std::string _ObjectType; @@ -826,7 +826,7 @@ namespace NLGUI void spliceFragment(std::list::iterator src); // decode all HTML entities - static ucstring decodeHTMLEntities(const ucstring &str); + static std::string decodeHTMLEntities(const std::string &str); struct CDataImageDownload { diff --git a/nel/include/nel/gui/view_text.h b/nel/include/nel/gui/view_text.h index 933f9a747..7c0324f58 100644 --- a/nel/include/nel/gui/view_text.h +++ b/nel/include/nel/gui/view_text.h @@ -222,7 +222,7 @@ namespace NLGUI int luaSetLineMaxW(CLuaState &ls); REFLECT_EXPORT_START(CViewText, CViewBase) - REFLECT_STRING("text", getText, setText); + REFLECT_STRING("text_raw", getText, setText); REFLECT_STRING("hardtext", getHardText, setHardText); // REFLECT_UCSTRING("uc_text", getTextAsUtf16, setTextAsUtf16); // Deprecate uc_ functions REFLECT_UCSTRING("uc_hardtext", getHardTextAsUtf16, setHardTextAsUtf16); @@ -262,8 +262,8 @@ namespace NLGUI // width of the font in pixel. Just a Hint for tabing format (computed with '_') float _FontWidth; // strings to use when computing font size - ucstring _FontSizingChars; - ucstring _FontSizingFallback; + ::u32string _FontSizingChars; + ::u32string _FontSizingFallback; // height of the font in pixel. // use getFontHeight float _FontHeight; diff --git a/nel/include/nel/misc/events.h b/nel/include/nel/misc/events.h index c783a85eb..6cfe902b8 100644 --- a/nel/include/nel/misc/events.h +++ b/nel/include/nel/misc/events.h @@ -320,11 +320,11 @@ public: class CEventChar : public CEventKey { public: - CEventChar (ucchar c, TKeyButton button, IEventEmitter* emitter) : CEventKey (button, emitter, EventCharId), _Raw(true) + CEventChar (u32char c, TKeyButton button, IEventEmitter* emitter) : CEventKey (button, emitter, EventCharId), _Raw(true) { Char=c; } - ucchar Char; + u32char Char; virtual CEvent *clone() const {return new CEventChar(*this);} void setRaw( bool raw ) { _Raw = raw; } @@ -341,11 +341,11 @@ private: class CEventString : public CEventKey { public: - CEventString (const ucstring &str, IEventEmitter* emitter) : CEventKey (noKeyButton, emitter, EventStringId) + CEventString (const std::string &str, IEventEmitter* emitter) : CEventKey (noKeyButton, emitter, EventStringId) { String = str; } - ucstring String; + std::string String; virtual CEvent *clone() const {return new CEventString(*this);} }; diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index 61291f421..ab8a25a58 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -54,11 +54,11 @@ public: inline CUtfStringView(const ucstring &utf16Str) : m_Str(utf16Str.c_str()), m_Size(utf16Str.size() << 1), m_Iterator(utf16Iterator) {} inline CUtfStringView(const ucchar *utf16Str) : m_Str(utf16Str), m_Size(strlen((const char *)utf16Str) & (ptrdiff_t)(-2)), m_Iterator(utf16Iterator) {} - inline CUtfStringView(const u32string &utf32Str) : m_Str(utf32Str.c_str()), m_Size(utf32Str.size() << 2), m_Iterator(utf32Iterator) {} + inline CUtfStringView(const ::u32string &utf32Str) : m_Str(utf32Str.c_str()), m_Size(utf32Str.size() << 2), m_Iterator(utf32Iterator) {} std::string toUtf8(bool reEncode = false) const; // Makes a copy ucstring toUtf16(bool reEncode = false) const; // Makes a copy - u32string toUtf32() const; // Makes a copy + ::u32string toUtf32() const; // Makes a copy std::wstring toWide() const; // Platform dependent, UTF-16 or UTF-32. Makes a copy. std::string toAscii() const; // Returns only values 0-127, 7-bit ASCII. Makes a copy. diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 211ed27fd..bb954ba4d 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -1265,6 +1265,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l return 0; } + // https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar + if (message == WM_UNICHAR) + return (wParam == UNICODE_NOCHAR); + return DefWindowProcW(hWnd, message, wParam, lParam); } diff --git a/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/nel/src/3d/driver/opengl/driver_opengl_window.cpp index f04ad304e..dc48ecbf0 100644 --- a/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -183,6 +183,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l return 0; } + // https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar + if (message == WM_UNICHAR) + return (wParam == UNICODE_NOCHAR); + return trapMessage ? 0 : DefWindowProcW(hWnd, message, wParam, lParam); } diff --git a/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/nel/src/3d/driver/opengl/unix_event_emitter.cpp index d4153dde5..2945b90e7 100644 --- a/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -29,6 +29,7 @@ #include #include #include "nel/misc/debug.h" +#include "nel/misc/utf_string_view.h" #ifdef DEBUG_NEW #define new DEBUG_NEW @@ -537,8 +538,7 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) if (c > 0) { #ifdef X_HAVE_UTF8_STRING - ucstring ucstr; - ucstr.fromUtf8(Text); + ::u32string ucstr = NLMISC::CUtfStringView(Text).toUtf32(); CEventChar *charEvent = new CEventChar (ucstr[0], getKeyButton(event.xbutton.state), this); @@ -549,7 +549,7 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) #else for (int i = 0; i < c; i++) { - CEventChar *charEvent = new CEventChar ((ucchar)(unsigned char)Text[i], getKeyButton(event.xbutton.state), this); + CEventChar *charEvent = new CEventChar ((u32char)(unsigned char)Text[i], getKeyButton(event.xbutton.state), this); // raw if not processed by IME charEvent->setRaw(keyCode != 0); diff --git a/nel/src/gui/css_parser.cpp b/nel/src/gui/css_parser.cpp index e59cf832b..ebc8d8d34 100644 --- a/nel/src/gui/css_parser.cpp +++ b/nel/src/gui/css_parser.cpp @@ -65,7 +65,7 @@ namespace NLGUI _Rules.clear(); _Style.clear(); - _Style.fromUtf8(cssString); + _Style = cssString; preprocess(); _Position = 0; @@ -73,7 +73,7 @@ namespace NLGUI { skipWhitespace(); - if (_Style[_Position] == (ucchar)'@') + if (_Style[_Position] == '@') readAtRule(); else readRule(); @@ -89,13 +89,13 @@ namespace NLGUI // style: "color: red; font-size: 10px;" // // @internal - void CCssParser::parseRule(const ucstring &selectorString, const ucstring &styleString) + void CCssParser::parseRule(const std::string &selectorString, const std::string &styleString) { - std::vector selectors; - NLMISC::explode(selectorString, ucstring(","), selectors); + std::vector selectors; + NLMISC::explode(selectorString, std::string(","), selectors); TStyleVec props; - props = parseDecls(styleString.toUtf8()); + props = parseDecls(styleString); // duplicate props to each selector in selector list, // example 'div > p, h1' creates 'div>p' and 'h1' @@ -129,7 +129,7 @@ namespace NLGUI skipIdentifier(); // skip at-rule statement - while(!is_eof() && _Style[_Position] != (ucchar)';') + while(!is_eof() && _Style[_Position] != ';') { if (maybe_escape()) { @@ -174,9 +174,9 @@ namespace NLGUI _Position++; else if (is_quote(_Style[_Position])) skipString(); - else if (_Style[_Position] == (ucchar)'[') + else if (_Style[_Position] == '[') skipBlock(); - else if (_Style[_Position] == (ucchar)'{') + else if (_Style[_Position] == '{') break; else _Position++; @@ -184,7 +184,7 @@ namespace NLGUI if (!is_eof()) { - ucstring selector; + std::string selector; selector.append(_Style, start, _Position - start); skipWhitespace(); @@ -194,7 +194,7 @@ namespace NLGUI skipBlock(); if (_Position <= _Style.size()) { - ucstring rules; + std::string rules; rules.append(_Style, start + 1, _Position - start - 2); parseRule(selector, rules); @@ -215,7 +215,7 @@ namespace NLGUI for(uint i=0; i<6 && is_hex(_Style[_Position]); i++) _Position++; - if (_Style[_Position] == (ucchar)' ') + if (_Style[_Position] == ' ') _Position++; } else if (_Style[_Position] != 0x0A) @@ -246,23 +246,23 @@ namespace NLGUI // cannot start with digit valid = false; } - else if ((_Position - start) == 0 && _Style[_Position-1] == (ucchar)'-') + else if ((_Position - start) == 0 && _Style[_Position-1] == '-') { // cannot start with -# valid = false; } } - else if (_Style[_Position] == (ucchar)'_') + else if (_Style[_Position] == '_') { // valid } - else if (_Style[_Position] >= 0x0080) + else if (_Style[_Position] >= 0x80) { // valid } - else if (_Style[_Position] == (ucchar)'-') + else if (_Style[_Position] == '-') { - if ((_Position - start) == 1 && _Style[_Position-1] == (ucchar)'-') + if ((_Position - start) == 1 && _Style[_Position-1] == '-') { // cannot start with -- valid = false; @@ -285,7 +285,7 @@ namespace NLGUI // @internal void CCssParser::skipBlock() { - ucchar startChar = _Style[_Position]; + char startChar = _Style[_Position]; // block start _Position++; @@ -311,7 +311,7 @@ namespace NLGUI // @internal void CCssParser::skipString() { - ucchar endChar = _Style[_Position]; + char endChar = _Style[_Position]; // quote start _Position++; @@ -338,7 +338,7 @@ namespace NLGUI // *************************************************************************** // parse selector list // @internal - std::vector CCssParser::parse_selector(const ucstring &sel, std::string &pseudoElement) const + std::vector CCssParser::parse_selector(const std::string &sel, std::string &pseudoElement) const { std::vector result; CCssSelector current; @@ -346,10 +346,10 @@ namespace NLGUI pseudoElement.clear(); bool failed = false; - ucstring::size_type start = 0, pos = 0; + std::string::size_type start = 0, pos = 0; while(pos < sel.size()) { - ucstring uc; + std::string uc; uc = sel[pos]; if (is_nmchar(sel[pos]) && current.empty()) { @@ -358,7 +358,7 @@ namespace NLGUI while(pos < sel.size() && is_nmchar(sel[pos])) pos++; - current.Element = toLower(sel.substr(start, pos - start).toUtf8()); + current.Element = toLower(sel.substr(start, pos - start)); start = pos; continue; } @@ -371,7 +371,7 @@ namespace NLGUI while(pos < sel.size() && is_nmchar(sel[pos])) pos++; - current.Id = toLower(sel.substr(start, pos - start).toUtf8()); + current.Id = toLower(sel.substr(start, pos - start)); start = pos; } else if (sel[pos] == '.') @@ -383,7 +383,7 @@ namespace NLGUI while(pos < sel.size() && (is_nmchar(sel[pos]) || sel[pos] == '.')) pos++; - current.setClass(toLower(sel.substr(start, pos - start).toUtf8())); + current.setClass(toLower(sel.substr(start, pos - start))); start = pos; } else if (sel[pos] == '[') @@ -399,9 +399,9 @@ namespace NLGUI start = pos; } - ucstring key; - ucstring value; - ucchar op = ' '; + std::string key; + std::string value; + char op = ' '; // key while(pos < sel.size() && is_nmchar(sel[pos])) @@ -420,7 +420,7 @@ namespace NLGUI if (sel[pos] == ']') { - current.addAttribute(key.toUtf8()); + current.addAttribute(key); } else { @@ -496,14 +496,14 @@ namespace NLGUI // [value="attr" i] if (value.size() > 2 && value[value.size()-2] == ' ') { - ucchar lastChar = value[value.size()-1]; + char lastChar = value[value.size()-1]; if (lastChar == 'i' || lastChar == 'I' || lastChar == 's' || lastChar == 'S') { value = value.substr(0, value.size()-2); cs = !((lastChar == 'i' || lastChar == 'I')); } } - current.addAttribute(key.toUtf8(), trimQuotes(value).toUtf8(), (char)op, cs); + current.addAttribute(key, trimQuotes(value), (char)op, cs); } // op error } // no value @@ -549,7 +549,7 @@ namespace NLGUI } } - std::string key = toLower(sel.substr(start, pos - start).toUtf8()); + std::string key = toLower(sel.substr(start, pos - start)); if (key.empty()) { failed = true; @@ -647,7 +647,7 @@ namespace NLGUI size_t start; size_t charsLeft; bool quote = false; - ucchar quoteChar; + char quoteChar; while(!is_eof()) { charsLeft = _Style.size() - _Position - 1; @@ -660,8 +660,8 @@ namespace NLGUI if (charsLeft >= 1 && _Style[_Position] == 0x0D && _Style[_Position+1] == 0x0A) len++; - ucstring tmp; - tmp += 0x000A; + std::string tmp; + tmp += 0x0A; _Style.replace(_Position, 1, tmp); } else if (_Style[_Position] == 0x00) @@ -686,12 +686,12 @@ namespace NLGUI } else if (!quote && is_comment_open()) { - size_t pos = _Style.find(ucstring("*/"), _Position + 2); + size_t pos = _Style.find("*/", _Position + 2); if (pos == std::string::npos) pos = _Style.size(); _Style.erase(_Position, pos - _Position + 2); - ucstring uc; + std::string uc; uc = _Style[_Position]; // _Position is already at correct place diff --git a/nel/src/gui/group_container.cpp b/nel/src/gui/group_container.cpp index e6b69326b..141c7ba9b 100644 --- a/nel/src/gui/group_container.cpp +++ b/nel/src/gui/group_container.cpp @@ -3955,8 +3955,8 @@ namespace NLGUI // *************************************************************************** void CGroupContainer::setTitle (const std::string &title) { - if (_Localize) setUCTitle (CI18N::get(title)); - else setUCTitle (title); + if (_Localize) setTitleRaw (CI18N::get(title)); + else setTitleRaw (title); } // *************************************************************************** @@ -3968,8 +3968,8 @@ namespace NLGUI // *************************************************************************** void CGroupContainer::setTitleOpened (const std::string &title) { - if (_Localize) setUCTitleOpened (CI18N::get(title)); - else setUCTitleOpened (title); + if (_Localize) setTitleOpenedRaw (CI18N::get(title)); + else setTitleOpenedRaw (title); } // *************************************************************************** @@ -3981,51 +3981,87 @@ namespace NLGUI // *************************************************************************** void CGroupContainer::setTitleClosed (const std::string &title) { - if (_Localize) setUCTitleClosed (CI18N::get(title)); - else setUCTitleClosed (title); + if (_Localize) setTitleClosedRaw (CI18N::get(title)); + else setTitleClosedRaw (title); } // *************************************************************************** - void CGroupContainer::setUCTitleOpened(const ucstring &title) + void CGroupContainer::setTitleOpenedRaw(const std::string &title) { - _TitleTextOpened = title.toUtf8(); + _TitleTextOpened = title; if (_TitleOpened != NULL) - _TitleOpened->setText (title.toUtf8()); + _TitleOpened->setText (title); invalidateCoords(); } // *************************************************************************** - void CGroupContainer::setUCTitleClosed(const ucstring &title) + void CGroupContainer::setTitleClosedRaw(const std::string &title) { - _TitleTextClosed = title.toUtf8(); + _TitleTextClosed = title; if (_TitleClosed != NULL) _TitleClosed->setText (_TitleTextClosed); invalidateCoords(); } + // *************************************************************************** + void CGroupContainer::setTitleRaw(const std::string &title) + { + setTitleOpenedRaw(title); + setTitleClosedRaw(title); + } + + // *************************************************************************** + std::string CGroupContainer::getTitleRaw () const + { + return getTitleOpened(); + } + + // *************************************************************************** + std::string CGroupContainer::getTitleOpenedRaw () const + { + return _TitleTextOpened; + } + + // *************************************************************************** + std::string CGroupContainer::getTitleClosedRaw () const + { + return _TitleTextClosed; + } + + // *************************************************************************** + void CGroupContainer::setUCTitleOpened(const ucstring &title) + { + setTitleOpenedRaw(title.toUtf8()); + } + + // *************************************************************************** + void CGroupContainer::setUCTitleClosed(const ucstring &title) + { + setTitleClosedRaw(title.toUtf8()); + } + // *************************************************************************** void CGroupContainer::setUCTitle(const ucstring &title) { - setUCTitleOpened(title); - setUCTitleClosed(title); + setTitleRaw(title.toUtf8()); } // *************************************************************************** ucstring CGroupContainer::getUCTitle () const { - return getUCTitleOpened(); + return ucstring::makeFromUtf8(getTitleRaw()); } // *************************************************************************** ucstring CGroupContainer::getUCTitleOpened () const { - return _TitleTextOpened; + return ucstring::makeFromUtf8(getTitleOpenedRaw()); } // *************************************************************************** ucstring CGroupContainer::getUCTitleClosed () const { - return _TitleTextClosed; + return ucstring::makeFromUtf8(getTitleClosedRaw()); } // *************************************************************************** diff --git a/nel/src/gui/group_editbox.cpp b/nel/src/gui/group_editbox.cpp index 768c69066..47a36d0a1 100644 --- a/nel/src/gui/group_editbox.cpp +++ b/nel/src/gui/group_editbox.cpp @@ -96,7 +96,7 @@ namespace NLGUI _ViewTextDeltaX(0) { - _Prompt = u32string(1, (u32char)'>'); + _Prompt = ::u32string(1, (u32char)'>'); _BackSelectColor= CRGBA::White; _TextSelectColor= CRGBA::Black; } @@ -264,9 +264,9 @@ namespace NLGUI std::string s; s.reserve( _NegativeFilter.size() ); - std::vector< char >::const_iterator itr; - for( itr = _NegativeFilter.begin(); itr != _NegativeFilter.end(); ++itr ) - s.push_back( *itr ); + std::vector< u32char >::const_iterator itr; + for (itr = _NegativeFilter.begin(); itr != _NegativeFilter.end(); ++itr) + CUtfStringView::append(s, *itr); return s; } @@ -450,10 +450,10 @@ namespace NLGUI if( name == "negative_filter" ) { _NegativeFilter.clear(); - - std::string::size_type i; - for( i = 0; i < value.size(); i++ ) - _NegativeFilter.push_back( value[ i ] ); + ::u32string::size_type i; + ::u32string ustr = CUtfStringView(value).toUtf32(); + for( i = 0; i < ustr.size(); i++ ) + _NegativeFilter.push_back(ustr[i]); } else CInterfaceGroup::setProperty( name, value ); @@ -539,9 +539,9 @@ namespace NLGUI std::string s; s.reserve( _NegativeFilter.size() ); - std::vector< char >::const_iterator itr; + std::vector< u32char >::const_iterator itr; for( itr = _NegativeFilter.begin(); itr != _NegativeFilter.end(); ++itr ) - s.push_back( *itr ); + CUtfStringView::append(s, *itr); xmlSetProp( node, BAD_CAST "negative_filter", BAD_CAST s.c_str() ); @@ -657,9 +657,11 @@ namespace NLGUI prop = (char*) xmlGetProp( cur, (xmlChar*)"negative_filter" ); if (prop) { - uint length = (uint)strlen(prop); - _NegativeFilter.resize(length); - std::copy((const char *) prop, (const char *) prop + length, _NegativeFilter.begin()); + _NegativeFilter.clear(); + ::u32string::size_type i; + ::u32string ustr = CUtfStringView(prop).toUtf32(); + for( i = 0; i < ustr.size(); i++ ) + _NegativeFilter.push_back(ustr[i]); } return true; @@ -829,10 +831,10 @@ namespace NLGUI // ---------------------------------------------------------------------------- void CGroupEditBox::writeString(const ucstring &str16, bool replace, bool atEnd) { - u32string str = CUtfStringView(str16).toUtf32(); + ::u32string str = CUtfStringView(str16).toUtf32(); sint length = (sint)str.length(); - u32string toAppend; + ::u32string toAppend; // filter character depending on the entry type switch (_EntryType) { @@ -854,7 +856,7 @@ namespace NLGUI } } // remove '\r' characters - toAppend.erase(std::remove(toAppend.begin(), toAppend.end(), (ucchar) '\r'), toAppend.end()); + toAppend.erase(std::remove(toAppend.begin(), toAppend.end(), (u32char) '\r'), toAppend.end()); } break; @@ -965,7 +967,7 @@ namespace NLGUI { length = _MaxNumChar - (sint)_InputString.length(); } - u32string toAdd = toAppend.substr(0, length); + ::u32string toAdd = toAppend.substr(0, length); sint32 minPos; sint32 maxPos; if (_CurrSelection == this) @@ -1015,7 +1017,7 @@ namespace NLGUI _CursorAtPreviousLineEnd = false; if (_ClearOnEscape) { - setInputStringAsUtf32(u32string()); + setInputStringAsUtf32(::u32string()); triggerOnChangeAH(); } CWidgetManager::getInstance()->setCaptureKeyboard(NULL); @@ -1077,7 +1079,7 @@ namespace NLGUI cutSelection(); } - ucchar c = isKeyRETURN ? '\n' : rEDK.getChar(); + u32char c = isKeyRETURN ? '\n' : rEDK.getChar(); if (isFiltered(c)) return; switch(_EntryType) { @@ -1124,8 +1126,8 @@ namespace NLGUI if(_EntryType==Integer && (_IntegerMinValue!=INT_MIN || _IntegerMaxValue!=INT_MAX)) { // estimate new string - u32string copyStr= _InputString; - u32string::iterator it = copyStr.begin() + _CursorPos; + ::u32string copyStr= _InputString; + ::u32string::iterator it = copyStr.begin() + _CursorPos; copyStr.insert(it, c); sint32 value; fromString(CUtfStringView(copyStr).toUtf8(), value); @@ -1137,8 +1139,8 @@ namespace NLGUI if(_EntryType==PositiveInteger && (_PositiveIntegerMinValue!=0 || _PositiveIntegerMaxValue!=UINT_MAX)) { // estimate new string - u32string copyStr= _InputString; - u32string::iterator it = copyStr.begin() + _CursorPos; + ::u32string copyStr= _InputString; + ::u32string::iterator it = copyStr.begin() + _CursorPos; copyStr.insert(it, c); // \todo yoyo: this doesn't really work i think.... uint32 value; @@ -1151,7 +1153,7 @@ namespace NLGUI if ((uint) _InputString.length() < _MaxNumChar) { makeTopWindow(); - u32string::iterator it = _InputString.begin() + _CursorPos; + ::u32string::iterator it = _InputString.begin() + _CursorPos; _InputString.insert(it, c); ++ _CursorPos; triggerOnChangeAH(); @@ -1263,7 +1265,7 @@ namespace NLGUI // else delete last character else if(_InputString.size () > 0 && _CursorPos != 0) { - u32string::iterator it = _InputString.begin() + (_CursorPos - 1); + ::u32string::iterator it = _InputString.begin() + (_CursorPos - 1); _InputString.erase(it); -- _CursorPos; _CursorAtPreviousLineEnd = false; @@ -1436,7 +1438,7 @@ namespace NLGUI std::string usTmp; if (_EntryType == Password) { - usTmp = CUtfStringView(_Prompt + u32string(_InputString.size(), 0x2022)).toUtf8(); + usTmp = CUtfStringView(_Prompt + ::u32string(_InputString.size(), 0x2022)).toUtf8(); } else { @@ -1634,7 +1636,7 @@ namespace NLGUI { setInputStringAsUtf32(CUtfStringView(str).toUtf32()); } - void CGroupEditBox::setInputStringAsUtf32(const u32string &str) + void CGroupEditBox::setInputStringAsUtf32(const ::u32string &str) { _InputString = str; if (_CursorPos > (sint32) str.length()) @@ -1650,10 +1652,10 @@ namespace NLGUI // *************************************************************************** - void CGroupEditBox::setDefaultInputString(const ucstring &str) + void CGroupEditBox::setDefaultInputString(const std::string &str) { _DefaultInputString= true; - setInputStringAsUtf32(CUtfStringView(str).toUtf32()); + setInputString(str); } // *************************************************************************** @@ -1771,14 +1773,14 @@ namespace NLGUI } // *************************************************************************** - void CGroupEditBox::setCommand(const ucstring &command, bool execute) + void CGroupEditBox::setCommand(const std::string &command, bool execute) { // do nothing if frozen if(_Frozen) return; // set the string and maybe execute - setInputStringAsUtf16((ucchar) '/' + command); + setInputString('/' + command); if (execute) { // stop selection @@ -1878,7 +1880,7 @@ namespace NLGUI void CGroupEditBox::onQuit() { // clear the text and restore backup pos before final save - setInputStringAsUtf32(u32string()); + setInputStringAsUtf32(::u32string()); _CurrSelection = NULL; } @@ -1886,7 +1888,7 @@ namespace NLGUI void CGroupEditBox::onLoadConfig() { // config is not saved when there's an empty string, so restore that default state. - setInputStringAsUtf32(u32string()); + setInputStringAsUtf32(::u32string()); _CurrSelection = NULL; _PrevNumLine = 1; } @@ -1901,7 +1903,7 @@ namespace NLGUI if (_DefaultInputString) { _DefaultInputString= false; - setInputStringAsUtf32(u32string()); + setInputStringAsUtf32(::u32string()); } _CanRedo = false; _CanUndo = false; diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index b559b409f..f7a62cc90 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -1034,7 +1034,7 @@ namespace NLGUI // *************************************************************************** - void CGroupHTML::addText (const char * buf, int len) + void CGroupHTML::addText (const char *buf, int len) { if (_Browsing) { @@ -1042,44 +1042,43 @@ namespace NLGUI return; // Build a UTF8 string - string inputString(buf, buf+len); - if (_ParsingLua && _TrustedDomain) { // we are parsing a lua script - _LuaScript += inputString; + _LuaScript += string(buf, buf + len); // no more to do return; } // Build a unicode string - ucstring inputUCString; - inputUCString.fromUtf8(inputString); + CUtfStringView inputStringView(buf, len); // Build the final unicode string - ucstring tmp; + string tmp; tmp.reserve(len); - uint ucLen = (uint)inputUCString.size(); - for (uint i=0; i(textArea->getGroup("eb")); if (eb) { - eb->setInputString(CUtfStringView(decodeHTMLEntities(content)).toUtf8()); + eb->setInputString(decodeHTMLEntities(content)); if (style.hasStyle("background-color")) { CViewBitmap *bg = dynamic_cast(eb->getView("bg")); @@ -3310,7 +3309,7 @@ namespace NLGUI { if (_CurrentViewLink) { - u32string str = CUtfStringView(_CurrentViewLink->getText()).toUtf32(); // FIXME: Optimize reverse UTF iteration + ::u32string str = CUtfStringView(_CurrentViewLink->getText()).toUtf32(); // FIXME: Optimize reverse UTF iteration if (!str.empty()) return str[str.length()-1]; } @@ -3402,7 +3401,7 @@ namespace NLGUI // *************************************************************************** - void CGroupHTML::setTitle (const ucstring &title) + void CGroupHTML::setTitleRaw (const std::string &title) { CInterfaceElement *parent = getParent(); if (parent) @@ -3412,7 +3411,7 @@ namespace NLGUI CGroupContainer *container = dynamic_cast(parent); if (container) { - container->setUCTitle (title); + container->setTitleRaw (title); } } } @@ -3420,21 +3419,18 @@ namespace NLGUI void CGroupHTML::setTitle(const std::string &title) { - ucstring uctitle; - uctitle.fromUtf8(title); - _TitleString.clear(); if(!_TitlePrefix.empty()) { _TitleString = _TitlePrefix + " - "; } - _TitleString += uctitle; + _TitleString += title; - setTitle(_TitleString); + setTitleRaw(_TitleString); } std::string CGroupHTML::getTitle() const { - return _TitleString.toUtf8(); + return _TitleString; }; // *************************************************************************** @@ -4685,9 +4681,7 @@ namespace NLGUI CLuaIHM::checkArgType(ls, funcName, 3, LUA_TBOOLEAN); string name = ls.toString(1); - - ucstring text; - text.fromUtf8(ls.toString(2)); + string text = ls.toString(2); if (!_Forms.empty()) { @@ -4717,7 +4711,7 @@ namespace NLGUI const char *funcName = "addString"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); - addString(ucstring::makeFromUtf8(ls.toString(1))); + addString(ls.toString(1)); return 0; } @@ -4945,7 +4939,7 @@ namespace NLGUI } // *************************************************************************** - inline bool isDigit(ucchar c, uint base = 16) + inline bool isDigit(char c, uint base = 16) { if (c>='0' && c<='9') return true; if (base != 16) return false; @@ -4955,7 +4949,7 @@ namespace NLGUI } // *************************************************************************** - inline ucchar convertHexDigit(ucchar c) + inline char convertHexDigit(char c) { if (c>='0' && c<='9') return c-'0'; if (c>='A' && c<='F') return c-'A'+10; @@ -4964,9 +4958,10 @@ namespace NLGUI } // *************************************************************************** - ucstring CGroupHTML::decodeHTMLEntities(const ucstring &str) + std::string CGroupHTML::decodeHTMLEntities(const std::string &str) { - ucstring result; + std::string result; + result.reserve(str.size() + (str.size() >> 2)); uint last, pos; for (uint i=0; igetNumChildren() == 0) { - ucstring tmp("\n"); - addString(tmp); + addString("\n"); } else { @@ -6086,8 +6080,7 @@ namespace NLGUI { // Get the string name string name = elm.getAttribute("name"); - ucstring ucValue; - ucValue.fromUtf8(elm.getAttribute("value")); + string ucValue = elm.getAttribute("value"); uint size = 20; uint maxlength = 1024; @@ -6121,12 +6114,12 @@ namespace NLGUI string normal = elm.getAttribute("src"); string pushed; string over; - ucstring ucValue = ucstring("on"); + string ucValue = "on"; bool checked = elm.hasAttribute("checked"); // TODO: unknown if empty attribute should override or not if (elm.hasNonEmptyAttribute("value")) - ucValue.fromUtf8(elm.getAttribute("value")); + ucValue = elm.getAttribute("value"); if (type == "radio") { @@ -6191,8 +6184,7 @@ namespace NLGUI string name = elm.getAttribute("name"); // Get the value - ucstring ucValue; - ucValue.fromUtf8(elm.getAttribute("value")); + string ucValue = elm.getAttribute("value"); // Add an entry CGroupHTML::CForm::CEntry entry; @@ -6224,8 +6216,7 @@ namespace NLGUI if (elm.hasNonEmptyAttribute("value")) fromString(elm.getAttribute("value"), _UL.back().Value); - ucstring str; - str.fromUtf8(_UL.back().getListMarkerText()); + string str = _UL.back().getListMarkerText(); addString (str); // list-style-type: outside @@ -6429,7 +6420,7 @@ namespace NLGUI // use option text as value if (!elm.hasAttribute("value")) { - _Forms.back().Entries.back().SelectValues.back() = _SelectOptionStr.toUtf8(); + _Forms.back().Entries.back().SelectValues.back() = _SelectOptionStr; } // insert the parsed text into the select control @@ -6437,7 +6428,7 @@ namespace NLGUI if (cb) { uint lineIndex = cb->getNumTexts(); - cb->addText(_SelectOptionStr.toUtf8()); + cb->addText(_SelectOptionStr); if (_Forms.back().Entries.back().sbOptionDisabled == lineIndex) { cb->setGrayed(lineIndex, true); @@ -6449,7 +6440,7 @@ namespace NLGUI if (sb) { uint lineIndex = sb->getNumLine(); - sb->addLine(_SelectOptionStr.toUtf8(), "", ""); + sb->addLine(_SelectOptionStr, "", ""); if (_Forms.back().Entries.back().sbOptionDisabled == lineIndex) { diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index b5744925f..d8552f153 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -118,9 +118,10 @@ namespace NLGUI // Letter size // - "_" that should be the character with the lowest part // - A with an accent for the highest part - _FontSizingChars.fromUtf8("_\xc3\x84"); + // https://www.compart.com/en/unicode/U+00C4 + _FontSizingChars = { (u32char)'_', 0x000000C4 }; // fallback if SizingChars are not supported by font - _FontSizingFallback.fromUtf8("|"); + _FontSizingFallback = { (u32char)'|' }; computeFontSize (); } @@ -396,12 +397,12 @@ namespace NLGUI else if ( name == "sizing_chars" ) { - return _FontSizingChars.toUtf8(); + return CUtfStringView(_FontSizingChars).toUtf8(); } else if ( name == "sizing_fallback" ) { - return _FontSizingFallback.toUtf8(); + return CUtfStringView(_FontSizingFallback).toUtf8(); } else return ""; @@ -688,13 +689,13 @@ namespace NLGUI else if( name == "sizing_chars" ) { - _FontSizingChars.fromUtf8(value); + _FontSizingChars = CUtfStringView(value).toUtf32(); return true; } else if( name == "sizing_fallback" ) { - _FontSizingFallback.fromUtf8(value); + _FontSizingFallback = CUtfStringView(value).toUtf32(); return true; } else @@ -766,8 +767,8 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "clamp_right", BAD_CAST toString( _ClampRight ).c_str() ); xmlSetProp( node, BAD_CAST "auto_clamp_offset", BAD_CAST toString( _AutoClampOffset ).c_str() ); xmlSetProp( node, BAD_CAST "continuous_update", BAD_CAST toString( _ContinuousUpdate ).c_str() ); - xmlSetProp( node, BAD_CAST "sizing_chars", BAD_CAST _FontSizingChars.toUtf8().c_str() ); - xmlSetProp( node, BAD_CAST "sizing_fallback", BAD_CAST _FontSizingFallback.toUtf8().c_str() ); + xmlSetProp( node, BAD_CAST "sizing_chars", BAD_CAST CUtfStringView(_FontSizingChars).toUtf8().c_str() ); + xmlSetProp( node, BAD_CAST "sizing_fallback", BAD_CAST CUtfStringView(_FontSizingFallback).toUtf8().c_str() ); return true; } @@ -953,16 +954,16 @@ namespace NLGUI } // "_Ä" lowest/highest chars (underscore, A+diaeresis) - _FontSizingChars.fromUtf8("_\xc3\x84"); + _FontSizingChars = { (u32char)'_', 0x000000C4 }; prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_chars" ); if (prop) - _FontSizingChars.fromUtf8((const char*)prop); + _FontSizingChars = CUtfStringView((const char*)prop).toUtf32(); // fallback if SizingChars are not supported by font - _FontSizingFallback.fromUtf8("|"); + _FontSizingFallback = { (u32char)'|' }; prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_fallback" ); if (prop) - _FontSizingFallback.fromUtf8((const char*)prop); + _FontSizingFallback = CUtfStringView((const char*)prop).toUtf32(); computeFontSize (); } @@ -1468,9 +1469,9 @@ namespace NLGUI void CViewText::setFontSizing(const std::string &chars, const std::string &fallback) { _FontSizingChars.clear(); - _FontSizingChars.fromUtf8(chars); + _FontSizingChars = CUtfStringView(chars).toUtf32(); _FontSizingFallback.clear(); - _FontSizingFallback.fromUtf8(fallback); + _FontSizingFallback = CUtfStringView(fallback).toUtf32(); } // *************************************************************************** @@ -1683,7 +1684,7 @@ namespace NLGUI nMaxWidth *= _Scale; //for (i = 0; i < textSize; ++i) CUtfStringView sv(_Text); - u32string ucStrLetter(1, ' '); + ::u32string ucStrLetter(1, ' '); for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it, ++i) { if(isFormatTagChange(i, formatTagIndex)) @@ -1863,7 +1864,7 @@ namespace NLGUI uint i; for(i= (uint)spaceEnd;i<(uint)_Text.length();i++) { - ucchar c= _Text[i]; + char c= _Text[i]; if(c==' ' || c=='\n') break; // If change of color tag, stop the word, but don't take the new color now. @@ -1950,7 +1951,7 @@ namespace NLGUI else { float px = numSpaces * _SpaceWidth; - u32string oneChar(1, ' '); + ::u32string oneChar(1, ' '); CUtfStringView wsv(wordValue); CUtfStringView::iterator wit(wsv.begin()), wend(wsv.end()); for (; wit != wend; ++wit) @@ -2198,7 +2199,7 @@ namespace NLGUI if (_ClampRight) { CUtfStringView sv(_Text); - u32string ucStrLetter = u32string(1, (u32char)' '); + ::u32string ucStrLetter = u32string(1, (u32char)' '); for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) { ucStrLetter[0] = *it; @@ -2224,8 +2225,8 @@ namespace NLGUI else { // FIXME: Optimize reverse UTF iteration - u32string uctext = CUtfStringView(_Text).toUtf32(); - u32string ucStrLetter = u32string(1, (u32char)' '); + ::u32string uctext = CUtfStringView(_Text).toUtf32(); + ::u32string ucStrLetter = u32string(1, (u32char)' '); for (sint i = (sint)uctext.size() - 1; i >= 0; --i) { ucStrLetter[0] = uctext[i]; @@ -2358,7 +2359,7 @@ namespace NLGUI charIndex += currLine.getNumChars() + currLine.getEndSpaces() + (currLine.getLF() ? 1 : 0); } // skip all spaces at start of line (unless there are only spaces in the line) - std::string::size_type nextPos = _Text.find_first_not_of((ucchar) ' ', charIndex); + std::string::size_type nextPos = _Text.find_first_not_of(' ', charIndex); if (nextPos != std::string::npos) { if (getLineFromIndex(charIndex) == (sint) line) @@ -2567,7 +2568,7 @@ namespace NLGUI float px = 0.f; UTextContext::CStringInfo si; - u32string singleChar(1, ' '); + ::u32string singleChar(1, ' '); uint i = 0; NLMISC::CUtfStringView sv(textValue); for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it, ++i) @@ -3405,7 +3406,7 @@ namespace NLGUI while(textIndexend()); it != end; ++it) res += *it; diff --git a/nel/src/misc/win_event_emitter.cpp b/nel/src/misc/win_event_emitter.cpp index 5b6860794..0d370cffc 100644 --- a/nel/src/misc/win_event_emitter.cpp +++ b/nel/src/misc/win_event_emitter.cpp @@ -162,6 +162,14 @@ bool CWinEventEmitter::processMessage (HWND hWnd, uint32 msg, WPARAM wParam, LPA server->postEvent (new CEventKeyUp ((NLMISC::TKey)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this)); } break; + case WM_UNICHAR: + if (wParam != UNICODE_NOCHAR && _KeyboardEventsEnabled) + { + //if (wParam < KeyCount) + //nlinfo("WM_UNICHAR with %u", wParam); + server->postEvent (new CEventChar ((u32char)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this)); + } + break; case WM_CHAR: if (_KeyboardEventsEnabled) { diff --git a/ryzom/client/src/actions.cpp b/ryzom/client/src/actions.cpp index 783088b21..428c607f0 100644 --- a/ryzom/client/src/actions.cpp +++ b/ryzom/client/src/actions.cpp @@ -499,9 +499,9 @@ void CCombo::init (NLMISC::TKey key, NLMISC::TKeyButton keyButtons) } // *************************************************************************** -ucstring CCombo::toUCString() const +string CCombo::toString() const { - ucstring ret; + string ret; if ((KeyButtons & shiftKeyButton) && (Key != 0x10)) ret += CI18N::get("uiKeySHIFT") + "+"; if ((KeyButtons & ctrlKeyButton) && (Key != 0x11)) diff --git a/ryzom/client/src/actions.h b/ryzom/client/src/actions.h index 1e1bffb84..3fe976ac4 100644 --- a/ryzom/client/src/actions.h +++ b/ryzom/client/src/actions.h @@ -66,7 +66,7 @@ public: void init (NLMISC::TKey key, NLMISC::TKeyButton keyButtons); /// Get the combo in human readable form - ucstring toUCString() const; + std::string toString() const; // For maps bool operator<(const CCombo &other) const diff --git a/ryzom/client/src/interface_v3/action_handler_edit.cpp b/ryzom/client/src/interface_v3/action_handler_edit.cpp index bde8f5389..c2d3bafbc 100644 --- a/ryzom/client/src/interface_v3/action_handler_edit.cpp +++ b/ryzom/client/src/interface_v3/action_handler_edit.cpp @@ -70,7 +70,7 @@ static inline uint getCharacterCategory(u32char c) /** skip a block of character in a string, (same behaviour than when Ctrl-arrow is pressed) * It returns the new index */ -static uint skipUCCharsRight(uint startPos, const u32string &str) +static uint skipUCCharsRight(uint startPos, const ::u32string &str) { uint pos = startPos; uint endIndex = (uint)str.length(); @@ -87,7 +87,7 @@ static uint skipUCCharsRight(uint startPos, const u32string &str) /** skip a block of character in a string, (same behaviour than when Ctrl-arrow is pressed) * It returns the new index */ -static uint skipUCCharsLeft(uint startPos, const u32string &str) +static uint skipUCCharsLeft(uint startPos, const ::u32string &str) { uint pos = startPos; -- pos; @@ -363,7 +363,7 @@ class CAHEditPreviousLine : public CAHEdit if (_GroupEdit->getMaxHistoric() && (! _GroupEdit->getViewText()->getMultiLine())) { // Get the start of the string. - u32string startStr= _GroupEdit->getInputStringRef().substr(0, _GroupEdit->getCursorPos()); + ::u32string startStr= _GroupEdit->getInputStringRef().substr(0, _GroupEdit->getCursorPos()); // Search all historic string that match startStr. for(sint i=_GroupEdit->getCurrentHistoricIndex()+1;i<(sint)_GroupEdit->getNumHistoric();i++) @@ -435,7 +435,7 @@ class CAHEditNextLine : public CAHEdit if( (! _GroupEdit->getViewText()->getMultiLine()) && _GroupEdit->getMaxHistoric() && _GroupEdit->getCurrentHistoricIndex()>0) { // Get the start of the string. - u32string startStr= _GroupEdit->getInputStringRef().substr(0, _GroupEdit->getCursorPos()); + ::u32string startStr= _GroupEdit->getInputStringRef().substr(0, _GroupEdit->getCursorPos()); // Search all historic string that match startStr. for(sint i=_GroupEdit->getCurrentHistoricIndex()-1;i>=0;i--) @@ -521,8 +521,8 @@ protected: // else cut forwards else if(_GroupEdit->getCursorPos() < (sint32) _GroupEdit->getInputStringRef().length()) { - u32string inputString = _GroupEdit->getInputStringRef(); - u32string::iterator it = inputString.begin() + _GroupEdit->getCursorPos(); + ::u32string inputString = _GroupEdit->getInputStringRef(); + ::u32string::iterator it = inputString.begin() + _GroupEdit->getCursorPos(); inputString.erase(it); _GroupEdit->setInputStringRef (inputString); if (!_GroupEdit->getAHOnChange().empty()) @@ -660,7 +660,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit else { // it is not a filtered chat, display 'tell' (must be ingame) - _GroupEdit->setCommand(ucstring("tell ") + *lastTellPeople + (ucchar) ' ', false); + _GroupEdit->setCommand("tell " + (*lastTellPeople).toUtf8() + ' ', false); } } }; diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index 354a4c833..e046fbe2d 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -349,13 +349,13 @@ void CChatWindow::enableBlink(uint numBlinks) void CChatWindow::setCommand(const std::string &command, bool execute) { if (!_EB) return; - _EB->setCommand(ucstring(command), execute); + _EB->setCommand(command, execute); } void CChatWindow::setCommand(const ucstring &command,bool execute) { if (!_EB) return; - _EB->setCommand(command, execute); + _EB->setCommand(command.toUtf8(), execute); } diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 669ee62c2..994274571 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -3398,7 +3398,7 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const if (macroName.empty()) macroName = CI18N::get("uiNotAssigned"); - ucstring assignedTo = macro->Combo.toUCString(); + ucstring assignedTo = macro->Combo.toString(); if (assignedTo.empty()) assignedTo = CI18N::get("uiNotAssigned"); 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 e3791cf8e..6f28e3b65 100644 --- a/ryzom/client/src/interface_v3/group_modal_get_key.cpp +++ b/ryzom/client/src/interface_v3/group_modal_get_key.cpp @@ -89,7 +89,7 @@ bool CGroupModalGetKey::handleEvent (const NLGUI::CEventDescriptor &event) // Setup the text ! CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewText *pVT= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( VIEW_TEXT_KEY )); - if (pVT != NULL) pVT->setText(Combo.toUCString().toUtf8()); + if (pVT != NULL) pVT->setText(Combo.toString()); // Check if in use CActionsManager *pCurAM = NULL; diff --git a/ryzom/client/src/interface_v3/group_quick_help.cpp b/ryzom/client/src/interface_v3/group_quick_help.cpp index 0b789fccf..77775489f 100644 --- a/ryzom/client/src/interface_v3/group_quick_help.cpp +++ b/ryzom/client/src/interface_v3/group_quick_help.cpp @@ -244,7 +244,7 @@ void CGroupQuickHelp::beginElement(CHtmlElement &elm) CActionsManager::TActionComboMap::const_iterator ite = actionCombo.find (CAction::CName (elm.getAttribute("z_action_shortcut").c_str(), params.c_str())); if (ite != actionCombo.end()) { - addString (ite->second.toUCString()); + addString (ite->second.toString()); } } } diff --git a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp index 82b928211..aa8cd0582 100644 --- a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp +++ b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp @@ -665,7 +665,7 @@ static DECLARE_INTERFACE_USER_FCT(getKey) CActionsManager::TActionComboMap::const_iterator it = acmap.find(CAction::CName(name.c_str(),param.c_str())); if (it != acmap.end()) { - result.setString (it->second.toUCString().toUtf8()); + result.setString (it->second.toString()); } else { diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index d62a8746a..c04ce38cd 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -208,7 +208,7 @@ void getAllComboAction(uint8 nAM, CGroupList *pList, const mapsecond.Combo.Key==KeyCount) keyName= CI18N::get("uiNotAssigned"); else - keyName= remapIT->second.Combo.toUCString(); + keyName= remapIT->second.Combo.toString(); const CBaseAction *baseAction = pAM->getBaseAction(remapIT->second.ActionName); if (baseAction) { @@ -711,7 +711,7 @@ void CModalContainerEditCmd::activateFrom (const std::string &cmdName, const std CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+VIEW_EDITCMD_TEXT_KEY)); if (pVT != NULL) pVT->setActive(true); // setup the text of the key - pVT->setText(it->second.toUCString().toUtf8()); + pVT->setText(it->second.toString()); // There is already a shortcut so we can display ok button pBut = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+CTRL_EDITCMD_BUTTON_OK)); @@ -887,7 +887,7 @@ void CModalContainerEditCmd::validCurrentCommand() { CurrentEditCmdLine.Combo = it->second; // Yes ok let setup the text of the key - pVT->setText(it->second.toUCString().toUtf8()); + pVT->setText(it->second.toString()); // There is already a shortcut so we can display ok button CCtrlBaseButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WinName+CTRL_EDITCMD_BUTTON_OK)); if (pCB != NULL) pCB->setFrozen (false); @@ -1353,7 +1353,7 @@ public: pMCM->NewKey->CurrentEditCmdLine.Combo = pGetKey->Combo; CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(pMCM->NewKey->WinName+VIEW_EDITCMD_TEXT_KEY)); - if (pVT != NULL) pVT->setText(pMCM->NewKey->CurrentEditCmdLine.Combo.toUCString().toUtf8()); + if (pVT != NULL) pVT->setText(pMCM->NewKey->CurrentEditCmdLine.Combo.toString()); CCtrlBaseButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(pMCM->NewKey->WinName+CTRL_EDITCMD_BUTTON_OK)); if (pCB != NULL) pCB->setFrozen (false); @@ -1365,7 +1365,7 @@ public: pMCM->EditCmd->CurrentEditCmdLine.Combo = pGetKey->Combo; pMCM->CurrentEditMacro.Combo = pMCM->EditCmd->CurrentEditCmdLine.Combo; CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_NEWMACRO_KEY)); - if (pVT != NULL) pVT->setText(pMCM->EditCmd->CurrentEditCmdLine.Combo.toUCString().toUtf8()); + if (pVT != NULL) pVT->setText(pMCM->EditCmd->CurrentEditCmdLine.Combo.toString()); } } }; diff --git a/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/ryzom/client/src/interface_v3/macrocmd_manager.cpp index 4b0d2fee9..d097ec239 100644 --- a/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -897,7 +897,7 @@ public: if (pMCM->CurrentEditMacro.Combo.Key == KeyCount) pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT)); else - pVT->setText(pMCM->CurrentEditMacro.Combo.toUCString().toUtf8()); + pVT->setText(pMCM->CurrentEditMacro.Combo.toString()); } pList->clearGroups(); @@ -1003,7 +1003,7 @@ void addMacroLine (CGroupList *pParent, uint macNb, const CMacroCmd ¯o) if (pVT != NULL) { if (macro.Combo.Key != KeyCount) - pVT->setText(macro.Combo.toUCString().toUtf8()); + pVT->setText(macro.Combo.toString()); else pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT)); } diff --git a/ryzom/client/src/interface_v3/task_bar_manager.cpp b/ryzom/client/src/interface_v3/task_bar_manager.cpp index fcc4c30f2..35f27b07d 100644 --- a/ryzom/client/src/interface_v3/task_bar_manager.cpp +++ b/ryzom/client/src/interface_v3/task_bar_manager.cpp @@ -180,7 +180,7 @@ public: if (pVT != NULL) { if (it != acmap.end()) - pVT->setText(it->second.toUCString().toUtf8()); + pVT->setText(it->second.toString()); else pVT->setText(CI18N::get("uiNotAssigned")); } diff --git a/ryzom/client/src/main_loop_debug.cpp b/ryzom/client/src/main_loop_debug.cpp index 70616e1f7..7c63d9502 100644 --- a/ryzom/client/src/main_loop_debug.cpp +++ b/ryzom/client/src/main_loop_debug.cpp @@ -714,7 +714,7 @@ static std::string getActionKey(const char* name, const char* param = "") CActionsManager::TActionComboMap::const_iterator ite = acmap.find(CAction::CName(name, param)); if (ite != acmap.end()) - return ite->second.toUCString().toString(); + return ite->second.toString(); return CI18N::get("uiNotAssigned"); } From 632f8133a287df6a7faa7233ea1169c4e3f60094 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 10:50:39 +0800 Subject: [PATCH 073/205] Fix merge --- nel/src/gui/view_text.cpp | 5 +- .../src/interface_v3/action_handler_item.cpp | 165 +++++++++++++++--- 2 files changed, 146 insertions(+), 24 deletions(-) diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index d8552f153..4f0b71c60 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -1022,7 +1022,10 @@ namespace NLGUI if (_MultiLine) { - setTextFormatTaged(CI18N::get(propPtr)); + if (NLMISC::startsWith(propPtr, "u:")) + setTextFormatTaged(std::string(propPtr).substr(2)); + else + setTextFormatTaged(CI18N::get(propPtr)); } else { diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 23992f4f6..d108e6a21 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -156,27 +156,35 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() // Select all the text for easier selection editBoxShort->setSelectionAll(); } + group->setActive(true); } else { + ucstring localDesc = ucstring(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)); if (itemInfo.CustomText.empty()) - display->setTextFormatTaged(CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)).toUtf8()); + display->setTextFormatTaged(localDesc.toUtf8()); else { ucstring text = itemInfo.CustomText; - string::size_type delimiter = text.find(' '); - if(text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') + if (text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') { CGroupHTML *pGH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html")); if (pGH) - pGH->browse(ucstring(text.substr(4, delimiter-4)).toString().c_str()); - if (delimiter == string::npos) - group->setActive(false); - else - text = text.substr(delimiter, text.size()-delimiter); + pGH->browse(text.substr(4, text.size()-4).toString().c_str()); + text = localDesc; + } + else if (text.size() > 3 && text[0]=='@' && text[1]=='L' && text[2]=='U' && text[3]=='A') + { + string code = text.substr(4, text.size()-4).toString(); + if (!code.empty()) + CLuaManager::getInstance().executeLuaScript(code); + text = localDesc; + } + if (!text.empty()) + { + display->setTextFormatTaged(text.toUtf8()); + group->setActive(true); } - - display->setTextFormatTaged(text.toUtf8()); } } } @@ -287,33 +295,37 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() display->setActive(true); editButtons->setActive(false); closeButton->setActive(true); - group->setActive(true); + group->setActive(false); editBoxShort->setInputString(std::string()); editBoxLarge->setInputString(std::string()); - display->setTextFormatTaged(std::string()); + display->setTextFormatTaged(ucstring()); // Finish the display or add the waiter if (getInventory().isItemInfoUpToDate(ItemSlotId)) { - // If we already have item info + ucstring localDesc = ucstring(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)); if (itemInfo.CustomText.empty()) - display->setTextFormatTaged(CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)).toUtf8()); + display->setTextFormatTaged(localDesc.toUtf8()); else { ucstring text = itemInfo.CustomText; - string::size_type delimiter = text.find(' '); - if(text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') + if (text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') { CGroupHTML *pGH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html")); if (pGH) - pGH->browse(ucstring(text.substr(4, delimiter-4)).toString().c_str()); - if (delimiter == string::npos) - group->setActive(false); - else - text = text.substr(delimiter, text.size()-delimiter); + pGH->browse(text.substr(4, text.size()-4).toUtf8().c_str()); + text = localDesc; } - display->setTextFormatTaged(text.toUtf8()); + else if (text.size() > 3 && text[0]=='@' && text[1]=='L' && text[2]=='U' && text[3]=='A') + { + string code = text.substr(4, text.size()-4).toUtf8(); + if (!code.empty()) + CLuaManager::getInstance().executeLuaScript(code); + text = localDesc; + } + if (!text.empty()) + display->setTextFormatTaged(text.toUtf8()); } } else @@ -434,7 +446,7 @@ static TStackMode CurrentStackMode; static void validateStackItem(CDBCtrlSheet *src, CDBCtrlSheet *dest, sint32 quantity, TStackMode stackMode); - +static void checkItemCommand(const CItemSheet *itemSheet); //===================================================================================================================== /** Send a swap item msg to the server @@ -1676,6 +1688,10 @@ class CHandlerItemCristalReload : public IActionHandler CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); if (pCS == NULL) return; + const CItemSheet *pIS = pCS->asItemSheet(); + if (pIS && pIS->Scroll.Label.empty()) + checkItemCommand(pIS); + sendToServerEnchantMessage((uint8)pCS->getInventoryIndex(), (uint16)pCS->getIndexInDB()); } }; @@ -1753,6 +1769,7 @@ class CHandlerItemMenuCheck : public IActionHandler CViewTextMenu *pCrisReload = dynamic_cast(pMenu->getView("cris_reload")); CViewTextMenu *pTeleportUse = dynamic_cast(pMenu->getView("teleport_use")); CViewTextMenu *pItemConsume = dynamic_cast(pMenu->getView("item_consume")); + CViewTextMenu *pItemExecute = dynamic_cast(pMenu->getView("item_execute")); CViewTextMenu *pXpCatalyserUse = dynamic_cast(pMenu->getView("xp_catalyser_use")); CViewTextMenu *pDrop = dynamic_cast(pMenu->getView("drop")); CViewTextMenu *pDestroy = dynamic_cast(pMenu->getView("destroy")); @@ -1780,6 +1797,7 @@ class CHandlerItemMenuCheck : public IActionHandler if(pCrisReload) pCrisReload->setActive(false); if(pTeleportUse) pTeleportUse->setActive(false); if(pItemConsume) pItemConsume->setActive(false); + if(pItemExecute) pItemExecute->setActive(false); if(pXpCatalyserUse) pXpCatalyserUse->setActive(false); if(pItemTextDisplay) pItemTextDisplay->setActive(false); if(pItemTextEdition) pItemTextEdition->setActive(false); @@ -1854,6 +1872,61 @@ class CHandlerItemMenuCheck : public IActionHandler { pItemInfos->setActive(true); } + // item has a label? + if (!pIS->Scroll.Label.empty()) + { + CGroupMenu *menu = dynamic_cast( + CWidgetManager::getInstance()->getElementFromId("ui:interface:item_menu_in_bag") + ); + // add the label to default menu + if (!pIS->Scroll.LuaCommand.empty() || !pIS->Scroll.WebCommand.empty()) + menu->setActionHandler(4, menu->getActionHandler(4)); + else + { + // replace default menu and redirect action handler + if (pCrisEnchant && pCrisEnchant->getActive()) + { + pCrisEnchant->setActive(false); + menu->setActionHandler(4, menu->getActionHandler(0)); + } + if (pCrisReload && pCrisReload->getActive()) + { + pCrisReload->setActive(false); + menu->setActionHandler(4, menu->getActionHandler(1)); + } + if (pTeleportUse && pTeleportUse->getActive()) + { + pTeleportUse->setActive(false); + menu->setActionHandler(4, menu->getActionHandler(2)); + } + if (pItemConsume && pItemConsume->getActive()) + { + pItemConsume->setActive(false); + menu->setActionHandler(4, menu->getActionHandler(3)); + } + if (pXpCatalyserUse && pXpCatalyserUse->getActive()) + { + pXpCatalyserUse->setActive(false); + menu->setActionHandler(4, menu->getActionHandler(5)); + } + if (pItemTextDisplay && pItemTextDisplay->getActive()) + { + pItemTextDisplay->setActive(false); + menu->setActionHandler(4, menu->getActionHandler(6)); + menu->setActionHandlerParam(4, menu->getActionHandlerParam(6)); + } + } + if (!bIsLockedByOwner) + { + if (pCS->getInventoryIndex() == INVENTORIES::bag) + pItemExecute->setActive(true); + // enchant and reload can be used from anywhere + if (pIS->Family == ITEMFAMILY::CRYSTALLIZED_SPELL || pIS->Family == ITEMFAMILY::ITEM_SAP_RECHARGE) + pItemExecute->setActive(true); + + pItemExecute->setText(CI18N::get(pIS->Scroll.Label)); + } + } } CInventoryManager &invMngr= getInventory(); @@ -1984,6 +2057,7 @@ class CHandlerItemMenuCheck : public IActionHandler if(pCrisReload) pCrisReload->setGrayed(true); if(pTeleportUse) pTeleportUse->setGrayed(true); if(pItemConsume) pItemConsume->setGrayed(true); + if(pItemExecute) pItemExecute->setGrayed(true); if(pXpCatalyserUse) pXpCatalyserUse->setGrayed(true); if(pDrop) pDrop->setGrayed(true); if(pDestroy) pDestroy->setGrayed(true); @@ -2003,6 +2077,7 @@ class CHandlerItemMenuCheck : public IActionHandler if(pCrisReload) pCrisReload->setGrayed(false); if(pTeleportUse) pTeleportUse->setGrayed(false); if(pItemConsume) pItemConsume->setGrayed(false); + if(pItemExecute) pItemExecute->setGrayed(false); if(pXpCatalyserUse) pXpCatalyserUse->setGrayed(false); if(pDrop) pDrop->setGrayed(false); if(pDestroy) pDestroy->setGrayed(false); @@ -2181,6 +2256,24 @@ static void sendMsgStopUseXpCat( bool isRingCatalyser ) } } +// *************************************************************************** +static void checkItemCommand(const CItemSheet *itemSheet) +{ + if (itemSheet) + { + if (!itemSheet->Scroll.LuaCommand.empty()) + CLuaManager::getInstance().executeLuaScript(itemSheet->Scroll.LuaCommand); + // webig + if (!itemSheet->Scroll.WebCommand.empty()) + { + CGroupHTML *pGH = dynamic_cast( + CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html") + ); + if (pGH) pGH->browse(itemSheet->Scroll.WebCommand.c_str()); + } + } + return; +} // *************************************************************************** class CHandlerTeleportUse : public IActionHandler @@ -2209,6 +2302,8 @@ class CHandlerTeleportUse : public IActionHandler LoadingBackground = TeleportKaravanBackground; break; } + if (pIS->Scroll.Label.empty()) + checkItemCommand(pIS); } } }; @@ -2223,12 +2318,28 @@ class CHandlerItemConsume : public IActionHandler CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); if (pCS == NULL) return; + const CItemSheet *pIS = pCS->asItemSheet(); + if (pIS && pIS->Scroll.Label.empty()) + checkItemCommand(pIS); + // use the item sendMsgUseItem(uint16(pCS->getIndexInDB())); } }; REGISTER_ACTION_HANDLER( CHandlerItemConsume, "item_consume" ); +// *************************************************************************** +class CHandlerItemExecute : public IActionHandler +{ + void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) + { + CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); + if (pCS) + checkItemCommand(pCS->asItemSheet()); + return; + } +}; +REGISTER_ACTION_HANDLER( CHandlerItemExecute, "item_execute" ); // *************************************************************************** class CHandlerValidateItemTextEdition : public IActionHandler @@ -2252,6 +2363,10 @@ class CHandlerItemTextDisplay : public IActionHandler if (pCSItem == NULL || windowName.empty()) return; + const CItemSheet *pIS = pCSItem->asItemSheet(); + if (pIS && pIS->Scroll.Label.empty()) + checkItemCommand(pIS); + CInterfaceItemEdition::getInstance()->setCurrWindow(pCSItem, windowName, false); } }; @@ -2293,6 +2408,10 @@ class CHandlerXpCatalyserUse : public IActionHandler CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); if (pCS == NULL) return; + const CItemSheet *pIS = pCS->asItemSheet(); + if (pIS && pIS->Scroll.Label.empty()) + checkItemCommand(pIS); + // use the item sendMsgUseItem(uint16(pCS->getIndexInDB())); } From 856f7e88f264c28a3e1254312837ac5e36eb296e Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Thu, 29 Oct 2020 11:29:49 +0800 Subject: [PATCH 074/205] Update general_settings_widget.cpp --- .../client/client_config_qt/src/general_settings_widget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ryzom/tools/client/client_config_qt/src/general_settings_widget.cpp b/ryzom/tools/client/client_config_qt/src/general_settings_widget.cpp index f38e5299b..6bb81f70f 100644 --- a/ryzom/tools/client/client_config_qt/src/general_settings_widget.cpp +++ b/ryzom/tools/client/client_config_qt/src/general_settings_widget.cpp @@ -42,13 +42,13 @@ void CGeneralSettingsWidget::load() CSystem &s = CSystem::GetInstance(); std::vector codes = NLMISC::CI18N::getLanguageCodes(); - std::vector names = NLMISC::CI18N::getLanguageNames(); + std::vector names = NLMISC::CI18N::getLanguageNames(); languageComboBox->clear(); for(uint i = 0; i < codes.size(); ++i) { - languageComboBox->addItem(QString::fromUtf16(names[i].c_str()), QString::fromUtf8(codes[i].c_str())); + languageComboBox->addItem(QString::fromUtf8(names[i].c_str()), QString::fromUtf8(codes[i].c_str())); } sint32 cbIndex = getIndexForLanguageCode( QString::fromUtf8( s.config.getString( "LanguageCode" ).c_str() ) ); From 2450f95c03edb83c11463c83c3572aef3ac027ce Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 11:11:41 +0800 Subject: [PATCH 075/205] Fix XP build --- nel/src/3d/driver/direct3d/driver_direct3d.cpp | 2 ++ nel/src/3d/driver/opengl/driver_opengl_window.cpp | 2 ++ nel/src/misc/inter_window_msg_queue.cpp | 2 ++ nel/src/misc/win_event_emitter.cpp | 5 +++++ 4 files changed, 11 insertions(+) diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/nel/src/3d/driver/direct3d/driver_direct3d.cpp index bb954ba4d..f26a37afb 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -1265,9 +1265,11 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l return 0; } +#ifdef WM_UNICHAR // https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar if (message == WM_UNICHAR) return (wParam == UNICODE_NOCHAR); +#endif return DefWindowProcW(hWnd, message, wParam, lParam); } diff --git a/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/nel/src/3d/driver/opengl/driver_opengl_window.cpp index dc48ecbf0..a987b7425 100644 --- a/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -183,9 +183,11 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l return 0; } +#ifdef WM_UNICHAR // https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar if (message == WM_UNICHAR) return (wParam == UNICODE_NOCHAR); +#endif return trapMessage ? 0 : DefWindowProcW(hWnd, message, wParam, lParam); } diff --git a/nel/src/misc/inter_window_msg_queue.cpp b/nel/src/misc/inter_window_msg_queue.cpp index ead2565a4..74c34b281 100644 --- a/nel/src/misc/inter_window_msg_queue.cpp +++ b/nel/src/misc/inter_window_msg_queue.cpp @@ -459,9 +459,11 @@ namespace NLMISC { return handleWMCopyData(hwnd, (COPYDATASTRUCT *) lParam); } +#ifdef WM_UNICHAR // https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar if (uMsg == WM_UNICHAR) return (wParam == UNICODE_NOCHAR); +#endif return DefWindowProc(hwnd, uMsg, wParam, lParam); } diff --git a/nel/src/misc/win_event_emitter.cpp b/nel/src/misc/win_event_emitter.cpp index 0d370cffc..8788bab7b 100644 --- a/nel/src/misc/win_event_emitter.cpp +++ b/nel/src/misc/win_event_emitter.cpp @@ -162,6 +162,7 @@ bool CWinEventEmitter::processMessage (HWND hWnd, uint32 msg, WPARAM wParam, LPA server->postEvent (new CEventKeyUp ((NLMISC::TKey)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this)); } break; +#ifdef WM_UNICHAR case WM_UNICHAR: if (wParam != UNICODE_NOCHAR && _KeyboardEventsEnabled) { @@ -170,11 +171,15 @@ bool CWinEventEmitter::processMessage (HWND hWnd, uint32 msg, WPARAM wParam, LPA server->postEvent (new CEventChar ((u32char)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this)); } break; +#endif case WM_CHAR: if (_KeyboardEventsEnabled) { //if (wParam < KeyCount) //nlinfo("WM_CHAR with %u", wParam); +#ifndef WM_UNICHAR + // FIXME: Combine UTF-16 pairs +#endif server->postEvent (new CEventChar ((ucchar)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this)); } break; From 560a19e6f727e835e556130c51b186dc3a8ba390 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 11:17:18 +0800 Subject: [PATCH 076/205] Fix build --- nel/src/gui/view_text.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index 4f0b71c60..acb898d12 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -119,9 +119,11 @@ namespace NLGUI // - "_" that should be the character with the lowest part // - A with an accent for the highest part // https://www.compart.com/en/unicode/U+00C4 - _FontSizingChars = { (u32char)'_', 0x000000C4 }; + static const u32char chars[] = { (u32char)'_', 0x000000C4, 0 }; + _FontSizingChars = chars; // fallback if SizingChars are not supported by font - _FontSizingFallback = { (u32char)'|' }; + static const u32char fallback[] = { (u32char)'|', 0 }; + _FontSizingFallback = fallback; computeFontSize (); } @@ -954,13 +956,15 @@ namespace NLGUI } // "_Ä" lowest/highest chars (underscore, A+diaeresis) - _FontSizingChars = { (u32char)'_', 0x000000C4 }; + static const u32char chars[] = { (u32char)'_', 0x000000C4, 0 }; + _FontSizingChars = chars; prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_chars" ); if (prop) _FontSizingChars = CUtfStringView((const char*)prop).toUtf32(); // fallback if SizingChars are not supported by font - _FontSizingFallback = { (u32char)'|' }; + static const u32char fallback[] = { (u32char)'|', 0 }; + _FontSizingFallback = fallback; prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_fallback" ); if (prop) _FontSizingFallback = CUtfStringView((const char*)prop).toUtf32(); From 9ff5eee1e81357c65f7688455ab25cb64dae04f6 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 29 Oct 2020 13:13:56 +0800 Subject: [PATCH 077/205] Fix --- nel/src/gui/view_text.cpp | 4 ++-- nel/src/gui/view_text_id.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index acb898d12..2f8a27d0c 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -2206,7 +2206,7 @@ namespace NLGUI if (_ClampRight) { CUtfStringView sv(_Text); - ::u32string ucStrLetter = u32string(1, (u32char)' '); + ::u32string ucStrLetter = ::u32string(1, (u32char)' '); for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) { ucStrLetter[0] = *it; @@ -2233,7 +2233,7 @@ namespace NLGUI { // FIXME: Optimize reverse UTF iteration ::u32string uctext = CUtfStringView(_Text).toUtf32(); - ::u32string ucStrLetter = u32string(1, (u32char)' '); + ::u32string ucStrLetter = ::u32string(1, (u32char)' '); for (sint i = (sint)uctext.size() - 1; i >= 0; --i) { ucStrLetter[0] = uctext[i]; diff --git a/nel/src/gui/view_text_id.cpp b/nel/src/gui/view_text_id.cpp index 1f1ac5440..ea961dd2a 100644 --- a/nel/src/gui/view_text_id.cpp +++ b/nel/src/gui/view_text_id.cpp @@ -228,8 +228,12 @@ namespace NLGUI while(NLMISC::strFindReplace(result, "{ros_exit}", "")); // Modify the text? - if(_StringModifier) - _StringModifier->onReceiveTextId(ucstring::makeFromUtf8(result)); + if (_StringModifier) + { + ucstring tmp = ucstring::makeFromUtf8(result); + _StringModifier->onReceiveTextId(tmp); // FIXME: UTF-8 + result = tmp.toUtf8(); + } // Set the Text if(_IsTextFormatTaged) From bc66f3a464f0801b19dddad186d68e7f4121bb2e Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Thu, 29 Oct 2020 13:44:04 +0800 Subject: [PATCH 078/205] Update css_parser.cpp --- nel/src/gui/css_parser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nel/src/gui/css_parser.cpp b/nel/src/gui/css_parser.cpp index ebc8d8d34..6967cd567 100644 --- a/nel/src/gui/css_parser.cpp +++ b/nel/src/gui/css_parser.cpp @@ -667,7 +667,8 @@ namespace NLGUI else if (_Style[_Position] == 0x00) { // Unicode replacement character - _Style[_Position] = 0xFFFD; + // _Style[_Position] = 0xFFFD; + _Style.replace(_Position, 1, "\xE\xB\xBD"); } else { From 850b8e0158d1d28f1e940f1dd1817a9fbfde6d39 Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Thu, 29 Oct 2020 13:44:38 +0800 Subject: [PATCH 079/205] Update css_parser.cpp --- nel/src/gui/css_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nel/src/gui/css_parser.cpp b/nel/src/gui/css_parser.cpp index 6967cd567..f3003b195 100644 --- a/nel/src/gui/css_parser.cpp +++ b/nel/src/gui/css_parser.cpp @@ -668,7 +668,7 @@ namespace NLGUI { // Unicode replacement character // _Style[_Position] = 0xFFFD; - _Style.replace(_Position, 1, "\xE\xB\xBD"); + _Style.replace(_Position, 1, "\xEF\xBF\xBD"); } else { From 396f0d808e90e2d77f9bdf032e66feaad1840425 Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Thu, 29 Oct 2020 14:06:23 +0800 Subject: [PATCH 080/205] Update unix_event_emitter.cpp --- nel/src/3d/driver/opengl/unix_event_emitter.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/nel/src/3d/driver/opengl/unix_event_emitter.cpp index 2945b90e7..fcb00b20e 100644 --- a/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -699,22 +699,21 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) if (XGetWindowProperty(_dpy, _win, XA_NEL_SEL, 0, XMaxRequestSize(_dpy), False, AnyPropertyType, &actualType, &actualFormat, &nitems, &bytesLeft, (unsigned char**)&data) != Success) return false; - ucstring text; - std::string tmpData = (const char*)data; + std::string text = (const char*)data; XFree(data); // convert buffer to ucstring if (target == XA_UTF8_STRING) { - text = ucstring::makeFromUtf8(tmpData); + // OK } else if (target == XA_STRING) { - text = tmpData; + // FIXME: Convert local to UTF-8 } else { - nlwarning("Unknow format %u", (uint)target); + nlwarning("Unknown format %u", (uint)target); } // sent string event to event server From ce9c7aae84e7123a193eb3ebe990bb08702c6705 Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Thu, 29 Oct 2020 14:33:53 +0800 Subject: [PATCH 081/205] Update action_handler_item.cpp --- ryzom/client/src/interface_v3/action_handler_item.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index d108e6a21..2145ac2b6 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -299,7 +299,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() editBoxShort->setInputString(std::string()); editBoxLarge->setInputString(std::string()); - display->setTextFormatTaged(ucstring()); + display->setTextFormatTaged(std::string()); // Finish the display or add the waiter if (getInventory().isItemInfoUpToDate(ItemSlotId)) From e5fce11618b29bd91ac4c0f7034a92657cddd010 Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Fri, 30 Oct 2020 03:25:02 +0800 Subject: [PATCH 082/205] Update group_map.cpp --- ryzom/client/src/interface_v3/group_map.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index d7d68477f..4537adaae 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -1240,9 +1240,7 @@ void CGroupMap::checkCoords() _RespawnLM[i] = createArkPointButton(_ArkPoints[i]); _RespawnLM[i]->setId(this->getId() + ":arklm_" + NLMISC::toString(i)); _RespawnLM[i]->setParent(this); - ucstring title; - title.fromUtf8(_ArkPoints[i].Title); - _RespawnLM[i]->setDefaultContextHelp(title); + _RespawnLM[i]->setDefaultContextHelp(_ArkPoints[i].Title); _RespawnLM[i]->HandleEvents = true; addCtrl(_RespawnLM[i]); updateLMPosFromDBPos(_RespawnLM[i], _ArkPoints[i].x, _ArkPoints[i].y); From 7c028d7a83161c63c0e4e10cebec7c2f216eb788 Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Fri, 30 Oct 2020 04:43:47 +0800 Subject: [PATCH 083/205] Update group_map.cpp --- ryzom/client/src/interface_v3/group_map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index 4537adaae..f96a2842c 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -2831,7 +2831,7 @@ void CGroupMap::addUserLandMark(const NLMISC::CVector2f &pos, const ucstring &ti CLandMarkButton *lmb = createLandMarkButton(options); lmb->setParent(this); lmb->Pos = pos; - lmb->setDefaultContextHelp(title); + lmb->setDefaultContextHelp(title.toUtf8()); _UserLM.push_back(lmb); addCtrl(lmb); invalidateCoords(); From 8dc777495ae9f5074ba257eb350e3974e94a3831 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 03:33:05 +0800 Subject: [PATCH 084/205] UTF-8 clipboard, ryzom/ryzomcore#335 --- nel/include/nel/3d/driver.h | 4 +- nel/include/nel/3d/driver_user.h | 4 +- nel/include/nel/3d/u_driver.h | 4 +- nel/include/nel/gui/event_descriptor.h | 2 +- nel/include/nel/gui/group_editbox.h | 6 +-- nel/include/nel/misc/event_emitter_multi.h | 4 +- nel/include/nel/misc/system_utils.h | 4 +- .../3d/driver/direct3d/driver_direct3d.cpp | 4 +- nel/src/3d/driver/direct3d/driver_direct3d.h | 4 +- nel/src/3d/driver/opengl/driver_opengl.h | 4 +- .../3d/driver/opengl/driver_opengl_window.cpp | 4 +- .../3d/driver/opengl/unix_event_emitter.cpp | 11 +++-- nel/src/3d/driver/opengl/unix_event_emitter.h | 6 +-- nel/src/3d/driver_user.cpp | 4 +- nel/src/gui/action_handler.cpp | 4 +- nel/src/gui/group_editbox.cpp | 10 ++-- nel/src/misc/event_emitter_multi.cpp | 4 +- nel/src/misc/system_utils.cpp | 46 ++++++++++++++----- nel/src/misc/utf_string_view.cpp | 2 +- 19 files changed, 76 insertions(+), 55 deletions(-) diff --git a/nel/include/nel/3d/driver.h b/nel/include/nel/3d/driver.h index 75472df37..0fdae7a58 100644 --- a/nel/include/nel/3d/driver.h +++ b/nel/include/nel/3d/driver.h @@ -262,10 +262,10 @@ public: virtual NLMISC::IEventEmitter *getEventEmitter() = 0; /// Copy a string to system clipboard. - virtual bool copyTextToClipboard(const ucstring &text) = 0; + virtual bool copyTextToClipboard(const std::string &text) = 0; /// Paste a string from system clipboard. - virtual bool pasteTextFromClipboard(ucstring &text) = 0;/// Return the depth of the driver after init(). + virtual bool pasteTextFromClipboard(std::string &text) = 0;/// Return the depth of the driver after init(). virtual uint8 getBitPerPixel() = 0; diff --git a/nel/include/nel/3d/driver_user.h b/nel/include/nel/3d/driver_user.h index c3564975f..862921f8f 100644 --- a/nel/include/nel/3d/driver_user.h +++ b/nel/include/nel/3d/driver_user.h @@ -558,10 +558,10 @@ public: // @} // Copy a string to system clipboard. - virtual bool copyTextToClipboard(const ucstring &text); + virtual bool copyTextToClipboard(const std::string &text); // Paste a string from system clipboard. - virtual bool pasteTextFromClipboard(ucstring &text); + virtual bool pasteTextFromClipboard(std::string &text); virtual uint64 getSwapBufferCounter(); diff --git a/nel/include/nel/3d/u_driver.h b/nel/include/nel/3d/u_driver.h index f4f78e2cb..ca8a98e02 100644 --- a/nel/include/nel/3d/u_driver.h +++ b/nel/include/nel/3d/u_driver.h @@ -835,10 +835,10 @@ public: /// \name Clipboard management // @{ // Copy a string to system clipboard. - virtual bool copyTextToClipboard(const ucstring &text) =0; + virtual bool copyTextToClipboard(const std::string &text) =0; // Paste a string from system clipboard. - virtual bool pasteTextFromClipboard(ucstring &text) =0; + virtual bool pasteTextFromClipboard(std::string &text) =0; // @} public: diff --git a/nel/include/nel/gui/event_descriptor.h b/nel/include/nel/gui/event_descriptor.h index dd2ae19c4..baa9414fd 100644 --- a/nel/include/nel/gui/event_descriptor.h +++ b/nel/include/nel/gui/event_descriptor.h @@ -60,7 +60,7 @@ public: keydown = 0, // a key has been press down. The key value is stored as a TKey keyup, // a key has been released. The key value is stored as a TKey keychar, // a key has been stroke. The key is a ucchar - keystring, // a string has been sent. The string is a ucstring + keystring, // a string has been sent. The string is a utf-8 string unknown, // uninitialized event }; CEventDescriptorKey() : _KeyEvent(unknown), _CtrlState(false), _ShiftState(false), _AltState(false), _Char(0) diff --git a/nel/include/nel/gui/group_editbox.h b/nel/include/nel/gui/group_editbox.h index 9b2998be0..3263837c1 100644 --- a/nel/include/nel/gui/group_editbox.h +++ b/nel/include/nel/gui/group_editbox.h @@ -140,7 +140,7 @@ namespace NLGUI // Paste the selection into buffer void paste(); // Write the string into buffer - void writeString(const ucstring &str, bool replace = true, bool atEnd = true); // UTF-16 because of Clipboard implementation + void writeString(const std::string &str, bool replace = true, bool atEnd = true); // Expand the expression (true if there was a '/' at the start of the line) bool expand(); @@ -299,9 +299,9 @@ namespace NLGUI void handleEventString(const NLGUI::CEventDescriptorKey &event); void setup(); void triggerOnChangeAH(); - void appendStringFromClipboard(const ucstring &str); // UTF-16 because of Clipboard implementation + void appendStringFromClipboard(const std::string &str); - ucstring getSelection(); // UTF-16 because of Clipboard implementation + std::string getSelection(); static CGroupEditBox *_MenuFather; diff --git a/nel/include/nel/misc/event_emitter_multi.h b/nel/include/nel/misc/event_emitter_multi.h index e41ee2055..9b8d25c64 100644 --- a/nel/include/nel/misc/event_emitter_multi.h +++ b/nel/include/nel/misc/event_emitter_multi.h @@ -48,8 +48,8 @@ public: /// From IEventEmitter. This call submitEvents on all the emitters virtual void submitEvents(CEventServer &server, bool allWindows); - virtual bool copyTextToClipboard(const ucstring &text); - virtual bool pasteTextFromClipboard(ucstring &text); + virtual bool copyTextToClipboard(const std::string &text); + virtual bool pasteTextFromClipboard(std::string &text); private: typedef std::vector > TEmitterCont; diff --git a/nel/include/nel/misc/system_utils.h b/nel/include/nel/misc/system_utils.h index 426e38b73..9093eb90d 100644 --- a/nel/include/nel/misc/system_utils.h +++ b/nel/include/nel/misc/system_utils.h @@ -49,10 +49,10 @@ public: static bool updateProgressBar(uint value, uint total); /// Copy a string to system clipboard. - static bool copyTextToClipboard(const ucstring &text); + static bool copyTextToClipboard(const std::string &text); /// Paste a string from system clipboard. - static bool pasteTextFromClipboard(ucstring &text); + static bool pasteTextFromClipboard(std::string &text); /// Check if system supports unicode. static bool supportUnicode(); diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/nel/src/3d/driver/direct3d/driver_direct3d.cpp index f26a37afb..6263de0f8 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -4018,12 +4018,12 @@ void CDriverD3D::findNearestFullscreenVideoMode() } } } -bool CDriverD3D::copyTextToClipboard(const ucstring &text) +bool CDriverD3D::copyTextToClipboard(const std::string &text) { return _EventEmitter.copyTextToClipboard(text); } -bool CDriverD3D::pasteTextFromClipboard(ucstring &text) +bool CDriverD3D::pasteTextFromClipboard(std::string &text) { return _EventEmitter.pasteTextFromClipboard(text); } diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.h b/nel/src/3d/driver/direct3d/driver_direct3d.h index c021f052d..bc7911df2 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -2748,8 +2748,8 @@ public: bool convertBitmapToIcon(const NLMISC::CBitmap &bitmap, HICON &icon, uint iconWidth, uint iconHeight, uint iconDepth, const NLMISC::CRGBA &col = NLMISC::CRGBA::White, sint hotSpotX = 0, sint hotSpotY = 0, bool cursor = false); - virtual bool copyTextToClipboard(const ucstring &text); - virtual bool pasteTextFromClipboard(ucstring &text); + virtual bool copyTextToClipboard(const std::string &text); + virtual bool pasteTextFromClipboard(std::string &text); public: #ifdef NL_DEBUG diff --git a/nel/src/3d/driver/opengl/driver_opengl.h b/nel/src/3d/driver/opengl/driver_opengl.h index e1ee968a5..e85d2da05 100644 --- a/nel/src/3d/driver/opengl/driver_opengl.h +++ b/nel/src/3d/driver/opengl/driver_opengl.h @@ -354,8 +354,8 @@ public: return _win; } - virtual bool copyTextToClipboard(const ucstring &text); - virtual bool pasteTextFromClipboard(ucstring &text); + virtual bool copyTextToClipboard(const std::string &text); + virtual bool pasteTextFromClipboard(std::string &text); virtual uint32 getAvailableVertexAGPMemory (); virtual uint32 getAvailableVertexVRAMMemory (); diff --git a/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/nel/src/3d/driver/opengl/driver_opengl_window.cpp index a987b7425..c60ec602e 100644 --- a/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -3020,12 +3020,12 @@ void CDriverGL::setupApplicationMenu() } #endif -bool CDriverGL::copyTextToClipboard(const ucstring &text) +bool CDriverGL::copyTextToClipboard(const std::string &text) { return _EventEmitter.copyTextToClipboard(text); } -bool CDriverGL::pasteTextFromClipboard(ucstring &text) +bool CDriverGL::pasteTextFromClipboard(std::string &text) { return _EventEmitter.pasteTextFromClipboard(text); } diff --git a/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/nel/src/3d/driver/opengl/unix_event_emitter.cpp index fcb00b20e..594d60183 100644 --- a/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -547,6 +547,7 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) server->postEvent (charEvent); #else + // FIXME: Convert locale to UTF-32 for (int i = 0; i < c; i++) { CEventChar *charEvent = new CEventChar ((u32char)(unsigned char)Text[i], getKeyButton(event.xbutton.state), this); @@ -610,14 +611,13 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) else if (req.target == XA_STRING) { respond.xselection.property = req.property; - std::string str = _CopiedString.toString(); + std::string str = _CopiedString; // NLMISC::CUtfStringView(_CopiedString).toAscii(); // FIXME: Convert UTF-8 to local XChangeProperty(req.display, req.requestor, req.property, XA_STRING, 8, PropModeReplace, (const unsigned char*)str.c_str(), str.length()); } else if (req.target == XA_UTF8_STRING) { respond.xselection.property = req.property; - std::string str = _CopiedString.toUtf8(); - XChangeProperty(req.display, req.requestor, respond.xselection.property, XA_UTF8_STRING, 8, PropModeReplace, (const unsigned char*)str.c_str(), str.length()); + XChangeProperty(req.display, req.requestor, respond.xselection.property, XA_UTF8_STRING, 8, PropModeReplace, (const unsigned char*)_CopiedString.c_str(), _CopiedString.length()); } else { @@ -710,6 +710,7 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) else if (target == XA_STRING) { // FIXME: Convert local to UTF-8 + // text = NLMISC::CUtfStringView(text).toAscii(); } else { @@ -767,7 +768,7 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) return true; } -bool CUnixEventEmitter::copyTextToClipboard(const ucstring &text) +bool CUnixEventEmitter::copyTextToClipboard(const std::string &text) { _CopiedString = text; @@ -786,7 +787,7 @@ bool CUnixEventEmitter::copyTextToClipboard(const ucstring &text) return true; } -bool CUnixEventEmitter::pasteTextFromClipboard(ucstring &text) +bool CUnixEventEmitter::pasteTextFromClipboard(std::string &text) { // check if we own the selection if (_SelectionOwned) diff --git a/nel/src/3d/driver/opengl/unix_event_emitter.h b/nel/src/3d/driver/opengl/unix_event_emitter.h index bbee65e5e..68dc81a48 100644 --- a/nel/src/3d/driver/opengl/unix_event_emitter.h +++ b/nel/src/3d/driver/opengl/unix_event_emitter.h @@ -66,12 +66,12 @@ public: /** * Copy a string to system clipboard. */ - virtual bool copyTextToClipboard(const ucstring &text); + virtual bool copyTextToClipboard(const std::string &text); /* * Paste a string from system clipboard. */ - virtual bool pasteTextFromClipboard(ucstring &text); + virtual bool pasteTextFromClipboard(std::string &text); void createIM(); void closeIM(); @@ -105,7 +105,7 @@ private: XIC _ic; NL3D::IDriver* _driver; CUnixEventServer _InternalServer; - ucstring _CopiedString; + std::string _CopiedString; bool _SelectionOwned; }; diff --git a/nel/src/3d/driver_user.cpp b/nel/src/3d/driver_user.cpp index b44a64737..02e9c4b27 100644 --- a/nel/src/3d/driver_user.cpp +++ b/nel/src/3d/driver_user.cpp @@ -1971,12 +1971,12 @@ bool CDriverUser::setRenderTarget(class UTexture & uTex, uint32 x, uint32 y, uin return result; } -bool CDriverUser::copyTextToClipboard(const ucstring &text) +bool CDriverUser::copyTextToClipboard(const std::string &text) { return _Driver->copyTextToClipboard(text); } -bool CDriverUser::pasteTextFromClipboard(ucstring &text) +bool CDriverUser::pasteTextFromClipboard(std::string &text) { return _Driver->pasteTextFromClipboard(text); } diff --git a/nel/src/gui/action_handler.cpp b/nel/src/gui/action_handler.cpp index 2b8bf890b..b80ce2f5f 100644 --- a/nel/src/gui/action_handler.cpp +++ b/nel/src/gui/action_handler.cpp @@ -751,9 +751,7 @@ namespace NLGUI { virtual void execute (CCtrlBase *pCaller, const std::string ¶ms) { - ucstring s; - s.fromUtf8(params); - if (!CViewRenderer::getInstance()->getDriver()->copyTextToClipboard(s)) + if (!CViewRenderer::getInstance()->getDriver()->copyTextToClipboard(params)) { nlwarning("Copy to clipboard failed: '%s'", params.c_str()); } diff --git a/nel/src/gui/group_editbox.cpp b/nel/src/gui/group_editbox.cpp index 47a36d0a1..dc7e34e16 100644 --- a/nel/src/gui/group_editbox.cpp +++ b/nel/src/gui/group_editbox.cpp @@ -805,7 +805,7 @@ namespace NLGUI cutSelection(); } - ucstring sString; + string sString; if (CViewRenderer::getInstance()->getDriver()->pasteTextFromClipboard(sString)) { @@ -815,7 +815,7 @@ namespace NLGUI } // ---------------------------------------------------------------------------- - void CGroupEditBox::appendStringFromClipboard(const ucstring &str) + void CGroupEditBox::appendStringFromClipboard(const std::string &str) { stopParentBlink(); makeTopWindow(); @@ -829,7 +829,7 @@ namespace NLGUI } // ---------------------------------------------------------------------------- - void CGroupEditBox::writeString(const ucstring &str16, bool replace, bool atEnd) + void CGroupEditBox::writeString(const std::string &str16, bool replace, bool atEnd) { ::u32string str = CUtfStringView(str16).toUtf32(); sint length = (sint)str.length(); @@ -1717,12 +1717,12 @@ namespace NLGUI } // *************************************************************************** - ucstring CGroupEditBox::getSelection() + std::string CGroupEditBox::getSelection() { ptrdiff_t minPos= min(_CursorPos, _SelectCursorPos); ptrdiff_t maxPos= max(_CursorPos, _SelectCursorPos); // get the selection - return CUtfStringView(_InputString.substr(minPos, maxPos-minPos)).toUtf16(); + return CUtfStringView(_InputString.substr(minPos, maxPos-minPos)).toUtf8(); } diff --git a/nel/src/misc/event_emitter_multi.cpp b/nel/src/misc/event_emitter_multi.cpp index 45559ebc4..a7d133f3c 100644 --- a/nel/src/misc/event_emitter_multi.cpp +++ b/nel/src/misc/event_emitter_multi.cpp @@ -98,13 +98,13 @@ const IEventEmitter *CEventEmitterMulti::getEmitter(uint index) const return _Emitters[index].first; } -bool CEventEmitterMulti::copyTextToClipboard(const ucstring &text) +bool CEventEmitterMulti::copyTextToClipboard(const std::string &text) { // Naush: wrapped to old API to avoid duplicate code return CSystemUtils::copyTextToClipboard(text); } -bool CEventEmitterMulti::pasteTextFromClipboard(ucstring &text) +bool CEventEmitterMulti::pasteTextFromClipboard(std::string &text) { // Naush: wrapped to old API to avoid duplicate code return CSystemUtils::pasteTextFromClipboard(text); diff --git a/nel/src/misc/system_utils.cpp b/nel/src/misc/system_utils.cpp index 63eecbf0d..ba15d5363 100644 --- a/nel/src/misc/system_utils.cpp +++ b/nel/src/misc/system_utils.cpp @@ -19,6 +19,7 @@ #include "stdmisc.h" #include "nel/misc/system_utils.h" +#include "nel/misc/utf_string_view.h" #ifdef NL_OS_WINDOWS #define INITGUID @@ -154,7 +155,7 @@ bool CSystemUtils::updateProgressBar(uint value, uint total) return true; } -bool CSystemUtils::copyTextToClipboard(const ucstring &text) +bool CSystemUtils::copyTextToClipboard(const std::string &text) { if (text.empty()) return false; @@ -167,10 +168,23 @@ bool CSystemUtils::copyTextToClipboard(const ucstring &text) bool isUnicode = (IsClipboardFormatAvailable(CF_UNICODETEXT) == TRUE); // allocates a buffer to copy text in global memory - std::string textLocal; - if (!isUnicode) textLocal = NLMISC::wideToMbcs((const wchar_t *)text.c_str(), text.size()); - if (text.size() && !textLocal.size()) textLocal = text.toString(); - HGLOBAL mem = GlobalAlloc(GHND | GMEM_DDESHARE, isUnicode ? ((text.size() + 1) * sizeof(wchar_t)) : textLocal.size()); + std::string textMbcs; + std::wstring textWide; + if (!isUnicode) + { + textMbcs = NLMISC::utf8ToMbcs(text); // Prefer system for API + if (text.size() && !textMbcs.size()) + textMbcs = CUtfStringView(text).toAscii(); // Fallback to 7-bit ASCII + } + else + { + textWide = NLMISC::utf8ToWide(text); // Prefer system for API + if (text.size() && !textWide.size()) + textWide = CUtfStringView(text).toWide(); + } + HGLOBAL mem = GlobalAlloc(GHND | GMEM_DDESHARE, isUnicode + ? ((textWide.size() + 1) * sizeof(wchar_t)) + : (textMbcs.size() + 1)); if (mem) { @@ -180,9 +194,9 @@ bool CSystemUtils::copyTextToClipboard(const ucstring &text) { // copy text to this buffer if (isUnicode) - wcscpy((wchar_t *)hLock, (const wchar_t *)text.c_str()); + wcscpy((wchar_t *)hLock, textWide.c_str()); else - strcpy((char *)hLock, textLocal.c_str()); + strcpy((char *)hLock, textMbcs.c_str()); // unlock buffer GlobalUnlock(mem); @@ -204,7 +218,7 @@ bool CSystemUtils::copyTextToClipboard(const ucstring &text) return res; } -bool CSystemUtils::pasteTextFromClipboard(ucstring &text) +bool CSystemUtils::pasteTextFromClipboard(std::string &text) { bool res = false; @@ -228,13 +242,21 @@ bool CSystemUtils::pasteTextFromClipboard(ucstring &text) // retrieve clipboard data if (isUnicode) { - text = (const ucchar *)hLock; + const wchar_t *str = (const wchar_t *)hLock; + text = NLMISC::wideToUtf8(str); // Prefer system for API + if (!text.size() && str[0]) + text = CUtfStringView(str).toUtf8(); + else + text = CUtfStringView(text).toUtf8(true); // Sanitize UTF-8 user input } else { - reinterpret_cast(text) = NLMISC::mbcsToWide((const char *)hLock); - if (!text.size() && ((const char *)hLock)[0]) - text = (const char *)hLock; + const char *str = (const char *)hLock; + text = NLMISC::mbcsToUtf8(str); // Prefer system for API + if (!text.size() && str[0]) + text = CUtfStringView(str).toAscii(); // Fallback to 7-bit ASCII + else + text = CUtfStringView(text).toUtf8(true); // Sanitize UTF-8 user input } // unlock data diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp index 070745202..d1239ae43 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -125,7 +125,7 @@ std::string CUtfStringView::toAscii() const if (c < 0x80) res += c; else - res += '_'; + res += '?'; } return res; } From 592ec2aaf1feb9b0a1afb6d35b4a201ffc97df03 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 03:42:43 +0800 Subject: [PATCH 085/205] Cleanup group container title localization behaviour, ryzom/ryzomcore#335 --- nel/include/nel/gui/group_container.h | 18 ++---- nel/include/nel/gui/group_html.h | 2 +- nel/include/nel/gui/string_case.h | 1 - nel/include/nel/gui/view_text.h | 4 +- nel/src/gui/group_container.cpp | 86 ++++++++++++--------------- nel/src/gui/group_html.cpp | 6 +- 6 files changed, 51 insertions(+), 66 deletions(-) diff --git a/nel/include/nel/gui/group_container.h b/nel/include/nel/gui/group_container.h index 361ae70b9..30d91dad6 100644 --- a/nel/include/nel/gui/group_container.h +++ b/nel/include/nel/gui/group_container.h @@ -248,13 +248,6 @@ namespace NLGUI // Get the header color draw. NB: depends if grayed, and if active. NLMISC::CRGBA getDrawnHeaderColor () const; - std::string getTitleRaw () const; - void setTitleRaw (const std::string &title); - std::string getTitleOpenedRaw () const; - void setTitleOpenedRaw (const std::string &title); - std::string getTitleClosedRaw () const; - void setTitleClosedRaw (const std::string &title); - ucstring getUCTitleOpened () const; void setUCTitleOpened (const ucstring &title); ucstring getUCTitleClosed () const; @@ -295,10 +288,6 @@ namespace NLGUI REFLECT_STRING("title_opened", getTitleOpened, setTitleOpened); REFLECT_STRING("title_closed", getTitleClosed, setTitleClosed); - REFLECT_STRING("title_raw", getTitleRaw, setTitleRaw); - REFLECT_STRING("title_opened_raw", getTitleOpenedRaw, setTitleOpenedRaw); - REFLECT_STRING("title_closed_raw", getTitleClosedRaw, setTitleClosedRaw); - REFLECT_UCSTRING("uc_title_opened", getUCTitleOpened, setUCTitleOpened); // FIXME: Lua UTF-8 REFLECT_UCSTRING("uc_title_closed", getUCTitleClosed, setUCTitleClosed); // FIXME: Lua UTF-8 REFLECT_UCSTRING("uc_title", getUCTitle, setUCTitle); // FIXME: Lua UTF-8 @@ -315,6 +304,8 @@ namespace NLGUI REFLECT_BOOL("lockable", isLockable, setLockable); REFLECT_BOOL("locked", isLocked, setLocked); + REFLECT_BOOL("localize", isLocalize, setLocalize); + REFLECT_BOOL("header_active", getHeaderActive, setHeaderActive); REFLECT_BOOL("right_button_enabled", getRightButtonEnabled, setRightButtonEnabled); REFLECT_EXPORT_END @@ -377,7 +368,7 @@ namespace NLGUI bool isActiveSavable() const { return _ActiveSavable; } bool isLocalize() const { return _Localize; } - void setLocalize(bool localize) { _Localize = localize; } + void setLocalize(bool localize); void setPopupX(sint32 x) { _PopupX = x; } void setPopupY(sint32 y) { _PopupY = y; } @@ -649,6 +640,9 @@ namespace NLGUI TTileClass convertTitleClass(const char *ptr); + void setTitledOpenedViewText(); + void setTitledClosedViewText(); + static COptionsContainerMove *getMoveOptions(); COptionsLayer *getContainerOptions(sint32 ls=-1); // Depends if overload by OptionsName or default used diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index 56605c0cc..a5e1dc4e1 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -352,7 +352,7 @@ namespace NLGUI // Set the title void setTitle (const std::string &title); std::string getTitle() const; - void setTitleRaw (const std::string &title); + void setContainerTitle (const std::string &title); // Lookup a url in local file system bool lookupLocalFile (std::string &result, const char *url, bool isUrl); diff --git a/nel/include/nel/gui/string_case.h b/nel/include/nel/gui/string_case.h index bd56c7998..446998e1a 100644 --- a/nel/include/nel/gui/string_case.h +++ b/nel/include/nel/gui/string_case.h @@ -21,7 +21,6 @@ #define STRING_CASE_H #include "nel/misc/types_nl.h" -#include "nel/misc/ucstring.h" namespace NLGUI { diff --git a/nel/include/nel/gui/view_text.h b/nel/include/nel/gui/view_text.h index 7c0324f58..1974e6933 100644 --- a/nel/include/nel/gui/view_text.h +++ b/nel/include/nel/gui/view_text.h @@ -84,7 +84,7 @@ namespace NLGUI /// Set - void setText(const std::string &text); + void setText(const std::string &text); //< Not localized. Use setHardText to localize strings starting with "ui". TODO: Add a Localize flag, like title in group container. HardText then simply sets localize to true. void setTextAsUtf16 (const ucstring &text); void setFontName (const std::string &name); void setFontSize (sint nFontSize, bool coef = true); @@ -178,7 +178,7 @@ namespace NLGUI void getLineEndIndex(uint line, sint &index, bool &endOfPreviousLine) const; std::string getHardText() const { return _HardText.empty() ? _Text : _HardText; } - void setHardText (const std::string &ht); + void setHardText (const std::string &ht); //< Localizes strings starting with "ui" void setHardTextAsUtf16(const ucstring &ht); std::string getColorAsString() const; diff --git a/nel/src/gui/group_container.cpp b/nel/src/gui/group_container.cpp index 141c7ba9b..e201f2eb4 100644 --- a/nel/src/gui/group_container.cpp +++ b/nel/src/gui/group_container.cpp @@ -3744,7 +3744,7 @@ namespace NLGUI _TitleOpened->setY (pLayer->getValSInt32 ("title_offset_y")); } _TitleOpened->setFontSize (pLayer->getValSInt32 ("title_font_size")); - if (_TitleClass==TitleText) _TitleOpened->setText (_TitleTextOpened); + if (_TitleClass == TitleText) setTitledOpenedViewText(); _TitleOpened->setActive (_Opened); // Title when the container is closed @@ -3796,7 +3796,7 @@ namespace NLGUI _TitleClosed->setY (pLayer->getValSInt32 ("title_offset_y")); } _TitleClosed->setFontSize (pLayer->getValSInt32 ("title_font_size")); - if (_TitleClass==TitleText) _TitleClosed->setText (_TitleTextClosed); + if (_TitleClass == TitleText) setTitledClosedViewText(); _TitleClosed->setActive(!_Opened); @@ -3946,6 +3946,15 @@ namespace NLGUI } } + // *************************************************************************** + void CGroupContainer::setLocalize(bool localize) + { + _Localize = localize; + setTitledOpenedViewText(); + setTitledClosedViewText(); + invalidateCoords(); + } + // *************************************************************************** std::string CGroupContainer::getTitle () const { @@ -3955,8 +3964,8 @@ namespace NLGUI // *************************************************************************** void CGroupContainer::setTitle (const std::string &title) { - if (_Localize) setTitleRaw (CI18N::get(title)); - else setTitleRaw (title); + setTitleOpened(title); + setTitleClosed(title); } // *************************************************************************** @@ -3968,8 +3977,9 @@ namespace NLGUI // *************************************************************************** void CGroupContainer::setTitleOpened (const std::string &title) { - if (_Localize) setTitleOpenedRaw (CI18N::get(title)); - else setTitleOpenedRaw (title); + _TitleTextOpened = title; + setTitledOpenedViewText(); + invalidateCoords(); } // *************************************************************************** @@ -3980,88 +3990,70 @@ namespace NLGUI // *************************************************************************** void CGroupContainer::setTitleClosed (const std::string &title) - { - if (_Localize) setTitleClosedRaw (CI18N::get(title)); - else setTitleClosedRaw (title); - } - - // *************************************************************************** - void CGroupContainer::setTitleOpenedRaw(const std::string &title) - { - _TitleTextOpened = title; - if (_TitleOpened != NULL) - _TitleOpened->setText (title); - invalidateCoords(); - } - - // *************************************************************************** - void CGroupContainer::setTitleClosedRaw(const std::string &title) { _TitleTextClosed = title; - if (_TitleClosed != NULL) - _TitleClosed->setText (_TitleTextClosed); + setTitledClosedViewText(); invalidateCoords(); } // *************************************************************************** - void CGroupContainer::setTitleRaw(const std::string &title) + void CGroupContainer::setTitledOpenedViewText() { - setTitleOpenedRaw(title); - setTitleClosedRaw(title); - } - - // *************************************************************************** - std::string CGroupContainer::getTitleRaw () const - { - return getTitleOpened(); - } - - // *************************************************************************** - std::string CGroupContainer::getTitleOpenedRaw () const - { - return _TitleTextOpened; + if (_TitleOpened != NULL) + { + if (_Localize && NLMISC::startsWith(_TitleTextOpened, "ui")) + _TitleOpened->setHardText(_TitleTextOpened); + else + _TitleOpened->setText(_TitleTextOpened); + } } // *************************************************************************** - std::string CGroupContainer::getTitleClosedRaw () const + void CGroupContainer::setTitledClosedViewText() { - return _TitleTextClosed; + if (_TitleClosed != NULL) + { + if (_Localize && NLMISC::startsWith(_TitleTextClosed, "ui")) + _TitleClosed->setHardText(_TitleTextClosed); + else + _TitleClosed->setText(_TitleTextClosed); + } } // *************************************************************************** void CGroupContainer::setUCTitleOpened(const ucstring &title) { - setTitleOpenedRaw(title.toUtf8()); + setTitleOpened(title.toUtf8()); } // *************************************************************************** void CGroupContainer::setUCTitleClosed(const ucstring &title) { - setTitleClosedRaw(title.toUtf8()); + setTitleClosed(title.toUtf8()); } // *************************************************************************** void CGroupContainer::setUCTitle(const ucstring &title) { - setTitleRaw(title.toUtf8()); + setTitle(title.toUtf8()); } // *************************************************************************** ucstring CGroupContainer::getUCTitle () const { - return ucstring::makeFromUtf8(getTitleRaw()); + return ucstring::makeFromUtf8(getTitle()); } // *************************************************************************** ucstring CGroupContainer::getUCTitleOpened () const { - return ucstring::makeFromUtf8(getTitleOpenedRaw()); + return ucstring::makeFromUtf8(getTitleOpened()); } // *************************************************************************** ucstring CGroupContainer::getUCTitleClosed () const { - return ucstring::makeFromUtf8(getTitleClosedRaw()); + return ucstring::makeFromUtf8(getTitleClosed()); } // *************************************************************************** diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index f7a62cc90..b85cb5bfc 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -3401,7 +3401,7 @@ namespace NLGUI // *************************************************************************** - void CGroupHTML::setTitleRaw (const std::string &title) + void CGroupHTML::setContainerTitle (const std::string &title) { CInterfaceElement *parent = getParent(); if (parent) @@ -3411,7 +3411,7 @@ namespace NLGUI CGroupContainer *container = dynamic_cast(parent); if (container) { - container->setTitleRaw (title); + container->setTitle(title); } } } @@ -3426,7 +3426,7 @@ namespace NLGUI } _TitleString += title; - setTitleRaw(_TitleString); + setContainerTitle(_TitleString); } std::string CGroupHTML::getTitle() const { From 7ea4b2b9895405509c6a1cb683578a1157e44338 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 04:42:30 +0800 Subject: [PATCH 086/205] Adjust font sizing --- nel/include/nel/gui/view_text.h | 4 ++-- nel/src/gui/view_text.cpp | 36 +++++++++++++++------------------ 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/nel/include/nel/gui/view_text.h b/nel/include/nel/gui/view_text.h index 1974e6933..2074576c1 100644 --- a/nel/include/nel/gui/view_text.h +++ b/nel/include/nel/gui/view_text.h @@ -262,8 +262,8 @@ namespace NLGUI // width of the font in pixel. Just a Hint for tabing format (computed with '_') float _FontWidth; // strings to use when computing font size - ::u32string _FontSizingChars; - ::u32string _FontSizingFallback; + std::string _FontSizingChars; + std::string _FontSizingFallback; // height of the font in pixel. // use getFontHeight float _FontHeight; diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index 2f8a27d0c..a307893c7 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -119,11 +119,9 @@ namespace NLGUI // - "_" that should be the character with the lowest part // - A with an accent for the highest part // https://www.compart.com/en/unicode/U+00C4 - static const u32char chars[] = { (u32char)'_', 0x000000C4, 0 }; - _FontSizingChars = chars; + _FontSizingChars = "_\xC3\x84q"; // fallback if SizingChars are not supported by font - static const u32char fallback[] = { (u32char)'|', 0 }; - _FontSizingFallback = fallback; + _FontSizingFallback = "|XO"; computeFontSize (); } @@ -399,12 +397,12 @@ namespace NLGUI else if ( name == "sizing_chars" ) { - return CUtfStringView(_FontSizingChars).toUtf8(); + return _FontSizingChars; } else if ( name == "sizing_fallback" ) { - return CUtfStringView(_FontSizingFallback).toUtf8(); + return _FontSizingFallback; } else return ""; @@ -691,13 +689,13 @@ namespace NLGUI else if( name == "sizing_chars" ) { - _FontSizingChars = CUtfStringView(value).toUtf32(); + _FontSizingChars = value; return true; } else if( name == "sizing_fallback" ) { - _FontSizingFallback = CUtfStringView(value).toUtf32(); + _FontSizingFallback = value; return true; } else @@ -769,8 +767,8 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "clamp_right", BAD_CAST toString( _ClampRight ).c_str() ); xmlSetProp( node, BAD_CAST "auto_clamp_offset", BAD_CAST toString( _AutoClampOffset ).c_str() ); xmlSetProp( node, BAD_CAST "continuous_update", BAD_CAST toString( _ContinuousUpdate ).c_str() ); - xmlSetProp( node, BAD_CAST "sizing_chars", BAD_CAST CUtfStringView(_FontSizingChars).toUtf8().c_str() ); - xmlSetProp( node, BAD_CAST "sizing_fallback", BAD_CAST CUtfStringView(_FontSizingFallback).toUtf8().c_str() ); + xmlSetProp( node, BAD_CAST "sizing_chars", BAD_CAST _FontSizingChars.c_str() ); + xmlSetProp( node, BAD_CAST "sizing_fallback", BAD_CAST _FontSizingFallback.c_str() ); return true; } @@ -956,18 +954,18 @@ namespace NLGUI } // "_Ä" lowest/highest chars (underscore, A+diaeresis) - static const u32char chars[] = { (u32char)'_', 0x000000C4, 0 }; - _FontSizingChars = chars; prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_chars" ); if (prop) - _FontSizingChars = CUtfStringView((const char*)prop).toUtf32(); + _FontSizingChars = (const char*)prop; + else + _FontSizingChars = "_\xC3\x84q"; // fallback if SizingChars are not supported by font - static const u32char fallback[] = { (u32char)'|', 0 }; - _FontSizingFallback = fallback; prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_fallback" ); if (prop) - _FontSizingFallback = CUtfStringView((const char*)prop).toUtf32(); + _FontSizingFallback = (const char *)prop; + else + _FontSizingFallback = "|XO"; computeFontSize (); } @@ -1475,10 +1473,8 @@ namespace NLGUI // *************************************************************************** void CViewText::setFontSizing(const std::string &chars, const std::string &fallback) { - _FontSizingChars.clear(); - _FontSizingChars = CUtfStringView(chars).toUtf32(); - _FontSizingFallback.clear(); - _FontSizingFallback = CUtfStringView(fallback).toUtf32(); + _FontSizingChars = chars; + _FontSizingFallback = fallback; } // *************************************************************************** From 4fba8cc18d380da875117dc89248fea55d417470 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 05:16:06 +0800 Subject: [PATCH 087/205] Improved vertical font centering --- nel/src/gui/view_text.cpp | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index a307893c7..0f4e93b89 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -3045,6 +3045,44 @@ namespace NLGUI TextContext->setEmbolden (_Embolden); TextContext->setOblique (_Oblique); +#if 1 + + UTextContext::CStringInfo si = TextContext->getStringInfo("XO"); + float xoHeight = si.StringHeight; + + si = TextContext->getStringInfo("XO\xC3\x81\xC3\x83"); + float upHeight = si.StringHeight; + + si = TextContext->getStringInfo("XOgq"); + float downHeight = si.StringHeight; + float legHeight = si.StringLine; + + nlassert(upHeight >= xoHeight); + nlassert(downHeight >= xoHeight); + float diff; + if (downHeight > upHeight) + { + diff = downHeight - xoHeight; + } + else + { + diff = upHeight - xoHeight; + legHeight += upHeight - downHeight; + } + + _FontHeight = xoHeight + diff + diff; + _FontLegHeight = legHeight; + + // Space width + si = TextContext->getStringInfo(" "); + _SpaceWidth = si.StringWidth; + + // Font Width (used for ) + si = TextContext->getStringInfo("O"); + _FontWidth = si.StringWidth; + +#else + // Letter size UTextContext::CStringInfo si = TextContext->getStringInfo(_FontSizingChars); @@ -3065,6 +3103,8 @@ namespace NLGUI // Font Width (used for ) si = TextContext->getStringInfo("_"); _FontWidth = si.StringWidth; + +#endif } From 0499fce27dfb3a48d28d632e1e0230f15130c292 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 04:42:42 +0800 Subject: [PATCH 088/205] Fix login alignment --- ryzom/client/data/gamedev/interfaces_v3/login_main.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ryzom/client/data/gamedev/interfaces_v3/login_main.xml b/ryzom/client/data/gamedev/interfaces_v3/login_main.xml index 9d5a9da3b..fb45a7123 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/login_main.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/login_main.xml @@ -47,17 +47,17 @@ --> - + - - + - Date: Thu, 29 Oct 2020 22:10:55 +0000 Subject: [PATCH 089/205] Update out_v2_select.xml closes #117 --- .../gamedev/interfaces_v3/out_v2_select.xml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ryzom/client/data/gamedev/interfaces_v3/out_v2_select.xml b/ryzom/client/data/gamedev/interfaces_v3/out_v2_select.xml index 6263f9d29..28ace0100 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/out_v2_select.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/out_v2_select.xml @@ -781,22 +781,22 @@ - - - - - - - - - + + + + + + + + + Date: Fri, 30 Oct 2020 09:41:01 +0800 Subject: [PATCH 090/205] Update copyright attribution for GPL compliance --- nel/include/nel/3d/computed_string.h | 2 +- nel/include/nel/3d/driver.h | 2 +- nel/include/nel/3d/driver_user.h | 2 +- nel/include/nel/3d/font_generator.h | 3 +++ nel/include/nel/3d/font_manager.h | 3 +++ nel/include/nel/3d/landscape.h | 3 +++ nel/include/nel/3d/text_context.h | 2 +- nel/include/nel/3d/text_context_user.h | 2 +- nel/include/nel/3d/texture.h | 3 +++ nel/include/nel/3d/texture_font.h | 3 +++ nel/include/nel/3d/u_driver.h | 2 +- nel/include/nel/3d/u_text_context.h | 2 +- nel/include/nel/gui/css_parser.h | 3 +++ nel/include/nel/gui/ctrl_base.h | 1 + nel/include/nel/gui/ctrl_text_button.h | 1 + nel/include/nel/gui/dbgroup_combo_box.h | 2 +- nel/include/nel/gui/dbview_quantity.h | 1 + nel/include/nel/gui/event_descriptor.h | 1 + nel/include/nel/gui/group_container.h | 1 + nel/include/nel/gui/group_editbox.h | 1 + nel/include/nel/gui/group_html.h | 1 + nel/include/nel/gui/group_list.h | 1 + nel/include/nel/gui/group_menu.h | 2 +- nel/include/nel/gui/group_paragraph.h | 1 + nel/include/nel/gui/group_tree.h | 1 + nel/include/nel/gui/interface_element.h | 1 + nel/include/nel/gui/interface_expr.h | 1 + nel/include/nel/gui/interface_group.h | 1 + nel/include/nel/gui/lua_helper.h | 2 +- nel/include/nel/gui/lua_helper_inline.h | 2 +- nel/include/nel/gui/reflect.h | 1 + nel/include/nel/gui/string_case.h | 1 + nel/include/nel/gui/view_pointer.h | 1 + nel/include/nel/gui/view_text.h | 2 +- nel/include/nel/gui/view_text_formated.h | 1 + nel/include/nel/gui/view_text_id.h | 1 + nel/include/nel/gui/view_text_id_formated.h | 1 + nel/include/nel/gui/widget_manager.h | 2 +- nel/include/nel/misc/common.h | 2 +- nel/include/nel/misc/debug.h | 2 +- nel/include/nel/misc/event_emitter_multi.h | 3 +++ nel/include/nel/misc/events.h | 3 +++ nel/include/nel/misc/file.h | 3 +++ nel/include/nel/misc/i18n.h | 1 + nel/include/nel/misc/sha1.h | 2 +- nel/include/nel/misc/sheet_id.h | 2 +- nel/include/nel/misc/stream.h | 3 +++ nel/include/nel/misc/string_common.h | 2 +- nel/include/nel/misc/system_utils.h | 2 +- nel/include/nel/misc/types_nl.h | 2 +- nel/include/nel/misc/ucstring.h | 2 +- nel/include/nel/net/unified_network.h | 3 +++ nel/include/nel/sound/music_channel_fader.h | 2 +- nel/include/nel/sound/stream_file_source.h | 2 +- nel/include/nel/web/http_client_curl.h | 2 +- nel/samples/misc/i18n/main.cpp | 3 +++ .../3d/driver/direct3d/driver_direct3d.cpp | 2 +- nel/src/3d/driver/direct3d/driver_direct3d.h | 2 +- .../direct3d/driver_direct3d_material.cpp | 2 +- .../direct3d/driver_direct3d_texture.cpp | 2 +- nel/src/3d/driver/opengl/driver_opengl.h | 2 +- .../driver/opengl/driver_opengl_extension.cpp | 2 +- .../driver_opengl_vertex_buffer_hard.cpp | 2 +- .../3d/driver/opengl/driver_opengl_window.cpp | 2 +- .../3d/driver/opengl/unix_event_emitter.cpp | 2 +- nel/src/3d/driver/opengl/unix_event_emitter.h | 1 + nel/src/3d/driver_user.cpp | 2 +- nel/src/3d/font_generator.cpp | 2 +- nel/src/3d/font_manager.cpp | 3 +++ nel/src/3d/fxaa.cpp | 2 +- nel/src/3d/lod_character_manager.cpp | 3 +++ nel/src/3d/packed_zone.cpp | 3 +++ nel/src/3d/render_trav.cpp | 2 +- nel/src/3d/scene.cpp | 2 +- nel/src/3d/shadow_map_manager.cpp | 2 +- nel/src/3d/shape_bank.cpp | 3 +++ nel/src/3d/surface_light_grid.cpp | 3 +++ nel/src/3d/tessellation.cpp | 3 +++ nel/src/3d/text_context.cpp | 2 +- nel/src/3d/text_context_user.cpp | 2 +- nel/src/3d/texture_bump.cpp | 3 +++ nel/src/georges/form.cpp | 2 +- nel/src/georges/type.cpp | 2 +- nel/src/gui/action_handler.cpp | 1 + nel/src/gui/css_parser.cpp | 3 +++ nel/src/gui/ctrl_base.cpp | 1 + nel/src/gui/ctrl_scroll.cpp | 2 +- nel/src/gui/ctrl_text_button.cpp | 1 + nel/src/gui/dbgroup_combo_box.cpp | 2 +- nel/src/gui/dbview_number.cpp | 1 + nel/src/gui/dbview_quantity.cpp | 1 + nel/src/gui/group_container.cpp | 2 +- nel/src/gui/group_editbox.cpp | 1 + nel/src/gui/group_header.cpp | 1 + nel/src/gui/group_html.cpp | 2 +- nel/src/gui/group_list.cpp | 1 + nel/src/gui/group_menu.cpp | 2 +- nel/src/gui/group_paragraph.cpp | 1 + nel/src/gui/group_tree.cpp | 1 + nel/src/gui/interface_expr.cpp | 1 + nel/src/gui/interface_expr_user_fct.cpp | 1 + nel/src/gui/interface_group.cpp | 2 +- nel/src/gui/interface_link.cpp | 2 +- nel/src/gui/lua_helper.cpp | 2 +- nel/src/gui/lua_ihm.cpp | 2 +- nel/src/gui/string_case.cpp | 1 + nel/src/gui/view_pointer.cpp | 1 + nel/src/gui/view_renderer.cpp | 1 + nel/src/gui/view_text.cpp | 2 +- nel/src/gui/view_text_formated.cpp | 1 + nel/src/gui/view_text_id.cpp | 1 + nel/src/gui/view_text_id_formated.cpp | 1 + nel/src/gui/widget_manager.cpp | 2 +- nel/src/ligo/primitive.cpp | 1 + nel/src/logic/logic_state_machine.cpp | 3 +++ nel/src/misc/big_file.cpp | 3 +++ nel/src/misc/bitmap.cpp | 2 +- nel/src/misc/cdb_branch.cpp | 2 +- nel/src/misc/co_task.cpp | 2 +- nel/src/misc/common.cpp | 2 +- nel/src/misc/debug.cpp | 2 +- nel/src/misc/diff_tool.cpp | 3 +++ nel/src/misc/eid_translator.cpp | 3 +++ nel/src/misc/eval_num_expr.cpp | 2 +- nel/src/misc/event_emitter_multi.cpp | 3 +++ nel/src/misc/file.cpp | 2 +- nel/src/misc/i18n.cpp | 1 + nel/src/misc/i_xml.cpp | 3 +++ nel/src/misc/inter_window_msg_queue.cpp | 3 +++ nel/src/misc/mem_displayer.cpp | 2 +- nel/src/misc/object_arena_allocator.cpp | 2 +- nel/src/misc/path.cpp | 2 +- nel/src/misc/seven_zip.cpp | 2 +- nel/src/misc/string_common.cpp | 2 +- nel/src/misc/string_mapper.cpp | 3 +++ nel/src/misc/system_info.cpp | 2 +- nel/src/misc/system_utils.cpp | 2 +- nel/src/misc/ucstring.cpp | 3 +++ nel/src/misc/unicode.cpp | 3 +++ nel/src/misc/win_displayer.cpp | 2 +- nel/src/misc/win_event_emitter.cpp | 2 +- nel/src/misc/win_thread.cpp | 2 +- nel/src/net/unified_network.cpp | 2 +- nel/src/pacs/build_indoor.cpp | 2 +- nel/src/pacs/move_container.cpp | 3 +++ nel/src/sound/audio_decoder.cpp | 2 +- .../sound/driver/xaudio2/source_xaudio2.cpp | 2 +- nel/src/sound/music_channel_fader.cpp | 2 +- nel/src/sound/stream_file_source.cpp | 2 +- .../3d/build_clodtex/lod_texture_builder.cpp | 3 +++ nel/tools/3d/ig_elevation/main.cpp | 2 +- nel/tools/3d/panoply_preview/main_window.cpp | 2 +- .../nel_3dsmax_shared/string_common.h | 2 +- .../plugin_max/nel_patch_converter/script.cpp | 2 +- nel/tools/pacs/build_rbank/prim_checker.cpp | 2 +- ryzom/client/src/actions.cpp | 1 + ryzom/client/src/actions.h | 2 +- ryzom/client/src/bg_downloader_access.cpp | 2 +- ryzom/client/src/character_cl.cpp | 2 +- ryzom/client/src/client_cfg.cpp | 2 +- ryzom/client/src/client_cfg.h | 2 +- ryzom/client/src/client_chat_manager.cpp | 1 + .../src/client_sheets/character_sheet.cpp | 3 +++ ryzom/client/src/client_sheets/item_sheet.cpp | 3 +++ ryzom/client/src/client_sheets/item_sheet.h | 3 +++ ryzom/client/src/commands.cpp | 2 +- ryzom/client/src/connection.cpp | 2 +- ryzom/client/src/contextual_cursor.cpp | 1 + ryzom/client/src/continent.cpp | 3 +++ ryzom/client/src/debug_client.cpp | 2 +- ryzom/client/src/entity_cl.cpp | 2 +- ryzom/client/src/far_tp.cpp | 2 +- ryzom/client/src/forage_source_cl.cpp | 1 + ryzom/client/src/fx_cl.cpp | 3 +++ ryzom/client/src/game_context_menu.cpp | 1 + ryzom/client/src/init.cpp | 2 +- ryzom/client/src/init_main_loop.cpp | 2 +- .../src/interface_v3/action_handler_edit.cpp | 1 + .../src/interface_v3/action_handler_game.cpp | 2 +- .../src/interface_v3/action_handler_help.cpp | 1 + .../src/interface_v3/action_handler_item.cpp | 1 + .../interface_v3/action_handler_phrase.cpp | 1 + .../src/interface_v3/action_phrase_faber.cpp | 1 + .../bot_chat_page_create_guild.cpp | 1 + .../bot_chat_page_dynamic_mission.cpp | 1 + .../src/interface_v3/bot_chat_page_trade.cpp | 1 + .../src/interface_v3/chat_text_manager.cpp | 1 + ryzom/client/src/interface_v3/chat_window.cpp | 1 + ryzom/client/src/interface_v3/chat_window.h | 1 + .../client/src/interface_v3/dbctrl_sheet.cpp | 2 +- ryzom/client/src/interface_v3/dbctrl_sheet.h | 2 +- .../src/interface_v3/dbgroup_build_phrase.cpp | 1 + .../dbgroup_list_sheet_icon_phrase.cpp | 1 + .../dbgroup_list_sheet_mission.cpp | 1 + .../interface_v3/dbgroup_list_sheet_text.cpp | 2 +- .../interface_v3/dbgroup_list_sheet_text.h | 1 + ...roup_list_sheet_text_brick_composition.cpp | 2 +- .../dbgroup_list_sheet_text_phrase.cpp | 1 + .../dbgroup_list_sheet_text_phrase_id.cpp | 3 +++ .../interface_v3/dbgroup_list_sheet_trade.cpp | 1 + .../src/interface_v3/encyclopedia_manager.cpp | 1 + .../src/interface_v3/flying_text_manager.cpp | 1 + .../client/src/interface_v3/group_compas.cpp | 1 + .../client/src/interface_v3/group_html_cs.cpp | 1 + ryzom/client/src/interface_v3/group_html_cs.h | 1 + .../src/interface_v3/group_html_forum.cpp | 1 + .../src/interface_v3/group_html_forum.h | 1 + .../src/interface_v3/group_html_mail.cpp | 1 + .../client/src/interface_v3/group_html_mail.h | 1 + .../src/interface_v3/group_html_webig.h | 1 + .../interface_v3/group_in_scene_bubble.cpp | 1 + .../interface_v3/group_in_scene_user_info.cpp | 2 +- ryzom/client/src/interface_v3/group_map.cpp | 2 +- .../src/interface_v3/group_modal_get_key.cpp | 1 + .../group_phrase_skill_filter.cpp | 1 + .../src/interface_v3/group_quick_help.cpp | 1 + .../src/interface_v3/group_quick_help.h | 1 + .../client/src/interface_v3/group_skills.cpp | 1 + .../client/src/interface_v3/guild_manager.cpp | 1 + .../interface_v3/input_handler_manager.cpp | 2 +- .../src/interface_v3/input_handler_manager.h | 1 + .../client/src/interface_v3/interface_ddx.cpp | 1 + .../interface_expr_user_fct_game.cpp | 1 + .../interface_expr_user_fct_items.cpp | 1 + .../src/interface_v3/interface_manager.cpp | 2 +- .../src/interface_v3/interface_manager.h | 2 +- .../src/interface_v3/inventory_manager.cpp | 2 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 2 +- .../client/src/interface_v3/macrocmd_key.cpp | 1 + .../src/interface_v3/macrocmd_manager.cpp | 1 + .../client/src/interface_v3/music_player.cpp | 1 + .../src/interface_v3/people_interraction.cpp | 2 +- ryzom/client/src/interface_v3/people_list.cpp | 1 + .../client/src/interface_v3/skill_manager.cpp | 1 + .../src/interface_v3/sphrase_manager.cpp | 2 +- .../src/interface_v3/task_bar_manager.cpp | 1 + ryzom/client/src/item_group_manager.cpp | 3 +++ ryzom/client/src/login.cpp | 2 +- ryzom/client/src/login_patch.cpp | 2 +- ryzom/client/src/main_loop.cpp | 2 +- ryzom/client/src/main_loop_debug.cpp | 2 +- ryzom/client/src/net_manager.cpp | 2 +- ryzom/client/src/network_connection.cpp | 2 +- ryzom/client/src/network_connection.h | 2 +- ryzom/client/src/player_cl.cpp | 1 + ryzom/client/src/progress.cpp | 2 +- ryzom/client/src/r2/auto_group.cpp | 3 +++ .../client/src/r2/displayer_visual_entity.cpp | 2 +- .../client/src/r2/displayer_visual_group.cpp | 1 + .../src/r2/dmc/client_edition_module.cpp | 2 +- ryzom/client/src/r2/dmc/com_lua_module.cpp | 2 +- ryzom/client/src/r2/editor.cpp | 2 +- ryzom/client/src/r2/instance_map_deco.cpp | 1 + ryzom/client/src/r2/instance_map_deco.h | 1 + ryzom/client/src/r2/prim_render.cpp | 1 + ryzom/client/src/r2/tool_select_move.cpp | 3 +++ ryzom/client/src/session_browser.cpp | 3 +++ ryzom/client/src/session_browser_impl.cpp | 2 +- ryzom/client/src/string_manager_client.h | 3 +++ ryzom/client/src/timed_fx_manager.cpp | 2 +- ryzom/client/src/user_entity.cpp | 2 +- ryzom/common/src/game_share/crypt.cpp | 2 +- .../src/game_share/mirrored_data_set.cpp | 2 +- ryzom/common/src/game_share/object.cpp | 2 +- ryzom/common/src/game_share/object.h | 3 +++ ryzom/common/src/game_share/rm_family.cpp | 3 +++ ryzom/common/src/game_share/rm_family.h | 3 +++ ryzom/common/src/game_share/roles.cpp | 3 +++ ryzom/common/src/game_share/roles.h | 3 +++ .../game_share/server_animation_module.cpp | 3 +++ .../time_weather_season/weather_function.cpp | 3 +++ ryzom/common/src/game_share/timer.h | 3 +++ ryzom/common/src/game_share/utils.h | 1 + .../src/game_share/visual_slot_manager.h | 3 +++ .../src/general_settings_widget.cpp | 3 +++ .../georges_dll/file_tree_view.cpp | 2 +- .../leveldesign/georges_dll/form_dialog.cpp | 2 +- .../leveldesign/mission_compiler_lib/main.cpp | 3 +++ ryzom/tools/leveldesign/mp_generator/main.cpp | 1 + .../world_editor/world_editor.cpp | 2 +- .../sheets_packer_shard.cpp | 2 +- ryzom/tools/translation_tools/main.cpp | 2 +- .../bnp_manager/bnp_manager_window.cpp | 3 +++ .../plugins/core/general_settings_page.cpp | 1 + .../georges_editor/georges_editor_form.cpp | 1 + .../georges_treeview_dialog.cpp | 2 +- tool/attribution/annotate.py | 25 +++++++++++-------- 287 files changed, 410 insertions(+), 143 deletions(-) diff --git a/nel/include/nel/3d/computed_string.h b/nel/include/nel/3d/computed_string.h index 35bfb692c..c0ae90578 100644 --- a/nel/include/nel/3d/computed_string.h +++ b/nel/include/nel/3d/computed_string.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/3d/driver.h b/nel/include/nel/3d/driver.h index 0fdae7a58..1892aace0 100644 --- a/nel/include/nel/3d/driver.h +++ b/nel/include/nel/3d/driver.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/3d/driver_user.h b/nel/include/nel/3d/driver_user.h index 862921f8f..a59d167a4 100644 --- a/nel/include/nel/3d/driver_user.h +++ b/nel/include/nel/3d/driver_user.h @@ -4,7 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2010 Matt RAYKOWSKI (sfb) // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/3d/font_generator.h b/nel/include/nel/3d/font_generator.h index ea737afab..eca05d456 100644 --- a/nel/include/nel/3d/font_generator.h +++ b/nel/include/nel/3d/font_generator.h @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/include/nel/3d/font_manager.h b/nel/include/nel/3d/font_manager.h index 134df26f9..620b2164f 100644 --- a/nel/include/nel/3d/font_manager.h +++ b/nel/include/nel/3d/font_manager.h @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/include/nel/3d/landscape.h b/nel/include/nel/3d/landscape.h index f6e1a5861..cf05f6c9a 100644 --- a/nel/include/nel/3d/landscape.h +++ b/nel/include/nel/3d/landscape.h @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/include/nel/3d/text_context.h b/nel/include/nel/3d/text_context.h index 01a711e7e..a8d4188a8 100644 --- a/nel/include/nel/3d/text_context.h +++ b/nel/include/nel/3d/text_context.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/3d/text_context_user.h b/nel/include/nel/3d/text_context_user.h index 039aebcd0..b673bfa8f 100644 --- a/nel/include/nel/3d/text_context_user.h +++ b/nel/include/nel/3d/text_context_user.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/3d/texture.h b/nel/include/nel/3d/texture.h index f74af29d9..6016917d2 100644 --- a/nel/include/nel/3d/texture.h +++ b/nel/include/nel/3d/texture.h @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2019 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/include/nel/3d/texture_font.h b/nel/include/nel/3d/texture_font.h index 5b0796721..b250fecd8 100644 --- a/nel/include/nel/3d/texture_font.h +++ b/nel/include/nel/3d/texture_font.h @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/include/nel/3d/u_driver.h b/nel/include/nel/3d/u_driver.h index ca8a98e02..24e3d6482 100644 --- a/nel/include/nel/3d/u_driver.h +++ b/nel/include/nel/3d/u_driver.h @@ -4,7 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2010 Matt RAYKOWSKI (sfb) // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/3d/u_text_context.h b/nel/include/nel/3d/u_text_context.h index c5d31b886..f7f833c47 100644 --- a/nel/include/nel/3d/u_text_context.h +++ b/nel/include/nel/3d/u_text_context.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/css_parser.h b/nel/include/nel/gui/css_parser.h index 65b6a11b0..c3a426ee7 100644 --- a/nel/include/nel/gui/css_parser.h +++ b/nel/include/nel/gui/css_parser.h @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/include/nel/gui/ctrl_base.h b/nel/include/nel/gui/ctrl_base.h index 39b795252..9c80e7f7a 100644 --- a/nel/include/nel/gui/ctrl_base.h +++ b/nel/include/nel/gui/ctrl_base.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/ctrl_text_button.h b/nel/include/nel/gui/ctrl_text_button.h index 74e1c1291..4773a25e9 100644 --- a/nel/include/nel/gui/ctrl_text_button.h +++ b/nel/include/nel/gui/ctrl_text_button.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/dbgroup_combo_box.h b/nel/include/nel/gui/dbgroup_combo_box.h index 61e447f4e..ddf84cbef 100644 --- a/nel/include/nel/gui/dbgroup_combo_box.h +++ b/nel/include/nel/gui/dbgroup_combo_box.h @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2015 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/dbview_quantity.h b/nel/include/nel/gui/dbview_quantity.h index c23b394ab..e172624d7 100644 --- a/nel/include/nel/gui/dbview_quantity.h +++ b/nel/include/nel/gui/dbview_quantity.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/event_descriptor.h b/nel/include/nel/gui/event_descriptor.h index baa9414fd..69c90ff5d 100644 --- a/nel/include/nel/gui/event_descriptor.h +++ b/nel/include/nel/gui/event_descriptor.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/group_container.h b/nel/include/nel/gui/group_container.h index 30d91dad6..d7c489e5f 100644 --- a/nel/include/nel/gui/group_container.h +++ b/nel/include/nel/gui/group_container.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/group_editbox.h b/nel/include/nel/gui/group_editbox.h index 3263837c1..4bf200df8 100644 --- a/nel/include/nel/gui/group_editbox.h +++ b/nel/include/nel/gui/group_editbox.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index a5e1dc4e1..a96f0180a 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/group_list.h b/nel/include/nel/gui/group_list.h index 6e7587e34..e7fda6eb3 100644 --- a/nel/include/nel/gui/group_list.h +++ b/nel/include/nel/gui/group_list.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/group_menu.h b/nel/include/nel/gui/group_menu.h index f304a3d60..fb5f9af88 100644 --- a/nel/include/nel/gui/group_menu.h +++ b/nel/include/nel/gui/group_menu.h @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/group_paragraph.h b/nel/include/nel/gui/group_paragraph.h index 0e1898633..20bc50585 100644 --- a/nel/include/nel/gui/group_paragraph.h +++ b/nel/include/nel/gui/group_paragraph.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/group_tree.h b/nel/include/nel/gui/group_tree.h index d7518a68d..835a305e1 100644 --- a/nel/include/nel/gui/group_tree.h +++ b/nel/include/nel/gui/group_tree.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/interface_element.h b/nel/include/nel/gui/interface_element.h index 47025f155..42fa1de2f 100644 --- a/nel/include/nel/gui/interface_element.h +++ b/nel/include/nel/gui/interface_element.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/interface_expr.h b/nel/include/nel/gui/interface_expr.h index 0a9d9b4e9..27ed24fe0 100644 --- a/nel/include/nel/gui/interface_expr.h +++ b/nel/include/nel/gui/interface_expr.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/interface_group.h b/nel/include/nel/gui/interface_group.h index 9f1e5562b..672e52e6a 100644 --- a/nel/include/nel/gui/interface_group.h +++ b/nel/include/nel/gui/interface_group.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/lua_helper.h b/nel/include/nel/gui/lua_helper.h index 8a0f985a6..fa941f79a 100644 --- a/nel/include/nel/gui/lua_helper.h +++ b/nel/include/nel/gui/lua_helper.h @@ -2,8 +2,8 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/lua_helper_inline.h b/nel/include/nel/gui/lua_helper_inline.h index 5dbc3cef4..d50455880 100644 --- a/nel/include/nel/gui/lua_helper_inline.h +++ b/nel/include/nel/gui/lua_helper_inline.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/reflect.h b/nel/include/nel/gui/reflect.h index 8bd3b4781..7da0b3529 100644 --- a/nel/include/nel/gui/reflect.h +++ b/nel/include/nel/gui/reflect.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/string_case.h b/nel/include/nel/gui/string_case.h index 446998e1a..44e38651f 100644 --- a/nel/include/nel/gui/string_case.h +++ b/nel/include/nel/gui/string_case.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/view_pointer.h b/nel/include/nel/gui/view_pointer.h index bc605a717..b947cc604 100644 --- a/nel/include/nel/gui/view_pointer.h +++ b/nel/include/nel/gui/view_pointer.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/view_text.h b/nel/include/nel/gui/view_text.h index 2074576c1..7980e6427 100644 --- a/nel/include/nel/gui/view_text.h +++ b/nel/include/nel/gui/view_text.h @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/view_text_formated.h b/nel/include/nel/gui/view_text_formated.h index f6a3cf443..1b7146b8b 100644 --- a/nel/include/nel/gui/view_text_formated.h +++ b/nel/include/nel/gui/view_text_formated.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/view_text_id.h b/nel/include/nel/gui/view_text_id.h index 8c012f319..abba8cb39 100644 --- a/nel/include/nel/gui/view_text_id.h +++ b/nel/include/nel/gui/view_text_id.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/view_text_id_formated.h b/nel/include/nel/gui/view_text_id_formated.h index dfd11d0d4..428bca035 100644 --- a/nel/include/nel/gui/view_text_id_formated.h +++ b/nel/include/nel/gui/view_text_id_formated.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/gui/widget_manager.h b/nel/include/nel/gui/widget_manager.h index e8b4e376c..dc1d75063 100644 --- a/nel/include/nel/gui/widget_manager.h +++ b/nel/include/nel/gui/widget_manager.h @@ -2,8 +2,8 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/misc/common.h b/nel/include/nel/misc/common.h index 7b89bae3b..7c2cc2937 100644 --- a/nel/include/nel/misc/common.h +++ b/nel/include/nel/misc/common.h @@ -4,7 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2010 Matt RAYKOWSKI (sfb) // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2015-2019 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/misc/debug.h b/nel/include/nel/misc/debug.h index 1d533c149..9b6e48376 100644 --- a/nel/include/nel/misc/debug.h +++ b/nel/include/nel/misc/debug.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2015 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/misc/event_emitter_multi.h b/nel/include/nel/misc/event_emitter_multi.h index 9b8d25c64..cb41d023f 100644 --- a/nel/include/nel/misc/event_emitter_multi.h +++ b/nel/include/nel/misc/event_emitter_multi.h @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/include/nel/misc/events.h b/nel/include/nel/misc/events.h index 6cfe902b8..b75d72ca2 100644 --- a/nel/include/nel/misc/events.h +++ b/nel/include/nel/misc/events.h @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/include/nel/misc/file.h b/nel/include/nel/misc/file.h index f634f4378..6f0584dd7 100644 --- a/nel/include/nel/misc/file.h +++ b/nel/include/nel/misc/file.h @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/include/nel/misc/i18n.h b/nel/include/nel/misc/i18n.h index 28df54c5e..86499eae5 100644 --- a/nel/include/nel/misc/i18n.h +++ b/nel/include/nel/misc/i18n.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2012 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/misc/sha1.h b/nel/include/nel/misc/sha1.h index d458c6f8f..8c046fca1 100644 --- a/nel/include/nel/misc/sha1.h +++ b/nel/include/nel/misc/sha1.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/misc/sheet_id.h b/nel/include/nel/misc/sheet_id.h index 856dbf330..c1fc7070f 100644 --- a/nel/include/nel/misc/sheet_id.h +++ b/nel/include/nel/misc/sheet_id.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2012 Jan BOON (Kaetemi) +// Copyright (C) 2012-2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/misc/stream.h b/nel/include/nel/misc/stream.h index 89db78a1c..9b18d575c 100644 --- a/nel/include/nel/misc/stream.h +++ b/nel/include/nel/misc/stream.h @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/include/nel/misc/string_common.h b/nel/include/nel/misc/string_common.h index 6021b8159..96f7f7bd1 100644 --- a/nel/include/nel/misc/string_common.h +++ b/nel/include/nel/misc/string_common.h @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2012 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2016-2019 Jan BOON (Kaetemi) +// Copyright (C) 2016-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/misc/system_utils.h b/nel/include/nel/misc/system_utils.h index 9093eb90d..5cec22af2 100644 --- a/nel/include/nel/misc/system_utils.h +++ b/nel/include/nel/misc/system_utils.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2015-2019 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/misc/types_nl.h b/nel/include/nel/misc/types_nl.h index bac48c3d6..a257eb293 100644 --- a/nel/include/nel/misc/types_nl.h +++ b/nel/include/nel/misc/types_nl.h @@ -2,7 +2,7 @@ // Copyright (C) 2010-2011 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/misc/ucstring.h b/nel/include/nel/misc/ucstring.h index 61f7f416b..5b95c33c2 100644 --- a/nel/include/nel/misc/ucstring.h +++ b/nel/include/nel/misc/ucstring.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2015 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/net/unified_network.h b/nel/include/nel/net/unified_network.h index df735a740..094ff7390 100644 --- a/nel/include/nel/net/unified_network.h +++ b/nel/include/nel/net/unified_network.h @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/include/nel/sound/music_channel_fader.h b/nel/include/nel/sound/music_channel_fader.h index 577d23949..bacbbe837 100644 --- a/nel/include/nel/sound/music_channel_fader.h +++ b/nel/include/nel/sound/music_channel_fader.h @@ -7,7 +7,7 @@ */ // NeL - MMORPG Framework -// Copyright (C) 2008-2012 Jan BOON (Kaetemi) +// Copyright (C) 2008-2020 Jan BOON (Kaetemi) // // This source file has been modified by the following contributors: // Copyright (C) 2010 Winch Gate Property Limited diff --git a/nel/include/nel/sound/stream_file_source.h b/nel/include/nel/sound/stream_file_source.h index c8cf91cf5..1ade68572 100644 --- a/nel/include/nel/sound/stream_file_source.h +++ b/nel/include/nel/sound/stream_file_source.h @@ -7,7 +7,7 @@ */ // NeL - MMORPG Framework -// Copyright (C) 2012 Jan BOON (Kaetemi) +// Copyright (C) 2012-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/include/nel/web/http_client_curl.h b/nel/include/nel/web/http_client_curl.h index e130cd768..cfb1ac38a 100644 --- a/nel/include/nel/web/http_client_curl.h +++ b/nel/include/nel/web/http_client_curl.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/samples/misc/i18n/main.cpp b/nel/samples/misc/i18n/main.cpp index 5456c1325..5b1c73123 100644 --- a/nel/samples/misc/i18n/main.cpp +++ b/nel/samples/misc/i18n/main.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 6263de0f8..f8a678957 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2013-2019 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // Copyright (C) 2014 Matthew LAGOE (Botanic) // // This program is free software: you can redistribute it and/or modify diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.h b/nel/src/3d/driver/direct3d/driver_direct3d.h index bc7911df2..9a434cab2 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2013-2019 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp b/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp index 2285688d4..1436e5aa4 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp b/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp index 15dcb7768..71af20f00 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2012-2014 Jan BOON (Kaetemi) +// Copyright (C) 2012-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/driver/opengl/driver_opengl.h b/nel/src/3d/driver/opengl/driver_opengl.h index e85d2da05..5be157403 100644 --- a/nel/src/3d/driver/opengl/driver_opengl.h +++ b/nel/src/3d/driver/opengl/driver_opengl.h @@ -4,7 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2010 Robert TIMM (rti) // Copyright (C) 2010 Thibaut GIRKA (ThibG) -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index 0b8c4a458..ff5252c61 100644 --- a/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp b/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp index 8e539afd7..8c86f4c7e 100644 --- a/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp +++ b/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/nel/src/3d/driver/opengl/driver_opengl_window.cpp index c60ec602e..163f64843 100644 --- a/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -4,7 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2010 Robert TIMM (rti) // Copyright (C) 2014 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/nel/src/3d/driver/opengl/unix_event_emitter.cpp index 594d60183..e8e8ae99f 100644 --- a/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/driver/opengl/unix_event_emitter.h b/nel/src/3d/driver/opengl/unix_event_emitter.h index 68dc81a48..297fdcb5a 100644 --- a/nel/src/3d/driver/opengl/unix_event_emitter.h +++ b/nel/src/3d/driver/opengl/unix_event_emitter.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2010 Robert TIMM (rti) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/driver_user.cpp b/nel/src/3d/driver_user.cpp index 02e9c4b27..a7bd7a332 100644 --- a/nel/src/3d/driver_user.cpp +++ b/nel/src/3d/driver_user.cpp @@ -4,7 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2010 Matt RAYKOWSKI (sfb) // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // Copyright (C) 2015 Laszlo KIS-ADAM (dfighter) // // This program is free software: you can redistribute it and/or modify diff --git a/nel/src/3d/font_generator.cpp b/nel/src/3d/font_generator.cpp index 86a233f22..06ccd3a8b 100644 --- a/nel/src/3d/font_generator.cpp +++ b/nel/src/3d/font_generator.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2015 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/font_manager.cpp b/nel/src/3d/font_manager.cpp index 872c1fd3d..9e954ac1f 100644 --- a/nel/src/3d/font_manager.cpp +++ b/nel/src/3d/font_manager.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/3d/fxaa.cpp b/nel/src/3d/fxaa.cpp index 6478abf8e..2dfd58d37 100644 --- a/nel/src/3d/fxaa.cpp +++ b/nel/src/3d/fxaa.cpp @@ -7,7 +7,7 @@ */ // NeL - MMORPG Framework -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/lod_character_manager.cpp b/nel/src/3d/lod_character_manager.cpp index f5d6a23c5..8e062bf07 100644 --- a/nel/src/3d/lod_character_manager.cpp +++ b/nel/src/3d/lod_character_manager.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/3d/packed_zone.cpp b/nel/src/3d/packed_zone.cpp index 72866ea78..f1cb7426b 100644 --- a/nel/src/3d/packed_zone.cpp +++ b/nel/src/3d/packed_zone.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/3d/render_trav.cpp b/nel/src/3d/render_trav.cpp index 355ceb7ab..1b7e8e84e 100644 --- a/nel/src/3d/render_trav.cpp +++ b/nel/src/3d/render_trav.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2012-2014 Jan BOON (Kaetemi) +// Copyright (C) 2012-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/scene.cpp b/nel/src/3d/scene.cpp index db8a629ff..15173d7d9 100644 --- a/nel/src/3d/scene.cpp +++ b/nel/src/3d/scene.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/shadow_map_manager.cpp b/nel/src/3d/shadow_map_manager.cpp index e6a7cfe50..174ecd580 100644 --- a/nel/src/3d/shadow_map_manager.cpp +++ b/nel/src/3d/shadow_map_manager.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/shape_bank.cpp b/nel/src/3d/shape_bank.cpp index a7c60cd03..71bdb79e2 100644 --- a/nel/src/3d/shape_bank.cpp +++ b/nel/src/3d/shape_bank.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/3d/surface_light_grid.cpp b/nel/src/3d/surface_light_grid.cpp index b30abe730..d85422869 100644 --- a/nel/src/3d/surface_light_grid.cpp +++ b/nel/src/3d/surface_light_grid.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/3d/tessellation.cpp b/nel/src/3d/tessellation.cpp index 9dbc12296..88c0fa26e 100644 --- a/nel/src/3d/tessellation.cpp +++ b/nel/src/3d/tessellation.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/3d/text_context.cpp b/nel/src/3d/text_context.cpp index b31a82959..4549622da 100644 --- a/nel/src/3d/text_context.cpp +++ b/nel/src/3d/text_context.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/text_context_user.cpp b/nel/src/3d/text_context_user.cpp index 447122293..f32fd175d 100644 --- a/nel/src/3d/text_context_user.cpp +++ b/nel/src/3d/text_context_user.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/3d/texture_bump.cpp b/nel/src/3d/texture_bump.cpp index 7705a58fa..fc1fe4139 100644 --- a/nel/src/3d/texture_bump.cpp +++ b/nel/src/3d/texture_bump.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/georges/form.cpp b/nel/src/georges/form.cpp index c3fea6e0a..40f374b8d 100644 --- a/nel/src/georges/form.cpp +++ b/nel/src/georges/form.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/georges/type.cpp b/nel/src/georges/type.cpp index 1055313dd..9c65acae7 100644 --- a/nel/src/georges/type.cpp +++ b/nel/src/georges/type.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/action_handler.cpp b/nel/src/gui/action_handler.cpp index b80ce2f5f..a10513ebb 100644 --- a/nel/src/gui/action_handler.cpp +++ b/nel/src/gui/action_handler.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/css_parser.cpp b/nel/src/gui/css_parser.cpp index f3003b195..d43189fca 100644 --- a/nel/src/gui/css_parser.cpp +++ b/nel/src/gui/css_parser.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/gui/ctrl_base.cpp b/nel/src/gui/ctrl_base.cpp index 1f652031b..2e95c50dd 100644 --- a/nel/src/gui/ctrl_base.cpp +++ b/nel/src/gui/ctrl_base.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/ctrl_scroll.cpp b/nel/src/gui/ctrl_scroll.cpp index 14caa75f4..b40498186 100644 --- a/nel/src/gui/ctrl_scroll.cpp +++ b/nel/src/gui/ctrl_scroll.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2015 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/ctrl_text_button.cpp b/nel/src/gui/ctrl_text_button.cpp index 5cc89c9a7..c5571a4ca 100644 --- a/nel/src/gui/ctrl_text_button.cpp +++ b/nel/src/gui/ctrl_text_button.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/dbgroup_combo_box.cpp b/nel/src/gui/dbgroup_combo_box.cpp index b13005b33..725019b72 100644 --- a/nel/src/gui/dbgroup_combo_box.cpp +++ b/nel/src/gui/dbgroup_combo_box.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2013-2015 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/dbview_number.cpp b/nel/src/gui/dbview_number.cpp index 7ba4c17ba..c0c728f2b 100644 --- a/nel/src/gui/dbview_number.cpp +++ b/nel/src/gui/dbview_number.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/dbview_quantity.cpp b/nel/src/gui/dbview_quantity.cpp index 192b0a936..84c214191 100644 --- a/nel/src/gui/dbview_quantity.cpp +++ b/nel/src/gui/dbview_quantity.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/group_container.cpp b/nel/src/gui/group_container.cpp index e201f2eb4..1416f5ee6 100644 --- a/nel/src/gui/group_container.cpp +++ b/nel/src/gui/group_container.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/group_editbox.cpp b/nel/src/gui/group_editbox.cpp index dc7e34e16..799452b33 100644 --- a/nel/src/gui/group_editbox.cpp +++ b/nel/src/gui/group_editbox.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/group_header.cpp b/nel/src/gui/group_header.cpp index 5fec1d4be..2671c2a62 100644 --- a/nel/src/gui/group_header.cpp +++ b/nel/src/gui/group_header.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index b85cb5bfc..d2c6d4cf3 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/group_list.cpp b/nel/src/gui/group_list.cpp index b94ff6a5f..c65d759ba 100644 --- a/nel/src/gui/group_list.cpp +++ b/nel/src/gui/group_list.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/group_menu.cpp b/nel/src/gui/group_menu.cpp index 77f73e18e..8db402540 100644 --- a/nel/src/gui/group_menu.cpp +++ b/nel/src/gui/group_menu.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2015 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/group_paragraph.cpp b/nel/src/gui/group_paragraph.cpp index a4c2a6da7..4ca13c8ae 100644 --- a/nel/src/gui/group_paragraph.cpp +++ b/nel/src/gui/group_paragraph.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/group_tree.cpp b/nel/src/gui/group_tree.cpp index 674da9546..44636f1d6 100644 --- a/nel/src/gui/group_tree.cpp +++ b/nel/src/gui/group_tree.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/interface_expr.cpp b/nel/src/gui/interface_expr.cpp index c83c1d722..c10627e02 100644 --- a/nel/src/gui/interface_expr.cpp +++ b/nel/src/gui/interface_expr.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/interface_expr_user_fct.cpp b/nel/src/gui/interface_expr_user_fct.cpp index 7fc097f48..f5de62b6f 100644 --- a/nel/src/gui/interface_expr_user_fct.cpp +++ b/nel/src/gui/interface_expr_user_fct.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/interface_group.cpp b/nel/src/gui/interface_group.cpp index dacaf16cf..9cced8264 100644 --- a/nel/src/gui/interface_group.cpp +++ b/nel/src/gui/interface_group.cpp @@ -2,8 +2,8 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/interface_link.cpp b/nel/src/gui/interface_link.cpp index 1cad39c94..6fbe3a3ec 100644 --- a/nel/src/gui/interface_link.cpp +++ b/nel/src/gui/interface_link.cpp @@ -2,8 +2,8 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/lua_helper.cpp b/nel/src/gui/lua_helper.cpp index a07ba3b71..bb5fd5426 100644 --- a/nel/src/gui/lua_helper.cpp +++ b/nel/src/gui/lua_helper.cpp @@ -2,8 +2,8 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/lua_ihm.cpp b/nel/src/gui/lua_ihm.cpp index c915a8671..9b00026d7 100644 --- a/nel/src/gui/lua_ihm.cpp +++ b/nel/src/gui/lua_ihm.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/string_case.cpp b/nel/src/gui/string_case.cpp index 8946a5d1d..801b2fc68 100644 --- a/nel/src/gui/string_case.cpp +++ b/nel/src/gui/string_case.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/view_pointer.cpp b/nel/src/gui/view_pointer.cpp index 3c319c228..74644fa9f 100644 --- a/nel/src/gui/view_pointer.cpp +++ b/nel/src/gui/view_pointer.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/view_renderer.cpp b/nel/src/gui/view_renderer.cpp index 82716de4a..405781440 100644 --- a/nel/src/gui/view_renderer.cpp +++ b/nel/src/gui/view_renderer.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index 0f4e93b89..87ebab92d 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/view_text_formated.cpp b/nel/src/gui/view_text_formated.cpp index dfd57eadf..537773788 100644 --- a/nel/src/gui/view_text_formated.cpp +++ b/nel/src/gui/view_text_formated.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/view_text_id.cpp b/nel/src/gui/view_text_id.cpp index ea961dd2a..61d97b523 100644 --- a/nel/src/gui/view_text_id.cpp +++ b/nel/src/gui/view_text_id.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/view_text_id_formated.cpp b/nel/src/gui/view_text_id_formated.cpp index 88f9a58e0..b6bd9dc22 100644 --- a/nel/src/gui/view_text_id_formated.cpp +++ b/nel/src/gui/view_text_id_formated.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/gui/widget_manager.cpp b/nel/src/gui/widget_manager.cpp index 864e4ef5b..534a0cc1b 100644 --- a/nel/src/gui/widget_manager.cpp +++ b/nel/src/gui/widget_manager.cpp @@ -2,8 +2,8 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/ligo/primitive.cpp b/nel/src/ligo/primitive.cpp index d43d4cde1..205464c67 100644 --- a/nel/src/ligo/primitive.cpp +++ b/nel/src/ligo/primitive.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/logic/logic_state_machine.cpp b/nel/src/logic/logic_state_machine.cpp index 3d55be849..0492671f6 100644 --- a/nel/src/logic/logic_state_machine.cpp +++ b/nel/src/logic/logic_state_machine.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/misc/big_file.cpp b/nel/src/misc/big_file.cpp index f01bbf297..533d52818 100644 --- a/nel/src/misc/big_file.cpp +++ b/nel/src/misc/big_file.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/misc/bitmap.cpp b/nel/src/misc/bitmap.cpp index 967cc325e..33c0cec43 100644 --- a/nel/src/misc/bitmap.cpp +++ b/nel/src/misc/bitmap.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2016 Jan BOON (Kaetemi) +// Copyright (C) 2016-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/cdb_branch.cpp b/nel/src/misc/cdb_branch.cpp index f3e4f7de5..f77acc194 100644 --- a/nel/src/misc/cdb_branch.cpp +++ b/nel/src/misc/cdb_branch.cpp @@ -2,8 +2,8 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/co_task.cpp b/nel/src/misc/co_task.cpp index 4548fbe86..7446a72d3 100644 --- a/nel/src/misc/co_task.cpp +++ b/nel/src/misc/co_task.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2015 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/common.cpp b/nel/src/misc/common.cpp index cbc6ee070..8d046c97c 100644 --- a/nel/src/misc/common.cpp +++ b/nel/src/misc/common.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/debug.cpp b/nel/src/misc/debug.cpp index 6a40d3b0b..f821ac620 100644 --- a/nel/src/misc/debug.cpp +++ b/nel/src/misc/debug.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // Copyright (C) 2015 Laszlo KIS-ADAM (dfighter) // // This program is free software: you can redistribute it and/or modify diff --git a/nel/src/misc/diff_tool.cpp b/nel/src/misc/diff_tool.cpp index 3cbaea5a6..2e390f9d9 100644 --- a/nel/src/misc/diff_tool.cpp +++ b/nel/src/misc/diff_tool.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/misc/eid_translator.cpp b/nel/src/misc/eid_translator.cpp index 9978b37e0..d8c7e06ee 100644 --- a/nel/src/misc/eid_translator.cpp +++ b/nel/src/misc/eid_translator.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010-2019 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/misc/eval_num_expr.cpp b/nel/src/misc/eval_num_expr.cpp index 5d19e22a1..8cde36a48 100644 --- a/nel/src/misc/eval_num_expr.cpp +++ b/nel/src/misc/eval_num_expr.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2016 Jan BOON (Kaetemi) +// Copyright (C) 2016-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/event_emitter_multi.cpp b/nel/src/misc/event_emitter_multi.cpp index a7d133f3c..245d935a7 100644 --- a/nel/src/misc/event_emitter_multi.cpp +++ b/nel/src/misc/event_emitter_multi.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/misc/file.cpp b/nel/src/misc/file.cpp index 24222bdfe..138e85c88 100644 --- a/nel/src/misc/file.cpp +++ b/nel/src/misc/file.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014-2016 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/i18n.cpp b/nel/src/misc/i18n.cpp index 729234f56..74558db17 100644 --- a/nel/src/misc/i18n.cpp +++ b/nel/src/misc/i18n.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Laszlo KIS-ADAM (dfighter) // Copyright (C) 2014 Matthew LAGOE (Botanic) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/i_xml.cpp b/nel/src/misc/i_xml.cpp index 24a2b7910..b38601f06 100644 --- a/nel/src/misc/i_xml.cpp +++ b/nel/src/misc/i_xml.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/misc/inter_window_msg_queue.cpp b/nel/src/misc/inter_window_msg_queue.cpp index 74c34b281..6e8478801 100644 --- a/nel/src/misc/inter_window_msg_queue.cpp +++ b/nel/src/misc/inter_window_msg_queue.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/misc/mem_displayer.cpp b/nel/src/misc/mem_displayer.cpp index 0250fc4c6..cefa99589 100644 --- a/nel/src/misc/mem_displayer.cpp +++ b/nel/src/misc/mem_displayer.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014-2016 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/object_arena_allocator.cpp b/nel/src/misc/object_arena_allocator.cpp index ba2c81148..b8aea9ada 100644 --- a/nel/src/misc/object_arena_allocator.cpp +++ b/nel/src/misc/object_arena_allocator.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/path.cpp b/nel/src/misc/path.cpp index 2e3aacae6..bd8190db0 100644 --- a/nel/src/misc/path.cpp +++ b/nel/src/misc/path.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2012-2019 Jan BOON (Kaetemi) +// Copyright (C) 2012-2020 Jan BOON (Kaetemi) // Copyright (C) 2014-2015 Laszlo KIS-ADAM (dfighter) // // This program is free software: you can redistribute it and/or modify diff --git a/nel/src/misc/seven_zip.cpp b/nel/src/misc/seven_zip.cpp index ad07bf3cc..7a89c20c6 100644 --- a/nel/src/misc/seven_zip.cpp +++ b/nel/src/misc/seven_zip.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/string_common.cpp b/nel/src/misc/string_common.cpp index f869a5d35..9e6459677 100644 --- a/nel/src/misc/string_common.cpp +++ b/nel/src/misc/string_common.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/string_mapper.cpp b/nel/src/misc/string_mapper.cpp index 8518afa4b..88b81ff07 100644 --- a/nel/src/misc/string_mapper.cpp +++ b/nel/src/misc/string_mapper.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2019 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/misc/system_info.cpp b/nel/src/misc/system_info.cpp index 5dc70182c..fb192cc43 100644 --- a/nel/src/misc/system_info.cpp +++ b/nel/src/misc/system_info.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/system_utils.cpp b/nel/src/misc/system_utils.cpp index ba15d5363..8c01b227c 100644 --- a/nel/src/misc/system_utils.cpp +++ b/nel/src/misc/system_utils.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/ucstring.cpp b/nel/src/misc/ucstring.cpp index 05c0d24ab..9e97df650 100644 --- a/nel/src/misc/ucstring.cpp +++ b/nel/src/misc/ucstring.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/misc/unicode.cpp b/nel/src/misc/unicode.cpp index c6780db54..10321a907 100644 --- a/nel/src/misc/unicode.cpp +++ b/nel/src/misc/unicode.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/misc/win_displayer.cpp b/nel/src/misc/win_displayer.cpp index 7a0045c17..50bef6030 100644 --- a/nel/src/misc/win_displayer.cpp +++ b/nel/src/misc/win_displayer.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/win_event_emitter.cpp b/nel/src/misc/win_event_emitter.cpp index 8788bab7b..dfc385bd9 100644 --- a/nel/src/misc/win_event_emitter.cpp +++ b/nel/src/misc/win_event_emitter.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/misc/win_thread.cpp b/nel/src/misc/win_thread.cpp index c3624c161..6f45594ca 100644 --- a/nel/src/misc/win_thread.cpp +++ b/nel/src/misc/win_thread.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2012-2014 Jan BOON (Kaetemi) +// Copyright (C) 2012-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/net/unified_network.cpp b/nel/src/net/unified_network.cpp index ca3ef37d7..0ac8b1c21 100644 --- a/nel/src/net/unified_network.cpp +++ b/nel/src/net/unified_network.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014-2016 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/pacs/build_indoor.cpp b/nel/src/pacs/build_indoor.cpp index f97dddfa7..e1207235d 100644 --- a/nel/src/pacs/build_indoor.cpp +++ b/nel/src/pacs/build_indoor.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/pacs/move_container.cpp b/nel/src/pacs/move_container.cpp index 099f46839..35b7ddcd6 100644 --- a/nel/src/pacs/move_container.cpp +++ b/nel/src/pacs/move_container.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010-2019 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/src/sound/audio_decoder.cpp b/nel/src/sound/audio_decoder.cpp index db87bd990..57fc8ead8 100644 --- a/nel/src/sound/audio_decoder.cpp +++ b/nel/src/sound/audio_decoder.cpp @@ -7,7 +7,7 @@ */ // NeL - MMORPG Framework -// Copyright (C) 2008-2019 Jan BOON (Kaetemi) +// Copyright (C) 2008-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/sound/driver/xaudio2/source_xaudio2.cpp b/nel/src/sound/driver/xaudio2/source_xaudio2.cpp index 273c6ee60..13a613d6d 100644 --- a/nel/src/sound/driver/xaudio2/source_xaudio2.cpp +++ b/nel/src/sound/driver/xaudio2/source_xaudio2.cpp @@ -1,5 +1,5 @@ // NeL - MMORPG Framework -// Copyright (C) 2008-2015 Jan BOON (Kaetemi) +// Copyright (C) 2008-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/src/sound/music_channel_fader.cpp b/nel/src/sound/music_channel_fader.cpp index 70ab890d2..3e1b0f1cf 100644 --- a/nel/src/sound/music_channel_fader.cpp +++ b/nel/src/sound/music_channel_fader.cpp @@ -1,5 +1,5 @@ // NeL - MMORPG Framework -// Copyright (C) 2008-2012 Jan BOON (Kaetemi) +// Copyright (C) 2008-2020 Jan BOON (Kaetemi) // // This source file has been modified by the following contributors: // Copyright (C) 2010 Matt RAYKOWSKI (sfb) diff --git a/nel/src/sound/stream_file_source.cpp b/nel/src/sound/stream_file_source.cpp index 50d9bda97..a7b45b948 100644 --- a/nel/src/sound/stream_file_source.cpp +++ b/nel/src/sound/stream_file_source.cpp @@ -7,7 +7,7 @@ */ // NeL - MMORPG Framework -// Copyright (C) 2012 Jan BOON (Kaetemi) +// Copyright (C) 2012-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/tools/3d/build_clodtex/lod_texture_builder.cpp b/nel/tools/3d/build_clodtex/lod_texture_builder.cpp index b0ff316df..05bb184bb 100644 --- a/nel/tools/3d/build_clodtex/lod_texture_builder.cpp +++ b/nel/tools/3d/build_clodtex/lod_texture_builder.cpp @@ -1,6 +1,9 @@ // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/nel/tools/3d/ig_elevation/main.cpp b/nel/tools/3d/ig_elevation/main.cpp index 126c66c62..4856051c3 100644 --- a/nel/tools/3d/ig_elevation/main.cpp +++ b/nel/tools/3d/ig_elevation/main.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/tools/3d/panoply_preview/main_window.cpp b/nel/tools/3d/panoply_preview/main_window.cpp index 1ef144a14..1195642e8 100644 --- a/nel/tools/3d/panoply_preview/main_window.cpp +++ b/nel/tools/3d/panoply_preview/main_window.cpp @@ -1,5 +1,5 @@ // NeL - MMORPG Framework -// Copyright (C) 2014-2016 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/tools/3d/plugin_max/nel_3dsmax_shared/string_common.h b/nel/tools/3d/plugin_max/nel_3dsmax_shared/string_common.h index 4a331a78a..22b16e981 100644 --- a/nel/tools/3d/plugin_max/nel_3dsmax_shared/string_common.h +++ b/nel/tools/3d/plugin_max/nel_3dsmax_shared/string_common.h @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp b/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp index 48bf1d921..2f00c9c63 100644 --- a/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp +++ b/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2011-2019 Jan BOON (Kaetemi) +// Copyright (C) 2011-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/nel/tools/pacs/build_rbank/prim_checker.cpp b/nel/tools/pacs/build_rbank/prim_checker.cpp index 3b8c11bf9..e4c2b0b91 100644 --- a/nel/tools/pacs/build_rbank/prim_checker.cpp +++ b/nel/tools/pacs/build_rbank/prim_checker.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/actions.cpp b/ryzom/client/src/actions.cpp index 428c607f0..67695a9d6 100644 --- a/ryzom/client/src/actions.cpp +++ b/ryzom/client/src/actions.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/actions.h b/ryzom/client/src/actions.h index 3fe976ac4..f333782f5 100644 --- a/ryzom/client/src/actions.h +++ b/ryzom/client/src/actions.h @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2012 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2015 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/bg_downloader_access.cpp b/ryzom/client/src/bg_downloader_access.cpp index 2a0e2d73a..e2500eaa6 100644 --- a/ryzom/client/src/bg_downloader_access.cpp +++ b/ryzom/client/src/bg_downloader_access.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2012 Jan BOON (Kaetemi) +// Copyright (C) 2012-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/character_cl.cpp b/ryzom/client/src/character_cl.cpp index 76263ee56..84b058902 100644 --- a/ryzom/client/src/character_cl.cpp +++ b/ryzom/client/src/character_cl.cpp @@ -4,7 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2016 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index ec3535529..21d73859e 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2010-2019 Jan BOON (Kaetemi) +// Copyright (C) 2010-2020 Jan BOON (Kaetemi) // Copyright (C) 2011-2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) // diff --git a/ryzom/client/src/client_cfg.h b/ryzom/client/src/client_cfg.h index e35e9701f..a8404fb39 100644 --- a/ryzom/client/src/client_cfg.h +++ b/ryzom/client/src/client_cfg.h @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2010-2014 Jan BOON (Kaetemi) +// Copyright (C) 2010-2020 Jan BOON (Kaetemi) // Copyright (C) 2011-2012 Matt RAYKOWSKI (sfb) // // This program is free software: you can redistribute it and/or modify diff --git a/ryzom/client/src/client_chat_manager.cpp b/ryzom/client/src/client_chat_manager.cpp index 09b1140d4..d614d345b 100644 --- a/ryzom/client/src/client_chat_manager.cpp +++ b/ryzom/client/src/client_chat_manager.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/client_sheets/character_sheet.cpp b/ryzom/client/src/client_sheets/character_sheet.cpp index e6e5cbd00..2568717f9 100644 --- a/ryzom/client/src/client_sheets/character_sheet.cpp +++ b/ryzom/client/src/client_sheets/character_sheet.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/client/src/client_sheets/item_sheet.cpp b/ryzom/client/src/client_sheets/item_sheet.cpp index 25d66acce..0bc47d947 100644 --- a/ryzom/client/src/client_sheets/item_sheet.cpp +++ b/ryzom/client/src/client_sheets/item_sheet.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010-2019 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/client/src/client_sheets/item_sheet.h b/ryzom/client/src/client_sheets/item_sheet.h index e36fd5c84..dc6c0a658 100644 --- a/ryzom/client/src/client_sheets/item_sheet.h +++ b/ryzom/client/src/client_sheets/item_sheet.h @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010-2019 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/client/src/commands.cpp b/ryzom/client/src/commands.cpp index 23a09c62e..986da78e6 100644 --- a/ryzom/client/src/commands.cpp +++ b/ryzom/client/src/commands.cpp @@ -4,7 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2013-2019 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index b6370602e..4fafe3ebc 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -4,7 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/contextual_cursor.cpp b/ryzom/client/src/contextual_cursor.cpp index 11398f620..24c95a96c 100644 --- a/ryzom/client/src/contextual_cursor.cpp +++ b/ryzom/client/src/contextual_cursor.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/continent.cpp b/ryzom/client/src/continent.cpp index 6bd22741a..3a7dff52d 100644 --- a/ryzom/client/src/continent.cpp +++ b/ryzom/client/src/continent.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010-2019 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/client/src/debug_client.cpp b/ryzom/client/src/debug_client.cpp index 30e2645bf..88df4be99 100644 --- a/ryzom/client/src/debug_client.cpp +++ b/ryzom/client/src/debug_client.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/entity_cl.cpp b/ryzom/client/src/entity_cl.cpp index 506069426..9d3f446eb 100644 --- a/ryzom/client/src/entity_cl.cpp +++ b/ryzom/client/src/entity_cl.cpp @@ -3,8 +3,8 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/far_tp.cpp b/ryzom/client/src/far_tp.cpp index 80134f26b..c250aec95 100644 --- a/ryzom/client/src/far_tp.cpp +++ b/ryzom/client/src/far_tp.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2016 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/forage_source_cl.cpp b/ryzom/client/src/forage_source_cl.cpp index be41c0e75..46249ed9e 100644 --- a/ryzom/client/src/forage_source_cl.cpp +++ b/ryzom/client/src/forage_source_cl.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/fx_cl.cpp b/ryzom/client/src/fx_cl.cpp index aeb3ddcba..32a764e99 100644 --- a/ryzom/client/src/fx_cl.cpp +++ b/ryzom/client/src/fx_cl.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/client/src/game_context_menu.cpp b/ryzom/client/src/game_context_menu.cpp index 2b46d33dd..441976be8 100644 --- a/ryzom/client/src/game_context_menu.cpp +++ b/ryzom/client/src/game_context_menu.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/init.cpp b/ryzom/client/src/init.cpp index 28d14dc7b..ebb713a73 100644 --- a/ryzom/client/src/init.cpp +++ b/ryzom/client/src/init.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2010-2019 Jan BOON (Kaetemi) +// Copyright (C) 2010-2020 Jan BOON (Kaetemi) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) // // This program is free software: you can redistribute it and/or modify diff --git a/ryzom/client/src/init_main_loop.cpp b/ryzom/client/src/init_main_loop.cpp index a1caef841..a5bfa67df 100644 --- a/ryzom/client/src/init_main_loop.cpp +++ b/ryzom/client/src/init_main_loop.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/action_handler_edit.cpp b/ryzom/client/src/interface_v3/action_handler_edit.cpp index c2d3bafbc..ffca45406 100644 --- a/ryzom/client/src/interface_v3/action_handler_edit.cpp +++ b/ryzom/client/src/interface_v3/action_handler_edit.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index dacb6f100..cf25d00c5 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2,8 +2,8 @@ // Copyright (C) 2010-2019 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index 0eb240b7d..dc64feae1 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 2145ac2b6..e3ee653aa 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/ryzom/client/src/interface_v3/action_handler_phrase.cpp index f55d376bd..033f99bbf 100644 --- a/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index 6591472d4..3eacf8a60 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp b/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp index 105d4a180..143a71837 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp b/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp index e5f8cf1e4..78a38051e 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 4c67b70b3..ce4ec3173 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/chat_text_manager.cpp b/ryzom/client/src/interface_v3/chat_text_manager.cpp index 6fae6a29b..dff2da28c 100644 --- a/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index e046fbe2d..237ffdd8b 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/chat_window.h b/ryzom/client/src/interface_v3/chat_window.h index 0c8811842..13012ca31 100644 --- a/ryzom/client/src/interface_v3/chat_window.h +++ b/ryzom/client/src/interface_v3/chat_window.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 994274571..a07d4c2fb 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010-2019 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2011 Jan BOON (Kaetemi) +// Copyright (C) 2011-2020 Jan BOON (Kaetemi) // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) // diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.h b/ryzom/client/src/interface_v3/dbctrl_sheet.h index b662d86af..9440222f4 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -2,7 +2,7 @@ // Copyright (C) 2010-2019 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2011 Jan BOON (Kaetemi) +// Copyright (C) 2011-2020 Jan BOON (Kaetemi) // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) // diff --git a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp index 5a1952735..be0df19ad 100644 --- a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp index 9a8efa4ae..19083e4ee 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2012 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp index f008c32f1..188e06225 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp index 0a474b650..7e47e740c 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2015 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h index 3d308d582..1cb977978 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp index 8e21b7f26..e8ad3a2e8 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp index 02f8fb6ae..cad06e699 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2012 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp index bc812bbc5..6e5e19d9e 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase_id.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the 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 aec03653b..a461d0194 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/encyclopedia_manager.cpp b/ryzom/client/src/interface_v3/encyclopedia_manager.cpp index c9912325f..63c5f07c9 100644 --- a/ryzom/client/src/interface_v3/encyclopedia_manager.cpp +++ b/ryzom/client/src/interface_v3/encyclopedia_manager.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/flying_text_manager.cpp b/ryzom/client/src/interface_v3/flying_text_manager.cpp index f577d41e2..3f2e510e1 100644 --- a/ryzom/client/src/interface_v3/flying_text_manager.cpp +++ b/ryzom/client/src/interface_v3/flying_text_manager.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_compas.cpp b/ryzom/client/src/interface_v3/group_compas.cpp index f7418e868..a5e443da6 100644 --- a/ryzom/client/src/interface_v3/group_compas.cpp +++ b/ryzom/client/src/interface_v3/group_compas.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_html_cs.cpp b/ryzom/client/src/interface_v3/group_html_cs.cpp index ba20123e1..d02940e60 100644 --- a/ryzom/client/src/interface_v3/group_html_cs.cpp +++ b/ryzom/client/src/interface_v3/group_html_cs.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_html_cs.h b/ryzom/client/src/interface_v3/group_html_cs.h index 76a066e6d..f21eb0834 100644 --- a/ryzom/client/src/interface_v3/group_html_cs.h +++ b/ryzom/client/src/interface_v3/group_html_cs.h @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_html_forum.cpp b/ryzom/client/src/interface_v3/group_html_forum.cpp index fe218c215..641f9b43e 100644 --- a/ryzom/client/src/interface_v3/group_html_forum.cpp +++ b/ryzom/client/src/interface_v3/group_html_forum.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_html_forum.h b/ryzom/client/src/interface_v3/group_html_forum.h index 31e5308be..ef7a98063 100644 --- a/ryzom/client/src/interface_v3/group_html_forum.h +++ b/ryzom/client/src/interface_v3/group_html_forum.h @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_html_mail.cpp b/ryzom/client/src/interface_v3/group_html_mail.cpp index 8627a8573..ac2241523 100644 --- a/ryzom/client/src/interface_v3/group_html_mail.cpp +++ b/ryzom/client/src/interface_v3/group_html_mail.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_html_mail.h b/ryzom/client/src/interface_v3/group_html_mail.h index 59cf4c852..1a24469cb 100644 --- a/ryzom/client/src/interface_v3/group_html_mail.h +++ b/ryzom/client/src/interface_v3/group_html_mail.h @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_html_webig.h b/ryzom/client/src/interface_v3/group_html_webig.h index a339dd3dc..be6412710 100644 --- a/ryzom/client/src/interface_v3/group_html_webig.h +++ b/ryzom/client/src/interface_v3/group_html_webig.h @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as 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 b6b0195ef..258700dd2 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index bd339d19d..fa88db43e 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -3,8 +3,8 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index f96a2842c..ce6d21021 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as 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 6f28e3b65..b79f6c38a 100644 --- a/ryzom/client/src/interface_v3/group_modal_get_key.cpp +++ b/ryzom/client/src/interface_v3/group_modal_get_key.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp b/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp index 62d96280f..d246918bd 100644 --- a/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp +++ b/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_quick_help.cpp b/ryzom/client/src/interface_v3/group_quick_help.cpp index 77775489f..8a5e925cf 100644 --- a/ryzom/client/src/interface_v3/group_quick_help.cpp +++ b/ryzom/client/src/interface_v3/group_quick_help.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_quick_help.h b/ryzom/client/src/interface_v3/group_quick_help.h index 0d897d014..6f9c748a3 100644 --- a/ryzom/client/src/interface_v3/group_quick_help.h +++ b/ryzom/client/src/interface_v3/group_quick_help.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/group_skills.cpp b/ryzom/client/src/interface_v3/group_skills.cpp index 4248ea898..d0efce626 100644 --- a/ryzom/client/src/interface_v3/group_skills.cpp +++ b/ryzom/client/src/interface_v3/group_skills.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/guild_manager.cpp b/ryzom/client/src/interface_v3/guild_manager.cpp index 331b0ebfe..e3a1b6b41 100644 --- a/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/ryzom/client/src/interface_v3/guild_manager.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/input_handler_manager.cpp b/ryzom/client/src/interface_v3/input_handler_manager.cpp index 67a1b2350..28420dff4 100644 --- a/ryzom/client/src/interface_v3/input_handler_manager.cpp +++ b/ryzom/client/src/interface_v3/input_handler_manager.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/input_handler_manager.h b/ryzom/client/src/interface_v3/input_handler_manager.h index 4b078ee84..b587fecef 100644 --- a/ryzom/client/src/interface_v3/input_handler_manager.h +++ b/ryzom/client/src/interface_v3/input_handler_manager.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/interface_ddx.cpp b/ryzom/client/src/interface_v3/interface_ddx.cpp index caa394723..36bd17e62 100644 --- a/ryzom/client/src/interface_v3/interface_ddx.cpp +++ b/ryzom/client/src/interface_v3/interface_ddx.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp index aa8cd0582..a4dfb9d79 100644 --- a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp +++ b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp b/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp index b686db2be..eafdcccaf 100644 --- a/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp +++ b/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 089dc39d0..d03412c35 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010-2017 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2010-2019 Jan BOON (Kaetemi) +// Copyright (C) 2010-2020 Jan BOON (Kaetemi) // Copyright (C) 2011 Robert TIMM (rti) // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) diff --git a/ryzom/client/src/interface_v3/interface_manager.h b/ryzom/client/src/interface_v3/interface_manager.h index 342b8a7be..059020018 100644 --- a/ryzom/client/src/interface_v3/interface_manager.h +++ b/ryzom/client/src/interface_v3/interface_manager.h @@ -2,8 +2,8 @@ // Copyright (C) 2010-2018 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/inventory_manager.cpp b/ryzom/client/src/interface_v3/inventory_manager.cpp index 5324c6e69..75cab6f78 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2015-2019 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 2efdf339b..e448b1f4a 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2013-2019 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index c04ce38cd..81033f5aa 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/ryzom/client/src/interface_v3/macrocmd_manager.cpp index d097ec239..03e53c06b 100644 --- a/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/music_player.cpp b/ryzom/client/src/interface_v3/music_player.cpp index f7f9e05f2..889b83495 100644 --- a/ryzom/client/src/interface_v3/music_player.cpp +++ b/ryzom/client/src/interface_v3/music_player.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index 3d23e31f2..948b45e51 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -2,8 +2,8 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/people_list.cpp b/ryzom/client/src/interface_v3/people_list.cpp index 30a468975..3f0481b1f 100644 --- a/ryzom/client/src/interface_v3/people_list.cpp +++ b/ryzom/client/src/interface_v3/people_list.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/skill_manager.cpp b/ryzom/client/src/interface_v3/skill_manager.cpp index 936db39a7..cf35e6bd6 100644 --- a/ryzom/client/src/interface_v3/skill_manager.cpp +++ b/ryzom/client/src/interface_v3/skill_manager.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/sphrase_manager.cpp b/ryzom/client/src/interface_v3/sphrase_manager.cpp index dc605d11d..f6a89df7a 100644 --- a/ryzom/client/src/interface_v3/sphrase_manager.cpp +++ b/ryzom/client/src/interface_v3/sphrase_manager.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/interface_v3/task_bar_manager.cpp b/ryzom/client/src/interface_v3/task_bar_manager.cpp index 35f27b07d..713a9d07b 100644 --- a/ryzom/client/src/interface_v3/task_bar_manager.cpp +++ b/ryzom/client/src/interface_v3/task_bar_manager.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/item_group_manager.cpp b/ryzom/client/src/item_group_manager.cpp index 83c8b4f5a..5e5f0d6c9 100644 --- a/ryzom/client/src/item_group_manager.cpp +++ b/ryzom/client/src/item_group_manager.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index 9e0fb7f12..a5b94c879 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/login_patch.cpp b/ryzom/client/src/login_patch.cpp index 3d7a8a4c8..650531773 100644 --- a/ryzom/client/src/login_patch.cpp +++ b/ryzom/client/src/login_patch.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2014 Matthew LAGOE (Botanic) -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/main_loop.cpp b/ryzom/client/src/main_loop.cpp index 356b00452..d9de05961 100644 --- a/ryzom/client/src/main_loop.cpp +++ b/ryzom/client/src/main_loop.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2013-2016 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/main_loop_debug.cpp b/ryzom/client/src/main_loop_debug.cpp index 7c63d9502..b4edaf5e9 100644 --- a/ryzom/client/src/main_loop_debug.cpp +++ b/ryzom/client/src/main_loop_debug.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010-2017 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013-2016 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index 8d743074d..f1f622836 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/network_connection.cpp b/ryzom/client/src/network_connection.cpp index 4778641c0..bad168a60 100644 --- a/ryzom/client/src/network_connection.cpp +++ b/ryzom/client/src/network_connection.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2016 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/network_connection.h b/ryzom/client/src/network_connection.h index 84bb26d43..99b1bf699 100644 --- a/ryzom/client/src/network_connection.h +++ b/ryzom/client/src/network_connection.h @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2015 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/player_cl.cpp b/ryzom/client/src/player_cl.cpp index 15e8209db..9aef1032b 100644 --- a/ryzom/client/src/player_cl.cpp +++ b/ryzom/client/src/player_cl.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/progress.cpp b/ryzom/client/src/progress.cpp index 48d642aea..e75b4a984 100644 --- a/ryzom/client/src/progress.cpp +++ b/ryzom/client/src/progress.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/r2/auto_group.cpp b/ryzom/client/src/r2/auto_group.cpp index 7bbeb39d3..ee269376c 100644 --- a/ryzom/client/src/r2/auto_group.cpp +++ b/ryzom/client/src/r2/auto_group.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/client/src/r2/displayer_visual_entity.cpp b/ryzom/client/src/r2/displayer_visual_entity.cpp index 344d2a8fa..72b4c3ddb 100644 --- a/ryzom/client/src/r2/displayer_visual_entity.cpp +++ b/ryzom/client/src/r2/displayer_visual_entity.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2016 Jan BOON (Kaetemi) +// Copyright (C) 2016-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/r2/displayer_visual_group.cpp b/ryzom/client/src/r2/displayer_visual_group.cpp index 5cf2c542d..ba7249fd9 100644 --- a/ryzom/client/src/r2/displayer_visual_group.cpp +++ b/ryzom/client/src/r2/displayer_visual_group.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/r2/dmc/client_edition_module.cpp b/ryzom/client/src/r2/dmc/client_edition_module.cpp index e388707ca..73e231d4a 100644 --- a/ryzom/client/src/r2/dmc/client_edition_module.cpp +++ b/ryzom/client/src/r2/dmc/client_edition_module.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2015-2018 Jan BOON (Kaetemi) +// Copyright (C) 2015-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/r2/dmc/com_lua_module.cpp b/ryzom/client/src/r2/dmc/com_lua_module.cpp index 2ea3d91dd..aaa8410ab 100644 --- a/ryzom/client/src/r2/dmc/com_lua_module.cpp +++ b/ryzom/client/src/r2/dmc/com_lua_module.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2013-2014 Jan BOON (Kaetemi) +// Copyright (C) 2013-2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/r2/editor.cpp b/ryzom/client/src/r2/editor.cpp index d3611067a..3628dfe93 100644 --- a/ryzom/client/src/r2/editor.cpp +++ b/ryzom/client/src/r2/editor.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2013-2016 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/r2/instance_map_deco.cpp b/ryzom/client/src/r2/instance_map_deco.cpp index ae3857990..46b1ad874 100644 --- a/ryzom/client/src/r2/instance_map_deco.cpp +++ b/ryzom/client/src/r2/instance_map_deco.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/r2/instance_map_deco.h b/ryzom/client/src/r2/instance_map_deco.h index 9be099c19..dd7c719e4 100644 --- a/ryzom/client/src/r2/instance_map_deco.h +++ b/ryzom/client/src/r2/instance_map_deco.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/r2/prim_render.cpp b/ryzom/client/src/r2/prim_render.cpp index f4b6cb8a9..93f610377 100644 --- a/ryzom/client/src/r2/prim_render.cpp +++ b/ryzom/client/src/r2/prim_render.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/r2/tool_select_move.cpp b/ryzom/client/src/r2/tool_select_move.cpp index d16b45ced..e23d969eb 100644 --- a/ryzom/client/src/r2/tool_select_move.cpp +++ b/ryzom/client/src/r2/tool_select_move.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/client/src/session_browser.cpp b/ryzom/client/src/session_browser.cpp index 6d80c55cb..7b29f3023 100644 --- a/ryzom/client/src/session_browser.cpp +++ b/ryzom/client/src/session_browser.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2019 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/client/src/session_browser_impl.cpp b/ryzom/client/src/session_browser_impl.cpp index 9f3cc77a9..08a5dba3a 100644 --- a/ryzom/client/src/session_browser_impl.cpp +++ b/ryzom/client/src/session_browser_impl.cpp @@ -2,8 +2,8 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2013 Jan BOON (Kaetemi) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/string_manager_client.h b/ryzom/client/src/string_manager_client.h index c553f7c57..971d808b3 100644 --- a/ryzom/client/src/string_manager_client.h +++ b/ryzom/client/src/string_manager_client.h @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010-2017 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/client/src/timed_fx_manager.cpp b/ryzom/client/src/timed_fx_manager.cpp index 6f46d6712..c42928127 100644 --- a/ryzom/client/src/timed_fx_manager.cpp +++ b/ryzom/client/src/timed_fx_manager.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/client/src/user_entity.cpp b/ryzom/client/src/user_entity.cpp index 5c14bf82e..a09256703 100644 --- a/ryzom/client/src/user_entity.cpp +++ b/ryzom/client/src/user_entity.cpp @@ -3,7 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2013-2019 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/common/src/game_share/crypt.cpp b/ryzom/common/src/game_share/crypt.cpp index 1416cac52..5a2e99b9c 100644 --- a/ryzom/common/src/game_share/crypt.cpp +++ b/ryzom/common/src/game_share/crypt.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/common/src/game_share/mirrored_data_set.cpp b/ryzom/common/src/game_share/mirrored_data_set.cpp index 8db024784..61c7dc08b 100644 --- a/ryzom/common/src/game_share/mirrored_data_set.cpp +++ b/ryzom/common/src/game_share/mirrored_data_set.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2016 Jan BOON (Kaetemi) +// Copyright (C) 2016-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/common/src/game_share/object.cpp b/ryzom/common/src/game_share/object.cpp index bb92c4936..51e5e3ef6 100644 --- a/ryzom/common/src/game_share/object.cpp +++ b/ryzom/common/src/game_share/object.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2016 Jan BOON (Kaetemi) +// Copyright (C) 2016-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/common/src/game_share/object.h b/ryzom/common/src/game_share/object.h index 806d790aa..5b8c1c45d 100644 --- a/ryzom/common/src/game_share/object.h +++ b/ryzom/common/src/game_share/object.h @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2019 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/common/src/game_share/rm_family.cpp b/ryzom/common/src/game_share/rm_family.cpp index 5351b00b7..cae184117 100644 --- a/ryzom/common/src/game_share/rm_family.cpp +++ b/ryzom/common/src/game_share/rm_family.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/common/src/game_share/rm_family.h b/ryzom/common/src/game_share/rm_family.h index 9f9048531..627969214 100644 --- a/ryzom/common/src/game_share/rm_family.h +++ b/ryzom/common/src/game_share/rm_family.h @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/common/src/game_share/roles.cpp b/ryzom/common/src/game_share/roles.cpp index 578096b44..f4471183a 100644 --- a/ryzom/common/src/game_share/roles.cpp +++ b/ryzom/common/src/game_share/roles.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/common/src/game_share/roles.h b/ryzom/common/src/game_share/roles.h index 8b6dfd5b2..226a4d3c6 100644 --- a/ryzom/common/src/game_share/roles.h +++ b/ryzom/common/src/game_share/roles.h @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/common/src/game_share/server_animation_module.cpp b/ryzom/common/src/game_share/server_animation_module.cpp index 3c3276130..634d518c3 100644 --- a/ryzom/common/src/game_share/server_animation_module.cpp +++ b/ryzom/common/src/game_share/server_animation_module.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/common/src/game_share/time_weather_season/weather_function.cpp b/ryzom/common/src/game_share/time_weather_season/weather_function.cpp index f62a5a244..e43561da1 100644 --- a/ryzom/common/src/game_share/time_weather_season/weather_function.cpp +++ b/ryzom/common/src/game_share/time_weather_season/weather_function.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/common/src/game_share/timer.h b/ryzom/common/src/game_share/timer.h index 1659464fa..8f7ed63dd 100644 --- a/ryzom/common/src/game_share/timer.h +++ b/ryzom/common/src/game_share/timer.h @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/common/src/game_share/utils.h b/ryzom/common/src/game_share/utils.h index a534b156b..cb22574a4 100644 --- a/ryzom/common/src/game_share/utils.h +++ b/ryzom/common/src/game_share/utils.h @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2010 Matt RAYKOWSKI (sfb) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/common/src/game_share/visual_slot_manager.h b/ryzom/common/src/game_share/visual_slot_manager.h index 135e729a8..de1a5634a 100644 --- a/ryzom/common/src/game_share/visual_slot_manager.h +++ b/ryzom/common/src/game_share/visual_slot_manager.h @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/tools/client/client_config_qt/src/general_settings_widget.cpp b/ryzom/tools/client/client_config_qt/src/general_settings_widget.cpp index 6bb81f70f..3ba0d9bf3 100644 --- a/ryzom/tools/client/client_config_qt/src/general_settings_widget.cpp +++ b/ryzom/tools/client/client_config_qt/src/general_settings_widget.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp b/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp index e1a52d887..24d2bec98 100644 --- a/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp +++ b/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp b/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp index b4def1a14..9d3b4df65 100644 --- a/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp +++ b/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/tools/leveldesign/mission_compiler_lib/main.cpp b/ryzom/tools/leveldesign/mission_compiler_lib/main.cpp index 6c4285d46..6f32fbd8c 100644 --- a/ryzom/tools/leveldesign/mission_compiler_lib/main.cpp +++ b/ryzom/tools/leveldesign/mission_compiler_lib/main.cpp @@ -1,6 +1,9 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/ryzom/tools/leveldesign/mp_generator/main.cpp b/ryzom/tools/leveldesign/mp_generator/main.cpp index 150807f5c..f265ccc05 100644 --- a/ryzom/tools/leveldesign/mp_generator/main.cpp +++ b/ryzom/tools/leveldesign/mp_generator/main.cpp @@ -3,6 +3,7 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) +// Copyright (C) 2019 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp b/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp index 0140452b5..c57536fd3 100644 --- a/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp +++ b/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp b/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp index 3062878ed..f5c3971d9 100644 --- a/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp +++ b/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp @@ -1,5 +1,5 @@ // NeL - MMORPG Framework -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/ryzom/tools/translation_tools/main.cpp b/ryzom/tools/translation_tools/main.cpp index 4f65df260..dc91079f3 100644 --- a/ryzom/tools/translation_tools/main.cpp +++ b/ryzom/tools/translation_tools/main.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2014 Jan BOON (Kaetemi) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/studio/src/plugins/bnp_manager/bnp_manager_window.cpp b/studio/src/plugins/bnp_manager/bnp_manager_window.cpp index 9a4af0cd5..5dc19ff8f 100644 --- a/studio/src/plugins/bnp_manager/bnp_manager_window.cpp +++ b/studio/src/plugins/bnp_manager/bnp_manager_window.cpp @@ -1,6 +1,9 @@ // Object Viewer Qt - BNP Manager Plugin - MMORPG Framework // Copyright (C) 2011 Roland WINKLMEIER // +// This source file has been modified by the following contributors: +// Copyright (C) 2020 Jan BOON (Kaetemi) +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/studio/src/plugins/core/general_settings_page.cpp b/studio/src/plugins/core/general_settings_page.cpp index 6fb51b128..af2ede1b7 100644 --- a/studio/src/plugins/core/general_settings_page.cpp +++ b/studio/src/plugins/core/general_settings_page.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/studio/src/plugins/georges_editor/georges_editor_form.cpp b/studio/src/plugins/georges_editor/georges_editor_form.cpp index 009d2a6f0..89d8dfd19 100644 --- a/studio/src/plugins/georges_editor/georges_editor_form.cpp +++ b/studio/src/plugins/georges_editor/georges_editor_form.cpp @@ -4,6 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp b/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp index 014b6c6ba..b6b6a8f92 100644 --- a/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp +++ b/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp @@ -3,8 +3,8 @@ // // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) -// Copyright (C) 2014 Jan BOON (Kaetemi) // Copyright (C) 2014 Laszlo KIS-ADAM (dfighter) +// Copyright (C) 2014-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as diff --git a/tool/attribution/annotate.py b/tool/attribution/annotate.py index 80d530650..6029f9aeb 100644 --- a/tool/attribution/annotate.py +++ b/tool/attribution/annotate.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2019 Jan BOON +# Copyright (C) 2019-2020 Jan BOON # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -45,7 +45,7 @@ from datetime import datetime from pathlib import Path from git import Repo -repo = Repo("../../..") +repo = Repo("../..") # Mapping for author short name to full display name authors = { } @@ -83,6 +83,7 @@ authors["etrange"] = "StudioEtrange " authors["sircotare"] = "SirCotare" authors["rolandw"] = "Roland WINKLMEIER " authors["thibg"] = "Thibaut GIRKA (ThibG) " # LibVR support +authors["xtarsia"] = "Xtarsia" # Mapping from git author name to short name, dash to ignore author short_authors = { } @@ -164,6 +165,8 @@ short_authors["cemycc "] = "cemycc" short_authors["cemycc"] = "cemycc" short_authors["Thibaut Girka "] = "thibg" short_authors["Thibaut Girka (ThibG)"] = "thibg" +short_authors["Xtarsia <69606701+Xtarsia@users.noreply.github.com>"] = "xtarsia" +short_authors["Xtarsia"] = "xtarsia" # short_authors["\"picomancer ext:(%22) "] = "-" # short_authors["Quitta"] = "-" # short_authors["Krolock"] = "-" @@ -206,12 +209,12 @@ override_author["dc734ed66226b257becae9fcd140898e14510e6a"] = "-" # Header clean # Exclude some paths exclude_paths = { } -exclude_paths["code/nel/3rdparty"] = True -exclude_paths["code/nel/src/3d/driver/opengl/GL"] = True -exclude_paths["code/nel/src/3d/driver/opengl/EGL"] = True -exclude_paths["code/nel/src/3d/driver/opengl/GLES"] = True -exclude_paths["code/nel/src/3d/driver/opengl/KHR"] = True -exclude_paths["code/studio/src/3rdparty"] = True +exclude_paths["nel/3rdparty"] = True +exclude_paths["nel/src/3d/driver/opengl/GL"] = True +exclude_paths["nel/src/3d/driver/opengl/EGL"] = True +exclude_paths["nel/src/3d/driver/opengl/GLES"] = True +exclude_paths["nel/src/3d/driver/opengl/KHR"] = True +exclude_paths["studio/src/3rdparty"] = True # Programmatical remappings def remap_author(blob, commit, author): @@ -234,7 +237,7 @@ def remap_author(blob, commit, author): short_author = "winch_gate" if short_author == "sircotare" and authored_date.year >= 2012: short_author = "winch_gate" - if short_author == "inky": + if short_author == "inky" and authored_date.year < 2020: short_author = "winch_gate" if "feature-export-assimp" in commit.message and authored_date.year <= 2015: # Project paid for by Winch Gate @@ -334,7 +337,7 @@ def rewrite_cpp(path, copyright_oldest, copyright_newest, copyright_lines): # Everything before the first "// Copyright" remains intact # Parse existing notices, merge with lists, track which one is first # Write out new copyright and modification notices - contents = Path("../../../" + path).read_text() + contents = Path("../../" + path).read_text() content_start = contents.find("// This program is free software") if content_start < 0: header_not_found[path] = True @@ -431,7 +434,7 @@ def rewrite_cpp(path, copyright_oldest, copyright_newest, copyright_lines): new_contents = contents[0:copyright_start] + new_statement + contents[content_start:] if contents != new_contents: print(new_statement) - Path("../../../" + path).write_text(new_contents) + Path("../../" + path).write_text(new_contents) def process_cpp(cpp_entry): print(cpp_entry.path) From 38e5dfe00711f93da4589629739bc25a44e554df Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 06:19:02 +0800 Subject: [PATCH 091/205] Stricter UTF-8 --- nel/src/misc/utf_string_view.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp index d1239ae43..222265e91 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -178,8 +178,13 @@ u32char CUtfStringView::utf8Iterator(const void **addr) const uint8 **pp = reinterpret_cast(addr); u32char c0 = **pp; ++(*pp); - if ((c0 & 0xC0) == 0xC0) + if (c0 >= 0x80) { + if (c0 < 0xC0) + { + // Replacement character � + return 0xFFFD; + } uint8 cx = **pp; if ((cx & 0xC0) == 0x80) { @@ -206,6 +211,11 @@ u32char CUtfStringView::utf8Iterator(const void **addr) c0 <<= 6; c0 |= (cx & 0x3F); // 22 bits now (17 - 1 + 6), 3-byte encoding } + else + { + // Replacement character � + return 0xFFFD; + } } else if ((c0 & 0xFC00) == 0xD800) // Higher bits of nutcase UTF-16 encoded as UTF-8 { @@ -222,10 +232,30 @@ u32char CUtfStringView::utf8Iterator(const void **addr) c0 |= (c1 & 0x03FF); c0 += 0x10000; } + else + { + // Replacement character � + return 0xFFFD; + } } + else if ((c0 & 0xFC00) == 0xDC00) // Lower bits of nutcase UTF-16 encoded as UTF-8 + { + // Replacement character � + return 0xFFFD; + } + } + else + { + // Replacement character � + return 0xFFFD; } } } + else + { + // Replacement character � + return 0xFFFD; + } } return c0; } From 182a9173388afd844385900e032c86f5a36fa2fd Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 06:37:52 +0800 Subject: [PATCH 092/205] Make control characters printable --- nel/src/3d/font_manager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nel/src/3d/font_manager.cpp b/nel/src/3d/font_manager.cpp index 9e954ac1f..da8573ef7 100644 --- a/nel/src/3d/font_manager.cpp +++ b/nel/src/3d/font_manager.cpp @@ -146,6 +146,8 @@ void CFontManager::computeString (NLMISC::CUtfStringView sv, { // Creating font k.Char = *it; + if (k.Char < 0x20) + k.Char += 0x2400; k.FontGenerator = fontGen; k.Size = fontSize; k.Embolden = embolden; @@ -300,6 +302,8 @@ void CFontManager::computeStringInfo ( NLMISC::CUtfStringView sv, { // Creating font k.Char = *it; + if (k.Char < 0x20) + k.Char += 0x2400; k.FontGenerator = fontGen; k.Size = fontSize; k.Embolden = embolden; From 0bd43913e16e7e26b7dc133aff4617e9d09087d1 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 06:56:03 +0800 Subject: [PATCH 093/205] Stricter UTF-8 --- nel/src/misc/utf_string_view.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp index 222265e91..17dbaea58 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -49,7 +49,7 @@ NL_FORCE_INLINE void appendUtf8(std::string &str, u32char c) str += (char)((c & 0x0FC0) >> 6) | 0x80; str += (char)(c & 0x3F) | 0x80; } - else + else if (c < 0x110000) { // Encode as 4 bytes str += (char)((c & 0x1C0000) >> 18) | 0xF0; @@ -57,6 +57,11 @@ NL_FORCE_INLINE void appendUtf8(std::string &str, u32char c) str += (char)((c & 0x0FC0) >> 6) | 0x80; str += (char)(c & 0x3F) | 0x80; } + else + { + // Replacement character � + str += "\xEF\xB\xBD"; + } } void CUtfStringView::append(std::string &str, u32char c) @@ -175,6 +180,7 @@ u32char CUtfStringView::utf8Iterator(const void **addr) { // Decode UTF-8 // This implementation makes no attempt at fixing bad encoding, except for bad UTF-16 surrogate pairs + // Invalid characters are replaced with the replacement character const uint8 **pp = reinterpret_cast(addr); u32char c0 = **pp; ++(*pp); @@ -209,7 +215,12 @@ u32char CUtfStringView::utf8Iterator(const void **addr) ++(*pp); c0 &= 0xFFFF; // Drop first bit c0 <<= 6; - c0 |= (cx & 0x3F); // 22 bits now (17 - 1 + 6), 3-byte encoding + c0 |= (cx & 0x3F); // 22 bits now (17 - 1 + 6), 4-byte encoding + if (c0 >= 0x110000) + { + // Replacement character � + return 0xFFFD; + } } else { From 47c0c8cc074b9a424789008476da3d59380773e3 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 10:21:01 +0800 Subject: [PATCH 094/205] Fix utf iterator ptr --- nel/include/nel/misc/utf_string_view.h | 39 ++++++++++++-------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index ab8a25a58..0aac8d2c3 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -71,29 +71,27 @@ public: { public: inline void operator++() - { - m_Char = m_View.m_Iterator(&m_Addr); - if ((ptrdiff_t)m_Addr > ((ptrdiff_t)m_View.m_Str + m_View.m_Size)) - { - m_Addr = 0; - m_Char = 0; - } + { + if ((ptrdiff_t)m_Next > ((ptrdiff_t)m_View.m_Str + m_View.m_Size)) + m_Next = (void *)((ptrdiff_t)m_View.m_Str + m_View.m_Size); + m_Addr = m_Next; + m_Char = m_View.m_Iterator(&m_Next); } inline void operator+=(ptrdiff_t a) { - while (m_Addr) + while ((ptrdiff_t)m_Addr < ((ptrdiff_t)m_View.m_Str + m_View.m_Size)) { ++(*this); } } inline bool operator!=(const const_iterator &o) const { return m_Addr != o.m_Addr; } inline bool operator==(const const_iterator &o) const { return m_Addr == o.m_Addr; } - inline const u32char &operator*() const { return m_Char; } + inline const u32char &operator*() const { return m_Char; } const_iterator() : m_View(*(CUtfStringView *)NULL), m_Addr(NULL), m_Char(0) { } - const_iterator &operator=(const const_iterator &other) - { - if(this == &other) return *this; + const_iterator &operator=(const const_iterator &other) + { + if (this == &other) return *this; this->~const_iterator(); return *new(this) const_iterator(other); } @@ -101,23 +99,22 @@ public: const void *ptr() const { return m_Addr; } private: friend class CUtfStringView; - inline const_iterator(const CUtfStringView &view, const void *addr) : m_View(view), m_Addr(addr), m_Char(addr ? view.m_Iterator(&m_Addr) : 0) - { - if ((ptrdiff_t)m_Addr > ((ptrdiff_t)m_View.m_Str + m_View.m_Size)) - { - m_Addr = 0; - m_Char = 0; - } + inline const_iterator(const CUtfStringView &view, const void *addr) : m_View(view), m_Addr(addr), m_Next(addr), m_Char(view.m_Iterator(&m_Next)) + { + if ((ptrdiff_t)m_Next > ((ptrdiff_t)m_View.m_Str + m_View.m_Size)) + m_Next = (void *)((ptrdiff_t)m_View.m_Str + m_View.m_Size); } + inline const_iterator(const CUtfStringView &view) : m_View(view), m_Addr((char *)view.m_Str + view.m_Size), m_Next((char *)view.m_Str + view.m_Size + 1), m_Char(0) { } const CUtfStringView &m_View; - const void *m_Addr; // Next address + const void *m_Addr; // Current address + const void *m_Next; // Next address u32char m_Char; }; typedef const_iterator iterator; iterator begin() const { return iterator(*this, m_Str); } - inline iterator end() const { return iterator(*this, NULL); } + inline iterator end() const { return iterator(*this); } /// Largest possible number of characters in this string. /// Number of actual characters may be less or equal. From ff49b89b73b0f04273eabf995b41af321ecddc0c Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 10:59:21 +0800 Subject: [PATCH 095/205] Fix identity title, kaetemi/ryzomclassic#170 --- .../src/interface_v3/interface_manager.cpp | 145 +++++++++++------- 1 file changed, 91 insertions(+), 54 deletions(-) diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index d03412c35..cbfb9ba57 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -335,97 +335,134 @@ public: { ++it; if (it == inputString.end()) + { + formatedResult += '$'; + --it; break; + } switch(*it) { case 't': // add text ID + { formatedResult += paramString; break; - + } case 'P': case 'p': // add player name - if (ClientCfg.Local) + { + if (ClientCfg.Local || !UserEntity) { if (*it == 'P') formatedResult += "PLAYER"; else formatedResult += "Player"; } else { - if(UserEntity) - { - std::string name = UserEntity->getEntityName().toUtf8(); - if (*it == 'P') name = toUpper(name); - formatedResult += name; - } + std::string name = UserEntity->getEntityName().toUtf8(); + if (*it == 'P') name = toUpper(name); + formatedResult += name; } break; - // + } case 's': case 'b': // add bot name + { + string botName; + bool womanTitle = false; + if (ClientCfg.Local) { - string botName; - bool womanTitle = false; - if (ClientCfg.Local) - { - botName = "NPC"; - } - else + botName = "NPC"; + } + else + { + CLFECOMMON::TCLEntityId trader = CLFECOMMON::INVALID_SLOT; + if(UserEntity) + trader = UserEntity->trader(); + if (trader != CLFECOMMON::INVALID_SLOT) { - CLFECOMMON::TCLEntityId trader = CLFECOMMON::INVALID_SLOT; - if(UserEntity) - trader = UserEntity->trader(); - if (trader != CLFECOMMON::INVALID_SLOT) + CEntityCL *entity = EntitiesMngr.entity(trader); + if (entity != NULL) { - CEntityCL *entity = EntitiesMngr.entity(trader); - if (entity != NULL) + uint32 nDBid = entity->getNameId(); + if (nDBid != 0) + { + STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); + pSMC->getString(nDBid, botName); + } + else { - uint32 nDBid = entity->getNameId(); - if (nDBid != 0) - { - STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - pSMC->getString(nDBid, botName); - } - else - { - botName = entity->getDisplayName().toUtf8(); - } - CCharacterCL *pChar = dynamic_cast(entity); - if (pChar != NULL) - womanTitle = pChar->getGender() == GSGENDER::female; + botName = entity->getDisplayName().toUtf8(); } + CCharacterCL *pChar = dynamic_cast(entity); + if (pChar != NULL) + womanTitle = pChar->getGender() == GSGENDER::female; } } - // get the title translated - ucstring sTitleTranslated = botName; // FIXME: UTF-8 - CStringPostProcessRemoveName spprn; - spprn.Woman = womanTitle; - spprn.cbIDStringReceived(sTitleTranslated); + } + // get the title translated + ucstring sTitleTranslated = botName; // FIXME: UTF-8 + CStringPostProcessRemoveName spprn; + spprn.Woman = womanTitle; + spprn.cbIDStringReceived(sTitleTranslated); - botName = CEntityCL::removeTitleAndShardFromName(botName).toUtf8(); + botName = CEntityCL::removeTitleAndShardFromName(botName).toUtf8(); - // short name (with no title such as 'guard', 'merchant' ...) - if (*it == 's') + // short name (with no title such as 'guard', 'merchant' ...) + if (*it == 's') + { + // But if there is no name, display only the title + if (botName.empty()) + botName = sTitleTranslated.toUtf8(); + } + else + { + // Else we want the title ! + if (!botName.empty()) + botName += " "; + botName += sTitleTranslated.toUtf8(); + } + + formatedResult += botName; + break; + } + case '\'': // 's and 'S -> Potato’s Identity and TOMATOES’ IDENTITY + { + std::string::const_iterator it2 = it; + ++it2; + if (it2 == inputString.end()) + { + formatedResult += "$'"; + } + else + { + it = it2; + if (*it == 's' || *it == 'S') { - // But if there is no name, display only the title - if (botName.empty()) - botName = sTitleTranslated.toUtf8(); + if (formatedResult.size() && (formatedResult[formatedResult.size() - 1] == 's' || formatedResult[formatedResult.size() - 1] == 'S')) + { + formatedResult += "\xE2\x80\x99"; // RIGHT SINGLE QUOTATION MARK + } + else + { + formatedResult += "\xE2\x80\x99"; // RIGHT SINGLE QUOTATION MARK + formatedResult += *it; + } } else { - // Else we want the title ! - if (!botName.empty()) - botName += " "; - botName += sTitleTranslated.toUtf8(); + --it; + formatedResult += "$'"; } - - formatedResult += botName; } break; - default: - formatedResult += '$'; + } + default: + { + formatedResult += '$'; + --it; break; } + } ++it; } else From 5934147d9eb45f7dd7ee2d56c5ff0f4f9332a8e4 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 10:59:27 +0800 Subject: [PATCH 096/205] Fix identity title, kaetemi/ryzomclassic#170 --- ryzom/client/data/gamedev/interfaces_v3/taskbar.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml b/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml index 4d30e0be4..9b65c4973 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml @@ -919,7 +919,7 @@ global_color_normal="false" global_color_over="false" global_color_pushed="false" click_when_pushed="true" onclick_l="show_hide" params_l="#win_name" /> - + @@ -941,7 +941,7 @@ global_color_normal="false" global_color_over="false" global_color_pushed="false" click_when_pushed="true" onclick_l="show_hide" params_l="#win_name" /> - + From 7812ccafc18e30c4b26a98436bd5e6e9417ced2d Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 12:25:53 +0800 Subject: [PATCH 097/205] Fix infinite loop --- ryzom/client/src/interface_v3/chat_window.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index 237ffdd8b..3b3063879 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -208,7 +208,8 @@ void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGr { if (!_Chat) { - nlwarning(" There's no global chat"); + if (msg.toUtf8() != "WRN: There's no global chat") + nlwarning(" There's no global chat"); return; } CGroupList *gl; @@ -541,7 +542,8 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC { if (!_Chat) { - nlwarning(" There's no global chat"); + if (msg.toUtf8() != "WRN: There's no global chat") + nlwarning(" There's no global chat"); return; } From 39fc4895d2d003b9c63ff8e0181c864862d82795 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 13:20:02 +0800 Subject: [PATCH 098/205] Fix to work with saner new behaviour --- ryzom/client/src/interface_v3/chat_window.cpp | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index 3b3063879..8d7551803 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -1093,10 +1093,7 @@ CChatWindow *CChatWindowManager::createChatWindow(const CChatWindowDesc &desc) if (desc.Id.empty()) _WindowID++; - if (desc.Localize) - _ChatWindowMap[CI18N::get(desc.Title.toString())] = w; - else - _ChatWindowMap[desc.Title] = w; + _ChatWindowMap[desc.Title] = w; w->setAHOnActive(desc.AHOnActive); w->setAHOnActiveParams(desc.AHOnActiveParams); @@ -1135,10 +1132,7 @@ CChatWindow *CChatWindowManager::createChatGroupWindow(const CChatWindowDesc &de if (desc.Id.empty()) _WindowID++; - if (desc.Localize) - _ChatWindowMap[CI18N::get(desc.Title.toString())] = w; - else - _ChatWindowMap[desc.Title] = w; + _ChatWindowMap[desc.Title] = w; w->setAHOnActive(desc.AHOnActive); w->setAHOnActiveParams(desc.AHOnActiveParams); @@ -1185,7 +1179,7 @@ void CChatWindowManager::removeChatWindow(const ucstring &title) TChatWindowMap::iterator it = _ChatWindowMap.find(title); if (it == _ChatWindowMap.end()) { - nlwarning("unknwown window %s", title.toString().c_str()); + nlwarning("Unknown chat window '%s'", title.toUtf8().c_str()); return; } it->second->deleteContainer(); @@ -1225,18 +1219,9 @@ bool CChatWindowManager::rename(const ucstring &oldName, const ucstring &newName if (newWin != NULL) return false; // target window exists TChatWindowMap::iterator it = _ChatWindowMap.find(oldName); if (it == _ChatWindowMap.end()) return false; - if (newNameLocalize) - { - _ChatWindowMap[CI18N::get(newName.toString())] = it->second; - it->second->getContainer()->setLocalize(true); - it->second->getContainer()->setTitle(newName.toString()); - } - else - { - _ChatWindowMap[newName] = it->second; - it->second->getContainer()->setLocalize(false); - it->second->getContainer()->setUCTitle(newName); - } + _ChatWindowMap[newName] = it->second; + it->second->getContainer()->setLocalize(false); + it->second->getContainer()->setTitle(newName.toUtf8()); _ChatWindowMap.erase(it); return true; } From 2a7bf997b9c4fe3b68134ebcc1b31834965689aa Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 15:06:12 +0800 Subject: [PATCH 099/205] Cleanup localization behaviour --- nel/include/nel/gui/view_text.h | 11 +- nel/src/gui/ctrl_text_button.cpp | 7 +- nel/src/gui/group_container.cpp | 32 ++--- nel/src/gui/group_editbox.cpp | 2 +- nel/src/gui/view_text.cpp | 211 ++++++++++++++++++++----------- nel/src/gui/widget_manager.cpp | 1 + 6 files changed, 166 insertions(+), 98 deletions(-) diff --git a/nel/include/nel/gui/view_text.h b/nel/include/nel/gui/view_text.h index 7980e6427..69f9efca7 100644 --- a/nel/include/nel/gui/view_text.h +++ b/nel/include/nel/gui/view_text.h @@ -84,8 +84,10 @@ namespace NLGUI /// Set - void setText(const std::string &text); //< Not localized. Use setHardText to localize strings starting with "ui". TODO: Add a Localize flag, like title in group container. HardText then simply sets localize to true. + void setText(const std::string &text); + void setTextLocalized(const std::string &text, bool localized); void setTextAsUtf16 (const ucstring &text); + void setLocalized(bool localized); void setFontName (const std::string &name); void setFontSize (sint nFontSize, bool coef = true); void setEmbolden (bool nEmbolden); @@ -114,9 +116,10 @@ namespace NLGUI void disableStringSelection(); /// Get - std::string getText() const { return _Text; } + std::string getText() const { return _HardText.empty() ? _Text : _HardText; } ucstring getTextAsUtf16() const; ucstring getHardTextAsUtf16() const; + bool isLocalized() const { return _Localized; } sint getFontSize() const; std::string getFontName() const { return _FontName; } bool getEmbolden() { return _Embolden; } @@ -224,6 +227,7 @@ namespace NLGUI REFLECT_EXPORT_START(CViewText, CViewBase) REFLECT_STRING("text_raw", getText, setText); REFLECT_STRING("hardtext", getHardText, setHardText); + REFLECT_BOOL ("localize", isLocalized, setLocalized); // REFLECT_UCSTRING("uc_text", getTextAsUtf16, setTextAsUtf16); // Deprecate uc_ functions REFLECT_UCSTRING("uc_hardtext", getHardTextAsUtf16, setHardTextAsUtf16); REFLECT_UCSTRING("uc_hardtext_format", getTextAsUtf16, setTextFormatTagedAsUtf16); // FIXME: Name doesn't make sense @@ -248,6 +252,7 @@ namespace NLGUI std::string _HardText; std::string _Text; mutable sint _TextLength; + bool _Localized; /// index of the computed String associated to this text control uint _Index; /// info on the computed String associated to this text control @@ -443,6 +448,8 @@ namespace NLGUI void setup (); void setupDefault (); + void setTextLocalized(const std::string &text); + void setStringSelectionSkipingSpace(uint stringId, const std::string &text, sint charStart, sint charEnd); // void pushString(const ucstring &str, bool deleteSpaceAtStart = false); diff --git a/nel/src/gui/ctrl_text_button.cpp b/nel/src/gui/ctrl_text_button.cpp index c5571a4ca..3be6142e3 100644 --- a/nel/src/gui/ctrl_text_button.cpp +++ b/nel/src/gui/ctrl_text_button.cpp @@ -597,12 +597,7 @@ namespace NLGUI if (prop) { const char *propPtr = prop; - std::string text; - if (NLMISC::startsWith(propPtr, "ui")) - text = CI18N::get(propPtr); - else - text = propPtr; - _ViewText->setText(text); + _ViewText->setTextLocalized(propPtr, true); } } diff --git a/nel/src/gui/group_container.cpp b/nel/src/gui/group_container.cpp index 1416f5ee6..0740bd80f 100644 --- a/nel/src/gui/group_container.cpp +++ b/nel/src/gui/group_container.cpp @@ -2144,24 +2144,20 @@ namespace NLGUI ptr = xmlGetProp (cur, (xmlChar*)"title"); if (ptr) { - if (_Localize) _TitleTextOpened = CI18N::get(string((const char*)ptr)); - else _TitleTextOpened = string((const char*)ptr); - if (_Localize) _TitleTextClosed = CI18N::get(string((const char*)ptr)); - else _TitleTextClosed = string((const char*)ptr); + _TitleTextOpened = (const char *)ptr; + _TitleTextClosed = (const char *)ptr; } ptr = xmlGetProp (cur, (xmlChar*)"title_opened"); if (ptr) { - if (_Localize) _TitleTextOpened = CI18N::get(string((const char*)ptr)); - else _TitleTextOpened = string((const char*)ptr); + _TitleTextOpened = (const char*)ptr; } ptr = xmlGetProp (cur, (xmlChar*)"title_closed"); if (ptr) { - if (_Localize) _TitleTextClosed = CI18N::get(string((const char*)ptr)); - else _TitleTextClosed = string((const char*)ptr); + _TitleTextClosed = (const char *)ptr; } ptr = xmlGetProp (cur, (xmlChar*)"header_active"); @@ -3950,8 +3946,14 @@ namespace NLGUI void CGroupContainer::setLocalize(bool localize) { _Localize = localize; - setTitledOpenedViewText(); - setTitledClosedViewText(); + if (_TitleOpened) + { + _TitleOpened->setLocalized(localize); + } + if (_TitleClosed) + { + _TitleClosed->setLocalized(localize); + } invalidateCoords(); } @@ -4001,10 +4003,7 @@ namespace NLGUI { if (_TitleOpened != NULL) { - if (_Localize && NLMISC::startsWith(_TitleTextOpened, "ui")) - _TitleOpened->setHardText(_TitleTextOpened); - else - _TitleOpened->setText(_TitleTextOpened); + _TitleOpened->setTextLocalized(_TitleTextOpened, _Localize); } } @@ -4013,10 +4012,7 @@ namespace NLGUI { if (_TitleClosed != NULL) { - if (_Localize && NLMISC::startsWith(_TitleTextClosed, "ui")) - _TitleClosed->setHardText(_TitleTextClosed); - else - _TitleClosed->setText(_TitleTextClosed); + _TitleClosed->setTextLocalized(_TitleTextClosed, _Localize); } } diff --git a/nel/src/gui/group_editbox.cpp b/nel/src/gui/group_editbox.cpp index 799452b33..27084dd1b 100644 --- a/nel/src/gui/group_editbox.cpp +++ b/nel/src/gui/group_editbox.cpp @@ -1580,7 +1580,7 @@ namespace NLGUI _ViewText->setParent( this ); _ViewText->setIdRecurse( "edit_text" ); - _ViewText->setHardText( "" ); + _ViewText->setTextLocalized( "", false ); _ViewText->setPosRef( Hotspot_ML ); _ViewText->setParentPosRef( Hotspot_ML ); addView( _ViewText ); diff --git a/nel/src/gui/view_text.cpp b/nel/src/gui/view_text.cpp index 87ebab92d..f96ac535d 100644 --- a/nel/src/gui/view_text.cpp +++ b/nel/src/gui/view_text.cpp @@ -111,6 +111,8 @@ namespace NLGUI _ClampRight = true; // clamp on the right of the text _OverflowText = "..."; + _Localized = true; + _LetterColors = NULL; _Setuped= false; _AutoClampOffset = 0; @@ -211,7 +213,7 @@ namespace NLGUI _Index = 0xFFFFFFFF; _ModulateGlobalColor= vt._ModulateGlobalColor; - + _Localized = vt._Localized; // remove previous lines clearLines(); @@ -244,6 +246,11 @@ namespace NLGUI std::string CViewText::getTextProperty( const std::string &name ) const { + if( name == "localize" ) + { + return toString(_Localized); + } + else if( name == "color" ) { return toString( _Color ); @@ -418,6 +425,18 @@ namespace NLGUI bool CViewText::setTextProperty( const std::string &name, const std::string &value ) { + if( name == "localize" ) + { + bool b; + if (fromString(value, b)) + { + _Localized = b; + setTextLocalized(_HardText.empty() ? _Text : _HardText); // FIXME: setCase? + _TextLength = 0; + } + return true; + } + else if( name == "color" ) { CRGBA c; @@ -649,28 +668,19 @@ namespace NLGUI return true; } else + if( name == "text" ) + { + setTextLocalized(value); // FIXME: setCase? + _TextLength = 0; + invalidateContent(); + return true; + } + else if( name == "hardtext" ) { -#if 1 - if (NLMISC::startsWith(value, "ui")) - { - _Text = CI18N::get(value); - _TextLength = 0; - _HardText = value; - } - else - { - _Text = value; - _TextLength = 0; - _HardText.clear(); - } -#else - _Text = value; + _Localized = true; + setTextLocalized(value); // FIXME: setCase? _TextLength = 0; - _HardText.clear(); - if (NLMISC::startsWith(value, "ui")) - _HardText = _Text; -#endif invalidateContent(); return true; } @@ -705,6 +715,8 @@ namespace NLGUI bool CViewText::serializeTextOptions( xmlNodePtr node ) const { + xmlSetProp( node, BAD_CAST "localize", BAD_CAST toString( _Localized ).c_str() ); + xmlSetProp( node, BAD_CAST "color", BAD_CAST toString( _Color ).c_str() ); xmlSetProp( node, BAD_CAST "global_color", BAD_CAST toString( _ModulateGlobalColor ).c_str() ); @@ -784,7 +796,7 @@ namespace NLGUI serializeTextOptions( node ); - xmlSetProp( node, BAD_CAST "hardtext", BAD_CAST _Text.c_str() ); + xmlSetProp( node, BAD_CAST "text", BAD_CAST (_HardText.empty() ? _Text.c_str() : _HardText.c_str()) ); xmlSetProp( node, BAD_CAST "hardtext_format", BAD_CAST _HardTextFormat.c_str() ); return node; @@ -795,6 +807,9 @@ namespace NLGUI { CXMLAutoPtr prop; + prop = xmlGetProp (cur, (xmlChar*)"localize"); + if (prop) _Localized = convertBool((const char*)prop); + prop= (char*) xmlGetProp( cur, (xmlChar*)"color" ); _Color = CRGBA(255,255,255,255); if (prop) @@ -1000,18 +1015,8 @@ namespace NLGUI if (prop) { const char *propPtr = prop; - if (NLMISC::startsWith(propPtr, "ui")) - { - _HardText = propPtr; - _Text = CI18N::get(propPtr); - _TextLength = 0; - } - else - { - _HardText.clear(); - _Text = propPtr; - _TextLength = 0; - } + _Localized = true; + setTextLocalized(propPtr); setCase(_Text, _CaseMode); _TextLength = 0; } @@ -1427,49 +1432,109 @@ namespace NLGUI } // *************************************************************************** - void CViewText::setText(const std::string &text) + void CViewText::setTextLocalized(const std::string &text, bool localized) { - _HardText.clear(); - // common case: no special format, no case mode => easy cache test - if (_FormatTags.empty() && _CaseMode==CaseNormal) + if (localized != _Localized) { - if (text != _Text) - { - _Text = text; - _TextLength = 0; - // no need to call "setCase (_Text, _CaseMode);" since CaseNormal: - invalidateContent (); - } + _Localized = localized; + + // Always recompute if localization and text changed + setTextLocalized(text); + setCase(_Text, _CaseMode); + _TextLength = 0; + invalidateContent(); } else { - // if the view text had some format before, no choice, must recompute all - if (!_FormatTags.empty()) + setText(text); + } + } + + // *************************************************************************** + void CViewText::setLocalized(bool localized) + { + if (localized != _Localized) + { + const std::string &text = _HardText.empty() ? _Text : _HardText; + _Localized = localized; + if (!text.empty() && NLMISC::startsWith(text, "ui")) { - _Text = text; - setCase (_Text, _CaseMode); + setTextLocalized(text); + setCase(_Text, _CaseMode); _TextLength = 0; - invalidateContent (); - } - // else test if after the case change the cache succeed - else - { - // compute the temp cased text - std::string tempText = text; - setCase (tempText, _CaseMode); - if (tempText != _Text) - { - _Text = tempText; - _TextLength = 0; - invalidateContent(); - } + invalidateContent(); } } - // clear format tags if any - _FormatTags.clear(); + nlassert(_Text.empty() || ((_Localized && (NLMISC::startsWith(getText(), "ui"))) == (_HardText.empty() == _Text.empty()))); + } + + // *************************************************************************** + void CViewText::setTextLocalized(const std::string &text) + { + if (_Localized && NLMISC::startsWith(text, "ui")) + { + _HardText = text; + _Text = CI18N::get(text); + } + else + { + _Text = text; + _HardText.clear(); + } } + // *************************************************************************** + void CViewText::setText(const std::string &text) + { + // common case: no special format, no case mode => easy cache test + if (_FormatTags.empty() && _CaseMode == CaseNormal) + { + if (_HardText.empty() ? text != _Text : text != _HardText) + { + setTextLocalized(text); + _TextLength = 0; + // no need to call "setCase (_Text, _CaseMode);" since CaseNormal: + invalidateContent(); + } + } + else + { + // if the view text had some format before, no choice, must recompute all + if (!_FormatTags.empty()) + { + setTextLocalized(text); + setCase(_Text, _CaseMode); + _TextLength = 0; + invalidateContent(); + } + // else test if after the case change the cache succeed + else + { + // compute the temp cased text + std::string holdText, holdHardText; + holdText.swap(_Text); + holdHardText.swap(_HardText); + setTextLocalized(text); + setCase(_Text, _CaseMode); + if (holdText != _Text) + { + _TextLength = 0; + invalidateContent(); + } + else + { + holdText.swap(_Text); + } + } + } + + nlassert(_Text.empty() || ((_Localized && (NLMISC::startsWith(text, "ui"))) == (_HardText.empty() == _Text.empty()))); + + // clear format tags if any + _FormatTags.clear(); + } + // *************************************************************************** void CViewText::setFontSizing(const std::string &chars, const std::string &fallback) { @@ -2396,15 +2461,12 @@ namespace NLGUI // *************************************************************************** void CViewText::setHardText (const std::string &ht) { - if (NLMISC::startsWith(ht, "ui")) - { - setText(CI18N::get(ht)); - _HardText = ht; - } - else + if (!_Localized) { - setText(ht); + setText(std::string()); + _Localized = true; } + setText(ht); } // *************************************************************************** @@ -3367,6 +3429,7 @@ namespace NLGUI // Copy to Text (preserve Memory) contReset(_Text); _Text = tempText; + _HardText.clear(); _TextLength = 0; CInterfaceGroup *parent = getParent(); @@ -3477,6 +3540,7 @@ namespace NLGUI // Copy to Text (preserve Memory) contReset(_Text); _Text = tempText; + _HardText.clear(); _TextLength = 0; invalidateContent (); } @@ -3560,6 +3624,11 @@ namespace NLGUI #define SERIAL_UINT(val) { uint32 tmp = (uint32) val; f.serial(tmp); val = (uint) tmp; } #define SERIAL_SINT(val) { sint32 tmp = (sint32) val; f.serial(tmp); val = (sint) tmp; } CViewBase::serial(f); + + int version = f.serialVersion(101); + nlassert(version >= 100); + + f.serial(_Localized); SERIAL_SINT(_FontSize); SERIAL_UINT(_FontWidth); SERIAL_UINT(_FontHeight); diff --git a/nel/src/gui/widget_manager.cpp b/nel/src/gui/widget_manager.cpp index 534a0cc1b..9ce889a95 100644 --- a/nel/src/gui/widget_manager.cpp +++ b/nel/src/gui/widget_manager.cpp @@ -1195,6 +1195,7 @@ namespace NLGUI sint32 backupX = groupOver->getX(); // Copy all aspects to the view + vtDst->setLocalized (vtSrc->isLocalized()); vtDst->setText (vtSrc->getText()); vtDst->setFontSize (vtSrc->getFontSize()); vtDst->setColor (vtSrc->getColor()); From d238d2122bafb2d7b7949af39adc636b974369ad Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 30 Oct 2020 15:07:36 +0800 Subject: [PATCH 100/205] Cleanup localization behaviour --- ryzom/client/src/connection.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 4fafe3ebc..a491d5e57 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -1021,7 +1021,7 @@ TInterfaceState globalMenu() // Display the firewall alert string CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:outgame:connecting:title")); if (pVT != NULL) - pVT->setText(CI18N::get("uiFirewallAlert") + "..."); + pVT->setTextLocalized("uiFirewallAlert", true); // The mouse and fullscreen mode should be unlocked for the user to set the firewall permission nlSleep( 30 ); // 'nice' the client, and prevent to make too many send attempts @@ -1237,8 +1237,8 @@ TInterfaceState globalMenu() if (pVT != NULL) { pVT->setMultiLine( true ); - pVT->setText(CI18N::get("uiFirewallFail")+".\n"+ - CI18N::get("uiFirewallAlert")+"."); + pVT->setTextLocalized(CI18N::get("uiFirewallFail")+".\n"+ + CI18N::get("uiFirewallAlert")+".", false); } } } @@ -1319,16 +1319,16 @@ public: if (pVT == NULL) return; if (rCS.Name.empty()) - pVT->setText(CI18N::get("uiEmptySlot")); + pVT->setTextLocalized("uiEmptySlot", true); else - pVT->setText(rCS.Name.toUtf8()); + pVT->setTextLocalized(rCS.Name.toUtf8(), false); } // 5 slots for (; i < 5; ++i) { CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sPath+":text"+NLMISC::toString(i))); if (pVT == NULL) return; - pVT->setText(CI18N::get("uiEmptySlot")); + pVT->setTextLocalized("uiEmptySlot", true); } } }; @@ -2171,7 +2171,7 @@ public: if (pVT != NULL) { std::string str = Mainlands[i].Name.toUtf8() + " " + Mainlands[i].Description.toUtf8(); - pVT->setText(str); + pVT->setTextLocalized(str, false); } // Add to the list @@ -2311,7 +2311,7 @@ public: CViewText *pVT = dynamic_cast(pNewLine->getView("name")); if (pVT != NULL) { - pVT->setText(name.toUtf8()); + pVT->setTextLocalized(name.toUtf8(), false); } CCtrlBase *pBut = pNewLine->getCtrl("but"); @@ -2559,7 +2559,7 @@ static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName { CViewText* viewText = dynamic_cast(result); if(viewText) - viewText->setText(text.toUtf8()); + viewText->setTextLocalized(text.toUtf8(), false); CGroupEditBox* editBox = dynamic_cast(result); if(editBox) editBox->setInputStringAsUtf16(text); @@ -2682,7 +2682,7 @@ class CAHScenarioControl : public IActionHandler CViewText* viewText = dynamic_cast(result); if(viewText) { - viewText->setText(R2::getEditor().isInitialized()?CI18N::get("uiR2EDScenarioName"):CI18N::get("uiR2EDScenarioFileName")); + viewText->setTextLocalized(R2::getEditor().isInitialized() ? "uiR2EDScenarioName" : "uiR2EDScenarioFileName", true); } } @@ -2712,7 +2712,7 @@ class CAHScenarioControl : public IActionHandler CViewText* viewText= dynamic_cast(result); if(viewText) - viewText->setText(""); + viewText->setText(std::string()); } } setScenarioInformation(scenarioWnd, ""); @@ -2748,7 +2748,7 @@ class CAHScenarioControl : public IActionHandler CViewText *shardName = dynamic_cast(toggleGr->getView("button_text")); if (shardName) { - shardName->setText(Mainlands[i].Name.toUtf8()); + shardName->setTextLocalized(Mainlands[i].Name.toUtf8(), false); } } } @@ -2888,7 +2888,7 @@ class CAHScenarioInformation : public IActionHandler scenarioName = scenarioName.substr(posScenarioName==0?posScenarioName:posScenarioName+1); posScenarioName = scenarioName.find('/'); } - viewText->setText(scenarioName); + viewText->setTextLocalized(scenarioName, false); } } @@ -3250,7 +3250,7 @@ class CAHLoadScenario : public IActionHandler { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningFreeTrial")); + pVT->setTextLocalized("uiRingWarningFreeTrial", true); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); return; @@ -3331,7 +3331,7 @@ class CAHLoadScenario : public IActionHandler { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningFreeTrial")); + pVT->setTextLocalized("uiRingWarningFreeTrial", true); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); } @@ -3360,7 +3360,7 @@ class CAHLoadScenario : public IActionHandler { CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningInviteFreeTrial")); + pVT->setTextLocalized("uiRingWarningInviteFreeTrial", true); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); } } From c061f3df3a707cbce417b140017c24998afb2ecd Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 03:32:50 +0800 Subject: [PATCH 101/205] Don't need this behaviour after all --- .../src/interface_v3/interface_manager.cpp | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index cbfb9ba57..24ab75058 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -425,37 +425,6 @@ public: formatedResult += botName; break; } - case '\'': // 's and 'S -> Potato’s Identity and TOMATOES’ IDENTITY - { - std::string::const_iterator it2 = it; - ++it2; - if (it2 == inputString.end()) - { - formatedResult += "$'"; - } - else - { - it = it2; - if (*it == 's' || *it == 'S') - { - if (formatedResult.size() && (formatedResult[formatedResult.size() - 1] == 's' || formatedResult[formatedResult.size() - 1] == 'S')) - { - formatedResult += "\xE2\x80\x99"; // RIGHT SINGLE QUOTATION MARK - } - else - { - formatedResult += "\xE2\x80\x99"; // RIGHT SINGLE QUOTATION MARK - formatedResult += *it; - } - } - else - { - --it; - formatedResult += "$'"; - } - } - break; - } default: { formatedResult += '$'; From 13f99b393f96f46e11bea14d6be2c23a17cb7a5b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 03:52:37 +0800 Subject: [PATCH 102/205] Reimplement setCase in purely UTF-8, kaetemi/ryzomclassic#172 --- nel/include/nel/misc/common.h | 10 ++++ nel/src/gui/string_case.cpp | 108 +++++++++++++++++----------------- nel/src/misc/unicode.cpp | 48 ++++++++++++--- 3 files changed, 103 insertions(+), 63 deletions(-) diff --git a/nel/include/nel/misc/common.h b/nel/include/nel/misc/common.h index 7c2cc2937..9ed33c8d8 100644 --- a/nel/include/nel/misc/common.h +++ b/nel/include/nel/misc/common.h @@ -240,6 +240,16 @@ std::string toUpper ( const char *str ); // UTF-8 std::string toUpper ( const std::string &str); // UTF-8 void toUpper ( char *str); // Ascii only +/** Convert a single character in UTF-8 to upper or lowercase. +* \param res Character is appended in UTF-8 into this string. +* \param src Character is sourced from this UTF-8 string. +* \param i Index in `str`, incremented by the number of bytes read. +*/ +void appendToLower(std::string &res, const char *str, ptrdiff_t &i); +void appendToLower(std::string &res, const std::string &str, ptrdiff_t &i); +void appendToUpper(std::string &res, const char *str, ptrdiff_t &i); +void appendToUpper(std::string &res, const std::string &str, ptrdiff_t &i); + /** * Convert to an hexadecimal std::string diff --git a/nel/src/gui/string_case.cpp b/nel/src/gui/string_case.cpp index 801b2fc68..ced12e3ca 100644 --- a/nel/src/gui/string_case.cpp +++ b/nel/src/gui/string_case.cpp @@ -28,19 +28,19 @@ namespace NLGUI { - inline bool isSeparator (u32char c) + inline bool isSeparator (char c) { - return (c == (u32char)' ') || (c == (u32char)'\t') || (c == (u32char)'\n') || (c == (u32char)'\r'); + return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r'); } - inline bool isEndSentence (u32char c, u32char lastChar) + inline bool isEndSentence (char c, char lastChar) { // Ex: One sentence. Another sentence. // ^ // Counterexample: nevrax.com // ^ - return ((c == (u32char)' ') || (c == (u32char)'\n')) - && (lastChar == (u32char)'.') || (lastChar == (u32char)'!') || (lastChar == (u32char)'?'); + return ((c == ' ') || (c == '\n')) + && (lastChar == '.') || (lastChar == '!') || (lastChar == '?'); } void setCase(std::string &str, TCaseMode mode) @@ -60,85 +60,83 @@ namespace NLGUI break; case CaseFirstStringLetterUp: { - NLMISC::CUtfStringView sv(str); std::string res; - res.reserve(sv.largestSize()); - for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) + res.reserve(str.size() + (str.size() >> 2)); + for (ptrdiff_t i = 0; i < (ptrdiff_t)str.size();) { - u32char c = *it; - if (c < 0x10000) + char c = str[i]; + if (!isSeparator(c)) { - if (!isSeparator(c)) - { - if (newString) - c = NLMISC::toUpper((ucchar)c); - else - c = NLMISC::toLower((ucchar)c); - newString = false; - } + if (newString) + NLMISC::appendToUpper(res, str, i); + else + NLMISC::appendToLower(res, str, i); + newString = false; + } + else + { + res += c; + ++i; } - NLMISC::CUtfStringView::append(res, c); } - str = nlmove(res); + str.swap(res); break; } case CaseFirstSentenceLetterUp: { - NLMISC::CUtfStringView sv(str); std::string res; - res.reserve(sv.largestSize()); - u32char lastChar = 0; - for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) + res.reserve(str.size() + (str.size() >> 2)); + char lastChar = 0; + for (ptrdiff_t i = 0; i < (ptrdiff_t)str.size();) { - u32char c = *it; - if (c < 0x10000) + char c = str[i]; + if (isEndSentence(c, lastChar)) { - if (isEndSentence(c, lastChar)) - newSentence = true; + newSentence = true; + res += c; + ++i; + } + else + { + if (newSentence) + NLMISC::appendToUpper(res, str, i); else - { - if (newSentence) - c = NLMISC::toUpper((ucchar)c); - else - c = NLMISC::toLower((ucchar)c); + NLMISC::appendToLower(res, str, i); - if (!isSeparator(c)) - newSentence = false; - } + if (!isSeparator(c)) + newSentence = false; } - NLMISC::CUtfStringView::append(res, c); lastChar = c; } - str = nlmove(res); + str.swap(res); break; } case CaseFirstWordLetterUp: { - NLMISC::CUtfStringView sv(str); std::string res; - res.reserve(sv.largestSize()); - u32char lastChar = 0; - for (NLMISC::CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) + res.reserve(str.size() + (str.size() >> 2)); + char lastChar = 0; + for (ptrdiff_t i = 0; i < (ptrdiff_t)str.size();) { - u32char c = *it; - if (c < 0x10000) + char c = str[i]; + if (isSeparator(c) || isEndSentence(c, lastChar)) + { + newWord = true; + res += c; + ++i; + } + else { - if (isSeparator(c) || isEndSentence(c, lastChar)) - newWord = true; + if (newWord) + NLMISC::appendToUpper(res, str, i); else - { - if (newWord) - c = NLMISC::toUpper((ucchar)c); - else - c = NLMISC::toLower((ucchar)c); + NLMISC::appendToLower(res, str, i); - newWord = false; - } + newWord = false; } - NLMISC::CUtfStringView::append(res, c); lastChar = c; } - str = nlmove(res); + str.swap(res); break; } default: diff --git a/nel/src/misc/unicode.cpp b/nel/src/misc/unicode.cpp index 10321a907..b38344d4a 100644 --- a/nel/src/misc/unicode.cpp +++ b/nel/src/misc/unicode.cpp @@ -4752,7 +4752,7 @@ NL_FORCE_INLINE void appendToLowerAsUtf8(std::string &res, const char *str, ptrd if (table[idx]) { res += &table[idx]; - ++i; + i += 2; return; } } @@ -4770,20 +4770,23 @@ NL_FORCE_INLINE void appendToLowerAsUtf8(std::string &res, const char *str, ptrd if (table[idx]) { res += &table[idx]; - i += 2; + i += 3; return; } } } } res += c; + ++i; } +// *************************************************************************** + std::string toLower(const char *str) { // UTF-8 toLower, tables generated from UTF-16 tables std::string res; - for (ptrdiff_t i = 0; str[i]; ++i) + for (ptrdiff_t i = 0; str[i];) appendToLowerAsUtf8(res, str, i); return res; } @@ -4796,11 +4799,25 @@ std::string toLower(const std::string &str) std::string res; res.reserve(str.size() + (str.size() >> 2)); const char *cstr = &str[0]; - for (ptrdiff_t i = 0; i < (ptrdiff_t)str.size(); ++i) + for (ptrdiff_t i = 0; i < (ptrdiff_t)str.size();) appendToLowerAsUtf8(res, cstr, i); return res; } +// *************************************************************************** + +void appendToLower(std::string &res, const char *str, ptrdiff_t &i) +{ + appendToLowerAsUtf8(res, str, i); +} + +// *************************************************************************** + +void appendToLower(std::string &res, const std::string &str, ptrdiff_t &i) +{ + appendToLowerAsUtf8(res, &str[0], i); +} + // *************************************************************************** // *************************************************************************** // *************************************************************************** @@ -4827,7 +4844,7 @@ NL_FORCE_INLINE void appendToUpperAsUtf8(std::string &res, const char *str, ptrd if (table[idx]) { res += &table[idx]; - ++i; + i += 2; return; } } @@ -4845,13 +4862,14 @@ NL_FORCE_INLINE void appendToUpperAsUtf8(std::string &res, const char *str, ptrd if (table[idx]) { res += &table[idx]; - i += 2; + i += 3; return; } } } } res += c; + ++i; } // *************************************************************************** @@ -4860,7 +4878,7 @@ std::string toUpper(const char *str) { // UTF-8 toLower, tables generated from UTF-16 tables std::string res; - for (ptrdiff_t i = 0; str[i]; ++i) + for (ptrdiff_t i = 0; str[i];) appendToUpperAsUtf8(res, str, i); return res; } @@ -4873,13 +4891,27 @@ std::string toUpper(const std::string &str) std::string res; res.reserve(str.size() + (str.size() >> 2)); const char *cstr = &str[0]; - for (ptrdiff_t i = 0; i < (ptrdiff_t)str.size(); ++i) + for (ptrdiff_t i = 0; i < (ptrdiff_t)str.size();) appendToUpperAsUtf8(res, cstr, i); return res; } // *************************************************************************** +void appendToUpper(std::string &res, const char *str, ptrdiff_t &i) +{ + appendToUpperAsUtf8(res, str, i); +} + +// *************************************************************************** + +void appendToUpper(std::string &res, const std::string &str, ptrdiff_t &i) +{ + appendToUpperAsUtf8(res, &str[0], i); +} + +// *************************************************************************** + #else // *************************************************************************** From 1c09d2ea4bd0ceb2847d3bc8a169e54a9a2b6bed Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 04:19:02 +0800 Subject: [PATCH 103/205] Avoid useless string operations --- nel/include/nel/misc/string_common.h | 7 ++++--- nel/src/gui/interface_element.cpp | 9 ++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/nel/include/nel/misc/string_common.h b/nel/include/nel/misc/string_common.h index 96f7f7bd1..71ab05a30 100644 --- a/nel/include/nel/misc/string_common.h +++ b/nel/include/nel/misc/string_common.h @@ -254,9 +254,10 @@ inline bool fromString(const std::string &str, double &val) { bool ret = sscanf( inline bool fromString(const std::string &str, wchar_t &val) { return fromString(str, reinterpret_cast(val)); } #endif -// Fast string to bool, reliably defined for strings starting with 0, 1, t, T, f, F, y, Y, n, N, anything else is undefined. -// (str[0] == '1' || (str[0] & 0xD2) == 0x50) -// - Kaetemi +/// Fast string to bool, reliably defined for strings starting with 0, 1, t, T, f, F, y, Y, n, N, and empty strings, anything else is undefined. +/// - Kaetemi +inline bool toBool(const char *str) { return str[0] == '1' || (str[0] & 0xD2) == 0x50; } +inline bool toBool(const std::string &str) { return toBool(str.c_str()); } // Safe because first byte may be null bool fromString(const std::string &str, bool &val); diff --git a/nel/src/gui/interface_element.cpp b/nel/src/gui/interface_element.cpp index cf5646077..bc5da4e03 100644 --- a/nel/src/gui/interface_element.cpp +++ b/nel/src/gui/interface_element.cpp @@ -1028,21 +1028,16 @@ namespace NLGUI } // ------------------------------------------------------------------------------------------------ - bool CInterfaceElement::convertBool (const char *ptr) + bool CInterfaceElement::convertBool (const char *ptr) { - std::string str = toLower(ptr); - bool b = false; - fromString( str, b ); - return b; + return NLMISC::toBool(ptr); } // ------------------------------------------------------------------------------------------------ NLMISC::CVector CInterfaceElement::convertVector (const char *ptr) { float x = 0.0f, y = 0.0f, z = 0.0f; - sscanf (ptr, "%f %f %f", &x, &y, &z); - return CVector(x,y,z); } From 0629951ba6903f3eb506dbca31cd0a1cecb57d49 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 04:25:07 +0800 Subject: [PATCH 104/205] Fix useless cursor reloads --- nel/include/nel/gui/view_pointer.h | 7 +++++-- nel/src/gui/view_pointer.cpp | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/nel/include/nel/gui/view_pointer.h b/nel/include/nel/gui/view_pointer.h index b947cc604..db7355465 100644 --- a/nel/include/nel/gui/view_pointer.h +++ b/nel/include/nel/gui/view_pointer.h @@ -61,8 +61,11 @@ namespace NLGUI // TEMP PATCH void setCursor (const std::string &name) { - _TxDefault = name; - _TxIdDefault = -2; + if (_TxDefault != name) + { + _TxDefault = name; + _TxIdDefault = -2; + } } // TEMP PATCH diff --git a/nel/src/gui/view_pointer.cpp b/nel/src/gui/view_pointer.cpp index 74644fa9f..228868731 100644 --- a/nel/src/gui/view_pointer.cpp +++ b/nel/src/gui/view_pointer.cpp @@ -207,7 +207,10 @@ namespace NLGUI if (_TxIdDefault == -2) { - _TxIdDefault = rVR.getTextureIdFromName (_TxDefault); + _TxIdDefault = rVR.getTextureIdFromName(_TxDefault); + } + if (_TxIdMoveWindow == -2) + { _TxIdMoveWindow = rVR.getTextureIdFromName (_TxMoveWindow); _TxIdResizeBRTL = rVR.getTextureIdFromName (_TxResizeBRTL); _TxIdResizeBLTR = rVR.getTextureIdFromName (_TxResizeBLTR); From 22fd1132edd0cf95fa14c440deb28d7faaf201e7 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 04:26:21 +0800 Subject: [PATCH 105/205] Improve setCase behaviour --- nel/src/gui/string_case.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nel/src/gui/string_case.cpp b/nel/src/gui/string_case.cpp index ced12e3ca..946b8d58a 100644 --- a/nel/src/gui/string_case.cpp +++ b/nel/src/gui/string_case.cpp @@ -40,7 +40,7 @@ namespace NLGUI // Counterexample: nevrax.com // ^ return ((c == ' ') || (c == '\n')) - && (lastChar == '.') || (lastChar == '!') || (lastChar == '?'); + && ((lastChar == '.') || (lastChar == '!') || (lastChar == '?') || (lastChar == '\n')); } void setCase(std::string &str, TCaseMode mode) From 7e8f84462f5097c923faa8e8e796ff23f9252db2 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 04:36:46 +0800 Subject: [PATCH 106/205] Add manifest to enable segment heap --- ryzom/client/src/CMakeLists.txt | 2 +- ryzom/client/src/segement_heap.manifest | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 ryzom/client/src/segement_heap.manifest diff --git a/ryzom/client/src/CMakeLists.txt b/ryzom/client/src/CMakeLists.txt index 99b9a6773..f5d19f1d5 100644 --- a/ryzom/client/src/CMakeLists.txt +++ b/ryzom/client/src/CMakeLists.txt @@ -21,7 +21,7 @@ IF(WITH_RYZOM_CLIENT) ENDIF() FILE(GLOB CFG ../*.cfg) - FILE(GLOB SRC *.cpp *.h motion/*.cpp motion/*.h client.rc) + FILE(GLOB SRC *.cpp *.h motion/*.cpp motion/*.h client.rc *.manifest) FILE(GLOB SRC_INTERFACE interface_v3/*.h interface_v3/*.cpp) FILE(GLOB SRC_MODE motion/modes/*.cpp motion/modes/*.h) FILE(GLOB SRC_R2 r2/*.h r2/*.cpp r2/dmc/*.h r2/dmc/*.cpp) diff --git a/ryzom/client/src/segement_heap.manifest b/ryzom/client/src/segement_heap.manifest new file mode 100644 index 000000000..0deedb1e7 --- /dev/null +++ b/ryzom/client/src/segement_heap.manifest @@ -0,0 +1,8 @@ + + + + + SegmentHeap + + + From 246ea2f603c7a3a3084bc175e2faecb1638ffcfd Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 06:38:33 +0800 Subject: [PATCH 107/205] UTF-8 entity name, ryzom/ryzomcore#335 --- nel/include/nel/misc/common.h | 4 + nel/src/misc/unicode.cpp | 232 +++++++++++++++++- ryzom/client/src/character_cl.cpp | 2 +- ryzom/client/src/client_chat_manager.cpp | 18 +- ryzom/client/src/connection.cpp | 8 +- ryzom/client/src/connection.h | 4 +- ryzom/client/src/debug_client.cpp | 2 +- ryzom/client/src/entity_cl.cpp | 34 +-- ryzom/client/src/entity_cl.h | 16 +- ryzom/client/src/forage_source_cl.cpp | 14 +- ryzom/client/src/init_main_loop.cpp | 8 +- .../src/interface_v3/action_handler_game.cpp | 4 +- .../src/interface_v3/action_handler_help.cpp | 14 +- .../src/interface_v3/action_handler_item.cpp | 4 +- .../src/interface_v3/action_handler_misc.cpp | 12 +- .../interface_v3/dbgroup_list_sheet_trade.cpp | 2 +- .../client/src/interface_v3/group_compas.cpp | 2 +- .../src/interface_v3/group_html_webig.cpp | 4 +- ryzom/client/src/interface_v3/group_map.cpp | 6 +- .../client/src/interface_v3/guild_manager.cpp | 4 +- .../src/interface_v3/interface_manager.cpp | 8 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 8 +- .../src/interface_v3/people_interraction.cpp | 6 +- ryzom/client/src/net_manager.cpp | 8 +- .../client/src/r2/displayer_visual_entity.cpp | 2 +- ryzom/client/src/string_manager_client.cpp | 4 +- 26 files changed, 329 insertions(+), 101 deletions(-) diff --git a/nel/include/nel/misc/common.h b/nel/include/nel/misc/common.h index 9ed33c8d8..6a4480e5a 100644 --- a/nel/include/nel/misc/common.h +++ b/nel/include/nel/misc/common.h @@ -250,6 +250,10 @@ void appendToLower(std::string &res, const std::string &str, ptrdiff_t &i); void appendToUpper(std::string &res, const char *str, ptrdiff_t &i); void appendToUpper(std::string &res, const std::string &str, ptrdiff_t &i); +/** UTF-8 case insensitive compare */ +int compareCaseInsensitive(const char *a, const char *b); +int compareCaseInsensitive(const char *a, size_t lenA, const char *b, size_t lenB); + /** * Convert to an hexadecimal std::string diff --git a/nel/src/misc/unicode.cpp b/nel/src/misc/unicode.cpp index b38344d4a..6e00afe88 100644 --- a/nel/src/misc/unicode.cpp +++ b/nel/src/misc/unicode.cpp @@ -4732,8 +4732,8 @@ static const char **s_UtfLowerToUpperMap[16] = { NL_FORCE_INLINE void appendToLowerAsUtf8(std::string &res, const char *str, ptrdiff_t &i) { - char c = str[i]; - char d, e; + unsigned char c = str[i]; + unsigned char d, e; if (c < 0x80) { if (c >= 'A' && c <= 'Z') @@ -4824,8 +4824,8 @@ void appendToLower(std::string &res, const std::string &str, ptrdiff_t &i) NL_FORCE_INLINE void appendToUpperAsUtf8(std::string &res, const char *str, ptrdiff_t &i) { - char c = str[i]; - char d, e; + unsigned char c = str[i]; + unsigned char d, e; if (c < 0x80) { if (c >= 'a' && c <= 'z') @@ -4910,6 +4910,230 @@ void appendToUpper(std::string &res, const std::string &str, ptrdiff_t &i) appendToUpperAsUtf8(res, &str[0], i); } +// *************************************************************************** +// *************************************************************************** +// *************************************************************************** + +static const char s_UpperAscii[] = { + 'A', 0, 'B', 0, 'C', 0, 'D', 0, 'E', 0, 'F', 0, 'G', 0, + 'H', 0, 'I', 0, 'J', 0, 'K', 0, 'L', 0, 'M', 0, 'N', 0, + 'O', 0, 'P', 0, 'Q', 0, 'R', 0, 'S', 0, 'T', 0, 'U', 0, + 'V', 0, 'W', 0, 'X', 0, 'Y', 0, 'Z', 0, 0, 0, 0, 0 +}; + +const char *fetchToUpperAsUtf8(const char **str) +{ + unsigned char c = *(*str); + unsigned char d, e; + if (c < 0x80) + { + if (c >= 'a' && c <= 'z') + { + // 1-byte UTF-8 + ++(*str); + return &s_UpperAscii[(c - 'a') << 1]; + } + } + else if ((c & 0xE0) == 0xC0 && ((d = (*str)[1]) & 0xC0) == 0x80) + { + // 2-byte UTF-8 + const char *table = s_Utf8LowerToUpperTables[c & 0x1F]; + if (table) + { + unsigned char idx = (d & 0x3F) << 2; + if (table[idx]) + { + (*str) += 2; + return &table[idx]; + } + } + } + else if ((c & 0xF0) == 0xE0 && ((d = (*str)[1]) & 0xC0) == 0x80 && ((e = (*str)[2]) & 0xC0) == 0x80) + { + // 3-byte UTF-8 + const char **map = s_UtfLowerToUpperMap[c & 0x0F]; + if (map) + { + const char *table = map[d & 0x3F]; + if (table) + { + unsigned char idx = (d & 0x3F) << 2; + if (table[idx]) + { + (*str) += 3; + return &table[idx]; + } + } + } + } + return NULL; +} + +int compareCaseInsensitive(const char *a, const char *b) +{ + // while (*a != 0 && *b != 0) + for (; ;) + { + const char *ca = fetchToUpperAsUtf8(&a); + const char *cb = fetchToUpperAsUtf8(&b); + if (!ca && !cb) + { + // Easy case, ASCII compare or junk + if (*a != *b) + { + if (*a > * b) return 1; + else return -1; + } + else if (!*a) // Equal and NUL, ends both + { + return 0; + } + ++a; + ++b; + } + else if (!cb) + { + // String a changed lowercase, iterate ca until NUL alongside b + nlassert(*ca); + do + { + if (*ca != *b) + { + if (*ca > *b) return 1; + else return -1; + } + ++ca; + ++b; + } while (*ca); + } + else if (!ca) + { + // String b changed lowercase, iterate a alongside cb until NUL + nlassert(*cb); + do + { + if (*a != *cb) + { + if (*a > *cb) return 1; + else return -1; + } + ++a; + ++cb; + } while (*cb); + } + else + { + // Both strings changed lowercase + if (ca != cb) // Only check if it's a different result + { + do + { + if (*ca != *cb) + { + if (*ca > *cb) return 1; + else return -1; + } + ++ca; + ++cb; + } while (*ca && *cb); + } + } + } + // if (*a == *b) return 0; + // if (*a > *b) return 1; + // return -1; +} + +int compareCaseInsensitive(const char *a, size_t lenA, const char *b, size_t lenB) +{ + const char *ma = a + lenA; + const char *mb = b + lenB; + for (; ;) + { + if (a >= ma) + { + if (b >= mb) + { + return 0; // Both strings ended + } + else + { + return 1; // A is longer + } + } + if (b >= mb) + { + return -1; // B is longer + } + const char *ca = fetchToUpperAsUtf8(&a); + const char *cb = fetchToUpperAsUtf8(&b); + if (!ca && !cb) + { + // Easy case, ASCII compare or junk + if (*a != *b) + { + if (*a > * b) return 1; + else return -1; + } + /* + else if (!*a) // Equal and NUL, ends both + { + return 0; + } + */ + ++a; + ++b; + } + else if (!cb) + { + // String a changed lowercase, iterate ca until NUL alongside b + nlassert(*ca); + do + { + if (*ca != *b) + { + if (*ca > *b) return 1; + else return -1; + } + ++ca; + ++b; + } while (*ca); + } + else if (!ca) + { + // String b changed lowercase, iterate a alongside cb until NUL + nlassert(*cb); + do + { + if (*a != *cb) + { + if (*a > *cb) return 1; + else return -1; + } + ++a; + ++cb; + } while (*cb); + } + else + { + // Both strings changed lowercase + if (ca != cb) // Only check if it's a different result + { + do + { + if (*ca != *cb) + { + if (*ca > *cb) return 1; + else return -1; + } + ++ca; + ++cb; + } while (*ca && *cb); + } + } + } +} + // *************************************************************************** #else diff --git a/ryzom/client/src/character_cl.cpp b/ryzom/client/src/character_cl.cpp index 84b058902..d68a836de 100644 --- a/ryzom/client/src/character_cl.cpp +++ b/ryzom/client/src/character_cl.cpp @@ -811,7 +811,7 @@ bool CCharacterCL::build(const CEntitySheet *sheet) // virtual // Get the fauna name in the sheet const ucstring creatureName(STRING_MANAGER::CStringManagerClient::getCreatureLocalizedName(_Sheet->Id)); if (creatureName.find(ucstring("(EntitiesMngr.getEntityByName(sender, true, true)); bool bWoman = entity && entity->getGender() == GSGENDER::female; - name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); + name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman); { // Sometimes translation contains another title ucstring::size_type pos = name.find('$'); if (pos != ucstring::npos) { - name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name), bWoman); + name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name.toUtf8()), bWoman); } } } else { // Does the char have a CSR title? - csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? ucstring("(CSR) ") : ucstring(""); + csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring(""); } result = csr + name + ucstring(" ") + CI18N::get("tellsYou") + ucstring(": ") + msg; @@ -1018,13 +1018,13 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde } // Format the sentence with the provided sender name - ucstring senderName = CEntityCL::removeTitleAndShardFromName(sender); + ucstring senderName = CEntityCL::removeTitleAndShardFromName(sender.toUtf8()); ucstring csr; // Does the char have a CSR title? - csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? ucstring("(CSR) ") : ucstring(""); + csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring(""); - if (UserEntity && senderName == UserEntity->getDisplayName()) + if (UserEntity && senderName.toUtf8() == UserEntity->getDisplayName()) { // The player talks switch(type) @@ -1046,13 +1046,13 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde // We need the gender to display the correct title bool bWoman = entity && entity->getGender() == GSGENDER::female; - senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); + senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman); { // Sometimes translation contains another title ucstring::size_type pos = senderName.find('$'); if (pos != ucstring::npos) { - senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName), bWoman); + senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName.toUtf8()), bWoman); } } } diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index a491d5e57..1fa7efb9f 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -145,8 +145,8 @@ string CharNameValidDBLink; uint8 PlayerSelectedSlot = 0; string PlayerSelectedFileName; TSessionId PlayerSelectedMainland= (TSessionId)0; // This is the mainland selected at the SELECT perso!! -ucstring PlayerSelectedHomeShardName; -ucstring PlayerSelectedHomeShardNameWithParenthesis; +std::string PlayerSelectedHomeShardName; +std::string PlayerSelectedHomeShardNameWithParenthesis; extern std::string CurrentCookie; ucstring NewKeysCharNameWanted; // name of the character for which a new keyset must be created @@ -1441,7 +1441,7 @@ Deprecated { ucstring::size_type pos = sValue.find('$'); if (pos != ucstring::npos) { - sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sValue), womanTitle); + sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sValue.toUtf8()), womanTitle); } } setTarget (pCaller, sTarget, sValue); @@ -3348,7 +3348,7 @@ class CAHLoadScenario : public IActionHandler ucstring res; if (pSMC->getString(val,res)) { - string charName = CEntityCL::removeTitleAndShardFromName(res).toString(); + string charName = CEntityCL::removeTitleAndShardFromName(res.toUtf8()); sessionBrowser.inviteCharacterByName(sessionBrowser._LastScheduleSessionCharId, charName); if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_invokeResult"))) diff --git a/ryzom/client/src/connection.h b/ryzom/client/src/connection.h index 67bda815c..bb6f4cd24 100644 --- a/ryzom/client/src/connection.h +++ b/ryzom/client/src/connection.h @@ -30,8 +30,8 @@ extern std::vector Mainlands; extern uint8 PlayerSelectedSlot; extern std::string PlayerSelectedFileName; extern TSessionId PlayerSelectedMainland; // This is the mainland selected at the SELECT perso!! -extern ucstring PlayerSelectedHomeShardName; // The home shard name (aniro, leanon etc....) -extern ucstring PlayerSelectedHomeShardNameWithParenthesis; // Same with parenthesis +extern std::string PlayerSelectedHomeShardName; // The home shard name (aniro, leanon etc....) +extern std::string PlayerSelectedHomeShardNameWithParenthesis; // Same with parenthesis extern std::vector CharacterSummaries; extern std::string UserPrivileges; extern sint LoginCharsel; diff --git a/ryzom/client/src/debug_client.cpp b/ryzom/client/src/debug_client.cpp index 88df4be99..cbceca4ef 100644 --- a/ryzom/client/src/debug_client.cpp +++ b/ryzom/client/src/debug_client.cpp @@ -514,7 +514,7 @@ string getDebugInformation() if(UserEntity) { - str += toString("Player Name: '%s'\n", UserEntity->getEntityName().toString().c_str()); + str += toString("Player Name: '%s'\n", UserEntity->getEntityName().c_str()); str += toString("UserPosition: %.2f %.2f %.2f\n", UserEntity->pos().x, UserEntity->pos().y, UserEntity->pos().z); } else diff --git a/ryzom/client/src/entity_cl.cpp b/ryzom/client/src/entity_cl.cpp index 9d3f446eb..9e57b3acb 100644 --- a/ryzom/client/src/entity_cl.cpp +++ b/ryzom/client/src/entity_cl.cpp @@ -2097,7 +2097,7 @@ bool CEntityCL::clipped (const std::vector &clippingPlanes, cons // Set the name of the entity. Handle replacement tag if any // to insert NPC task translated. //--------------------------------------------------- -void CEntityCL::setEntityName(const ucstring &name) +void CEntityCL::setEntityName(const std::string &name) { _EntityName = name; } @@ -2264,7 +2264,7 @@ void CEntityCL::load() // virtual //----------------------------------------------- void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) { - _EntityName = value; + _EntityName = value.toUtf8(); // remove the shard name if possible _EntityName= removeShardFromName(_EntityName); @@ -2303,7 +2303,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) if (pos != ucstring::npos) { ucstring sn = replacement; - _EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(sn.substr(0, pos)); + _EntityName = sn.substr(0, pos).toUtf8(); ucstring::size_type pos2 = sn.find('$', pos + 1); _TitleRaw = sn.substr(pos+1, pos2 - pos - 1); replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle); @@ -2370,32 +2370,32 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) //----------------------------------------------- // getTitleFromName //----------------------------------------------- -ucstring CEntityCL::getTitleFromName(const ucstring &name) +std::string CEntityCL::getTitleFromName(const std::string &name) { - ucstring::size_type p1 = name.find('$'); + std::string::size_type p1 = name.find('$'); if (p1 != ucstring::npos) { - ucstring::size_type p2 = name.find('$', p1 + 1); - if (p2 != ucstring::npos) + std::string::size_type p2 = name.find('$', p1 + 1); + if (p2 != std::string::npos) return name.substr(p1+1, p2-p1-1); } - return ucstring(""); + return std::string(); }// getTitleFromName // //----------------------------------------------- // removeTitleFromName //----------------------------------------------- -ucstring CEntityCL::removeTitleFromName(const ucstring &name) +std::string CEntityCL::removeTitleFromName(const std::string &name) { - ucstring::size_type p1 = name.find('$'); + std::string::size_type p1 = name.find('$'); if (p1 == ucstring::npos) { return name; } else { - ucstring::size_type p2 = name.find('$', p1 + 1); + std::string::size_type p2 = name.find('$', p1 + 1); if (p2 != ucstring::npos) { return name.substr(0, p1) + name.substr(p2 + 1); @@ -2410,16 +2410,16 @@ ucstring CEntityCL::removeTitleFromName(const ucstring &name) //----------------------------------------------- // removeShardFromName //----------------------------------------------- -ucstring CEntityCL::removeShardFromName(const ucstring &name) +std::string CEntityCL::removeShardFromName(const std::string &name) { // The string must contains a '(' and a ')' - ucstring::size_type p0= name.find('('); - ucstring::size_type p1= name.find(')'); - if(p0==ucstring::npos || p1==ucstring::npos || p1<=p0) + std::string::size_type p0= name.find('('); + std::string::size_type p1= name.find(')'); + if(p0==std::string::npos || p1==std::string::npos || p1<=p0) return name; // if it is the same as the shard name of the user, remove it - if(ucstrnicmp(name, (uint)p0+1, (uint)(p1-p0-1), PlayerSelectedHomeShardName)==0) + if (!NLMISC::compareCaseInsensitive(name.c_str() + p0 + 1, p1-p0-1, PlayerSelectedHomeShardName.c_str(), PlayerSelectedHomeShardName.size())) return name.substr(0,p0) + name.substr(p1+1); // else don't modify else @@ -2429,7 +2429,7 @@ ucstring CEntityCL::removeShardFromName(const ucstring &name) //----------------------------------------------- // removeTitleAndShardFromName //----------------------------------------------- -ucstring CEntityCL::removeTitleAndShardFromName(const ucstring &name) +std::string CEntityCL::removeTitleAndShardFromName(const std::string &name) { return removeTitleFromName(removeShardFromName(name)); } diff --git a/ryzom/client/src/entity_cl.h b/ryzom/client/src/entity_cl.h index e2985493a..5b53c3027 100644 --- a/ryzom/client/src/entity_cl.h +++ b/ryzom/client/src/entity_cl.h @@ -334,19 +334,19 @@ public: */ //@{ /// Return the Name of the entity. There may be a specification in it (guard, trader, etc ...). It is then surrounded by '$' - const ucstring &getEntityName() const {return _EntityName;} + const std::string &getEntityName() const {return _EntityName;} /// Return the title from a name. The specification is surrounded by '$', and tells the title of the entity (guard, matis merchant, etc ..) - static ucstring getTitleFromName(const ucstring &name); + static std::string getTitleFromName(const std::string &name); /// Remove the specification from a name. The specification is surrounded by '$', and tells the title of the entity (guard, matis merchant, etc ..) - static ucstring removeTitleFromName(const ucstring &name); + static std::string removeTitleFromName(const std::string &name); /// Remove the shard from a name (if player from the same shard). The shard is surrounded by (), and tells the incoming shard of the entity (aniro, leanon etc...) - static ucstring removeShardFromName(const ucstring &name); + static std::string removeShardFromName(const std::string &name); /// Remove both title and shard from name - static ucstring removeTitleAndShardFromName(const ucstring &name); + static std::string removeTitleAndShardFromName(const std::string &name); /// Change the entity name. - void setEntityName(const ucstring &name); + void setEntityName(const std::string &name); /// Return a displayable name - ucstring getDisplayName() const + std::string getDisplayName() const { return removeTitleAndShardFromName(_EntityName); } @@ -931,7 +931,7 @@ protected: // Flags to know what is possible to do with the entity (selectable, liftable, etc.). CProperties _Properties; // Current Name for the entity - ucstring _EntityName; + std::string _EntityName; // Current entity title ucstring _Title; // Current entity tags diff --git a/ryzom/client/src/forage_source_cl.cpp b/ryzom/client/src/forage_source_cl.cpp index 46249ed9e..7f538a2f0 100644 --- a/ryzom/client/src/forage_source_cl.cpp +++ b/ryzom/client/src/forage_source_cl.cpp @@ -508,9 +508,9 @@ void CForageSourceCL::updateVisualPropertyVisualFX(const NLMISC::TGameCycle &/* CEntityCL *prospector = EntitiesMngr.entities()[_ProspectorSlot]; if (prospector != NULL) { - ucstring prospectorName = prospector->getDisplayName(); + string prospectorName = prospector->getDisplayName(); if ( ! prospectorName.empty() ) - _EntityName += ucstring(" [") + prospectorName + ucstring("]"); + _EntityName += " [" + prospectorName + "]"; } } @@ -539,15 +539,15 @@ void CForageSourceCL::updateVisualPropertyName(const NLMISC::TGameCycle &/* game const ucchar *name = STRING_MANAGER::CStringManagerClient::getItemLocalizedName( rmSheetId ); if ( name ) { - _EntityName = name; + _EntityName = ucstring(name).toUtf8(); if ( _ProspectorSlot != 255 ) { CEntityCL *prospector = EntitiesMngr.entities()[_ProspectorSlot]; if (prospector != NULL) { - ucstring prospectorName = prospector->getDisplayName(); + std::string prospectorName = prospector->getDisplayName(); if ( ! prospectorName.empty() ) - _EntityName += ucstring(" [") + prospectorName + ucstring("]"); + _EntityName += " [" + prospectorName + "]"; } } // Rebuild inscene interface @@ -568,9 +568,9 @@ void CForageSourceCL::updateVisualPropertyTarget(const NLMISC::TGameCycle &/* ga CEntityCL *prospector = EntitiesMngr.entities()[_ProspectorSlot]; // NULL if entity not received if (prospector != NULL) { - ucstring prospectorName = prospector->getDisplayName(); + std::string prospectorName = prospector->getDisplayName(); if ( ! prospectorName.empty() ) - _EntityName = _EntityName + ucstring(" [") + prospectorName + ucstring("]"); + _EntityName = _EntityName + " [" + prospectorName + "]"; } // Rebuild inscene interface diff --git a/ryzom/client/src/init_main_loop.cpp b/ryzom/client/src/init_main_loop.cpp index a5bfa67df..e2566e48f 100644 --- a/ryzom/client/src/init_main_loop.cpp +++ b/ryzom/client/src/init_main_loop.cpp @@ -225,8 +225,8 @@ struct CStatThread : public NLMISC::IRunnable string cookie() { string name; - if(UserEntity && !UserEntity->getEntityName().toString().empty()) - name = UserEntity->getEntityName().toString(); + if(UserEntity && !UserEntity->getEntityName().empty()) + name = UserEntity->getEntityName(); std::string userid = toString("u%d", NetMngr.getUserId())+name; return toUpper(getMD5((const uint8 *)userid.c_str(), (uint32)userid.size()).toString()); @@ -236,7 +236,7 @@ struct CStatThread : public NLMISC::IRunnable bool connect() { //nlinfo("connect"); - if(!UserEntity || UserEntity->getEntityName().toString().empty()) + if(!UserEntity || UserEntity->getEntityName().empty()) return false; referer = ContinentMngr.getCurrentContinentSelectName(); @@ -260,7 +260,7 @@ struct CStatThread : public NLMISC::IRunnable timeinfo = localtime ( &rawtime ); strftime (buffer,80,"%H%%3A%M", timeinfo); addParam(params, "localtime", buffer); - addParam(params, "cv_name", UserEntity->getEntityName().toUtf8()); + addParam(params, "cv_name", UserEntity->getEntityName()); //addParam(params, "cv_email", ""); //addParam(params, "cv_avatar", ""); addParam(params, "cv_Userid", toString(NetMngr.getUserId())); diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index cf25d00c5..4da75a8da 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -1959,13 +1959,13 @@ public: if (pChar != NULL) womanTitle = pChar->getGender() == GSGENDER::female; - STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle); + STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout.toUtf8()), womanTitle); // Sometimes translation contains another title ucstring::size_type pos = copyInout.find('$'); if (pos != ucstring::npos) { - copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle); + copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout.toUtf8()), womanTitle); } CStringPostProcessRemoveTitle::cbIDStringReceived(copyInout); diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index dc64feae1..2ccbf963a 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -670,7 +670,7 @@ class CHandlerOpenTitleHelp : public IActionHandler if (selection == NULL) return; //if(selection->isNPC()) { - ucstring name = selection->getEntityName(); + std::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); - ucstring copyName = name; + std::string copyName = name; name = CEntityCL::removeTitleAndShardFromName(name); if (name.empty()) { @@ -689,18 +689,18 @@ class CHandlerOpenTitleHelp : public IActionHandler woman = pChar->getGender() == GSGENDER::female; // extract the replacement id - ucstring strNewTitle = CEntityCL::getTitleFromName(copyName); + std::string strNewTitle = CEntityCL::getTitleFromName(copyName); // retrieve the translated string if (!strNewTitle.empty()) - name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(strNewTitle, woman); + name = ucstring(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(ucstring::makeFromUtf8(strNewTitle), woman)).toUtf8(); else name.clear(); } } } if(!name.empty()) - CAHManager::getInstance()->runActionHandler("show_hide", pCaller, "profile|pname="+name.toUtf8()+"|ptype="+toString((int)selection->Type)); + CAHManager::getInstance()->runActionHandler("show_hide", pCaller, "profile|pname="+name+"|ptype="+toString((int)selection->Type)); return; } } @@ -2762,7 +2762,7 @@ class CPlayerShardNameRemover : public IOnReceiveTextId { virtual void onReceiveTextId(ucstring &str) { - str= CEntityCL::removeShardFromName(str); + str= CEntityCL::removeShardFromName(str.toUtf8()); } }; static CPlayerShardNameRemover PlayerShardNameRemover; @@ -3629,7 +3629,7 @@ public: CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:NAME", index)); if (node && CStringManagerClient::instance()->getDynString(node->getValue32(), txt)) { - CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt).toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt.toUtf8())); } } }; diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index e3ee653aa..0edd74491 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -1737,7 +1737,7 @@ void CItemMenuInBagInfoWaiter::infoValidated(CDBCtrlSheet* ctrlSheet) ucstring creatorNameString; if( STRING_MANAGER::CStringManagerClient::instance()->getString ( itemInfo.CreatorName, creatorNameString) ) { - if (toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString)) + if ( toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString.toUtf8())) isCraftedByUserEntity = true; } @@ -1845,7 +1845,7 @@ class CHandlerItemMenuCheck : public IActionHandler ucstring creatorNameString; if( STRING_MANAGER::CStringManagerClient::instance()->getString ( getInventory().getItemInfo(getInventory().getItemSlotId(pCS)).CreatorName, creatorNameString) ) { - if (toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString)) + if (toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString.toUtf8())) isTextEditionActive = true; } } diff --git a/ryzom/client/src/interface_v3/action_handler_misc.cpp b/ryzom/client/src/interface_v3/action_handler_misc.cpp index 8b379f6d1..63d491deb 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -836,7 +836,7 @@ class CAHReplyTeller : public IActionHandler { w->setKeyboardFocus(); w->enableBlink(1); - PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName)); + PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName.toUtf8())); CGroupEditBox *eb = w->getEditBox(); if (eb != NULL) { @@ -863,7 +863,7 @@ class CAHReplyTellerOnce : public IActionHandler { w->setKeyboardFocus(); w->enableBlink(1); - w->setCommand(ucstring("tell ") + CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName) + ucstring(" "), false); + w->setCommand(ucstring("tell ") + CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName.toUtf8()) + ucstring(" "), false); CGroupEditBox *eb = w->getEditBox(); if (eb != NULL) { @@ -916,7 +916,7 @@ NLMISC_COMMAND(slsn, "Temp : set the name of the last sender.", "") bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut) { // extract the replacement id - ucstring strNewTitle = CEntityCL::getTitleFromName(inOut); + ucstring strNewTitle = CEntityCL::getTitleFromName(inOut.toUtf8()); // retrieve the translated string if (!strNewTitle.empty()) @@ -927,7 +927,7 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut) ucstring::size_type pos = inOut.find('$'); if (pos != ucstring::npos) { - inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(inOut), Woman); + inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(inOut.toUtf8()), Woman); } } } @@ -940,14 +940,14 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut) // *************************************************************************** bool CStringPostProcessRemoveTitle::cbIDStringReceived(ucstring &inOut) { - inOut = CEntityCL::removeTitleAndShardFromName(inOut); + inOut = CEntityCL::removeTitleAndShardFromName(inOut.toUtf8()); return true; } // *************************************************************************** bool CStringPostProcessNPCRemoveTitle::cbIDStringReceived(ucstring &inOut) { - ucstring sOut = CEntityCL::removeTitleAndShardFromName(inOut); + ucstring sOut = CEntityCL::removeTitleAndShardFromName(inOut.toUtf8()); if (sOut.empty()) { CStringPostProcessRemoveName SPPRM; 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 a461d0194..3d59ea644 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -692,7 +692,7 @@ void CDBGroupListSheetTrade::checkCoords () ucstring result; if( pSMC->getString ( cst->LastVendorNameId, result) ) { - cst->VendorNameString = CEntityCL::removeShardFromName(result); + cst->VendorNameString = CEntityCL::removeShardFromName(result.toUtf8()); set< CSheetChildTrade *>::iterator itTmp = it; ++it; VendorNameIdToUpdate.erase(itTmp); diff --git a/ryzom/client/src/interface_v3/group_compas.cpp b/ryzom/client/src/interface_v3/group_compas.cpp index a5e443da6..d5b8d7e9c 100644 --- a/ryzom/client/src/interface_v3/group_compas.cpp +++ b/ryzom/client/src/interface_v3/group_compas.cpp @@ -560,7 +560,7 @@ bool buildCompassTargetFromTeamMember(CCompassTarget &ct, uint teamMemberId) CStringManagerClient *pSMC = CStringManagerClient::instance(); ucstring name; if (pSMC->getString(nameNode->getValue32(), name)) - ct.Name = CEntityCL::removeTitleAndShardFromName(name); // TODO : dynamic support for name + ct.Name = CEntityCL::removeTitleAndShardFromName(name.toUtf8()); // TODO : dynamic support for name else ct.Name = CI18N::get("uiNotReceived"); return true; diff --git a/ryzom/client/src/interface_v3/group_html_webig.cpp b/ryzom/client/src/interface_v3/group_html_webig.cpp index 985ae3f20..d190b83b6 100644 --- a/ryzom/client/src/interface_v3/group_html_webig.cpp +++ b/ryzom/client/src/interface_v3/group_html_webig.cpp @@ -97,7 +97,7 @@ void addWebIGParams (string &url, bool trustedDomain) if (url.find('$') != string::npos) { strFindReplace(url, "$gender$", GSGENDER::toString(UserEntity->getGender())); - strFindReplace(url, "$displayName$", UserEntity->getDisplayName().toString()); + strFindReplace(url, "$displayName$", UserEntity->getDisplayName()); // FIXME: UrlEncode... strFindReplace(url, "$posx$", toString(UserEntity->pos().x)); strFindReplace(url, "$posy$", toString(UserEntity->pos().y)); strFindReplace(url, "$posz$", toString(UserEntity->pos().z)); @@ -113,7 +113,7 @@ void addWebIGParams (string &url, bool trustedDomain) if (target) { strFindReplace(url, "$tdatasetid$", toString(target->dataSetId())); - strFindReplace(url, "$tdisplayName$", target->getDisplayName().toString()); + strFindReplace(url, "$tdisplayName$", target->getDisplayName()); // FIXME: UrlEncode... strFindReplace(url, "$tposx$", toString(target->pos().x)); strFindReplace(url, "$tposy$", toString(target->pos().y)); strFindReplace(url, "$tposz$", toString(target->pos().z)); diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index ce6d21021..7725d45f9 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -1201,7 +1201,7 @@ void CGroupMap::checkCoords() CEntityCL *sel = EntitiesMngr.entity(UserEntity->selection()); if (sel) { - _TargetLM->setDefaultContextHelp(NLMISC::CI18N::get("uiTargetTwoPoint") + sel->removeTitleAndShardFromName(sel->getEntityName()).toUtf8()); + _TargetLM->setDefaultContextHelp(NLMISC::CI18N::get("uiTargetTwoPoint") + sel->removeTitleAndShardFromName(sel->getEntityName())); } } } @@ -1405,8 +1405,8 @@ void CGroupMap::checkCoords() if (pSMC->getString(val,res)) { - res = CEntityCL::removeTitleAndShardFromName(res); - _TeammateLM[i]->setDefaultContextHelp(res.toUtf8()); + std::string res2 = CEntityCL::removeTitleAndShardFromName(res.toUtf8()); + _TeammateLM[i]->setDefaultContextHelp(res2); } } updateLMPosFromDBPos(_TeammateLM[i], px, py); diff --git a/ryzom/client/src/interface_v3/guild_manager.cpp b/ryzom/client/src/interface_v3/guild_manager.cpp index e3a1b6b41..328579d06 100644 --- a/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/ryzom/client/src/interface_v3/guild_manager.cpp @@ -359,7 +359,7 @@ void CGuildManager::update() for (uint i = 0; i < _GuildMembers.size(); ++i) { if (!pSMC->getString (_GuildMembers[i].NameID, _GuildMembers[i].Name)) bAllValid = false; - else _GuildMembers[i].Name = CEntityCL::removeTitleAndShardFromName(_GuildMembers[i].Name); + else _GuildMembers[i].Name = CEntityCL::removeTitleAndShardFromName(_GuildMembers[i].Name.toUtf8()); } // If all is valid no more need update and if guild is opened update the interface @@ -875,7 +875,7 @@ class CAHGuildSheetOpen : public IActionHandler CCtrlBase *inviteButton = pLine->getCtrl("invite_button"); if (inviteButton != NULL) - inviteButton->setActive(rGuildMembers[i].Online != ccs_offline && rGuildMembers[i].Name != UserEntity->getEntityName()); + inviteButton->setActive(rGuildMembers[i].Online != ccs_offline && rGuildMembers[i].Name.toUtf8() != UserEntity->getEntityName()); // Enter Date CViewText *pViewEnterDate = dynamic_cast(pLine->getView(TEMPLATE_GUILD_MEMBER_ENTER_DATE)); diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 24ab75058..40413914e 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -358,7 +358,7 @@ public: } else { - std::string name = UserEntity->getEntityName().toUtf8(); + std::string name = UserEntity->getEntityName(); if (*it == 'P') name = toUpper(name); formatedResult += name; } @@ -391,7 +391,7 @@ public: } else { - botName = entity->getDisplayName().toUtf8(); + botName = entity->getDisplayName(); } CCharacterCL *pChar = dynamic_cast(entity); if (pChar != NULL) @@ -405,7 +405,7 @@ public: spprn.Woman = womanTitle; spprn.cbIDStringReceived(sTitleTranslated); - botName = CEntityCL::removeTitleAndShardFromName(botName).toUtf8(); + botName = CEntityCL::removeTitleAndShardFromName(botName); // short name (with no title such as 'guard', 'merchant' ...) if (*it == 's') @@ -4214,7 +4214,7 @@ bool CInterfaceManager::parseTokens(string& ucstr) // Parse the parameter if (token_param == "name") { - string name = pTokenSubjectEntity->getDisplayName().toUtf8(); + string name = pTokenSubjectEntity->getDisplayName(); // special case where there is only a title, very rare case for some NPC if (name.empty()) { diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index e448b1f4a..c9dc2767e 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -1363,7 +1363,7 @@ int CLuaIHMRyzom::getPlayerGender(CLuaState &ls) int CLuaIHMRyzom::getPlayerName(CLuaState &ls) { CLuaIHM::checkArgCount(ls, "getPlayerName", 0); - ls.push(UserEntity->getEntityName().toUtf8()); + ls.push(UserEntity->getEntityName()); return 1; } @@ -1441,7 +1441,7 @@ int CLuaIHMRyzom::getTargetName(CLuaState &ls) if (!target) return 0; - ls.push(target->getEntityName().toUtf8()); + ls.push(target->getEntityName()); return 1; } @@ -3274,7 +3274,7 @@ void CLuaIHMRyzom::browseNpcWebPage(const std::string &htmlId, const std::string if (UserEntity) { - userName = UserEntity->getDisplayName().toString(); + userName = UserEntity->getDisplayName(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); ucstring ucsTmp; pSMC->getString(UserEntity->getGuildNameID(), ucsTmp); @@ -3648,7 +3648,7 @@ void CLuaIHMRyzom::tell(const ucstring &player, const ucstring &msg) CInterfaceManager *im = CInterfaceManager::getInstance(); w->setKeyboardFocus(); w->enableBlink(1); - w->setCommand(ucstring("tell ") + CEntityCL::removeTitleFromName(player) + ucstring(" "), false); + w->setCommand(ucstring("tell ") + CEntityCL::removeTitleFromName(player.toUtf8()) + ucstring(" "), false); CGroupEditBox *eb = w->getEditBox(); if (eb != NULL) diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index 948b45e51..de7c9023a 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -1276,7 +1276,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); + ucstring name= CEntityCL::removeShardFromName(nameIn.toUtf8()); // add the contact to this list sint index = pl.getIndexFromName(name); @@ -1327,7 +1327,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); + ucstring name= CEntityCL::removeShardFromName(nameIn.toUtf8()); return pl.getIndexFromName(name) != -1; } @@ -2250,7 +2250,7 @@ public: if (peopleList) { // don't add if it is the player name - if (!ClientCfg.Local && (UserEntity->getEntityName() == geb->getInputStringAsUtf16())) + if (!ClientCfg.Local && (UserEntity->getEntityName() == geb->getInputString())) { displayVisibleSystemMsg(CI18N::get("uiCantAddYourSelfInContactList")); } diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index f1f622836..e2d55e250 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -832,7 +832,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c } if (!senderName.empty()) { - CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName), true, true); + CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()), true, true); if (senderEntity) { if (senderEntity->Type != CEntityCL::Player) @@ -845,7 +845,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c } else { - CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName), false, true); + CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName.toUtf8()), false, true); if (destEntity) { destEntity->removeStateFx(); @@ -866,7 +866,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c // if tell, bkup sendername if (mode == CChatGroup::tell && windowVisible && !senderName.empty()) { - PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName); + PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()); } } @@ -928,7 +928,7 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); bool windowVisible; - ucstring goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName); + ucstring goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()); // The sender part is up to and including the first ":" after the goodSenderName ucstring::size_type pos = finalString.find(goodSenderName); diff --git a/ryzom/client/src/r2/displayer_visual_entity.cpp b/ryzom/client/src/r2/displayer_visual_entity.cpp index 72b4c3ddb..01eaf0bc0 100644 --- a/ryzom/client/src/r2/displayer_visual_entity.cpp +++ b/ryzom/client/src/r2/displayer_visual_entity.cpp @@ -1017,7 +1017,7 @@ void CDisplayerVisualEntity::updateName() { //BENCH(setEntityName) - _Entity->setEntityName(ucName); + _Entity->setEntityName(ucName.toUtf8()); } { //BENCH(buildInSceneInterface) diff --git a/ryzom/client/src/string_manager_client.cpp b/ryzom/client/src/string_manager_client.cpp index 06c3523b4..ec493e3d3 100644 --- a/ryzom/client/src/string_manager_client.cpp +++ b/ryzom/client/src/string_manager_client.cpp @@ -734,7 +734,7 @@ restartLoop: // If the shard name is the same as the player home shard name, remove it uint len= (uint)PlayerSelectedHomeShardNameWithParenthesis.size(); uint start= (uint)str.size()-len; - if(ucstrnicmp(str, start, len, PlayerSelectedHomeShardNameWithParenthesis)==0) + if(ucstrnicmp(str, start, len, PlayerSelectedHomeShardNameWithParenthesis)==0) // TODO: NLMISC::compareCaseInsensitive str.resize(start); } } @@ -744,7 +744,7 @@ restartLoop: ucstring::size_type pos = str.find('$'); if ( ! str.empty() && pos != ucstring::npos) { - str = CEntityCL::removeTitleFromName(str); + str = CEntityCL::removeTitleFromName(str.toUtf8()); } // append this string From 9d534882e862bc89f127b1d3c6a9ced098b88214 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 08:11:32 +0800 Subject: [PATCH 108/205] UTF-8 string manager, ryzom/ryzomcore#335 --- ryzom/client/src/commands.cpp | 22 +- ryzom/client/src/entity_cl.cpp | 37 ++- ryzom/client/src/entity_cl.h | 4 +- ryzom/client/src/forage_source_cl.cpp | 4 +- .../src/interface_v3/action_handler_help.cpp | 4 +- .../src/interface_v3/action_handler_misc.cpp | 2 +- .../client/src/interface_v3/group_compas.cpp | 4 +- .../src/interface_v3/sbrick_manager.cpp | 6 +- ryzom/client/src/net_manager.cpp | 8 +- ryzom/client/src/player_cl.cpp | 2 +- ryzom/client/src/player_r2_cl.cpp | 2 +- ryzom/client/src/string_manager_client.cpp | 241 +++++++++--------- ryzom/client/src/string_manager_client.h | 138 +++++----- 13 files changed, 247 insertions(+), 227 deletions(-) diff --git a/ryzom/client/src/commands.cpp b/ryzom/client/src/commands.cpp index 986da78e6..d3a6a2df6 100644 --- a/ryzom/client/src/commands.cpp +++ b/ryzom/client/src/commands.cpp @@ -1385,14 +1385,14 @@ NLMISC_COMMAND(setItemName, "set name of items, sbrick, etc.."," 2) - desc.fromUtf8(args[2]); + desc = args[2]; if (args.size() > 3) - desc2.fromUtf8(args[3]); + desc2 = args[3]; STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); if (pSMC) @@ -1406,10 +1406,10 @@ NLMISC_COMMAND(setItemName, "set name of items, sbrick, etc.."," ") { if (args.size() < 2) return false; - ucstring name; - name.fromUtf8(args[0]); - ucstring text; - text.fromUtf8(args[1]); + string name; + name = args[0]; + string text; + text = args[1]; STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); if (pSMC) @@ -1459,7 +1459,7 @@ NLMISC_COMMAND(ah, "Launch an action handler", " ") static void setDynString(uint32 strID, const std::string &value) { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - pSMC->receiveString(strID, ucstring(value)); + pSMC->receiveString(strID, value); CBitMemStream bm; if (bm.isReading()) bm.invert(); bm.serial(strID); diff --git a/ryzom/client/src/entity_cl.cpp b/ryzom/client/src/entity_cl.cpp index 9e57b3acb..b28d3fda6 100644 --- a/ryzom/client/src/entity_cl.cpp +++ b/ryzom/client/src/entity_cl.cpp @@ -2262,32 +2262,32 @@ void CEntityCL::load() // virtual // onStringAvailable : // Callback when the name is arrived. //----------------------------------------------- -void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) +void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) { - _EntityName = value.toUtf8(); + _EntityName = value; // remove the shard name if possible _EntityName= removeShardFromName(_EntityName); // New title - ucstring newtitle; + string newtitle; _HasReservedTitle = false; // check if there is any replacement tag in the string - ucstring::size_type p1 = _EntityName.find('$'); + string::size_type p1 = _EntityName.find('$'); if (p1 != ucstring::npos) { // we found a replacement point begin tag - ucstring::size_type p2 = _EntityName.find('$', p1+1); + string::size_type p2 = _EntityName.find('$', p1+1); if (p2 != ucstring::npos) { // ok, we have the second replacement point! // extract the replacement id - ucstring id = _EntityName.substr(p1+1, p2-p1-1); + string id = _EntityName.substr(p1+1, p2-p1-1); // retrieve the translated string - _TitleRaw = id.toString(); -// ucstring replacement = CI18N::get(strNewTitle); + _TitleRaw = id; +// string replacement = CI18N::get(strNewTitle); bool womanTitle = false; CCharacterCL * c = dynamic_cast(this); if(c) @@ -2295,22 +2295,21 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) womanTitle = ( c->getGender() == GSGENDER::female ); } - ucstring replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle)); + string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(), womanTitle); // Sometimes translation contains another title { - ucstring::size_type pos = replacement.find('$'); + string::size_type pos = replacement.find('$'); if (pos != ucstring::npos) { - ucstring sn = replacement; - _EntityName = sn.substr(0, pos).toUtf8(); - ucstring::size_type pos2 = sn.find('$', pos + 1); - _TitleRaw = sn.substr(pos+1, pos2 - pos - 1); - replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle); + _EntityName = _EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(sn.substr(0, pos)); + string::size_type pos2 = replacement.find('$', pos + 1); + _TitleRaw = replacement.substr(pos+1, pos2 - pos - 1); + replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(), womanTitle); } } - _Tags = STRING_MANAGER::CStringManagerClient::getTitleInfos(_TitleRaw, womanTitle); + _Tags = STRING_MANAGER::CStringManagerClient::getTitleInfos(_TitleRaw.toUtf8(), womanTitle); if (!replacement.empty() || !ClientCfg.DebugStringManager) { @@ -2319,9 +2318,9 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) _EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(_EntityName.substr(0, p1)); // + _Name.substr(p2+1) // Get extended name _NameEx = replacement; - newtitle = _NameEx; + newtitle = _NameEx.toUtf8(); } - CHARACTER_TITLE::ECharacterTitle titleEnum = CHARACTER_TITLE::toCharacterTitle( _TitleRaw.toString() ); + CHARACTER_TITLE::ECharacterTitle titleEnum = CHARACTER_TITLE::toCharacterTitle( _TitleRaw.toUtf8() ); if ( titleEnum >= CHARACTER_TITLE::BeginGmTitle && titleEnum <= CHARACTER_TITLE::EndGmTitle ) { _GMTitle = titleEnum - CHARACTER_TITLE::BeginGmTitle; @@ -2359,7 +2358,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) if (pGC != NULL) pGC->setUCTitle(_EntityName); CSkillManager *pSM = CSkillManager::getInstance(); - pSM->setPlayerTitle(_TitleRaw.toString()); + pSM->setPlayerTitle(_TitleRaw.toUtf8()); } // Must rebuild the in scene interface 'cause name has changed diff --git a/ryzom/client/src/entity_cl.h b/ryzom/client/src/entity_cl.h index 5b53c3027..3ac01ed25 100644 --- a/ryzom/client/src/entity_cl.h +++ b/ryzom/client/src/entity_cl.h @@ -935,7 +935,7 @@ protected: // Current entity title ucstring _Title; // Current entity tags - std::vector _Tags; + std::vector _Tags; // Current entity title string id ucstring _TitleRaw; // Current permanent content symbol for the entity @@ -1222,7 +1222,7 @@ public: private: // Override for string reception callback - virtual void onStringAvailable(uint stringId, const ucstring &value); + virtual void onStringAvailable(uint stringId, const std::string &value); }; diff --git a/ryzom/client/src/forage_source_cl.cpp b/ryzom/client/src/forage_source_cl.cpp index 7f538a2f0..e813912df 100644 --- a/ryzom/client/src/forage_source_cl.cpp +++ b/ryzom/client/src/forage_source_cl.cpp @@ -536,10 +536,10 @@ void CForageSourceCL::updateVisualPropertyVisualFX(const NLMISC::TGameCycle &/* void CForageSourceCL::updateVisualPropertyName(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &prop) { CSheetId rmSheetId( (const uint32&)prop ); - const ucchar *name = STRING_MANAGER::CStringManagerClient::getItemLocalizedName( rmSheetId ); + const char *name = STRING_MANAGER::CStringManagerClient::getItemLocalizedName( rmSheetId ); if ( name ) { - _EntityName = ucstring(name).toUtf8(); + _EntityName = name; if ( _ProspectorSlot != 255 ) { CEntityCL *prospector = EntitiesMngr.entities()[_ProspectorSlot]; diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index 2ccbf963a..c00328ef0 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -693,7 +693,7 @@ class CHandlerOpenTitleHelp : public IActionHandler // retrieve the translated string if (!strNewTitle.empty()) - name = ucstring(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(ucstring::makeFromUtf8(strNewTitle), woman)).toUtf8(); + name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(strNewTitle, woman); else name.clear(); } @@ -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) + if (CStringManagerClient::getTitleLocalizedName(CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)titleIDnb),women) == title.toUtf8()) break; } diff --git a/ryzom/client/src/interface_v3/action_handler_misc.cpp b/ryzom/client/src/interface_v3/action_handler_misc.cpp index 63d491deb..8190ab799 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -916,7 +916,7 @@ NLMISC_COMMAND(slsn, "Temp : set the name of the last sender.", "") bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut) { // extract the replacement id - ucstring strNewTitle = CEntityCL::getTitleFromName(inOut.toUtf8()); + string strNewTitle = CEntityCL::getTitleFromName(inOut.toUtf8()); // retrieve the translated string if (!strNewTitle.empty()) diff --git a/ryzom/client/src/interface_v3/group_compas.cpp b/ryzom/client/src/interface_v3/group_compas.cpp index d5b8d7e9c..fc0f2a5a5 100644 --- a/ryzom/client/src/interface_v3/group_compas.cpp +++ b/ryzom/client/src/interface_v3/group_compas.cpp @@ -1047,12 +1047,12 @@ REGISTER_ACTION_HANDLER( CHandlerSetCompassNorth, "set_compass_north"); class CCompassDialogsStringCallback : public IStringWaitCallback { - virtual void onDynStringAvailable(uint /* stringId */, const ucstring &value) + virtual void onDynStringAvailable(uint /* stringId */, const std::string &value) { uint size = (uint)CCompassDialogsManager::getInstance()._Entries.size(); for ( uint i = 0; i < size; i++) { - ucstring name; + std::string name; if ( CStringManagerClient::instance()->getDynString(CCompassDialogsManager::getInstance()._Entries[i].Text, name) ) { if ( value == name ) diff --git a/ryzom/client/src/interface_v3/sbrick_manager.cpp b/ryzom/client/src/interface_v3/sbrick_manager.cpp index d12ed783c..a2cecf2d4 100644 --- a/ryzom/client/src/interface_v3/sbrick_manager.cpp +++ b/ryzom/client/src/interface_v3/sbrick_manager.cpp @@ -436,7 +436,7 @@ void CSBrickManager::compileBrickProperties() // **** for all bricks, recompute localized text with formated version - ucstring textTemp; + string textTemp; textTemp.reserve(1000); for (std::vector::size_type ib = 0; ib < _BrickVector.size(); ++ib) { @@ -445,7 +445,7 @@ void CSBrickManager::compileBrickProperties() continue; // Get the Brick texts - ucstring texts[3]; + std::string texts[3]; texts[0]= STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(brickSheet->Id); texts[1]= STRING_MANAGER::CStringManagerClient::getSBrickLocalizedDescription(brickSheet->Id); texts[2]= STRING_MANAGER::CStringManagerClient::getSBrickLocalizedCompositionDescription(brickSheet->Id); @@ -453,7 +453,7 @@ void CSBrickManager::compileBrickProperties() // For alls texts, parse format for(uint i=0;i<3;i++) { - ucstring &text= texts[i]; + string &text= texts[i]; textTemp.erase(); // Parse the text diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index e2d55e250..9f05fe860 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -2299,11 +2299,9 @@ void impulsePhraseSend(NLMISC::CBitMemStream &impulse) void impulseStringResp(NLMISC::CBitMemStream &impulse) { uint32 stringId; - string strUtf8; + string str; impulse.serial(stringId); - impulse.serial(strUtf8); - ucstring str; - str.fromUtf8(strUtf8); + impulse.serial(str); if (PermanentlyBanned) return; @@ -3390,7 +3388,7 @@ private: public: // called when the string is available - virtual void onDynStringAvailable(uint stringId, const ucstring &value) + virtual void onDynStringAvailable(uint stringId, const std::string &value) { // don't care if already displayed if(_AlreadyDisplayed) diff --git a/ryzom/client/src/player_cl.cpp b/ryzom/client/src/player_cl.cpp index 9aef1032b..437149f16 100644 --- a/ryzom/client/src/player_cl.cpp +++ b/ryzom/client/src/player_cl.cpp @@ -743,7 +743,7 @@ void CPlayerCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle * } // update title when gender changed - const ucstring replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, _Gender == GSGENDER::female)); + const string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(), _Gender == GSGENDER::female); if (!replacement.empty() || !ClientCfg.DebugStringManager) { // Get extended name diff --git a/ryzom/client/src/player_r2_cl.cpp b/ryzom/client/src/player_r2_cl.cpp index 138e7d8fa..8f7621755 100644 --- a/ryzom/client/src/player_r2_cl.cpp +++ b/ryzom/client/src/player_r2_cl.cpp @@ -446,7 +446,7 @@ void CPlayerR2CL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle } // update title when gender changed - const ucstring replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw,_Gender == GSGENDER::female)); + const string replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(),_Gender == GSGENDER::female)); if (!replacement.empty()) { // Get extended name diff --git a/ryzom/client/src/string_manager_client.cpp b/ryzom/client/src/string_manager_client.cpp index ec493e3d3..7381f5cb9 100644 --- a/ryzom/client/src/string_manager_client.cpp +++ b/ryzom/client/src/string_manager_client.cpp @@ -39,17 +39,17 @@ namespace STRING_MANAGER // *************************************************************************** map CStringManagerClient::_SpecItem_TempMap; - map CStringManagerClient::_DynStrings; - vector CStringManagerClient::_TitleWords; + map CStringManagerClient::_DynStrings; + vector CStringManagerClient::_TitleWords; bool CStringManagerClient::_SpecItem_MemoryCompressed = false; char *CStringManagerClient::_SpecItem_Labels = NULL; - ucchar *CStringManagerClient::_SpecItem_NameDesc = NULL; + char *CStringManagerClient::_SpecItem_NameDesc = NULL; vector CStringManagerClient::_SpecItems; bool MustReleaseStaticArrays = true; CStringManagerClient *CStringManagerClient::_Instance= NULL; - ucstring CStringManagerClient::_WaitString("???"); + string CStringManagerClient::_WaitString("???"); CStringManagerClient::CStringManagerClient() @@ -57,7 +57,7 @@ namespace STRING_MANAGER _CacheInited = false; _CacheLoaded = false; // insert the empty string. - _ReceivedStrings.insert(make_pair((uint)EmptyStringId, ucstring())); + _ReceivedStrings.insert(make_pair((uint)EmptyStringId, string())); // reserve some place to avoid reallocation as possible _CacheStringToSave.reserve(1024); } @@ -122,6 +122,7 @@ namespace STRING_MANAGER { try { + const uint currentVersion = 1; _CacheFilename = std::string("save/") + _ShardId.substr(0, _ShardId.find(":")) + ".string_cache"; nlinfo("SM : Try to open the string cache : %s", _CacheFilename.c_str()); @@ -131,6 +132,8 @@ namespace STRING_MANAGER // there is a cache file, check date reset it if needed { NLMISC::CIFile file(_CacheFilename); + file.setVersionException(false, false); + file.serialVersion(currentVersion); file.serial(_Timestamp); } @@ -139,6 +142,7 @@ namespace STRING_MANAGER nlinfo("SM: Clearing string cache : outofdate"); // the cache is not sync, reset it NLMISC::COFile file(_CacheFilename); + file.serialVersion(currentVersion); file.serial(timestamp); } else @@ -151,6 +155,7 @@ namespace STRING_MANAGER nlinfo("SM: Creating string cache"); // cache file don't exist, create it with the timestamp NLMISC::COFile file(_CacheFilename); + file.serialVersion(currentVersion); file.serial(timestamp); } @@ -160,17 +165,19 @@ namespace STRING_MANAGER // NB : we keep the waiting strings and dyn strings // insert the empty string. - _ReceivedStrings.insert(make_pair((uint)EmptyStringId, ucstring())); + _ReceivedStrings.insert(make_pair((uint)EmptyStringId, string())); // load the cache file NLMISC::CIFile file(_CacheFilename); + int version = file.serialVersion(currentVersion); file.serial(_Timestamp); nlassert(_Timestamp == timestamp); + nlassert(version >= 1); // Initial version while (!file.eof()) { uint32 id; - ucstring str; + string str; file.serial(id); file.serial(str); @@ -194,12 +201,12 @@ namespace STRING_MANAGER - void CStringManagerClient::waitString(uint32 stringId, const IStringWaiterRemover *premover, ucstring *result) + void CStringManagerClient::waitString(uint32 stringId, const IStringWaiterRemover *premover, string *result) { H_AUTO( CStringManagerClient_waitString ) nlassert(premover && result); - ucstring value; + string value; if (getString(stringId, value)) *result = value; else @@ -217,7 +224,7 @@ namespace STRING_MANAGER H_AUTO( CStringManagerClient_waitString2 ) nlassert(pcallback != 0); - ucstring value; + string value; if (getString(stringId, value)) { pcallback->onStringAvailable(stringId, value); @@ -230,12 +237,12 @@ namespace STRING_MANAGER } - void CStringManagerClient::waitDynString(uint32 stringId, const IStringWaiterRemover *premover, ucstring *result) + void CStringManagerClient::waitDynString(uint32 stringId, const IStringWaiterRemover *premover, string *result) { H_AUTO( CStringManagerClient_waitDynString ) nlassert(premover && result); - ucstring value; + string value; if (getDynString(stringId, value)) *result = value; else @@ -253,7 +260,7 @@ namespace STRING_MANAGER H_AUTO( CStringManagerClient_waitDynString2 ) nlassert(pcallback != 0); - ucstring value; + string value; if (getDynString(stringId, value)) { pcallback->onDynStringAvailable(stringId, value); @@ -330,7 +337,7 @@ restartLoop4: - bool CStringManagerClient::getString(uint32 stringId, ucstring &result) + bool CStringManagerClient::getString(uint32 stringId, string &result) { H_AUTO( CStringManagerClient_getString ) @@ -357,7 +364,7 @@ restartLoop4: _WaitingStrings.insert(stringId); // need to ask for this string. NLMISC::CBitMemStream bms; - const std::string msgType = "STRING_MANAGER:STRING_RQ"; + const string msgType = "STRING_MANAGER:STRING_RQ"; if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) { bms.serial( stringId ); @@ -374,7 +381,7 @@ restartLoop4: { char tmp[1024]; sprintf(tmp, "", stringId); - result = ucstring(tmp); + result = tmp; } else result.erase(); // = _WaitString; @@ -385,14 +392,14 @@ restartLoop4: { char tmp[1024]; sprintf(tmp, "", stringId); - result = ucstring(tmp) + it->second; + result = tmp + it->second; } else { result = it->second; - if (result.size() > 9 && result.substr(0, 9) == ucstring(" 9 && result.substr(0, 9) == "::iterator itds = _DynStrings.find(result.substr(9, result.size()-10)); + map::iterator itds = _DynStrings.find(result.substr(9, result.size()-10)); if (itds != _DynStrings.end()) result = itds->second; } @@ -402,7 +409,7 @@ restartLoop4: return true; } - void CStringManagerClient::receiveString(uint32 stringId, const ucstring &str) + void CStringManagerClient::receiveString(uint32 stringId, const string &str) { H_AUTO( CStringManagerClient_receiveString ) @@ -419,8 +426,8 @@ restartLoop4: TStringsContainer::iterator it(_ReceivedStrings.find(stringId)); nlwarning("Receiving stringID %u (%s), already in received string (%s), replacing with new value.", stringId, - str.toString().c_str(), - it->second.toString().c_str()); + str.c_str(), + it->second.c_str()); if (it->second != str) it->second = str; @@ -484,7 +491,7 @@ restartLoop: last = _WaitingDynStrings.end(); for (; first != last; ++first) { - ucstring value; + string value; uint number = first->first; /// Warning: if getDynString() return true, 'first' is erased => don't use it after in this loop if (getDynString(number, value)) @@ -616,7 +623,7 @@ restartLoop: return false; } // ok, we have the base string, we can serial the parameters - ucstring::iterator first(dynInfo.String.begin()), last(dynInfo.String.end()); + string::iterator first(dynInfo.String.begin()), last(dynInfo.String.end()); for (; first != last; ++first) { if (*first == '%') @@ -699,10 +706,10 @@ restartLoop: if (dynInfo.Status == TDynStringInfo::serialized) { // try to retreive all string parameter to build the string. - ucstring temp; + string temp; temp.reserve(dynInfo.String.size() * 2); - ucstring::iterator src(dynInfo.String.begin()); - ucstring::iterator move = src; + string::iterator src(dynInfo.String.begin()); + string::iterator move = src; std::vector::iterator first(dynInfo.Params.begin()), last(dynInfo.Params.end()); for (; first != last; ++first) @@ -712,7 +719,7 @@ restartLoop: { case string_id: { - ucstring str; + string str; if (!getString(param.StringId, str)) return false; @@ -741,10 +748,10 @@ restartLoop: } // If the string contains a title, then remove it - ucstring::size_type pos = str.find('$'); + string::size_type pos = str.find('$'); if ( ! str.empty() && pos != ucstring::npos) { - str = CEntityCL::removeTitleFromName(str.toUtf8()); + str = CEntityCL::removeTitleFromName(str); } // append this string @@ -759,13 +766,13 @@ restartLoop: char value[1024]; sprintf(value, "%d", param.Integer); temp.append(move, src+param.ReplacementPoint); - temp+=ucstring(value); + temp += value; move = dynInfo.String.begin()+param.ReplacementPoint+2; } break; case time: { - ucstring value; + string value; uint32 time = (uint32)param.Time; if( time >= (10*60*60) ) { @@ -796,7 +803,7 @@ restartLoop: char value[1024]; sprintf(value, "%u", (uint32)param.Money); temp.append(move, src+param.ReplacementPoint); - temp+=ucstring(value); + temp += value; move = dynInfo.String.begin()+param.ReplacementPoint+2; } // TODO @@ -805,7 +812,7 @@ restartLoop: break; case dyn_string_id: { - ucstring dynStr; + string dynStr; if (!getDynString(param.DynStringId, dynStr)) return false; temp.append(move, src+param.ReplacementPoint); @@ -823,8 +830,8 @@ restartLoop: // apply any 'delete' character in the string and replace double '%' { - uint i =0; - while (i < temp.size()) + ptrdiff_t i =0; + while (i < (ptrdiff_t)temp.size()) { if (temp[i] == 8) { @@ -853,7 +860,7 @@ restartLoop: } - bool CStringManagerClient::getDynString(uint32 dynStringId, ucstring &result) + bool CStringManagerClient::getDynString(uint32 dynStringId, std::string &result) { H_AUTO( CStringManagerClient_getDynString ) @@ -882,7 +889,7 @@ restartLoop: { char tmp[1024]; sprintf(tmp, "", dynStringId); - result = ucstring(tmp) + it->second.String; + result = tmp + it->second.String; } else result = it->second.String; @@ -908,7 +915,7 @@ restartLoop: nlwarning("DynStringID %u is unknown !", dynStringId); char tmp[1024]; sprintf(tmp, "", dynStringId); - result = ucstring(tmp); + result = tmp; } else result.erase(); //_WaitString; @@ -920,7 +927,7 @@ restartLoop: { char tmp[1024]; sprintf(tmp, "", dynStringId); - result = ucstring(tmp) + it->second.String; + result = tmp + it->second.String; } else result = it->second.String; @@ -933,7 +940,7 @@ restartLoop: { char tmp[1024]; sprintf(tmp, "", dynStringId); - result = ucstring(tmp); + result = tmp; } else result.erase(); // = _WaitString; @@ -943,7 +950,7 @@ restartLoop: } // Tool fct to lookup a reference file - static string lookupReferenceFile(const std::string &fileName) + static string lookupReferenceFile(const string &fileName) { string referenceFile; // special location for the "wk" language @@ -964,14 +971,14 @@ restartLoop: return referenceFile; } - void CLoadProxy::loadStringFile(const std::string &filename, ucstring &text) + void CLoadProxy::loadStringFile(const string &filename, ucstring &text) { vector reference; vector addition; vector diff; // get the correct path name of the ref file - std::string referenceFile= lookupReferenceFile(filename); + string referenceFile= lookupReferenceFile(filename); // load the reference file if (!referenceFile.empty()) @@ -1041,7 +1048,7 @@ public: TWorksheet diff; // get the correct path name of the ref file - std::string referenceFile= lookupReferenceFile(filename); + string referenceFile= lookupReferenceFile(filename); // load the reference file if (!referenceFile.empty()) @@ -1134,7 +1141,7 @@ public: const string StringClientPackedFileName= "./save/string_client.pack"; // Must Increment this number if change are made to the code (else change not taken into account) const uint StringClientPackedVersion= 0; -bool CStringManagerClient::checkWordFileDates(vector &fileChecks, const std::vector &fileNames, const std::string &languageCode) +bool CStringManagerClient::checkWordFileDates(vector &fileChecks, const std::vector &fileNames, const string &languageCode) { fileChecks.resize(fileNames.size()); @@ -1142,7 +1149,7 @@ bool CStringManagerClient::checkWordFileDates(vector &fileChecks, co for(uint i=0;i &fileChecks, co // *************************************************************************** -void CStringManagerClient::initI18NSpecialWords(const std::string &languageCode) +void CStringManagerClient::initI18NSpecialWords(const string &languageCode) { ucstring womenNameColIdent= string("women_name"); ucstring descColIdent= string("description"); @@ -1213,8 +1220,8 @@ void CStringManagerClient::initI18NSpecialWords(const std::string &languageCode) uint32 profile0= (uint32)ryzomGetLocalTime(); ucstring ucs; - std::string fileName = fileNames[i]; - std::string keyExtenstion = specialWords[i*3+2]; + string fileName = fileNames[i]; + string keyExtenstion = specialWords[i*3+2]; // read the ucstring and make diffs with data in ./translation/work. CReadWorkSheetFile rwsf; @@ -1250,17 +1257,17 @@ void CStringManagerClient::initI18NSpecialWords(const std::string &languageCode) for(uint j=1;j::iterator it; + std::map::iterator it; it= _SpecItem_TempMap.find( keyStr ); if ( it!=_SpecItem_TempMap.end() ) { @@ -1276,7 +1283,7 @@ void CStringManagerClient::initI18NSpecialWords(const std::string &languageCode) if(womenNameColIndex!=std::numeric_limits::max()) { const ucstring &womenName= ws.getData(j, womenNameColIndex); - _SpecItem_TempMap[keyStr].WomenName= womenName; + _SpecItem_TempMap[keyStr].WomenName= womenName.toUtf8(); // replace all \n in the women name with true \n while(strFindReplace(_SpecItem_TempMap[keyStr].WomenName, "\\n", "\n")); } @@ -1285,7 +1292,7 @@ void CStringManagerClient::initI18NSpecialWords(const std::string &languageCode) if(descColIndex!=std::numeric_limits::max()) { const ucstring &desc= ws.getData(j, descColIndex); - _SpecItem_TempMap[keyStr].Desc= desc; + _SpecItem_TempMap[keyStr].Desc= desc.toUtf8(); // replace all \n in the desc with true \n while(strFindReplace(_SpecItem_TempMap[keyStr].Desc, "\\n", "\n")); } @@ -1294,7 +1301,7 @@ void CStringManagerClient::initI18NSpecialWords(const std::string &languageCode) if(descColIndex2!=std::numeric_limits::max()) { const ucstring &desc= ws.getData(j, descColIndex2); - _SpecItem_TempMap[keyStr].Desc2= desc; + _SpecItem_TempMap[keyStr].Desc2= desc.toUtf8(); // replace all \n in the desc with true \n while(strFindReplace(_SpecItem_TempMap[keyStr].Desc2, "\\n", "\n")); } @@ -1358,7 +1365,7 @@ void CStringManagerClient::specialWordsMemoryCompress() // Make big strings _SpecItems.resize(nNbEntries); _SpecItem_Labels = new char[nLabelSize]; - _SpecItem_NameDesc = new ucchar[nNameDescSize]; + _SpecItem_NameDesc = new char[nNameDescSize]; nNbEntries = 0; nLabelSize = 0; @@ -1366,35 +1373,30 @@ void CStringManagerClient::specialWordsMemoryCompress() it = _SpecItem_TempMap.begin(); while (it != _SpecItem_TempMap.end()) { - - if (strnicmp(it->first.c_str(), "bf", 2) == 0) + if (NLMISC::startsWith(it->first.c_str(), "bf")) { uint nDbg = 0; nDbg++; } _SpecItems[nNbEntries].Label = _SpecItem_Labels+nLabelSize; - strcpy(_SpecItems[nNbEntries].Label, it->first.c_str()); + strcpy(_SpecItem_Labels+nLabelSize, it->first.c_str()); nLabelSize += (uint32)it->first.size() + 1; _SpecItems[nNbEntries].Name = _SpecItem_NameDesc+nNameDescSize; - memcpy(_SpecItems[nNbEntries].Name, it->second.Name.c_str(), 2*(it->second.Name.size()+1)); - _SpecItems[nNbEntries].Name[it->second.Name.size()] = 0; + strcpy(_SpecItem_NameDesc+nNameDescSize, it->second.Name.c_str()); nNameDescSize += (uint32)it->second.Name.size() + 1; _SpecItems[nNbEntries].WomenName = _SpecItem_NameDesc+nNameDescSize; - memcpy(_SpecItems[nNbEntries].WomenName, it->second.WomenName.c_str(), 2*(it->second.WomenName.size()+1)); - _SpecItems[nNbEntries].WomenName[it->second.WomenName.size()] = 0; + strcpy(_SpecItem_NameDesc+nNameDescSize, it->second.WomenName.c_str()); nNameDescSize += (uint32)it->second.WomenName.size() + 1; _SpecItems[nNbEntries].Desc = _SpecItem_NameDesc+nNameDescSize; - memcpy(_SpecItems[nNbEntries].Desc, it->second.Desc.c_str(), 2*(it->second.Desc.size()+1)); - _SpecItems[nNbEntries].Desc[it->second.Desc.size()] = 0; + strcpy(_SpecItem_NameDesc+nNameDescSize, it->second.Desc.c_str()); nNameDescSize += (uint32)it->second.Desc.size() + 1; _SpecItems[nNbEntries].Desc2 = _SpecItem_NameDesc+nNameDescSize; - memcpy(_SpecItems[nNbEntries].Desc2, it->second.Desc2.c_str(), 2*(it->second.Desc2.size()+1)); - _SpecItems[nNbEntries].Desc2[it->second.Desc2.size()] = 0; + strcpy(_SpecItem_NameDesc+nNameDescSize, it->second.Desc2.c_str()); nNameDescSize += (uint32)it->second.Desc2.size() + 1; nNbEntries++; @@ -1406,22 +1408,21 @@ void CStringManagerClient::specialWordsMemoryCompress() } // *************************************************************************** -const ucchar * CStringManagerClient::getSpecialWord(const std::string &label, bool women) +const char *CStringManagerClient::getSpecialWord(const string &label, bool women) { if (label.empty()) { - static ucstring emptyString; + static string emptyString; return emptyString.c_str(); } if (label[0] == '#') { - static ucstring rawString; return getLocalizedName(label.substr(1, label.size()-1)); } // avoid case problems - static std::string lwrLabel; + static string lwrLabel; lwrLabel = toLower(label); if (_SpecItem_MemoryCompressed) @@ -1456,28 +1457,26 @@ const ucchar * CStringManagerClient::getSpecialWord(const std::string &label, bo } } - static ucstring badString; - - badString = ucstring(std::string(""); - + static string badString; + badString = ""; return badString.c_str(); } // *************************************************************************** -const ucchar * CStringManagerClient::getSpecialDesc(const std::string &label) +const char *CStringManagerClient::getSpecialDesc(const string &label) { - static ucstring emptyString; + static string emptyString; if (label.empty()) return emptyString.c_str(); // avoid case problems - static std::string lwrLabel; + static string lwrLabel; lwrLabel = toLower(label); if (_SpecItem_MemoryCompressed) { CItemLight tmp; - tmp.Label = (char*)lwrLabel.c_str(); + tmp.Label = lwrLabel.c_str(); vector::iterator it = lower_bound(_SpecItems.begin(), _SpecItems.end(), tmp, CItemLightComp()); if (it != _SpecItems.end()) @@ -1497,20 +1496,20 @@ const ucchar * CStringManagerClient::getSpecialDesc(const std::string &label) } // *************************************************************************** -const ucchar * CStringManagerClient::getSpecialDesc2(const std::string &label) +const char *CStringManagerClient::getSpecialDesc2(const string &label) { - static ucstring emptyString; + static string emptyString; if (label.empty()) return emptyString.c_str(); // avoid case problems - static std::string lwrLabel; + static string lwrLabel; lwrLabel = toLower(label); if (_SpecItem_MemoryCompressed) { CItemLight tmp; - tmp.Label = (char*)lwrLabel.c_str(); + tmp.Label = lwrLabel.c_str(); vector::iterator it = lower_bound(_SpecItems.begin(), _SpecItems.end(), tmp, CItemLightComp()); if (it != _SpecItems.end()) @@ -1539,87 +1538,88 @@ const ucchar * CStringManagerClient::getSpecialDesc2(const std::string &label) */ // *************************************************************************** -const ucchar *CStringManagerClient::getPlaceLocalizedName(const string &placeNameID) +const char *CStringManagerClient::getPlaceLocalizedName(const string &placeNameID) { return getSpecialWord(placeNameID); } // *************************************************************************** -const ucchar *CStringManagerClient::getFactionLocalizedName(const string &factionNameID) +const char *CStringManagerClient::getFactionLocalizedName(const string &factionNameID) { return getSpecialWord(factionNameID); } // *************************************************************************** -const ucchar *CStringManagerClient::getSkillLocalizedName(SKILLS::ESkills e) +const char *CStringManagerClient::getSkillLocalizedName(SKILLS::ESkills e) { return getSpecialWord(SKILLS::toString(e)); } // *************************************************************************** -const ucchar *CStringManagerClient::getItemLocalizedName(CSheetId id) +const char *CStringManagerClient::getItemLocalizedName(CSheetId id) { return getSpecialWord(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getCreatureLocalizedName(NLMISC::CSheetId id) +const char *CStringManagerClient::getCreatureLocalizedName(NLMISC::CSheetId id) { return getSpecialWord(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getSBrickLocalizedName(NLMISC::CSheetId id) +const char *CStringManagerClient::getSBrickLocalizedName(NLMISC::CSheetId id) { return getSpecialWord(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getSPhraseLocalizedName(NLMISC::CSheetId id) +const char *CStringManagerClient::getSPhraseLocalizedName(NLMISC::CSheetId id) { return getSpecialWord(id.toString()); } // *************************************************************************** -/*const ucchar *CStringManagerClient::getBrickLocalizedDescription(BRICK_FAMILIES::TBrickFamily e) +/*const char *CStringManagerClient::getBrickLocalizedDescription(BRICK_FAMILIES::TBrickFamily e) { return getSpecialDesc(BRICK_FAMILIES::toString(e)); } */ // *************************************************************************** -const ucchar *CStringManagerClient::getSkillLocalizedDescription(SKILLS::ESkills e) +const char *CStringManagerClient::getSkillLocalizedDescription(SKILLS::ESkills e) { return getSpecialDesc(SKILLS::toString(e)); } // *************************************************************************** -const ucchar *CStringManagerClient::getItemLocalizedDescription(CSheetId id) +const char *CStringManagerClient::getItemLocalizedDescription(CSheetId id) { return getSpecialDesc(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getSBrickLocalizedDescription(NLMISC::CSheetId id) +const char *CStringManagerClient::getSBrickLocalizedDescription(NLMISC::CSheetId id) { return getSpecialDesc(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getSBrickLocalizedCompositionDescription(NLMISC::CSheetId id) +const char *CStringManagerClient::getSBrickLocalizedCompositionDescription(NLMISC::CSheetId id) { return getSpecialDesc2(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId id) +const char *CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId id) { return getSpecialDesc(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getTitleLocalizedName(const ucstring &titleId, bool women) +const char *CStringManagerClient::getTitleLocalizedName(const string &titleId, bool women) { - vector listInfos = getTitleInfos(titleId, women); + vector listInfos = getTitleInfos(titleId, women); + if (!listInfos.empty()) { _TitleWords.push_back(listInfos[0]); @@ -1661,18 +1661,18 @@ const ucchar *CStringManagerClient::getLocalizedName(const ucstring &uctext) } // *************************************************************************** -vector CStringManagerClient::getTitleInfos(const ucstring &titleId, bool women) +vector CStringManagerClient::getTitleInfos(const string &titleId, bool women) { //ucstring infosUC; //infosUC.fromUtf8(titleId); - vector listInfos; - splitUCString(titleId, ucstring("#"), listInfos); + vector listInfos; + splitString(titleId, string("#"), listInfos); if (!listInfos.empty()) { if (titleId[0] != '#') { - listInfos[0] = getSpecialWord(listInfos[0].toUtf8(), women); + listInfos[0] = getSpecialWord(listInfos[0], women); } } @@ -1680,74 +1680,76 @@ vector CStringManagerClient::getTitleInfos(const ucstring &titleId, bo } // *************************************************************************** -const ucchar *CStringManagerClient::getClassificationTypeLocalizedName(EGSPD::CClassificationType::TClassificationType type) +const char *CStringManagerClient::getClassificationTypeLocalizedName(EGSPD::CClassificationType::TClassificationType type) { return getSpecialDesc(EGSPD::CClassificationType::toString(type)); } // *************************************************************************** -const ucchar *CStringManagerClient::getOutpostLocalizedName(NLMISC::CSheetId id) +const char *CStringManagerClient::getOutpostLocalizedName(NLMISC::CSheetId id) { return getSpecialWord(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getOutpostLocalizedDescription(NLMISC::CSheetId id) +const char *CStringManagerClient::getOutpostLocalizedDescription(NLMISC::CSheetId id) { return getSpecialDesc(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getOutpostBuildingLocalizedName(NLMISC::CSheetId id) +const char *CStringManagerClient::getOutpostBuildingLocalizedName(NLMISC::CSheetId id) { return getSpecialWord(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getOutpostBuildingLocalizedDescription(NLMISC::CSheetId id) +const char *CStringManagerClient::getOutpostBuildingLocalizedDescription(NLMISC::CSheetId id) { return getSpecialDesc(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getSquadLocalizedName(NLMISC::CSheetId id) +const char *CStringManagerClient::getSquadLocalizedName(NLMISC::CSheetId id) { return getSpecialWord(id.toString()); } // *************************************************************************** -const ucchar *CStringManagerClient::getSquadLocalizedDescription(NLMISC::CSheetId id) +const char *CStringManagerClient::getSquadLocalizedDescription(NLMISC::CSheetId id) { return getSpecialDesc(id.toString()); } // *************************************************************************** -void CStringManagerClient::replaceDynString(const ucstring &name, const ucstring &text) +void CStringManagerClient::replaceDynString(const std::string &name, const std::string &text) { _DynStrings[name] = text; } // *************************************************************************** -void CStringManagerClient::replaceSBrickName(NLMISC::CSheetId id, const ucstring &name, const ucstring &desc, const ucstring &desc2) +void CStringManagerClient::replaceSBrickName(NLMISC::CSheetId id, const std::string &name, const std::string &desc, const std::string &desc2) { - std::string label= id.toString(); + string label= id.toString(); if (label.empty()) { return; } // avoid case problems - static std::string lwrLabel; + static string lwrLabel; lwrLabel = toLower(label); + nlassert(!_SpecItem_MemoryCompressed); // Not allowed, strings are released! if (_SpecItem_MemoryCompressed) { - ucchar *strName = (ucchar *)name.c_str(); - ucchar *strDesc = (ucchar *)desc.c_str(); - ucchar *strDesc2 = (ucchar *)desc2.c_str(); +#if 0 + const char *strName = name.c_str(); + const char *strDesc = desc.c_str(); + const char *strDesc2 = desc2.c_str(); CItemLight tmp; - tmp.Label = (char*)lwrLabel.c_str(); + tmp.Label = lwrLabel.c_str(); vector::iterator it = lower_bound(_SpecItems.begin(), _SpecItems.end(), tmp, CItemLightComp()); if (it != _SpecItems.end()) @@ -1773,6 +1775,7 @@ void CStringManagerClient::replaceSBrickName(NLMISC::CSheetId id, const ucstring tmp.Desc2 = strDesc2; _SpecItems.push_back(tmp); } +#endif } else { diff --git a/ryzom/client/src/string_manager_client.h b/ryzom/client/src/string_manager_client.h index 971d808b3..5179318f4 100644 --- a/ryzom/client/src/string_manager_client.h +++ b/ryzom/client/src/string_manager_client.h @@ -63,15 +63,16 @@ public: // Force the cache to be saved void flushStringCache(); - bool getString(uint32 stringId, std::string &result) { ucstring temp; bool res = getString(stringId, temp); result = temp.toUtf8(); return res; } // FIXME: UTF-8 - bool getString(uint32 stringId, ucstring &result); - void waitString(uint32 stringId, const IStringWaiterRemover *premover, ucstring *result); + bool getString(uint32 stringId, std::string &result); + bool getString(uint32 stringId, ucstring &result) { std::string temp; bool res = getString(stringId, temp); result.fromUtf8(temp); return res; } // FIXME: UTF-8 + void waitString(uint32 stringId, const IStringWaiterRemover *premover, std::string *result); void waitString(uint32 stringId, IStringWaitCallback *pcallback); - bool getDynString(uint32 dynStringId, ucstring &result); - void waitDynString(uint32 stringId, const IStringWaiterRemover *premover, ucstring *result); + bool getDynString(uint32 dynStringId, std::string &result); + bool getDynString(uint32 dynStringId, ucstring &result) { std::string temp; bool res = getString(dynStringId, temp); result.fromUtf8(temp); return res; } // FIXME: UTF-8 + void waitDynString(uint32 stringId, const IStringWaiterRemover *premover, std::string *result); void waitDynString(uint32 stringId, IStringWaitCallback *pcallback); - void receiveString(uint32 stringId, const ucstring &str); + void receiveString(uint32 stringId, const std::string &str); void receiveDynString(NLMISC::CBitMemStream &bms); void releaseDynString(uint32 stringId); @@ -80,55 +81,55 @@ public: static void initI18NSpecialWords(const std::string &languageCode); static void specialWordsMemoryCompress(); // Yoyo: Replace the Brick Name with Filled stats (CSBrickManager work). No-Op if not found - static void replaceSBrickName(NLMISC::CSheetId id, const ucstring &name, const ucstring &desc, const ucstring &desc2); - static void replaceDynString(const ucstring &name, const ucstring &text); + static void replaceSBrickName(NLMISC::CSheetId id, const std::string &name, const std::string &desc, const std::string &desc2); + static void replaceDynString(const std::string &name, const std::string &text); // Get the Localized Name of the Places. - static const ucchar *getPlaceLocalizedName(const std::string &placeNameID); + static const char *getPlaceLocalizedName(const std::string &placeNameID); // Get the Localized Name of the faction (for the fame) - static const ucchar *getFactionLocalizedName(const std::string &factionNameID); + static const char *getFactionLocalizedName(const std::string &factionNameID); // Get the Localized Name of the Skill. - static const ucchar *getSkillLocalizedName(SKILLS::ESkills e); + static const char *getSkillLocalizedName(SKILLS::ESkills e); // Get the Localized Name of the Item. - static const ucchar *getItemLocalizedName(NLMISC::CSheetId id); + static const char *getItemLocalizedName(NLMISC::CSheetId id); // Get the Localized Name of the Creature. - static const ucchar *getCreatureLocalizedName(NLMISC::CSheetId id); + static const char *getCreatureLocalizedName(NLMISC::CSheetId id); // Get the Localized Name of the SBrick. - static const ucchar *getSBrickLocalizedName(NLMISC::CSheetId id); + static const char *getSBrickLocalizedName(NLMISC::CSheetId id); // Get the Localized Name of the SPhrase. - static const ucchar *getSPhraseLocalizedName(NLMISC::CSheetId id); + static const char *getSPhraseLocalizedName(NLMISC::CSheetId id); // Get the Localized Description of the Skill. - static const ucchar *getSkillLocalizedDescription(SKILLS::ESkills e); + static const char *getSkillLocalizedDescription(SKILLS::ESkills e); // Get the Localized Descriptionof the Item. - static const ucchar *getItemLocalizedDescription(NLMISC::CSheetId id); + static const char *getItemLocalizedDescription(NLMISC::CSheetId id); // Get the Localized Description of the SBrick. - static const ucchar *getSBrickLocalizedDescription(NLMISC::CSheetId id); + static const char *getSBrickLocalizedDescription(NLMISC::CSheetId id); // Get the Localized Composition Description of the SBrick. - static const ucchar *getSBrickLocalizedCompositionDescription(NLMISC::CSheetId id); + static const char *getSBrickLocalizedCompositionDescription(NLMISC::CSheetId id); // Get the Localized Description of the SPhrase. - static const ucchar *getSPhraseLocalizedDescription(NLMISC::CSheetId id); + static const char *getSPhraseLocalizedDescription(NLMISC::CSheetId id); // Get the Localized Title name - static const ucchar *getTitleLocalizedName(const ucstring &titleId, bool women); - static const ucchar *getLocalizedName(const ucstring &text); - static std::vector getTitleInfos(const ucstring &titleId, bool women); + static const char *getTitleLocalizedName(const std::string &titleId, bool women); + static const char *getLocalizedName(const std::string &text); + static std::vector getTitleInfos(const std::string &titleId, bool women); // Get the Localized name of a classification type - static const ucchar *getClassificationTypeLocalizedName(EGSPD::CClassificationType::TClassificationType type); + static const char *getClassificationTypeLocalizedName(EGSPD::CClassificationType::TClassificationType type); // Outpost name - static const ucchar *getOutpostLocalizedName(NLMISC::CSheetId id); + static const char *getOutpostLocalizedName(NLMISC::CSheetId id); // Outpost description - static const ucchar *getOutpostLocalizedDescription(NLMISC::CSheetId id); + static const char *getOutpostLocalizedDescription(NLMISC::CSheetId id); // Outpost building name - static const ucchar *getOutpostBuildingLocalizedName(NLMISC::CSheetId id); + static const char *getOutpostBuildingLocalizedName(NLMISC::CSheetId id); // Outpost building description - static const ucchar *getOutpostBuildingLocalizedDescription(NLMISC::CSheetId id); + static const char *getOutpostBuildingLocalizedDescription(NLMISC::CSheetId id); // Squad name - static const ucchar *getSquadLocalizedName(NLMISC::CSheetId id); + static const char *getSquadLocalizedName(NLMISC::CSheetId id); // Squad description - static const ucchar *getSquadLocalizedDescription(NLMISC::CSheetId id); + static const char *getSquadLocalizedDescription(NLMISC::CSheetId id); private: // constructor. @@ -153,8 +154,8 @@ private: struct TParamValue { - TParamType Type; - ucstring::size_type ReplacementPoint; + TParamType Type; + std::string::size_type ReplacementPoint; union { uint32 StringId; @@ -177,7 +178,7 @@ private: NLMISC::CBitMemStream Message; uint32 StringId; std::vector Params; - ucstring String; + std::string String; }; enum @@ -189,7 +190,7 @@ private: struct TStringWaiter { /// Pointer to the ucstring to fill - ucstring *Result; + std::string *Result; /// Pointer to the remover that contains this string reference const IStringWaiterRemover *Remover; }; @@ -198,7 +199,7 @@ private: /// Container for simple strings - typedef CHashMap TStringsContainer; + typedef CHashMap TStringsContainer; /// Container for dyn strings typedef CHashMap TDynStringsContainer; /// Container of string reference waiting for value. @@ -224,7 +225,7 @@ private: TStringCallbacksContainer _DynStringsCallbacks; // Return value for waiting string.. - static ucstring _WaitString; + static std::string _WaitString; // Singleton pattern implementation static CStringManagerClient *_Instance; @@ -247,7 +248,7 @@ private: struct CCacheString { uint32 StringId; - ucstring String; + std::string String; }; std::vector _CacheStringToSave; //@} @@ -257,41 +258,60 @@ private: { public: // The Name of the item - ucstring Name; + std::string Name; // The Women Name of the item - ucstring WomenName; + std::string WomenName; // Description of the item - ucstring Desc; + std::string Desc; // Optional Second description (For SBrick composition for example) - ucstring Desc2; + std::string Desc2; void serial(NLMISC::IStream &f) { - sint ver= f.serialVersion(1); - f.serial(Name); - if (ver >= 1) + sint ver = f.serialVersion(2); + if (ver >= 2) + { + f.serial(Name); f.serial(WomenName); - f.serial(Desc); - f.serial(Desc2); + f.serial(Desc); + f.serial(Desc2); + } + else + { + nlassert(f.isReading()); + ucstring name; + ucstring womenName; + ucstring desc; + ucstring desc2; + f.serial(name); + if (ver >= 1) + f.serial(womenName); + f.serial(desc); + f.serial(desc2); + Name = name.toUtf8(); + WomenName = womenName.toUtf8(); + Desc = desc.toUtf8(); + Desc2 = desc2.toUtf8(); + } } }; static bool _SpecItem_MemoryCompressed; static std::map _SpecItem_TempMap; - static std::vector _TitleWords; - static std::map _DynStrings; + static std::vector _TitleWords; + static std::map _DynStrings; static char *_SpecItem_Labels; - static ucchar *_SpecItem_NameDesc; + static char *_SpecItem_NameDesc; struct CItemLight { - char *Label; - ucchar *Name; - ucchar *WomenName; - ucchar *Desc; - ucchar *Desc2; + const char *Label; + const char *Name; + const char *WomenName; + const char *Desc; + const char *Desc2; }; struct CItemLightComp { @@ -303,9 +323,9 @@ private: static std::vector _SpecItems; - static const ucchar *getSpecialWord(const std::string &label, bool women = false); - static const ucchar *getSpecialDesc(const std::string &label); - static const ucchar *getSpecialDesc2(const std::string &label); + static const char *getSpecialWord(const std::string &label, bool women = false); + static const char *getSpecialDesc(const std::string &label); + static const char *getSpecialDesc2(const std::string &label); // Check Files for the Packed string. class CFileCheck @@ -381,9 +401,9 @@ class IStringWaitCallback { public: /// Overide this method to receive callback for string. - virtual void onStringAvailable(uint /* stringId */, const ucstring &/* value */) {} + virtual void onStringAvailable(uint /* stringId */, const std::string &/* value */) {} /// Overide this method to receive callback for dynamic string. - virtual void onDynStringAvailable(uint /* stringId */, const ucstring &/* value */) {} + virtual void onDynStringAvailable(uint /* stringId */, const std::string &/* value */) {} virtual ~IStringWaitCallback() { From 5a470a7b16a77c1be7b56d8a1d1a40ba7b26788e Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 08:21:31 +0800 Subject: [PATCH 109/205] UTF-8 string manager, ryzom/ryzomcore#335 --- nel/include/nel/gui/interface_expr.h | 1 + ryzom/client/src/game_context_menu.cpp | 2 +- .../src/interface_v3/action_handler_item.cpp | 6 ++---- ryzom/client/src/interface_v3/dbctrl_sheet.cpp | 8 ++++---- .../interface_v3/dbgroup_list_sheet_trade.cpp | 2 +- .../src/interface_v3/encyclopedia_manager.cpp | 9 +++------ .../src/interface_v3/group_in_scene_bubble.cpp | 3 +-- .../interface_v3/group_phrase_skill_filter.cpp | 2 +- ryzom/client/src/interface_v3/group_skills.cpp | 4 ++-- .../interface_expr_user_fct_game.cpp | 16 ++++++++-------- .../interface_expr_user_fct_items.cpp | 8 ++++---- 11 files changed, 28 insertions(+), 33 deletions(-) diff --git a/nel/include/nel/gui/interface_expr.h b/nel/include/nel/gui/interface_expr.h index 27ed24fe0..b4474ac22 100644 --- a/nel/include/nel/gui/interface_expr.h +++ b/nel/include/nel/gui/interface_expr.h @@ -68,6 +68,7 @@ namespace NLGUI void setInteger(sint64 value) { clean(); _Type = Integer; _IntegerValue = value; } void setDouble(double value) { clean(); _Type = Double; _DoubleValue = value; } void setString(const std::string &value) { clean(); _Type = String; _StringValue = value; } + void setString(const char *value) { clean(); _Type = String; _StringValue = value; } void setRGBA(NLMISC::CRGBA value) { clean(); _Type = RGBA; _RGBAValue = (uint32)(value.R+(value.G<<8)+(value.B<<16)+(value.A<<24)); } void setUserType(CInterfaceExprUserType *value); // reset this object to initial state (no type) diff --git a/ryzom/client/src/game_context_menu.cpp b/ryzom/client/src/game_context_menu.cpp index 441976be8..47ca97a80 100644 --- a/ryzom/client/src/game_context_menu.cpp +++ b/ryzom/client/src/game_context_menu.cpp @@ -798,7 +798,7 @@ void CGameContextMenu::updateContextMenuOutpostState(uint options) { CViewTextMenu *pVTM = _TextOutpostState; if (pVTM) - pVTM->setText(CUtfStringView(STRING_MANAGER::CStringManagerClient::getOutpostLocalizedName(outpostSheet)).toUtf8()); + pVTM->setText(STRING_MANAGER::CStringManagerClient::getOutpostLocalizedName(outpostSheet)); } // apply the active diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 0edd74491..2df888285 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -161,9 +161,8 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() } else { - ucstring localDesc = ucstring(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)); if (itemInfo.CustomText.empty()) - display->setTextFormatTaged(localDesc.toUtf8()); + display->setTextFormatTaged(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)); else { ucstring text = itemInfo.CustomText; @@ -305,9 +304,8 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() // Finish the display or add the waiter if (getInventory().isItemInfoUpToDate(ItemSlotId)) { - ucstring localDesc = ucstring(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)); if (itemInfo.CustomText.empty()) - display->setTextFormatTaged(localDesc.toUtf8()); + display->setTextFormatTaged(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)); else { ucstring text = itemInfo.CustomText; diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index a07d4c2fb..e9575f776 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -3385,7 +3385,7 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const { // just show the name of the skill // the sheet id is interpreted as a skill enum - help= CUtfStringView(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName( (SKILLS::ESkills)_SheetId.getSInt32() )).toUtf8(); + help= STRING_MANAGER::CStringManagerClient::getSkillLocalizedName( (SKILLS::ESkills)_SheetId.getSInt32() ); } else if(getType() == CCtrlSheetInfo::SheetType_Macro) { @@ -3485,7 +3485,7 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const CSBrickManager *pBM= CSBrickManager::getInstance(); CSBrickSheet *brick= pBM->getBrick(CSheetId(getSheetId())); if(brick) - help= CUtfStringView(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(brick->Id)).toUtf8(); + help= STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(brick->Id); else help= _ContextHelp; } @@ -3549,7 +3549,7 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const { CSPhraseSheet *phrase= dynamic_cast(SheetMngr.get(CSheetId(getSheetId()))); if(phrase) - help= CUtfStringView(STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(phrase->Id)).toUtf8(); + help= STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(phrase->Id); else help= _ContextHelp; } @@ -3557,7 +3557,7 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const { const COutpostBuildingSheet *outpost = asOutpostBuildingSheet(); if (outpost) - help = CUtfStringView(CStringManagerClient::getOutpostBuildingLocalizedName(CSheetId(_SheetId.getSInt32()))).toUtf8(); + help = CStringManagerClient::getOutpostBuildingLocalizedName(CSheetId(_SheetId.getSInt32())); else help = _ContextHelp; } 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 3d59ea644..2b52de9b0 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -269,7 +269,7 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT if (pOBS != NULL) { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - text += string("\n") + CUtfStringView(pSMC->getOutpostBuildingLocalizedDescription(CSheetId(Ctrl->getSheetId()))).toUtf8(); + text += string("\n") + pSMC->getOutpostBuildingLocalizedDescription(CSheetId(Ctrl->getSheetId())); text += "\n" + CI18N::get("uiBotChatPrice") + NLMISC::formatThousands(toString(pOBS->CostDapper)); text += CI18N::get("uiBotChatTime") + toString(pOBS->CostTime/60) + CI18N::get("uiBotChatTimeMinute"); if ((pOBS->CostTime % 60) != 0) diff --git a/ryzom/client/src/interface_v3/encyclopedia_manager.cpp b/ryzom/client/src/interface_v3/encyclopedia_manager.cpp index 63c5f07c9..25f5bc2e8 100644 --- a/ryzom/client/src/interface_v3/encyclopedia_manager.cpp +++ b/ryzom/client/src/interface_v3/encyclopedia_manager.cpp @@ -360,18 +360,15 @@ void CEncyclopediaManager::rebuildThemaPage(uint32 themaName) { if (pES->type() == CEntitySheet::ITEM) { - CUtfStringView desc(pSMC->getItemLocalizedDescription(CSheetId(pThema->RewardSheet))); - pRBVT->setText(desc.toUtf8()); + pRBVT->setText(pSMC->getItemLocalizedDescription(CSheetId(pThema->RewardSheet))); } else if (pES->type() == CEntitySheet::SBRICK) { - CUtfStringView desc(pSMC->getSBrickLocalizedDescription(CSheetId(pThema->RewardSheet))); - pRBVT->setText(desc.toUtf8()); + pRBVT->setText(pSMC->getSBrickLocalizedDescription(CSheetId(pThema->RewardSheet))); } else if (pES->type() == CEntitySheet::SPHRASE) { - CUtfStringView desc(pSMC->getSPhraseLocalizedDescription(CSheetId(pThema->RewardSheet))); - pRBVT->setText(desc.toUtf8()); + pRBVT->setText(pSMC->getSPhraseLocalizedDescription(CSheetId(pThema->RewardSheet))); } } 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 258700dd2..c3edc87f9 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -531,10 +531,9 @@ void CGroupInSceneBubbleManager::addSkillPopup (uint skillId, sint delta, uint t if (group) { // Skill name - CUtfStringView sSkillName(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)skillId)); CViewText *pViewSkillName = dynamic_cast(group->getView("name")); if (pViewSkillName != NULL) - pViewSkillName->setText (sSkillName.toUtf8()); + pViewSkillName->setText (STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)skillId)); // Skill value CCDBNodeLeaf *skillLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:CHARACTER_INFO:SKILLS:"+toString(skillId)+":BaseSKILL", false); diff --git a/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp b/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp index d246918bd..7d2054fc4 100644 --- a/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp +++ b/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp @@ -225,7 +225,7 @@ void CGroupPhraseSkillFilter::rebuild() // just text pNode->DisplayText = true; pNode->Template = NULL; - pNode->Text = CUtfStringView(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i)).toUtf8(); + pNode->Text = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i); // Action handler? if(!_AHCtrlNode.empty()) diff --git a/ryzom/client/src/interface_v3/group_skills.cpp b/ryzom/client/src/interface_v3/group_skills.cpp index d0efce626..146117d17 100644 --- a/ryzom/client/src/interface_v3/group_skills.cpp +++ b/ryzom/client/src/interface_v3/group_skills.cpp @@ -336,7 +336,7 @@ void CGroupSkills::createAllTreeNodes() // local variable (avoid realloc in loop) vector< pair > tempVec(2); - string sSkillName; + const char *sSkillName; while ((!bQuit) && (nCounter < 32)) // Counter is used to not infinitly loop { @@ -366,7 +366,7 @@ void CGroupSkills::createAllTreeNodes() pNode->Id = NLMISC::toString(i); // get Skill Name - sSkillName = CUtfStringView(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i)).toUtf8(); + sSkillName = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i); // just text or template? if(_TemplateSkill.empty()) diff --git a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp index a4dfb9d79..9494deacf 100644 --- a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp +++ b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp @@ -1083,7 +1083,7 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostName) // get sheet name STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - const std::string name = CUtfStringView(pSMC->getOutpostLocalizedName(CSheetId(nSheet))).toUtf8(); + const char *name = pSMC->getOutpostLocalizedName(CSheetId(nSheet)); result.setString(name); @@ -1110,7 +1110,7 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostDesc) // get sheet name STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - const string name = CUtfStringView(pSMC->getOutpostLocalizedDescription(CSheetId(nSheet))).toUtf8(); + const char *name = pSMC->getOutpostLocalizedDescription(CSheetId(nSheet)); result.setString(name); @@ -1137,7 +1137,7 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostBuildingName) // get sheet name STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - const string name = CUtfStringView(pSMC->getOutpostBuildingLocalizedName(CSheetId(nSheet))).toUtf8(); + const char *name = pSMC->getOutpostBuildingLocalizedName(CSheetId(nSheet)); result.setString(name); @@ -1163,18 +1163,18 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostBuildingDesc) } // get sheet name - string name; + const char *name; CEntitySheet *pSheet= SheetMngr.get(CSheetId(nSheet)); COutpostBuildingSheet *pOBS = dynamic_cast(pSheet); if (pOBS && pOBS->OBType == COutpostBuildingSheet::OB_Empty) { // Don't display description if the building is an empty slot - name.clear(); + name = ""; } else { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - name = CUtfStringView(pSMC->getOutpostBuildingLocalizedDescription(CSheetId(nSheet))).toUtf8(); + name = pSMC->getOutpostBuildingLocalizedDescription(CSheetId(nSheet)); } @@ -1203,7 +1203,7 @@ static DECLARE_INTERFACE_USER_FCT(getSquadName) // get sheet name STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - const string name = CUtfStringView(pSMC->getSquadLocalizedName(CSheetId(nSheet))).toUtf8(); + const char *name = pSMC->getSquadLocalizedName(CSheetId(nSheet)); result.setString(name); @@ -1230,7 +1230,7 @@ static DECLARE_INTERFACE_USER_FCT(getSquadDesc) // get sheet name STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - const string name = CUtfStringView(pSMC->getSquadLocalizedDescription(CSheetId(nSheet))).toUtf8(); + const char *name = pSMC->getSquadLocalizedDescription(CSheetId(nSheet)); result.setString(name); diff --git a/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp b/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp index eafdcccaf..cae4b9d77 100644 --- a/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp +++ b/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp @@ -320,8 +320,8 @@ static DECLARE_INTERFACE_USER_FCT(getSheetName) else { const CItemSheet *itemSheet = getItemSheet(args); - string tmp; - if (itemSheet != NULL) tmp = CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedName(itemSheet->Id)).toUtf8(); + const char *tmp = ""; + if (itemSheet != NULL) tmp = STRING_MANAGER::CStringManagerClient::getItemLocalizedName(itemSheet->Id); result.setString(tmp); return true; } @@ -346,8 +346,8 @@ static DECLARE_INTERFACE_USER_FCT(getItemTranslatedName) return false; } - string tmp; - tmp = CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedName(sheet)).toUtf8(); + const char *tmp = ""; + tmp = STRING_MANAGER::CStringManagerClient::getItemLocalizedName(sheet); result.setString(tmp); return true; } From ecabc00ec5338da1569f552a089dab194b610243 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 08:40:06 +0800 Subject: [PATCH 110/205] UTF-8 various, ryzom/ryzomcore#335 --- ryzom/client/src/init.cpp | 16 ++++++------- .../interface_v3/group_in_scene_user_info.cpp | 12 +++++----- ryzom/client/src/interface_v3/group_map.cpp | 10 ++++---- ryzom/client/src/progress.cpp | 24 +++++++++---------- ryzom/client/src/r2/auto_group.cpp | 6 ++--- ryzom/client/src/r2/editor.cpp | 6 ++--- ryzom/client/src/r2/tool_draw_prim.cpp | 6 ++--- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/ryzom/client/src/init.cpp b/ryzom/client/src/init.cpp index ebb713a73..41c924baf 100644 --- a/ryzom/client/src/init.cpp +++ b/ryzom/client/src/init.cpp @@ -168,7 +168,7 @@ extern NLMISC::CCmdArgs Args; // Tips of the day count #define RZ_NUM_TIPS 17 -ucstring TipsOfTheDay; +std::string TipsOfTheDay; uint TipsOfTheDayIndex; // includes for following register classes @@ -272,19 +272,19 @@ static INT_PTR CALLBACK ExitClientErrorDialogProc(HWND hwndDlg, UINT uMsg, WPARA { if (CI18N::hasTranslation("TheSagaOfRyzom")) { - if (!SetWindowTextW(hwndDlg, (WCHAR*)CI18N::get ("TheSagaOfRyzom").c_str ())) + if (!SetWindowTextW(hwndDlg, nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()))) { nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str()); } } - SetDlgItemTextW(hwndDlg, IDC_ERROR_MSG_TEXT, (WCHAR*) CurrentErrorMessage.c_str ()); + SetDlgItemTextW(hwndDlg, IDC_ERROR_MSG_TEXT, (WCHAR*)CurrentErrorMessage.c_str()); if (CI18N::hasTranslation("uiRyzomErrorMsgBoxExit")) { - SetDlgItemTextW(hwndDlg, IDOK, (WCHAR*)CI18N::get ("uiRyzomErrorMsgBoxExit").c_str ()); + SetDlgItemTextW(hwndDlg, IDOK, nlUtf8ToWide(CI18N::get("uiRyzomErrorMsgBoxExit").c_str())); } if (CI18N::hasTranslation("uiRyzomErrorMsgBoxHelp")) { - SetDlgItemTextW(hwndDlg, IDC_RYZOM_ERROR_HELP, (WCHAR*)CI18N::get ("uiRyzomErrorMsgBoxHelp").c_str ()); + SetDlgItemTextW(hwndDlg, IDC_RYZOM_ERROR_HELP, nlUtf8ToWide(CI18N::get("uiRyzomErrorMsgBoxHelp").c_str())); } RECT rect; RECT rectDesktop; @@ -343,7 +343,7 @@ void ExitClientError (const char *format, ...) /* ucstring ucstr; ucstr.fromUtf8 (str); - MessageBoxW (NULL, (WCHAR*)ucstr.c_str(), (WCHAR*)CI18N::get ("TheSagaOfRyzom").c_str (), MB_OK|MB_ICONERROR); + MessageBoxW (NULL, (WCHAR *)ucstr.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONERROR); */ #else fprintf (stderr, "%s\n", str); @@ -360,7 +360,7 @@ void ExitClientError (const char *format, ...) void ClientInfo (const ucstring &message) { #ifdef NL_OS_WINDOWS - MessageBoxW (NULL, (WCHAR*)message.c_str(), (WCHAR*)CI18N::get ("TheSagaOfRyzom").c_str (), MB_OK|MB_ICONINFORMATION); + MessageBoxW(NULL, (WCHAR *)message.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONINFORMATION); #endif } @@ -368,7 +368,7 @@ void ClientInfo (const ucstring &message) bool ClientQuestion (const ucstring &message) { #ifdef NL_OS_WINDOWS - return MessageBoxW (NULL, (WCHAR*)message.c_str(), (WCHAR*)CI18N::get ("TheSagaOfRyzom").c_str (), MB_YESNO|MB_ICONQUESTION) != IDNO; + return MessageBoxW(NULL, (WCHAR *)message.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_YESNO|MB_ICONQUESTION) != IDNO; #else return false; #endif diff --git a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index fa88db43e..c5dc116e3 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -200,9 +200,9 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) // Names const char *templateName; - ucstring theTribeName; - ucstring entityName = entity->getDisplayName(); - ucstring entityTitle = entity->getTitle(); + const char *theTribeName = ""; + std::string entityName = entity->getDisplayName(); + std::string entityTitle = entity->getTitle().toUtf8(); // For some NPC's the name is empty and only a title is given, // in that case, treat the title as the name. @@ -780,19 +780,19 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) // Set player name if (info->_Name) { - info->_Name->setText(entityName.toUtf8()); + info->_Name->setText(entityName); info->_Name->setModulateGlobalColor(false); } // Set player title if (info->_Title) - info->_Title->setText(entityTitle.toUtf8()); + info->_Title->setText(entityTitle); // Set tribe name if (info->_TribeName) { nlassert(info->_GuildName == NULL); - info->_TribeName->setText(theTribeName.toUtf8()); + info->_TribeName->setText(theTribeName); } // Init user leaf nodes diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index 7725d45f9..b5302885e 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -2530,19 +2530,19 @@ void CGroupMap::createLMWidgets(const std::vector &lms) NLMISC::CVector2f mapPos; worldToMap(mapPos, rCLM.Pos); - const ucstring ucsTmp(CStringManagerClient::getPlaceLocalizedName(rCLM.TitleTextID)); - const ucstring lcTitle = toLower(ucsTmp); + const char *ucsTmp = CStringManagerClient::getPlaceLocalizedName(rCLM.TitleTextID); + const std::string lcTitle = toLower(ucsTmp); bool searchMatch = notWorldMode && _LandmarkFilter.size() > 0 && filterLandmark(lcTitle); if (searchMatch) - _MatchedLandmarks.push_back(SMatchedLandmark(rCLM.Pos, ucsTmp, _ContinentLMOptions)); + _MatchedLandmarks.push_back(SMatchedLandmark(rCLM.Pos, ucstring::makeFromUtf8(ucsTmp), _ContinentLMOptions)); // Add button if not a region nor a place if ((rCLM.Type != CContLandMark::Region) && (rCLM.Type != CContLandMark::Place) && (rCLM.Type != CContLandMark::Street)) { if (rCLM.Type != CContLandMark::Stable) - addLandMark(_ContinentLM, mapPos, ucsTmp, _ContinentLMOptions); + addLandMark(_ContinentLM, mapPos, ucstring::makeFromUtf8(ucsTmp), _ContinentLMOptions); else addLandMark(_ContinentLM, mapPos, CI18N::get("uiStable"), _ContinentLMOptions); _ContinentLM.back()->Type = rCLM.Type; @@ -2551,7 +2551,7 @@ void CGroupMap::createLMWidgets(const std::vector &lms) else // just add a text { CLandMarkText *pNewText = new CLandMarkText(CViewBase::TCtorParam()); - pNewText->setText(ucsTmp.toUtf8()); + pNewText->setText(ucsTmp); pNewText->Pos = mapPos; pNewText->setParent(this); pNewText->setParentPosRef(Hotspot_BL); diff --git a/ryzom/client/src/progress.cpp b/ryzom/client/src/progress.cpp index e75b4a984..c27e285e1 100644 --- a/ryzom/client/src/progress.cpp +++ b/ryzom/client/src/progress.cpp @@ -50,7 +50,7 @@ extern NL3D::UMaterial LoadingMaterialFull; extern std::vector LogoBitmaps; extern uint TipsOfTheDayIndex; -extern ucstring TipsOfTheDay; +extern string TipsOfTheDay; extern bool UseEscapeDuringLoading; CProgress::CProgress () @@ -287,8 +287,8 @@ void CProgress::internalProgress (float value) // Display the tips of the day. TextContext->setFontSize((uint)(16.f * fontFactor)); TextContext->setHotSpot(UTextContext::MiddleTop); - ucstring::size_type index = 0; - ucstring::size_type end = TipsOfTheDay.find((ucchar)'\n'); + string::size_type index = 0; + string::size_type end = TipsOfTheDay.find('\n'); if (end == string::npos) end = TipsOfTheDay.size(); float fY = ClientCfg.TipsY; @@ -297,15 +297,15 @@ void CProgress::internalProgress (float value) while (index < end) { // Get the line - ucstring line = TipsOfTheDay.substr (index, end-index); + string line = TipsOfTheDay.substr (index, end-index); // Draw the line TextContext->printAt(0.5f, fY, line); fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY); index=end+1; - end = TipsOfTheDay.find((ucchar)'\n', index); - if (end == ucstring::npos) + end = TipsOfTheDay.find('\n', index); + if (end == string::npos) end = TipsOfTheDay.size(); } @@ -338,7 +338,7 @@ void CProgress::internalProgress (float value) TextContext->setFontSize((uint)(15.f * fontFactor)); TextContext->setHotSpot(UTextContext::BottomLeft); - ucstring uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText + ") - " + CI18N::get("uiDelayedTPCancel"); + string uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText.toUtf8() + ") - " + 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); @@ -386,13 +386,13 @@ void CProgress::internalProgress (float value) TextContext->setFontSize( (uint)(16.f * fontFactor)); // build the ucstr(s) - ucstring ucstr = CI18N::get((*itpc).Text); - vector vucstr; - ucstring sep("\n"); - splitUCString(ucstr,sep,vucstr); + string ucstr = CI18N::get((*itpc).Text); + vector vucstr; + string sep("\n"); + splitString(ucstr,sep,vucstr); // Letter size - UTextContext::CStringInfo si = TextContext->getStringInfo(ucstring("|")); + UTextContext::CStringInfo si = TextContext->getStringInfo("|"); uint fontHeight = (uint) si.StringHeight + 2; // we add 2 pixels for the gap uint i; diff --git a/ryzom/client/src/r2/auto_group.cpp b/ryzom/client/src/r2/auto_group.cpp index ee269376c..7da977b3d 100644 --- a/ryzom/client/src/r2/auto_group.cpp +++ b/ryzom/client/src/r2/auto_group.cpp @@ -279,12 +279,12 @@ void CAutoGroup::group(CObject *newEntityDesc, const NLMISC::CVectorD &createPos getEditor().getDMC().flushActions(); return; } - ucstring readableName; + string readableName; CLuaState &ls = getEditor().getLua(); R2::getEditor().getEnv()["PaletteIdToGroupTranslation"][newEntityDesc->getAttr("Base")->toString()].push(); if (ls.isString(-1)) - readableName.fromUtf8(ls.toString(-1)); - ucstring ucGroupName = ucstring(readableName + " " + CI18N::get("uiR2EDNameGroup")); + readableName = ls.toString(-1); + string ucGroupName = readableName + " " + CI18N::get("uiR2EDNameGroup"); newGroup->set("Name", getEditor().genInstanceName(ucGroupName).toUtf8()); getEditor().getDMC().requestInsertNode(destGroup->getParentAct()->getId(), diff --git a/ryzom/client/src/r2/editor.cpp b/ryzom/client/src/r2/editor.cpp index 3628dfe93..c9b47e6a3 100644 --- a/ryzom/client/src/r2/editor.cpp +++ b/ryzom/client/src/r2/editor.cpp @@ -1571,12 +1571,12 @@ int CEditor::luaGetUserEntityName(CLuaState &ls) CLuaIHM::checkArgCount(ls, funcName, 1); // this is a method if (UserEntity) { - ucstring name = UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis; - ls.push( name.toUtf8() ); + string name = UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis; + ls.push( name ); } else { - ls.push(std::string("")); + ls.push(std::string()); } return 1; diff --git a/ryzom/client/src/r2/tool_draw_prim.cpp b/ryzom/client/src/r2/tool_draw_prim.cpp index c32682626..7ec119e29 100644 --- a/ryzom/client/src/r2/tool_draw_prim.cpp +++ b/ryzom/client/src/r2/tool_draw_prim.cpp @@ -551,9 +551,9 @@ void CToolDrawPrim::commit() if (!_Extending) { // set readable name - ucstring readableName = NLMISC::CI18N::get(_PrimType == Road ? "uiR2EDNameBotRoad" : "uiR2EDNameBotRegion"); - readableName = getEditor().genInstanceName(readableName); - desc->set("Name", readableName.toUtf8()); + string readableName = NLMISC::CI18N::get(_PrimType == Road ? "uiR2EDNameBotRoad" : "uiR2EDNameBotRegion"); + readableName = getEditor().genInstanceName(readableName).toUtf8(); + desc->set("Name", readableName); // send creation command // tmp : static npc counter // add in component list of default feature From 2d9f10bee3fb1c91aea9a356b718064cb5325da1 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 09:43:23 +0800 Subject: [PATCH 111/205] UTF-8 various, ryzom/ryzomcore#335 --- nel/src/gui/view_renderer.cpp | 1 + ryzom/client/src/entity_cl.cpp | 12 ++++++------ ryzom/client/src/entity_cl.h | 14 +++++++------- .../src/interface_v3/group_in_scene_user_info.cpp | 2 +- .../client/src/interface_v3/interface_manager.cpp | 4 ++-- ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp | 8 ++++---- ryzom/client/src/player_cl.cpp | 4 ++-- ryzom/client/src/player_r2_cl.cpp | 2 +- 8 files changed, 24 insertions(+), 23 deletions(-) diff --git a/nel/src/gui/view_renderer.cpp b/nel/src/gui/view_renderer.cpp index 405781440..ea177dff0 100644 --- a/nel/src/gui/view_renderer.cpp +++ b/nel/src/gui/view_renderer.cpp @@ -883,6 +883,7 @@ namespace NLGUI driver->setCursorScale( CViewRenderer::hwCursorScale ); char bufTmp[256], tgaName[256]; + tgaName[0] = 0; string sTGAname; float uvMinU, uvMinV, uvMaxU, uvMaxV; while (!iFile.eof()) diff --git a/ryzom/client/src/entity_cl.cpp b/ryzom/client/src/entity_cl.cpp index b28d3fda6..5071f771d 100644 --- a/ryzom/client/src/entity_cl.cpp +++ b/ryzom/client/src/entity_cl.cpp @@ -2295,7 +2295,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) womanTitle = ( c->getGender() == GSGENDER::female ); } - string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(), womanTitle); + string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle); // Sometimes translation contains another title { @@ -2305,11 +2305,11 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) _EntityName = _EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(sn.substr(0, pos)); string::size_type pos2 = replacement.find('$', pos + 1); _TitleRaw = replacement.substr(pos+1, pos2 - pos - 1); - replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(), womanTitle); + replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle); } } - _Tags = STRING_MANAGER::CStringManagerClient::getTitleInfos(_TitleRaw.toUtf8(), womanTitle); + _Tags = STRING_MANAGER::CStringManagerClient::getTitleInfos(_TitleRaw, womanTitle); if (!replacement.empty() || !ClientCfg.DebugStringManager) { @@ -2320,7 +2320,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) _NameEx = replacement; newtitle = _NameEx.toUtf8(); } - CHARACTER_TITLE::ECharacterTitle titleEnum = CHARACTER_TITLE::toCharacterTitle( _TitleRaw.toUtf8() ); + CHARACTER_TITLE::ECharacterTitle titleEnum = CHARACTER_TITLE::toCharacterTitle( _TitleRaw ); if ( titleEnum >= CHARACTER_TITLE::BeginGmTitle && titleEnum <= CHARACTER_TITLE::EndGmTitle ) { _GMTitle = titleEnum - CHARACTER_TITLE::BeginGmTitle; @@ -2352,13 +2352,13 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:player:header_opened:player_title")); - if (pVT != NULL) pVT->setText(_Title.toUtf8()); + if (pVT != NULL) pVT->setText(_Title); CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:player")); if (pGC != NULL) pGC->setUCTitle(_EntityName); CSkillManager *pSM = CSkillManager::getInstance(); - pSM->setPlayerTitle(_TitleRaw.toUtf8()); + pSM->setPlayerTitle(_TitleRaw); } // Must rebuild the in scene interface 'cause name has changed diff --git a/ryzom/client/src/entity_cl.h b/ryzom/client/src/entity_cl.h index 3ac01ed25..0f1296780 100644 --- a/ryzom/client/src/entity_cl.h +++ b/ryzom/client/src/entity_cl.h @@ -769,25 +769,25 @@ public: bool isAnOutpostAlly() const; /// Return the entity title - const ucstring &getTitle() const + const std::string &getTitle() const { return _Title; } /// Return the entity tags - const ucstring &getTag(uint8 id) const + const std::string &getTag(uint8 id) const { if (_Tags.size() > id) { return _Tags[id]; } - static ucstring empty; + static const std::string empty; return empty; } /// Return the raw unparsed entity title - const ucstring getTitleRaw() const + const std::string &getTitleRaw() const { - return ucstring(_TitleRaw); + return _TitleRaw; } /// Return true if this entity has a reserved title @@ -933,11 +933,11 @@ protected: // Current Name for the entity std::string _EntityName; // Current entity title - ucstring _Title; + std::string _Title; // Current entity tags std::vector _Tags; // Current entity title string id - ucstring _TitleRaw; + std::string _TitleRaw; // Current permanent content symbol for the entity std::string _PermanentStatutIcon; // Has reserved title? diff --git a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index c5dc116e3..e5021ca00 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -202,7 +202,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) const char *templateName; const char *theTribeName = ""; std::string entityName = entity->getDisplayName(); - std::string entityTitle = entity->getTitle().toUtf8(); + std::string entityTitle = entity->getTitle(); // For some NPC's the name is empty and only a title is given, // in that case, treat the title as the name. diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 40413914e..a0d36f535 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -4218,13 +4218,13 @@ bool CInterfaceManager::parseTokens(string& ucstr) // special case where there is only a title, very rare case for some NPC if (name.empty()) { - name = pTokenSubjectEntity->getTitle().toUtf8(); + name = pTokenSubjectEntity->getTitle(); } token_replacement = name.empty() ? token_replacement : name; } else if (token_param == "title") { - string title = pTokenSubjectEntity->getTitle().toUtf8(); + string title = pTokenSubjectEntity->getTitle(); token_replacement = title.empty() ? token_replacement : title; } else if (token_param == "race") diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index c9dc2767e..21322295e 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -1371,7 +1371,7 @@ int CLuaIHMRyzom::getPlayerName(CLuaState &ls) int CLuaIHMRyzom::getPlayerTitleRaw(CLuaState &ls) { CLuaIHM::checkArgCount(ls, "getPlayerTitleRaw", 0); - ls.push(UserEntity->getTitleRaw().toUtf8()); + ls.push(UserEntity->getTitleRaw()); return 1; } @@ -1379,7 +1379,7 @@ int CLuaIHMRyzom::getPlayerTitleRaw(CLuaState &ls) int CLuaIHMRyzom::getPlayerTitle(CLuaState &ls) { CLuaIHM::checkArgCount(ls, "getPlayerTitle", 0); - ls.push(UserEntity->getTitle().toUtf8()); + ls.push(UserEntity->getTitle()); return 1; } @@ -1453,7 +1453,7 @@ int CLuaIHMRyzom::getTargetTitleRaw(CLuaState &ls) if (!target) return 0; - ls.push(target->getTitleRaw().toUtf8()); + ls.push(target->getTitleRaw()); return 1; } @@ -1465,7 +1465,7 @@ int CLuaIHMRyzom::getTargetTitle(CLuaState &ls) if (!target) return 0; - ls.push(target->getTitle().toUtf8()); + ls.push(target->getTitle()); return 1; } diff --git a/ryzom/client/src/player_cl.cpp b/ryzom/client/src/player_cl.cpp index 437149f16..58deeac56 100644 --- a/ryzom/client/src/player_cl.cpp +++ b/ryzom/client/src/player_cl.cpp @@ -743,7 +743,7 @@ void CPlayerCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle * } // update title when gender changed - const string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(), _Gender == GSGENDER::female); + const string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, _Gender == GSGENDER::female); if (!replacement.empty() || !ClientCfg.DebugStringManager) { // Get extended name @@ -754,7 +754,7 @@ void CPlayerCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle * if (_Slot == 0) { CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:player:header_opened:player_title")); - if (pVT != NULL) pVT->setText(_Title.toUtf8()); + if (pVT != NULL) pVT->setText(_Title); } // rebuild in scene interface diff --git a/ryzom/client/src/player_r2_cl.cpp b/ryzom/client/src/player_r2_cl.cpp index 8f7621755..75effe9bf 100644 --- a/ryzom/client/src/player_r2_cl.cpp +++ b/ryzom/client/src/player_r2_cl.cpp @@ -446,7 +446,7 @@ void CPlayerR2CL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle } // update title when gender changed - const string replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(),_Gender == GSGENDER::female)); + const string replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw,_Gender == GSGENDER::female)); if (!replacement.empty()) { // Get extended name From 5fe2fae8b02fb61a666f920e595813246b4fa6d2 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 10:03:53 +0800 Subject: [PATCH 112/205] UTF-8 string manager, ryzom/ryzomcore#335 --- ryzom/client/src/string_manager_client.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/ryzom/client/src/string_manager_client.cpp b/ryzom/client/src/string_manager_client.cpp index 7381f5cb9..0ef667dc9 100644 --- a/ryzom/client/src/string_manager_client.cpp +++ b/ryzom/client/src/string_manager_client.cpp @@ -364,7 +364,7 @@ restartLoop4: _WaitingStrings.insert(stringId); // need to ask for this string. NLMISC::CBitMemStream bms; - const string msgType = "STRING_MANAGER:STRING_RQ"; + static const string msgType = "STRING_MANAGER:STRING_RQ"; if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) { bms.serial( stringId ); @@ -749,7 +749,7 @@ restartLoop: // If the string contains a title, then remove it string::size_type pos = str.find('$'); - if ( ! str.empty() && pos != ucstring::npos) + if ( ! str.empty() && pos != string::npos) { str = CEntityCL::removeTitleFromName(str); } @@ -1178,9 +1178,9 @@ bool CStringManagerClient::checkWordFileDates(vector &fileChecks, co // *************************************************************************** void CStringManagerClient::initI18NSpecialWords(const string &languageCode) { - ucstring womenNameColIdent= string("women_name"); - ucstring descColIdent= string("description"); - ucstring descColIdent2= string("description2"); + ucstring womenNameColIdent = "women_name"; + ucstring descColIdent = "description"; + ucstring descColIdent2 = "description2"; // List of words to append to the local CI18N system. static const char *specialWords[]= @@ -1257,8 +1257,8 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode) for(uint j=1;jWomenName); - if( !ustr.empty() ) + if( !it->WomenName[0] ) return it->WomenName; } return it->Name; @@ -1663,8 +1662,6 @@ const ucchar *CStringManagerClient::getLocalizedName(const ucstring &uctext) // *************************************************************************** vector CStringManagerClient::getTitleInfos(const string &titleId, bool women) { - //ucstring infosUC; - //infosUC.fromUtf8(titleId); vector listInfos; splitString(titleId, string("#"), listInfos); From ad0e9707850b535c63d3da4210366e7244df575d Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 11:32:29 +0800 Subject: [PATCH 113/205] UTF-8 chat, ryzom/ryzomcore#335 --- ryzom/client/src/character_cl.cpp | 2 +- ryzom/client/src/client_chat_manager.cpp | 159 +++++++++--------- ryzom/client/src/client_chat_manager.h | 20 +-- ryzom/client/src/commands.cpp | 130 +++++++------- .../src/interface_v3/action_handler_edit.cpp | 4 +- .../src/interface_v3/action_handler_game.cpp | 20 +-- .../src/interface_v3/action_handler_misc.cpp | 4 +- .../src/interface_v3/action_handler_move.cpp | 2 +- .../interface_v3/action_handler_phrase.cpp | 4 +- .../client/src/interface_v3/chat_displayer.h | 2 +- ryzom/client/src/interface_v3/chat_filter.cpp | 17 +- ryzom/client/src/interface_v3/chat_filter.h | 12 +- .../src/interface_v3/chat_text_manager.cpp | 74 ++++---- .../src/interface_v3/chat_text_manager.h | 6 +- ryzom/client/src/interface_v3/chat_window.cpp | 48 +++--- ryzom/client/src/interface_v3/chat_window.h | 12 +- .../client/src/interface_v3/guild_manager.cpp | 10 +- .../src/interface_v3/interface_manager.cpp | 8 +- .../src/interface_v3/interface_manager.h | 4 +- .../src/interface_v3/inventory_manager.cpp | 4 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 14 +- .../client/src/interface_v3/music_player.cpp | 6 +- .../src/interface_v3/people_interraction.cpp | 43 +++-- .../src/interface_v3/people_interraction.h | 4 +- ryzom/client/src/interface_v3/people_list.cpp | 10 +- ryzom/client/src/interface_v3/people_list.h | 4 +- ryzom/client/src/item_group_manager.cpp | 5 +- ryzom/client/src/main_loop.cpp | 6 +- ryzom/client/src/misc.cpp | 32 ++-- ryzom/client/src/misc.h | 6 +- ryzom/client/src/net_manager.cpp | 98 +++++------ ryzom/client/src/user_entity.cpp | 26 +-- .../common/src/game_share/msg_client_server.h | 12 +- 33 files changed, 397 insertions(+), 411 deletions(-) diff --git a/ryzom/client/src/character_cl.cpp b/ryzom/client/src/character_cl.cpp index d68a836de..676bf11f4 100644 --- a/ryzom/client/src/character_cl.cpp +++ b/ryzom/client/src/character_cl.cpp @@ -10367,7 +10367,7 @@ NLMISC_COMMAND(pvpMode, "modify pvp mode", "[ ]") str+="in_safe_zone "; if( pvpMode&PVP_MODE::PvpSafe) str+="safe "; - IM->displaySystemInfo(ucstring(str)); + IM->displaySystemInfo(str); nlinfo(" %s",str.c_str()); } else diff --git a/ryzom/client/src/client_chat_manager.cpp b/ryzom/client/src/client_chat_manager.cpp index 06c9c9776..a6ec40bdd 100644 --- a/ryzom/client/src/client_chat_manager.cpp +++ b/ryzom/client/src/client_chat_manager.cpp @@ -241,7 +241,7 @@ CClientChatManager::CClientChatManager() } //------------------------------------------------------- -const ucstring *CClientChatManager::cycleLastTell() +const string *CClientChatManager::cycleLastTell() { if (_TellPeople.empty()) return NULL; _TellPeople.push_front(_TellPeople.back()); @@ -282,10 +282,10 @@ void CClientChatManager::init( const string& /* staticDBFileName */ ) // chat // //----------------------------------------------- -void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam ) +void CClientChatManager::chat( const string& strIn, bool isChatTeam ) { // Truncate to 255 chars max (because of server restriction) - ucstring str= strIn.substr(0,255); + ucstring str= ucstring(strIn).substr(0,255); // send str to IOS CBitMemStream bms; @@ -303,7 +303,7 @@ void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) { - bms.serial( str ); + bms.serial( str ); // FIXME: UTF-8 NetMngr.push( bms ); //nlinfo("impulseCallBack : %s %s sent", msgType.c_str(), str.toString().c_str()); } @@ -321,11 +321,11 @@ void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam ) // tell // //----------------------------------------------- -void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn ) +void CClientChatManager::tell( const string& receiverIn, const string& strIn ) { // Truncate to 255 chars max (because of server restriction) string receiver= receiverIn.substr(0,255); - ucstring str= strIn.substr(0,255); + ucstring str= ucstring(strIn).substr(0,255); // *** send str CBitMemStream bms; @@ -333,7 +333,7 @@ void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) { bms.serial( receiver ); - bms.serial( str ); + bms.serial( str ); // FIXME: UTF-8 NetMngr.push( bms ); //nlinfo("impulseCallBack : %s %s %s sent", msgType.c_str(), receiver.c_str(), str.toString().c_str()); } @@ -345,10 +345,10 @@ void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn ) // *** manage list of last telled people // remove the telled people from list (if present) - std::list::iterator it = _TellPeople.begin(); + std::list::iterator it = _TellPeople.begin(); while(it != _TellPeople.end()) { - if (*it == ucstring(receiver)) + if (*it == receiver) { it = _TellPeople.erase(it); nlassert(_NumTellPeople != 0); @@ -454,14 +454,14 @@ void CClientChatManager::processTellString(NLMISC::CBitMemStream& bms, IChatDisp // Serial. For tell message, there is no chat mode, coz we know we are in tell mode ! bms.serial (chatMsg.CompressedIndex); bms.serial (chatMsg.SenderNameId); - bms.serial (chatMsg.Content); + bms.serial (chatMsg.Content); // FIXME: UTF-8 if (PermanentlyBanned) return; chatMsg.ChatMode = (uint8) CChatGroup::tell; // If !complete, wait - ucstring senderStr; + string senderStr; bool complete = true; complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); if (!complete) @@ -472,8 +472,8 @@ void CClientChatManager::processTellString(NLMISC::CBitMemStream& bms, IChatDisp } // display - ucstring ucstr; - buildTellSentence(senderStr, chatMsg.Content, ucstr); + string ucstr; + buildTellSentence(senderStr, chatMsg.Content.toUtf8(), ucstr); chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr); } @@ -488,9 +488,9 @@ void CClientChatManager::processFarTellString(NLMISC::CBitMemStream& bms, IChatD if (PermanentlyBanned) return; // display - ucstring ucstr; - buildTellSentence(farTellMsg.SenderName, farTellMsg.Text, ucstr); - chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, farTellMsg.SenderName); + string ucstr; + buildTellSentence(farTellMsg.SenderName.toUtf8(), farTellMsg.Text.toUtf8(), ucstr); + chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, farTellMsg.SenderName.toUtf8()); } @@ -505,7 +505,7 @@ void CClientChatManager::processChatString( NLMISC::CBitMemStream& bms, IChatDis CChatMsg chatMsg; bms.serial( chatMsg ); CChatGroup::TGroupType type = static_cast(chatMsg.ChatMode); - ucstring senderStr; + string senderStr; bool complete = true; complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); @@ -528,9 +528,9 @@ void CClientChatManager::processChatString( NLMISC::CBitMemStream& bms, IChatDis } // display - ucstring ucstr; - buildChatSentence(chatMsg.CompressedIndex, senderStr, chatMsg.Content, type, ucstr); - chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, chatMsg.Content, type, chatMsg.DynChatChanID, senderStr); + string ucstr; + buildChatSentence(chatMsg.CompressedIndex, senderStr, chatMsg.Content.toUtf8(), type, ucstr); + chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, chatMsg.Content.toUtf8(), type, chatMsg.DynChatChanID, senderStr); } @@ -545,8 +545,8 @@ void CClientChatManager::processTellString2(NLMISC::CBitMemStream& bms, IChatDis bms.serial(chatMsg.PhraseId); // if !complete, wait - ucstring senderStr; - ucstring rawMessage; + string senderStr; + string rawMessage; bool complete = true; complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, rawMessage); @@ -558,7 +558,7 @@ void CClientChatManager::processTellString2(NLMISC::CBitMemStream& bms, IChatDis } // display - ucstring ucstr; + string ucstr; buildTellSentence(senderStr, rawMessage, ucstr); chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr); } @@ -571,8 +571,8 @@ void CClientChatManager::processChatString2(NLMISC::CBitMemStream& bms, IChatDis bms.serial( chatMsg ); if (PermanentlyBanned) return; CChatGroup::TGroupType type = static_cast(chatMsg.ChatMode); - ucstring senderStr; - ucstring rawMessage; + string senderStr; + string rawMessage; // here, the type cannot be dyn_chat (no DynChatId in the message) => discard if(type==CChatGroup::dyn_chat) @@ -592,11 +592,11 @@ void CClientChatManager::processChatString2(NLMISC::CBitMemStream& bms, IChatDis return; } - rawMessage += ucstring(" "); - rawMessage += chatMsg.CustomTxt; + rawMessage += " "; + rawMessage += chatMsg.CustomTxt.toUtf8(); // display - ucstring ucstr; + string ucstr; buildChatSentence(chatMsg.CompressedIndex, senderStr, rawMessage, type, ucstr); chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, rawMessage, type, CEntityId::Unknown, senderStr); } @@ -615,7 +615,7 @@ void CClientChatManager::processChatStringWithNoSender( NLMISC::CBitMemStream& b chatMsg.SenderNameId = 0; chatMsg.ChatMode = type; chatMsg.PhraseId = phraseID; - ucstring ucstr; + string ucstr; // if !complete, wait bool complete = STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, ucstr); @@ -627,7 +627,7 @@ void CClientChatManager::processChatStringWithNoSender( NLMISC::CBitMemStream& b } // diplay - ucstring senderName(""); + string senderName; chatDisplayer.displayChat(INVALID_DATASET_INDEX, ucstr, ucstr, type, CEntityId::Unknown, senderName); } @@ -643,7 +643,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer) for( itMsg = _ChatBuffer.begin(); itMsg != _ChatBuffer.end(); ) { CChatGroup::TGroupType type = static_cast(itMsg->ChatMode); - ucstring sender, content; + string sender, content; // all strings received? bool complete = true; @@ -652,7 +652,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer) if(itMsg->UsePhraseId) complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(itMsg->PhraseId, content); else - content= itMsg->Content; + content= itMsg->Content.toUtf8(); if (type == CChatGroup::dyn_chat) { @@ -666,7 +666,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer) // if complete, process if (complete) { - ucstring ucstr; + string ucstr; if (itMsg->SenderNameId == 0) { ucstr = content; @@ -703,7 +703,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer) // getString // //----------------------------------------------- -ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) +string CClientChatManager::getString( CBitMemStream& bms, string& ucstr ) { // deal with parameters @@ -714,8 +714,8 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { // search if a parameter exists in the string sprintf(chTmp,"$%d",dynParamIdx); - ucstring ucstrTmp( chTmp ); - ucstring::size_type idx = ucstr.find(ucstrTmp); + string ucstrTmp( chTmp ); + string::size_type idx = ucstr.find(ucstrTmp); // if there's a parameter in the string if( idx != ucstring::npos ) @@ -728,7 +728,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { bool huff; bms.serialBit(huff); - const ucstring dynStr("???"); + const string dynStr("???"); if( huff ) { nldebug(" receiving huffman dynamic parameter in static string"); @@ -756,8 +756,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { string dynStr; bms.serial( dynStr ); - ucstring ucDynStr(dynStr); - ucstr.replace( idx, ucstrTmp.size()+1, ucDynStr ); + ucstr.replace( idx, ucstrTmp.size()+1, dynStr ); } break; @@ -766,7 +765,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { uint32 nb; bms.serial( nb ); - ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); + ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) ); } break; /* @@ -794,7 +793,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { sint32 nb; bms.serial( nb ); - ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); + ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) ); } break; /* @@ -823,7 +822,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) { float nb; bms.serial( nb ); - ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); + ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) ); } break; @@ -849,7 +848,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) // getString // //----------------------------------------------- -bool CClientChatManager::getString( ucstring &result, std::vector& args, const ucstring &ucstrbase ) +bool CClientChatManager::getString( string &result, std::vector& args, const string &ucstrbase ) { result = ucstrbase; @@ -863,17 +862,17 @@ bool CClientChatManager::getString( ucstring &result, std::vector& args, { // search if a parameter exists in the string sprintf(chTmp,"$%d",dynParamIdx); - ucstring ucstrTmp( chTmp ); - ucstring::size_type idx = result.find(ucstrTmp); + string ucstrTmp( chTmp ); + string::size_type idx = result.find(ucstrTmp); // if there's a parameter in the string - if( idx != ucstring::npos ) + if( idx != string::npos ) { - ucstring rep; + string rep; rep = "???"; if (dynParamIdx >= args.size()) { - nlwarning ("Missing args for string '%s', only %d args, need arg %d", ucstrbase.toString().c_str(), args.size(), dynParamIdx); + nlwarning ("Missing args for string '%s', only %d args, need arg %d", ucstrbase.c_str(), args.size(), dynParamIdx); } else { @@ -948,15 +947,15 @@ bool CClientChatManager::getString( ucstring &result, std::vector& args, } // getString // // *************************************************************************** -void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstring &msg, ucstring &result) +void CClientChatManager::buildTellSentence(const string &sender, const string &msg, string &result) { // If no sender name was provided, show only the msg if ( sender.empty() ) result = msg; else { - ucstring name = CEntityCL::removeTitleAndShardFromName(sender.toUtf8()); - ucstring csr; + string name = CEntityCL::removeTitleAndShardFromName(sender); + string csr; // special case where there is only a title, very rare case for some NPC if (name.empty()) @@ -965,29 +964,29 @@ void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstrin CCharacterCL *entity = dynamic_cast(EntitiesMngr.getEntityByName(sender, true, true)); bool bWoman = entity && entity->getGender() == GSGENDER::female; - name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman); + name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); { // Sometimes translation contains another title ucstring::size_type pos = name.find('$'); if (pos != ucstring::npos) { - name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name.toUtf8()), bWoman); + name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name), bWoman); } } } else { // Does the char have a CSR title? - csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring(""); + csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? "(CSR) " : ""; } - result = csr + name + ucstring(" ") + CI18N::get("tellsYou") + ucstring(": ") + msg; + result = csr + name + " " + CI18N::get("tellsYou") + ": " + msg; } } // *************************************************************************** -void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderIndex */, const ucstring &sender, const ucstring &msg, CChatGroup::TGroupType type, ucstring &result) +void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderIndex */, const string &sender, const string &msg, CChatGroup::TGroupType type, string &result) { // if its a tell, then use buildTellSentence if(type==CChatGroup::tell) @@ -1005,35 +1004,35 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde // get the category if any. Note, in some case (chat from other player), there is not categories // and we do not want getStringCategory to return 'SYS' category. - ucstring finalMsg; + string finalMsg; string catStr = getStringCategory(msg, finalMsg, false); - ucstring cat; + string cat; if (!catStr.empty()) - cat = string("&")+catStr+"&"; + cat = "&" + catStr + "&"; - if ( ! cat.empty()) + if (!cat.empty()) { result = msg; return; } // Format the sentence with the provided sender name - ucstring senderName = CEntityCL::removeTitleAndShardFromName(sender.toUtf8()); + string senderName = CEntityCL::removeTitleAndShardFromName(sender); - ucstring csr; + string csr; // Does the char have a CSR title? - csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring(""); + csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? "(CSR) " : ""; - if (UserEntity && senderName.toUtf8() == UserEntity->getDisplayName()) + if (UserEntity && senderName == UserEntity->getDisplayName()) { // The player talks switch(type) { case CChatGroup::shout: - result = cat + csr + CI18N::get("youShout") + ucstring(": ") + finalMsg; + result = cat + csr + CI18N::get("youShout") + ": " + finalMsg; break; default: - result = cat + csr + CI18N::get("youSay") + ucstring(": ") + finalMsg; + result = cat + csr + CI18N::get("youSay") + ": " + finalMsg; break; } } @@ -1046,13 +1045,13 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde // We need the gender to display the correct title bool bWoman = entity && entity->getGender() == GSGENDER::female; - senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman); + senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); { // Sometimes translation contains another title ucstring::size_type pos = senderName.find('$'); if (pos != ucstring::npos) { - senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName.toUtf8()), bWoman); + senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName), bWoman); } } } @@ -1061,10 +1060,10 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde switch(type) { case CChatGroup::shout: - result = cat + csr + senderName + ucstring(" ") + CI18N::get("heShout") + ucstring(": ") + finalMsg; + result = cat + csr + senderName + " " + CI18N::get("heShout") + ": " + finalMsg; break; default: - result = cat + csr + senderName + ucstring(" ") + CI18N::get("heSays") + ucstring(": ") + finalMsg; + result = cat + csr + senderName + " " + CI18N::get("heSays") + ": " + finalMsg; break; } } @@ -1174,7 +1173,7 @@ void CClientChatManager::updateDynamicChatChannels(IChatDisplayer &chatDisplayer class CHandlerTell : public IActionHandler { - void execute (CCtrlBase *pCaller, const std::string &sParams) + void execute (CCtrlBase *pCaller, const string &sParams) { string receiver = getParam (sParams, "player"); string message; @@ -1219,7 +1218,7 @@ REGISTER_ACTION_HANDLER( CHandlerTell, "tell"); class CHandlerEnterTell : public IActionHandler { - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + void execute (CCtrlBase * /* pCaller */, const string &sParams) { CInterfaceManager *im = CInterfaceManager::getInstance(); string receiver = getParam (sParams, "player"); @@ -1295,7 +1294,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne case CChatGroup::guild: if (guildActive) pUserBut->setHardText("uiFilterGuild"); break; case CChatGroup::dyn_chat: uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChannelDbIndex); - ucstring title; + string title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); if (title.empty()) { @@ -1305,7 +1304,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne } else { - pUserBut->setHardText(title.toUtf8()); + pUserBut->setHardText(title); } break; } @@ -1337,7 +1336,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne class CHandlerTalk : public IActionHandler { - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + void execute (CCtrlBase * /* pCaller */, const string &sParams) { // Param uint mode; @@ -1376,7 +1375,7 @@ class CHandlerTalk : public IActionHandler else { CInterfaceManager *im = CInterfaceManager::getInstance(); - im->displaySystemInfo (ucstring::makeFromUtf8(cmd) + ": " + CI18N::get ("uiCommandNotExists")); + im->displaySystemInfo (cmd + ": " + CI18N::get ("uiCommandNotExists")); } } else @@ -1409,7 +1408,7 @@ REGISTER_ACTION_HANDLER( CHandlerTalk, "talk"); class CHandlerEnterTalk : public IActionHandler { - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + void execute (CCtrlBase * /* pCaller */, const string &sParams) { // Param uint mode; @@ -1436,10 +1435,10 @@ REGISTER_ACTION_HANDLER( CHandlerEnterTalk, "enter_talk"); class CHandlerTalkMessage : public IActionHandler { - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + void execute (CCtrlBase * /* pCaller */, const string &sParams) { // Param - ucstring text = CI18N::get ("uiTalkMemMsg"+sParams); + string text = CI18N::get ("uiTalkMemMsg"+sParams); // Find the base group if (!text.empty()) @@ -1455,7 +1454,7 @@ REGISTER_ACTION_HANDLER( CHandlerTalkMessage, "talk_message"); class CHandlerSwapChatMode : public IActionHandler { - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + void execute (CCtrlBase * /* pCaller */, const string &sParams) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); bool updateCapture= getParam(sParams, "update_capture")=="1"; diff --git a/ryzom/client/src/client_chat_manager.h b/ryzom/client/src/client_chat_manager.h index 2f7decac9..06792a50f 100644 --- a/ryzom/client/src/client_chat_manager.h +++ b/ryzom/client/src/client_chat_manager.h @@ -137,11 +137,11 @@ public: * \param mode in which channel should this message goes * \param dynChatId is valid only if mode==dyn_chat. This the Id of channel (not the index in DB!) */ - virtual void displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer=0) =0; + virtual void displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer=0) =0; /** * display a player tell message */ - virtual void displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName) =0; + virtual void displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName) =0; /** * Clear a channel. * \param dynChatDbIndex is valid only if mode==dyn_chat. Contrary to displayChat, this is the Db Index (0..MaxDynChanPerPlayer) @@ -177,18 +177,18 @@ public : * \param str is the chat content (truncated to 255 char max) * \param isChatTeam special case for Chat TEAM */ - void chat( const ucstring& str, bool isChatTeam = false ); + void chat( const std::string& str, bool isChatTeam = false ); /** * Transmit a chat message to the receiver * \param receiver is the name of the listening char (truncated to 255 char max) * \param str is the chat content (truncated to 255 char max) */ - void tell( const std::string& receiver, const ucstring& str ); + void tell( const std::string& receiver, const std::string& str ); /** Get the last name of the people with which a 'tell' has been done, then move that name at the start of the list */ - const ucstring *cycleLastTell(); + const std::string *cycleLastTell(); /** Set the max number of name in the tell list */ @@ -263,12 +263,12 @@ public : * \param result decoded string * \return true if the string is finalize, false if some param are missing from network */ - bool getString( ucstring &result, std::vector& args, const ucstring& strbase ); + bool getString( std::string &result, std::vector& args, const std::string& strbase ); // build a sentence to be displayed in the chat (e.g add "you say", "you shout", "[user name] says" or "[user name] shout") - static void buildChatSentence(TDataSetIndex compressedSenderIndex, const ucstring &sender, const ucstring &msg, CChatGroup::TGroupType type, ucstring &result); + static void buildChatSentence(TDataSetIndex compressedSenderIndex, const std::string &sender, const std::string &msg, CChatGroup::TGroupType type, std::string &result); // build a sentence to be displayed in the tell - static void buildTellSentence(const ucstring &sender, const ucstring &msg, ucstring &result); + static void buildTellSentence(const std::string &sender, const std::string &msg, std::string &result); /// \name Dynamic Chat channel mgt @@ -338,7 +338,7 @@ private : std::list _ChatBuffer; // peoples - std::list _TellPeople; // the last people on which tells ha been done + std::list _TellPeople; // the last people on which tells ha been done uint _NumTellPeople; uint _MaxNumTellPeople; @@ -361,7 +361,7 @@ private : * \param str string with parameter values at end (str will change after) * \return decoded string (str) */ - ucstring getString( NLMISC::CBitMemStream& bms, ucstring& str ); + std::string getString( NLMISC::CBitMemStream& bms, std::string& str ); }; diff --git a/ryzom/client/src/commands.cpp b/ryzom/client/src/commands.cpp index d3a6a2df6..3fea9a2a7 100644 --- a/ryzom/client/src/commands.cpp +++ b/ryzom/client/src/commands.cpp @@ -240,20 +240,18 @@ NLMISC_COMMAND(equipGroup, "equip group ", "name") } if(CItemGroupManager::getInstance()->equipGroup(args[0])) { - ucstring msg = CI18N::get("cmdEquipGroupSuccess"); + string msg = CI18N::get("cmdEquipGroupSuccess"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return true; } else { - ucstring msg = CI18N::get("cmdEquipGroupError"); + string msg = CI18N::get("cmdEquipGroupError"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return false; @@ -274,10 +272,9 @@ NLMISC_COMMAND(moveGroup, "move group to ", "name dst") if(CItemGroupManager::getInstance()->moveGroup(args[0], INVENTORIES::toInventory(args[1]))) { - ucstring msg = CI18N::get("cmdMoveGroupSuccess"); + string msg = CI18N::get("cmdMoveGroupSuccess"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%inventory", args[1]); pIM->displaySystemInfo(msg); @@ -285,10 +282,9 @@ NLMISC_COMMAND(moveGroup, "move group to ", "name dst") } else { - ucstring msg = CI18N::get("cmdMoveGroupError"); + string msg = CI18N::get("cmdMoveGroupError"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%inventory", args[1]); pIM->displaySystemInfo(msg); @@ -312,24 +308,22 @@ NLMISC_COMMAND(createGroup, "create group [true](create a for ev removeUnequiped = !args[1].empty(); if(CItemGroupManager::getInstance()->createGroup(args[0], removeUnequiped)) { - ucstring msg; + string msg; if(removeUnequiped) msg = CI18N::get("cmdCreateGroupSuccess2"); else msg = CI18N::get("cmdCreateGroupSuccess1"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return true; } else { - ucstring msg = CI18N::get("cmdCreateGroupError"); + string msg = CI18N::get("cmdCreateGroupError"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return false; @@ -350,20 +344,18 @@ NLMISC_COMMAND(deleteGroup, "delete group ", "name") } if(CItemGroupManager::getInstance()->deleteGroup(args[0])) { - ucstring msg = CI18N::get("cmdDeleteGroupSuccess"); + string msg = CI18N::get("cmdDeleteGroupSuccess"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return true; } else { - ucstring msg = CI18N::get("cmdDeleteGroupError"); + string msg = CI18N::get("cmdDeleteGroupError"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return false; @@ -494,7 +486,7 @@ NLMISC_COMMAND(random, "Roll a dice and say the result around","[] [h if (!randomFromString(args[0], max)) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("uiRandomBadParameter"); + string msg = CI18N::get("uiRandomBadParameter"); strFindReplace(msg, "%s", args[0] ); pIM->displaySystemInfo(msg); return false; @@ -504,7 +496,7 @@ NLMISC_COMMAND(random, "Roll a dice and say the result around","[] [h if (!randomFromString(args[1], min)) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("uiRandomBadParameter"); + string msg = CI18N::get("uiRandomBadParameter"); strFindReplace(msg, "%s", args[1] ); pIM->displaySystemInfo(msg); return false; @@ -544,7 +536,7 @@ NLMISC_COMMAND(dumpShapePos, "Dump Last Added Shape Pos.", "") CInterfaceManager *IM = CInterfaceManager::getInstance(); CVector pos = ShapeAddedByCommand.back().getPos(); - IM->displaySystemInfo(ucstring(toString("Shape Pos = %f, %f, %f", pos.x, pos.y, pos.z))); + IM->displaySystemInfo(toString("Shape Pos = %f, %f, %f", pos.x, pos.y, pos.z)); return true; } //----------------------------------------------- @@ -1096,11 +1088,11 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic" { // Help CInterfaceManager *IM = CInterfaceManager::getInstance(); - IM->displaySystemInfo(ucstring("This command need 1 parameter :")); - IM->displaySystemInfo(ucstring(" :")); - IM->displaySystemInfo(ucstring("- none(to remove all verboses)")); - IM->displaySystemInfo(ucstring("- magic(to add debug infos about magic)")); - IM->displaySystemInfo(ucstring("- anim (to add debug infos about animation)")); + IM->displaySystemInfo("This command need 1 parameter :"); + IM->displaySystemInfo(" :"); + IM->displaySystemInfo("- none(to remove all verboses)"); + IM->displaySystemInfo("- magic(to add debug infos about magic)"); + IM->displaySystemInfo("- anim (to add debug infos about animation)"); } else { @@ -1114,11 +1106,11 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic" else { CInterfaceManager *IM = CInterfaceManager::getInstance(); - IM->displaySystemInfo(ucstring("This command need 1 parameter :")); - IM->displaySystemInfo(ucstring(" :")); - IM->displaySystemInfo(ucstring("- none(to remove all verboses)")); - IM->displaySystemInfo(ucstring("- magic(to add debug infos about magic)")); - IM->displaySystemInfo(ucstring("- anim (to add debug infos about animation)")); + IM->displaySystemInfo("This command need 1 parameter :"); + IM->displaySystemInfo(" :"); + IM->displaySystemInfo("- none(to remove all verboses)"); + IM->displaySystemInfo("- magic(to add debug infos about magic)"); + IM->displaySystemInfo("- anim (to add debug infos about animation)"); } } return true; @@ -1323,7 +1315,7 @@ NLMISC_COMMAND(execScript, "Execute a script file (.cmd)","") } else { - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("Cannot open file")); + CInterfaceManager::getInstance()->displaySystemInfo("Cannot open file"); } return true; @@ -1368,7 +1360,7 @@ NLMISC_COMMAND(db, "Modify Database"," ") { sint64 prop = node->getValue64(); string str = toString(prop); - pIM->displaySystemInfo(ucstring(str)); + pIM->displaySystemInfo(str); nlinfo("%s", str.c_str()); } else @@ -1722,7 +1714,7 @@ NLMISC_COMMAND(getSheetId, "get_sheet_id","") return false; CSheetId id(args[0]); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(toString(id.asInt()))); + CInterfaceManager::getInstance()->displaySystemInfo(toString(id.asInt())); return true; } @@ -1737,7 +1729,7 @@ NLMISC_COMMAND(getSheetName, "get_sheet_name","") string name = id.toString(); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(name)); + CInterfaceManager::getInstance()->displaySystemInfo(name); return true; } @@ -2388,7 +2380,7 @@ NLMISC_COMMAND(sheet2idx, "Return the index of a sheet", " displaySystemInfo(ucstring(result)); + IM->displaySystemInfo(result); nlinfo("'sheet2idx': %s", result.c_str()); return true; } @@ -2411,7 +2403,7 @@ NLMISC_COMMAND(dynstr, "display a dyn string value", "") uint dynId; fromString(args[0], dynId); - ucstring result; + string result; STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynId, result); CInterfaceManager::getInstance()->displaySystemInfo(result); @@ -2426,7 +2418,7 @@ NLMISC_COMMAND(serverstr, "display a server string value", "getString(dynId, result); CInterfaceManager::getInstance()->displaySystemInfo(result); @@ -2510,11 +2502,11 @@ NLMISC_COMMAND(mode, "Change the mode for an entity in a slot", " [ if(args.size() < 2) { // Help - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 paramters :")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the slot number of the entity to change")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the mode wanted for the entity, one of the following number :")); + CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 paramters :"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the slot number of the entity to change"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the mode wanted for the entity, one of the following number :"); for(uint i = 0; idisplaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::modeToString((MBEHAV::EMode)i).c_str()))); + CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::modeToString((MBEHAV::EMode)i).c_str())); } // Right parameters number else @@ -2544,7 +2536,7 @@ NLMISC_COMMAND(mode, "Change the mode for an entity in a slot", " [ } // Invalid slot. else - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); + CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot"); } // Command well done. @@ -2557,12 +2549,12 @@ NLMISC_COMMAND(behaviour, "Change the behaviour for an entity in a slot", " 6) { // Help - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 to 6 paramters :")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the slot number of the entity to change")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the behaviour to play for the entity, one of the following number :")); + CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 to 6 paramters :"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the slot number of the entity to change"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the behaviour to play for the entity, one of the following number :"); for(uint i = 0; idisplaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i).c_str()))); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END))); + CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i).c_str())); + CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END)); } else { @@ -2633,7 +2625,7 @@ NLMISC_COMMAND(behaviour, "Change the behaviour for an entity in a slot", "updateVisualProperty(NetMngr.getCurrentServerTick()+dt, CLFECOMMON::PROPERTY_BEHAVIOUR); } else - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); + CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot"); } // Command well done. @@ -2782,7 +2774,7 @@ NLMISC_COMMAND(spell, "Cast a spell", "\n" entity->updateVisualProperty(NetMngr.getCurrentServerTick()+50, CLFECOMMON::PROPERTY_BEHAVIOUR); } else - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); + CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot"); } // Command well done. @@ -4005,7 +3997,7 @@ NLMISC_COMMAND(displayInventoryCounter, "display the Inventory counter to compar srvVal&= pIM->getLocalSyncActionCounterMask(); locVal&= pIM->getLocalSyncActionCounterMask(); - pIM->displaySystemInfo(ucstring( "ServerCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); + pIM->displaySystemInfo("ServerCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)); // Well done. return true; @@ -4023,7 +4015,7 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "") srvVal&= PHRASE_EXECUTE_COUNTER_MASK; locVal&= PHRASE_EXECUTE_COUNTER_MASK; - pIM->displaySystemInfo(ucstring( "NextCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); + pIM->displaySystemInfo("NextCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)); // cycle srvVal= NLGUI::CDBManager::getInstance()->getDbProp(PHRASE_DB_COUNTER_CYCLE)->getValue32(); @@ -4031,7 +4023,7 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "") srvVal&= PHRASE_EXECUTE_COUNTER_MASK; locVal&= PHRASE_EXECUTE_COUNTER_MASK; - pIM->displaySystemInfo(ucstring( "CycleCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); + pIM->displaySystemInfo("CycleCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)); return true; } @@ -4114,7 +4106,7 @@ NLMISC_COMMAND(skillToInt, "Convert a skill to an int", "") { if (args.size() != 1) return false; CInterfaceManager *im = CInterfaceManager::getInstance(); - im->displaySystemInfo(ucstring(toString((uint) SKILLS::toSkill(args[0])))); + im->displaySystemInfo(toString((uint) SKILLS::toSkill(args[0]))); return true; } @@ -4520,7 +4512,7 @@ NLMISC_COMMAND(getSkillValue, "get a skill value by its name", "skill_name") CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:SKILL", skillId), false); if(node) { - pIM->displaySystemInfo(ucstring(toString(node->getValue32()))); + pIM->displaySystemInfo(toString(node->getValue32())); } return true; @@ -4550,7 +4542,7 @@ NLMISC_COMMAND(getBaseSkillValue, "get a baseskill value by its name", "skill_na CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:BaseSKILL", skillId), false); if(node) { - pIM->displaySystemInfo(ucstring(toString(node->getValue32()))); + pIM->displaySystemInfo(toString(node->getValue32())); } return true; @@ -4812,7 +4804,7 @@ NLMISC_COMMAND(stick_log, "", "") skel->getStickedObjects(sticks); nlinfo("StickedModels: %d", sticks.size()); - pIM->displaySystemInfo(ucstring(toString("StickedModels: %d", sticks.size()))); + pIM->displaySystemInfo(toString("StickedModels: %d", sticks.size())); for(uint i=0;i= args.size()) { // Not enough arguments - pIM->displaySystemInfo (ucstring(CommandName+" : ")+CI18N::get ("uiCommandWrongArgumentCount")); + pIM->displaySystemInfo (CommandName+" : "+CI18N::get ("uiCommandWrongArgumentCount")); return false; } else @@ -5414,7 +5406,7 @@ bool CUserCommand::execute(const std::string &/* rawCommandString */, const std: else { // Not enough argument - pIM->displaySystemInfo (ucstring(CommandName+" : ")+CI18N::get ("uiCommandWrongArgumentCount")); + pIM->displaySystemInfo (CommandName+" : "+CI18N::get ("uiCommandWrongArgumentCount")); return false; } return true; @@ -5658,7 +5650,7 @@ NLMISC_COMMAND(tickToDate, "convert a tick value into a readable ryzom time", "" CInterfaceManager *im = CInterfaceManager::getInstance(); float ryTime = rt.getRyzomTime(); std::string readableDate = toString("Day = %d, hour = %d:%d", rt.getRyzomDay(), (int) floorf(ryTime), (int) floorf(60.f * fmodf(ryTime, 1.f))); - im->displaySystemInfo(ucstring(readableDate)); + im->displaySystemInfo(readableDate); return true; } @@ -5930,7 +5922,7 @@ NLMISC_COMMAND(time, "Shows information about the current time", "") tm = gmtime(&date); strftime(cs_utc, size, "%X", tm); - ucstring msg = CI18N::get("uiCurrentLocalAndUtcTime"); + string msg = CI18N::get("uiCurrentLocalAndUtcTime"); strFindReplace(msg, "%local", cs_local); strFindReplace(msg, "%utc", cs_utc); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); @@ -5939,7 +5931,7 @@ NLMISC_COMMAND(time, "Shows information about the current time", "") NLMISC_COMMAND(playedTime, "Display character played time", "") { - ucstring msg = CI18N::get("uiPlayedTime"); + string msg = CI18N::get("uiPlayedTime"); strFindReplace(msg, "%time", NLMISC::secondsToHumanReadable(CharPlayedTime)); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); return true; @@ -5947,7 +5939,7 @@ NLMISC_COMMAND(playedTime, "Display character played time", "") NLMISC_COMMAND(version, "Display client version", "") { - ucstring msg = getDebugVersion(); + string msg = getDebugVersion(); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); return true; } diff --git a/ryzom/client/src/interface_v3/action_handler_edit.cpp b/ryzom/client/src/interface_v3/action_handler_edit.cpp index ffca45406..1f3b7ee4f 100644 --- a/ryzom/client/src/interface_v3/action_handler_edit.cpp +++ b/ryzom/client/src/interface_v3/action_handler_edit.cpp @@ -647,7 +647,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit CInterfaceManager *im = CInterfaceManager::getInstance(); if (!im->isInGame()) return; // there was no / at the start of the line so try to cycle through the last people on which a tell was done - const ucstring *lastTellPeople = ChatMngr.cycleLastTell(); + const string *lastTellPeople = ChatMngr.cycleLastTell(); if (!lastTellPeople) return; // Get chat box from ist edit box // If it isn't a user chat or the main chat, just display 'tell' with the name. Otherwise, change the target of the window @@ -661,7 +661,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit else { // it is not a filtered chat, display 'tell' (must be ingame) - _GroupEdit->setCommand("tell " + (*lastTellPeople).toUtf8() + ' ', false); + _GroupEdit->setCommand("tell " + (*lastTellPeople) + ' ', false); } } }; diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 4da75a8da..d574a7248 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -1358,19 +1358,19 @@ class CSelectItemSheet : public IActionHandler // display msg in the system infos if (!canUse) { - ucstring msg = CI18N::get("msgCantUseItem"); + string msg = CI18N::get("msgCantUseItem"); string cat = getStringCategory(msg, msg); im->displaySystemInfo(msg, cat); } if (!canBuild) { - ucstring msg = CI18N::get("msgCantBuild"); + string msg = CI18N::get("msgCantBuild"); string cat = getStringCategory(msg, msg); im->displaySystemInfo(msg, cat); } if (!canUseBuiltItem) { - ucstring msg = CI18N::get("msgCantUseBuiltItem"); + string msg = CI18N::get("msgCantUseBuiltItem"); string cat = getStringCategory(msg, msg); im->displaySystemInfo(msg, cat); } @@ -3797,7 +3797,7 @@ class CHandlerSetInterfaceScale : public IActionHandler } } - ucstring help("/setuiscale "+toString("%.1f .. %.1f", ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max)); + string help = "/setuiscale "+toString("%.1f .. %.1f", ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max); CInterfaceManager::getInstance()->displaySystemInfo(help); } }; @@ -3981,7 +3981,7 @@ public: // display parry mode msg CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgUserModeParry"); + string msg = CI18N::get("msgUserModeParry"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); } @@ -3998,7 +3998,7 @@ public: // display dodge mode msg CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgUserModeDodge"); + string msg = CI18N::get("msgUserModeDodge"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); } @@ -4533,7 +4533,7 @@ public: if( sCustomPhrase.empty() ) { // Create the message and send. - const string msgName = "COMMAND:EMOTE"; + static const string msgName = "COMMAND:EMOTE"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4548,7 +4548,7 @@ public: else { // Create the message and send. - const string msgName = "COMMAND:CUSTOM_EMOTE"; + static const string msgName = "COMMAND:CUSTOM_EMOTE"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4561,7 +4561,7 @@ public: { // display "no animation for emote" CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgCustomizedEmoteNoAnim"); + string msg = CI18N::get("msgCustomizedEmoteNoAnim"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); return; @@ -4573,7 +4573,7 @@ public: } out.serialEnum(behavToSend); - out.serial(ucstr); + out.serial(ucstr); // FIXME: UTF-8 (serial) NetMngr.push(out); //nlinfo("impulseCallBack : %s %d %s sent", msgName.c_str(), (uint32)behavToSend, sCustomPhrase.c_str()); } diff --git a/ryzom/client/src/interface_v3/action_handler_misc.cpp b/ryzom/client/src/interface_v3/action_handler_misc.cpp index 8190ab799..d6d41e32b 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -598,7 +598,7 @@ void getBuffer (CBitmap &btm) void displayScreenShotSavedInfo(const string &filename) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg("'" + filename + "' " + CI18N::get("uiScreenshotSaved")); + string msg = "'" + filename + "' " + CI18N::get("uiScreenshotSaved"); pIM->displaySystemInfo(msg); } @@ -885,7 +885,7 @@ class CAHCycleTell : public IActionHandler { CInterfaceManager *im = CInterfaceManager::getInstance(); if (!im->isInGame()) return; - const ucstring *lastTellPeople = ChatMngr.cycleLastTell(); + const string *lastTellPeople = ChatMngr.cycleLastTell(); if (!lastTellPeople) return; // just popup the main chat //CChatWindow *w = PeopleInterraction.MainChat.Window; diff --git a/ryzom/client/src/interface_v3/action_handler_move.cpp b/ryzom/client/src/interface_v3/action_handler_move.cpp index cbdfb9491..415dedbbc 100644 --- a/ryzom/client/src/interface_v3/action_handler_move.cpp +++ b/ryzom/client/src/interface_v3/action_handler_move.cpp @@ -441,7 +441,7 @@ class CAHToggleDodgeParry : public IActionHandler virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg; + string msg; // 0 - dodge mode // 1 - parry mode if (NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DEFENSE:DEFENSE_MODE")->getValue32() == 0) diff --git a/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 033f99bbf..56382bf54 100644 --- a/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1173,7 +1173,7 @@ public: { // display "you can't cast while moving" CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgNoCastWhileMoving"); + string msg = CI18N::get("msgNoCastWhileMoving"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); return; @@ -1417,7 +1417,7 @@ public: else { // debug: - pIM->displaySystemInfo( ucstring("PHRASE:CANCEL_ALL") ); + pIM->displaySystemInfo("PHRASE:CANCEL_ALL"); } } }; diff --git a/ryzom/client/src/interface_v3/chat_displayer.h b/ryzom/client/src/interface_v3/chat_displayer.h index a3218670d..217b4beb8 100644 --- a/ryzom/client/src/interface_v3/chat_displayer.h +++ b/ryzom/client/src/interface_v3/chat_displayer.h @@ -97,7 +97,7 @@ public: std::vector &rVal = acces.value (); for (uint i = 0; i < rVal.size(); ++i) { - CInterfaceManager::getInstance()->displayDebugInfo(ucstring(rVal[i].Str), rVal[i].Mode); + CInterfaceManager::getInstance()->displayDebugInfo(rVal[i].Str, rVal[i].Mode); } rVal.clear(); } diff --git a/ryzom/client/src/interface_v3/chat_filter.cpp b/ryzom/client/src/interface_v3/chat_filter.cpp index a5fd04c5b..237106170 100644 --- a/ryzom/client/src/interface_v3/chat_filter.cpp +++ b/ryzom/client/src/interface_v3/chat_filter.cpp @@ -170,7 +170,7 @@ void CChatInputFilter::chatWindowRemoved(CChatWindow *cw) } //============================================================================================================= -void CChatInputFilter::displayMessage(const ucstring &msg, NLMISC::CRGBA col, uint numBlinks /*=0*/, bool *windowVisible) +void CChatInputFilter::displayMessage(const string &msg, NLMISC::CRGBA col, uint numBlinks /*=0*/, bool *windowVisible) { bool windowVisibleTmp = false; std::vector::iterator it; @@ -187,10 +187,9 @@ void CChatInputFilter::displayMessage(const ucstring &msg, NLMISC::CRGBA col, ui } //============================================================================================================= -void CChatInputFilter::displayTellMessage(/*TDataSetIndex &receiverIndex, */const ucstring &msg, const ucstring &sender, NLMISC::CRGBA col, uint numBlinks /*=0*/,bool *windowVisible /*=NULL*/) +void CChatInputFilter::displayTellMessage(/*TDataSetIndex &receiverIndex, */const string &msg, const string &sender, NLMISC::CRGBA col, uint numBlinks /*=0*/,bool *windowVisible /*=NULL*/) { - ucstring senderLwr; - senderLwr.fromUtf8(NLMISC::toLower(sender.toUtf8())); + string senderLwr = NLMISC::toLower(sender); // look in people lists std::vector::iterator peopleListIt; @@ -290,7 +289,7 @@ void CChatTargetFilter::setChat(CChatWindow *w) } //============================================================================================================= -void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow) +void CChatTargetFilter::msgEntered(const string &msg, CChatWindow *chatWindow) { // Common Target case if (ClientCfg.Local) @@ -307,9 +306,9 @@ void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow) else if (!_TargetPlayer.empty()) { // the target must be a player, make a tell on him - ChatMngr.tell(_TargetPlayer.toString(), msg); + ChatMngr.tell(_TargetPlayer, msg); // direct output in the chat - chatWindow->displayLocalPlayerTell(_TargetPlayer.toString(), msg); + chatWindow->displayLocalPlayerTell(_TargetPlayer, msg); } else { @@ -334,7 +333,7 @@ void CChatTargetFilter::setTargetPartyChat(CChatWindow *w) } //============================================================================================================= -void CChatTargetFilter::setTargetPlayer(const ucstring &targetPlayer) +void CChatTargetFilter::setTargetPlayer(const string &targetPlayer) { _TargetPlayer = targetPlayer; if (_TargetPartyChat) @@ -345,7 +344,7 @@ void CChatTargetFilter::setTargetPlayer(const ucstring &targetPlayer) // set the prompt if (_Chat) { - _Chat->setPrompt(targetPlayer + (ucchar) '>'); + _Chat->setPrompt(targetPlayer + '>'); } } diff --git a/ryzom/client/src/interface_v3/chat_filter.h b/ryzom/client/src/interface_v3/chat_filter.h index aeff77afc..317069899 100644 --- a/ryzom/client/src/interface_v3/chat_filter.h +++ b/ryzom/client/src/interface_v3/chat_filter.h @@ -42,10 +42,10 @@ public: * Listening windows will blick only if there isnt a single visible listening window, so that the player can know if there's a message * \param windowVisible is not NULL, points a bool that will be filled with true if one of the window on the which the msg was displayed is visible. */ - void displayMessage(const ucstring &msg, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); + void displayMessage(const std::string &msg, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); /** The same as displayMessage, but with sender name, so that the msg will be displayed in attached people lists as well */ - void displayTellMessage(/*TDataSetIndex &senderIndex, */const ucstring &msg, const ucstring &sender, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); + void displayTellMessage(/*TDataSetIndex &senderIndex, */const std::string &msg, const std::string &sender, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); /** Clear the messages in all registered chat windows */ void clearMessages(); @@ -134,8 +134,8 @@ public: /** Set a player as the target. This remove any previous window target * NB : this replace any previous party chat or target group or player */ - void setTargetPlayer(const ucstring &targetPlayer); - const ucstring &getTargetPlayer() const { return _TargetPlayer; } + void setTargetPlayer(const std::string &targetPlayer); + const std::string &getTargetPlayer() const { return _TargetPlayer; } //@} private: @@ -148,14 +148,14 @@ private: // @{ CChatWindow *_TargetPartyChat; // the target party chat CChatGroup::TGroupType _TargetGroup; - ucstring _TargetPlayer; + std::string _TargetPlayer; // relevant only if _TargetGroup==dyn_chat uint32 _TargetDynamicChannelDbIndex; // @} private: // from IChatWindowListener void chatWindowRemoved(CChatWindow *cw); - void msgEntered(const ucstring &msg, CChatWindow *chatWindow); + void msgEntered(const std::string &msg, CChatWindow *chatWindow); // copy not supported CChatTargetFilter(const CChatTargetFilter &/* other */):NLMISC::CRefCount() { nlassert(0); } CChatTargetFilter& operator=(const CChatTargetFilter &/* other */) { nlassert(0); return *this; } diff --git a/ryzom/client/src/interface_v3/chat_text_manager.cpp b/ryzom/client/src/interface_v3/chat_text_manager.cpp index dff2da28c..3e99cd8b5 100644 --- a/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -106,15 +106,13 @@ bool CChatTextManager::showTimestamps() const } //================================================================================= -static CInterfaceGroup *parseCommandTag(ucstring &line) +static CInterfaceGroup *parseCommandTag(string &line) { - string::size_type start = line.find(ucstring("/$$")); + string::size_type start = line.find("/$$"); if (start == string::npos) return NULL; - string::size_type end = line.find(ucstring("$$/"), start + 3); + string::size_type end = line.find("$$/", start + 3); if (end == string::npos) return NULL; - std::string commandLine; - ucstring ucCommandLine = line.substr(start + 3, end - start - 3); - ucCommandLine.toString(commandLine); + std::string commandLine = line.substr(start + 3, end - start - 3); line = line.substr(0, start) + line.substr(end +3); vector params; explode(commandLine, std::string("|"), params); @@ -221,11 +219,11 @@ static inline bool isUrlTag(const ucstring &s, ucstring::size_type index, ucstri // *************************************************************************** // isUrlTag must match -static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucstring &url, ucstring &title) +static inline void getUrlTag(const string &s, string::size_type &index, string &url, string &title) { bool isMarkdown = false; - ucstring::size_type textSize = s.size(); - ucstring::size_type pos; + string::size_type textSize = s.size(); + string::size_type pos; // see if we have markdown format if (s[index] == '(') @@ -250,8 +248,8 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst } } - ucchar chOpen = ' '; - ucchar chClose = ' '; + char chOpen = ' '; + char chClose = ' '; if (isMarkdown) { chOpen = '['; @@ -272,7 +270,7 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst pos = s.find_first_of(chClose, index); // handle common special case: 'text http://.../, text' - if (pos != ucstring::npos && index > 0) + if (pos != string::npos && index > 0) { if (s[index-1] == ' ' && (s[pos-1] == ',' || s[pos-1] == '.')) { @@ -308,7 +306,7 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst } // fallback to full string length as we did match http:// already and url spans to the end probably - if (pos == ucstring::npos) + if (pos == string::npos) { pos = textSize; } @@ -321,22 +319,22 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst } //================================================================================= -static void prependTimestamp(ucstring &msg) +static void prependTimestamp(string &msg) { - ucstring cur_time; + string cur_time; CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_CLOCK_12H", false); if (node && node->getValueBool()) cur_time = CInterfaceManager::getTimestampHuman("[%I:%M:%S %p] "); else cur_time = CInterfaceManager::getTimestampHuman(); - ucstring::size_type codePos = msg.find(ucstring("@{")); - if (codePos != ucstring::npos) + string::size_type codePos = msg.find("@{"); + if (codePos != string::npos) { // Prepend the current time (do it after the color if the color at first position. if (codePos == 0) { - codePos = msg.find(ucstring("}")); + codePos = msg.find(string("}")); msg = msg.substr(0, codePos + 1) + cur_time + msg.substr(codePos + 1, msg.length() - codePos); } else @@ -351,9 +349,9 @@ static void prependTimestamp(ucstring &msg) } //================================================================================= -CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA col, bool justified /*=false*/, bool plaintext /*=false*/) +CViewBase *CChatTextManager::createMsgText(const string &cstMsg, NLMISC::CRGBA col, bool justified /*=false*/, bool plaintext /*=false*/) { - ucstring msg = cstMsg; + string msg = cstMsg; CInterfaceGroup *commandGroup = parseCommandTag(msg); if (showTimestamps()) @@ -365,7 +363,7 @@ CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA } //================================================================================= -CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CRGBA col, bool justified, CInterfaceGroup *commandGroup) +CViewBase *CChatTextManager::createMsgTextSimple(const string &msg, NLMISC::CRGBA col, bool justified, CInterfaceGroup *commandGroup) { CViewText *vt = new CViewText(CViewText::TCtorParam()); // get parameters from config.xml @@ -379,14 +377,14 @@ CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CR // if text contain any color code, set the text formated and white, // otherwise, set text normal and apply global color - if (msg.find(ucstring("@{")) != ucstring::npos) + if (msg.find("@{") != string::npos) { - vt->setTextFormatTaged(msg.toUtf8()); + vt->setTextFormatTaged(msg); vt->setColor(NLMISC::CRGBA::White); } else { - vt->setText(msg.toUtf8()); + vt->setText(msg); vt->setColor(col); } @@ -401,9 +399,9 @@ CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CR } //================================================================================= -CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::CRGBA col, bool justified, bool plaintext, CInterfaceGroup *commandGroup) +CViewBase *CChatTextManager::createMsgTextComplex(const string &msg, NLMISC::CRGBA col, bool justified, bool plaintext, CInterfaceGroup *commandGroup) { - ucstring::size_type textSize = msg.size(); + string::size_type textSize = msg.size(); CGroupParagraph *para = new CGroupParagraph(CViewBase::TCtorParam()); para->setId("line"); @@ -412,7 +410,7 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C // use right click because left click might be used to activate chat window para->setRightClickHandler("copy_chat_popup"); - para->setRightClickHandlerParams(msg.toUtf8()); + para->setRightClickHandlerParams(msg); if (plaintext) { @@ -427,12 +425,12 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C // quickly check if text has links or not bool hasUrl; { - ucstring s = toLower(msg); - hasUrl = (s.find(ucstring("http://")) || s.find(ucstring("https://"))); + string s = toLower(msg); + hasUrl = (s.find("http://") || s.find("https://")); } - ucstring::size_type pos = 0; - for (ucstring::size_type i = 0; i< textSize;) + string::size_type pos = 0; + for (string::size_type i = 0; i< textSize;) { if (hasUrl && isUrlTag(msg, i, textSize)) { @@ -442,8 +440,8 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C para->addChild(vt); } - ucstring url; - ucstring title; + string url; + string title; getUrlTag(msg, i, url, title); if (url.size() > 0) { @@ -465,29 +463,29 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C if (title.size() > 0) { - vt->LinkTitle = title.toUtf8(); + vt->LinkTitle = title; vt->setText(vt->LinkTitle); } else { - vt->LinkTitle = url.toUtf8(); + vt->LinkTitle = url; vt->setText(vt->LinkTitle); } if (url.find_first_of('\'') != string::npos) { - ucstring clean; + string clean; for(string::size_type i = 0; i< url.size(); ++i) { if (url[i] == '\'') - clean += ucstring("%27"); + clean += "%27"; else clean += url[i]; } url = clean; } vt->setActionOnLeftClick("lua"); - vt->setParamsOnLeftClick("game:chatUrl('" + url.toUtf8() + "')"); + vt->setParamsOnLeftClick("game:chatUrl('" + url + "')"); para->addChildLink(vt); diff --git a/ryzom/client/src/interface_v3/chat_text_manager.h b/ryzom/client/src/interface_v3/chat_text_manager.h index 2f7e380be..1cf66730e 100644 --- a/ryzom/client/src/interface_v3/chat_text_manager.h +++ b/ryzom/client/src/interface_v3/chat_text_manager.h @@ -55,7 +55,7 @@ public: * \param justified Should be true for justified text (stretch spaces of line to fill the full width) * \param plaintext Text will not be parsed for uri markup links */ - NLGUI::CViewBase *createMsgText(const ucstring &msg, NLMISC::CRGBA col, bool justified = false, bool plaintext = false); + NLGUI::CViewBase *createMsgText(const std::string &msg, NLMISC::CRGBA col, bool justified = false, bool plaintext = false); // Singleton access static CChatTextManager &getInstance(); @@ -79,8 +79,8 @@ private: bool showTimestamps() const; - NLGUI::CViewBase *createMsgTextSimple(const ucstring &msg, NLMISC::CRGBA col, bool justified, NLGUI::CInterfaceGroup *commandGroup); - NLGUI::CViewBase *createMsgTextComplex(const ucstring &msg, NLMISC::CRGBA col, bool justified, bool plaintext, NLGUI::CInterfaceGroup *commandGroup); + NLGUI::CViewBase *createMsgTextSimple(const std::string &msg, NLMISC::CRGBA col, bool justified, NLGUI::CInterfaceGroup *commandGroup); + NLGUI::CViewBase *createMsgTextComplex(const std::string &msg, NLMISC::CRGBA col, bool justified, bool plaintext, NLGUI::CInterfaceGroup *commandGroup); }; // shortcut to get text manager instance diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index 8d7551803..eef48509e 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -204,11 +204,11 @@ bool CChatWindow::isVisible() const } //================================================================================= -void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/) +void CChatWindow::displayMessage(const string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/) { if (!_Chat) { - if (msg.toUtf8() != "WRN: There's no global chat") + if (msg != "WRN: There's no global chat") nlwarning(" There's no global chat"); return; } @@ -538,11 +538,11 @@ void CChatWindow::clearMessages(CChatGroup::TGroupType /* gt */, uint32 /* dynam // CChatGroupWindow // ////////////////////// -void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks, bool *windowVisible) +void CChatGroupWindow::displayMessage(const string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks, bool *windowVisible) { if (!_Chat) { - if (msg.toUtf8() != "WRN: There's no global chat") + if (msg != "WRN: There's no global chat") nlwarning(" There's no global chat"); return; } @@ -563,8 +563,8 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC CInterfaceManager *pIM= CInterfaceManager::getInstance(); CRGBA newMsgColor= CRGBA::stringToRGBA(CWidgetManager::getInstance()->getParser()->getDefine("chat_group_tab_color_newmsg").c_str()); - ucstring newmsg = msg; - ucstring prefix; + string newmsg = msg; + string prefix; if (gl != NULL) { @@ -599,20 +599,20 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC gl = gl2; // Add dyn chan number before string - ucstring prefix("[" + NLMISC::toString(dynamicChatDbIndex) + "]"); + string prefix = "[" + NLMISC::toString(dynamicChatDbIndex) + "]"; // Find position to put the new string // After timestamp? - size_t pos = newmsg.find(ucstring("]")); - size_t colonpos = newmsg.find(ucstring(": @{")); + size_t pos = newmsg.find("]"); + size_t colonpos = newmsg.find(": @{"); // If no ] found or if found but after the colon (so part of the user chat) - if (pos == ucstring::npos || (colonpos < pos)) + if (pos == string::npos || (colonpos < pos)) { // No timestamp, so put it right after the color and add a space - pos = newmsg.find(ucstring("}")); + pos = newmsg.find("}"); prefix += " "; } - if (pos == ucstring::npos) + if (pos == string::npos) newmsg = prefix + newmsg; else newmsg = newmsg.substr(0, pos + 1) + prefix + newmsg.substr(pos + 1); @@ -622,10 +622,10 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC if (node && node->getValueBool()) { uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChatDbIndex); - ucstring title; + string title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); - prefix = title.empty() ? ucstring("") : ucstring(" ") + title; - pos = newmsg.find(ucstring("] ")); + prefix = (title.empty() ? "" : " ") + title; + pos = newmsg.find("] "); if (pos == ucstring::npos) newmsg = prefix + newmsg; @@ -667,7 +667,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC } //================================================================================= -void CChatGroupWindow::displayTellMessage(const ucstring &msg, NLMISC::CRGBA col, const ucstring &sender) +void CChatGroupWindow::displayTellMessage(const string &msg, NLMISC::CRGBA col, const string &sender) { // If we are here with a tell message this is because the teller doesn't belong to any people list CGroupContainer *gcChat = createFreeTeller(sender); @@ -876,7 +876,7 @@ void CChatGroupWindow::setActiveFreeTeller(const ucstring &winName, bool bActive } //================================================================================= -ucstring CChatGroupWindow::getFreeTellerName(const std::string &containerID) +string CChatGroupWindow::getFreeTellerName(const std::string &containerID) { uint32 i; for (i = 0; i < _FreeTellers.size(); ++i) @@ -886,8 +886,8 @@ ucstring CChatGroupWindow::getFreeTellerName(const std::string &containerID) break; } if (i == _FreeTellers.size()) - return ucstring(""); - return _FreeTellers[i]->getUCTitle(); + return string(); + return _FreeTellers[i]->getTitle(); } //================================================================================= @@ -1306,7 +1306,7 @@ public: else { CInterfaceManager *im = CInterfaceManager::getInstance(); - im->displaySystemInfo (ucstring::makeFromUtf8(cmd) + ": " + CI18N::get ("uiCommandNotExists")); + im->displaySystemInfo (cmd + ": " + CI18N::get ("uiCommandNotExists")); } } else @@ -1410,16 +1410,16 @@ class CHandlerInviteToRingSession : public IActionHandler public: void execute (CCtrlBase *pCaller, const std::string &/* sParams */) { - ucstring playerName = ::getFreeTellerName(pCaller); + string playerName = ::getFreeTellerName(pCaller).toUtf8(); if (!playerName.empty()) { // ask the SBS to invite the character in the session - CSessionBrowserImpl::getInstance().inviteCharacterByName(CSessionBrowserImpl::getInstance().getCharId(), playerName.toUtf8()); + CSessionBrowserImpl::getInstance().inviteCharacterByName(CSessionBrowserImpl::getInstance().getCharId(), playerName); // additionaly, send a tell to signal the player he has been invited to a ring session - ChatMngr.tell(playerName.toUtf8(), CI18N::get("uiRingInviteNotification")); + ChatMngr.tell(playerName, CI18N::get("uiRingInviteNotification")); // CInterfaceManager *im = CInterfaceManager::getInstance(); - im->displaySystemInfo(ucstring("@{6F6F}") + playerName +ucstring(" @{FFFF}") + CI18N::get("uiRingInvitationSent"), "BC"); + im->displaySystemInfo("@{6F6F}" + playerName +" @{FFFF}" + CI18N::get("uiRingInvitationSent"), "BC"); // force a refresh of the ui CLuaManager::getInstance().executeLuaScript("CharTracking:forceRefresh()"); } diff --git a/ryzom/client/src/interface_v3/chat_window.h b/ryzom/client/src/interface_v3/chat_window.h index 13012ca31..39fc448f9 100644 --- a/ryzom/client/src/interface_v3/chat_window.h +++ b/ryzom/client/src/interface_v3/chat_window.h @@ -47,7 +47,7 @@ class CChatWindow; struct IChatWindowListener { // the user entered a msg in the given chat box - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) = 0; + virtual void msgEntered(const std::string &msg, CChatWindow *chatWindow) = 0; }; @@ -98,8 +98,8 @@ public: }; public: // display a message in this chat box with the given color - virtual void displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); - virtual void displayTellMessage(const ucstring &/* msg */, NLMISC::CRGBA /* col */, const ucstring &/* sender */) {} + virtual void displayMessage(const std::string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); + virtual void displayTellMessage(const std::string &/* msg */, NLMISC::CRGBA /* col */, const std::string &/* sender */) {} virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex); // Test if the window is visible bool isVisible() const; @@ -189,8 +189,8 @@ class CChatGroupWindow : public CChatWindow public: CChatGroupWindow() {} // display a message in this chat box with the given color (callback from chat input filter) - virtual void displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); - virtual void displayTellMessage(const ucstring &msg, NLMISC::CRGBA col, const ucstring &sender); + virtual void displayMessage(const std::string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); + virtual void displayTellMessage(const std::string &msg, NLMISC::CRGBA col, const std::string &sender); virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex); sint32 getTabIndex(); void setTabIndex(sint32 n); @@ -198,7 +198,7 @@ public: // Free Teller NLGUI::CGroupContainer *createFreeTeller(const ucstring &winName, const std::string &winColor=""); void setActiveFreeTeller(const ucstring &winName, bool bActive=true); - ucstring getFreeTellerName(const std::string &containerID); + std::string getFreeTellerName(const std::string &containerID); bool removeFreeTeller(const std::string &containerID); // Return true if free teller found void removeAllFreeTellers(); void saveFreeTeller(NLMISC::IStream &f); diff --git a/ryzom/client/src/interface_v3/guild_manager.cpp b/ryzom/client/src/interface_v3/guild_manager.cpp index 328579d06..74dc5d991 100644 --- a/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/ryzom/client/src/interface_v3/guild_manager.cpp @@ -370,8 +370,8 @@ void CGuildManager::update() { // See if we need to show any online/offline messages static map CachedGuildMembers; - ucstring onlineMessage = CI18N::get("uiPlayerOnline"); - ucstring offlineMessage = CI18N::get("uiPlayerOffline"); + const string &onlineMessage = CI18N::get("uiPlayerOnline"); + const string &offlineMessage = CI18N::get("uiPlayerOffline"); for (uint i = 0; i < _GuildMembers.size(); ++i) { @@ -390,8 +390,8 @@ void CGuildManager::update() continue; } - ucstring msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage; - strFindReplace(msg, "%s", _GuildMembers[i].Name); + string msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage; + strFindReplace(msg, "%s", _GuildMembers[i].Name.toUtf8()); string cat = getStringCategory(msg, msg); map::const_iterator it; NLMISC::CRGBA col = CRGBA::Yellow; @@ -1084,7 +1084,7 @@ public: MemberIndexSelected= nLineNb; MemberNameSelected = rGuildMembers[nLineNb].Name; - CPeopleInterraction::displayTellInMainChat(MemberNameSelected); + CPeopleInterraction::displayTellInMainChat(MemberNameSelected.toUtf8()); } // Current selection diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index a0d36f535..4330782bc 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -982,7 +982,7 @@ void CInterfaceManager::initInGame() // flush system msg buffer for( uint i=0; idisplaySystemInfo(ucstring(toString(im->getLocalSyncActionCounter()))); + im->displaySystemInfo(toString(im->getLocalSyncActionCounter())); return true; } diff --git a/ryzom/client/src/interface_v3/interface_manager.h b/ryzom/client/src/interface_v3/interface_manager.h index 059020018..39fd12dc4 100644 --- a/ryzom/client/src/interface_v3/interface_manager.h +++ b/ryzom/client/src/interface_v3/interface_manager.h @@ -292,12 +292,12 @@ public: void drawViews (NL3D::UCamera camera); // display a debug info - void displayDebugInfo(const ucstring &str, TSystemInfoMode mode = InfoMsg); + void displayDebugInfo(const std::string &str, TSystemInfoMode mode = InfoMsg); // get the color associated with the given system info mode NLMISC::CRGBA getDebugInfoColor(TSystemInfoMode mode); // display a system info string - void displaySystemInfo(const ucstring &str, const std::string &Category = "SYS"); + void displaySystemInfo(const std::string &str, const std::string &Category = "SYS"); NLMISC::CRGBA getSystemInfoColor(const std::string &Category = "SYS"); void setupOptions(); diff --git a/ryzom/client/src/interface_v3/inventory_manager.cpp b/ryzom/client/src/interface_v3/inventory_manager.cpp index 75cab6f78..3b16c41d2 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -3236,7 +3236,7 @@ class CHandlerInvTempToBag : public IActionHandler // If we cant find place display a message and dont send the request to the server if (!getInventory().isSpaceInAllBagsForItem(pCSDst)) { - ucstring msg = CI18N::get("msgCantPutItemInBag"); + string msg = CI18N::get("msgCantPutItemInBag"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); return; @@ -3322,7 +3322,7 @@ class CHandlerInvTempAll : public IActionHandler if (!bPlaceFound) { - ucstring msg = CI18N::get("msgCantPutItemInBag"); + string msg = CI18N::get("msgCantPutItemInBag"); string cat = getStringCategory(msg, msg); CInterfaceManager::getInstance()->displaySystemInfo(msg, cat); return; diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 21322295e..fec5ff3fe 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -1701,7 +1701,7 @@ int CLuaIHMRyzom::displaySystemInfo(CLuaState &ls) ucstring msg; nlverify(CLuaIHM::getUCStringOnStack(ls, 1, msg)); CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->displaySystemInfo(msg, ls.toString(2)); + pIM->displaySystemInfo(msg.toUtf8(), ls.toString(2)); return 0; } @@ -4247,27 +4247,27 @@ int CLuaIHMRyzom::displayChatMessage(CLuaState &ls) if (input == "around") { prop.readRGBA(std::string(dbPath + ":SAY").c_str(), " "); - ci.AroundMe.displayMessage(ucstring(msg), prop.getRGBA()); + ci.AroundMe.displayMessage(msg, prop.getRGBA()); } else if (input == "region") { prop.readRGBA(std::string(dbPath + ":REGION").c_str(), " "); - ci.Region.displayMessage(ucstring(msg), prop.getRGBA()); + ci.Region.displayMessage(msg, prop.getRGBA()); } else if (input == "universe") { prop.readRGBA(std::string(dbPath + ":UNIVERSE_NEW").c_str(), " "); - ci.Universe.displayMessage(ucstring(msg), prop.getRGBA()); + ci.Universe.displayMessage(msg, prop.getRGBA()); } else if (input == "guild") { prop.readRGBA(std::string(dbPath + ":CLADE").c_str(), " "); - ci.Guild.displayMessage(ucstring(msg), prop.getRGBA()); + ci.Guild.displayMessage(msg, prop.getRGBA()); } else if (input == "team") { prop.readRGBA(std::string(dbPath + ":GROUP").c_str(), " "); - ci.Team.displayMessage(ucstring(msg), prop.getRGBA()); + ci.Team.displayMessage(msg, prop.getRGBA()); } } if (ls.type(2) == LUA_TNUMBER) @@ -4275,7 +4275,7 @@ int CLuaIHMRyzom::displayChatMessage(CLuaState &ls) sint64 id = ls.toInteger(2); prop.readRGBA(toString("%s:DYN:%i", dbPath.c_str(), id).c_str(), " "); if (id >= 0 && id < CChatGroup::MaxDynChanPerPlayer) - ci.DynamicChat[id].displayMessage(ucstring(msg), prop.getRGBA()); + ci.DynamicChat[id].displayMessage(msg, prop.getRGBA()); } return 1; } diff --git a/ryzom/client/src/interface_v3/music_player.cpp b/ryzom/client/src/interface_v3/music_player.cpp index 889b83495..b45af6c7b 100644 --- a/ryzom/client/src/interface_v3/music_player.cpp +++ b/ryzom/client/src/interface_v3/music_player.cpp @@ -623,9 +623,9 @@ void CMusicPlayer::createPlaylistFromMusic() if (extensions.empty()) { // in the very unlikely scenario - const ucstring message("Sound driver has no support for music."); + static const string message("Sound driver has no support for music."); CInterfaceManager::getInstance()->displaySystemInfo(message, "SYS"); - nlinfo("%s", message.toUtf8().c_str()); + nlinfo("%s", message.c_str()); return; } std::string newPath = CPath::makePathAbsolute(CPath::standardizePath(ClientCfg.MediaPlayerDirectory), CPath::getCurrentPath(), true); @@ -635,7 +635,7 @@ void CMusicPlayer::createPlaylistFromMusic() std::string msg(CI18N::get("uiMk_system6")); msg += ": " + newPath + " (" + extlist + ")"; - CInterfaceManager::getInstance()->displaySystemInfo(ucstring::makeFromUtf8(msg), "SYS"); + CInterfaceManager::getInstance()->displaySystemInfo(msg, "SYS"); nlinfo("%s", msg.c_str()); // Recursive scan for files from media directory diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index de7c9023a..eaf6386c2 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -91,7 +91,7 @@ static const sint PARTY_CHAT_SPAWN_DELTA = 20; // to avoid that all party chat a /** Display an error msg in the system info window, and also in the last window that triggered the command (so that the user is sure to see it) */ -static void displayVisibleSystemMsg(const ucstring &msg, const string &cat = "CHK"); +static void displayVisibleSystemMsg(const std::string &msg, const string &cat = "CHK"); ////////////////////////////// @@ -102,7 +102,7 @@ static void displayVisibleSystemMsg(const ucstring &msg, const string &cat = "CH struct CPartyChatEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -120,7 +120,7 @@ struct CPartyChatEntryHandler : public IChatWindowListener // handler to manage user entry in 'around me' window struct CAroundMeEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -138,7 +138,7 @@ struct CAroundMeEntryHandler : public IChatWindowListener // handler to manage user entry in 'region' window struct CRegionEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -156,7 +156,7 @@ struct CRegionEntryHandler : public IChatWindowListener // handler to manage user entry in 'universe' window struct CUniverseEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -174,7 +174,7 @@ struct CUniverseEntryHandler : public IChatWindowListener // handler to manage user entry in 'guild chat' window struct CGuildChatEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -191,7 +191,7 @@ struct CGuildChatEntryHandler : public IChatWindowListener // handler to manage user entry in 'team chat' window struct CTeamChatEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -208,7 +208,7 @@ struct CTeamChatEntryHandler : public IChatWindowListener // handler to manage user entry in a 'talk with friend' window struct CFriendTalkEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -225,10 +225,9 @@ struct CFriendTalkEntryHandler : public IChatWindowListener // handler to manage user entry in a debug console window struct CDebugConsoleEntryHandler : public IChatWindowListener { - virtual void msgEntered(const ucstring &msg, CChatWindow * /* chatWindow */) + virtual void msgEntered(const string &msg, CChatWindow * /* chatWindow */) { - std::string str = msg.toString(); - NLMISC::ICommand::execute( str, g_log ); + NLMISC::ICommand::execute( msg, g_log ); } }; @@ -242,7 +241,7 @@ public: DbIndex= 0; } - virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) + virtual void msgEntered(const string &msg, CChatWindow *chatWindow) { if (ClientCfg.Local) { @@ -1410,8 +1409,8 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS // Player is not in my guild, and the status change is from offline to online/abroad online or vice versa. if (showMsg) { - ucstring msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline"); - strFindReplace(msg, "%s", FriendList.getName(index)); + string msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline"); + strFindReplace(msg, "%s", FriendList.getName(index).toUtf8()); string cat = getStringCategory(msg, msg); map::const_iterator it; NLMISC::CRGBA col = CRGBA::Yellow; @@ -1883,7 +1882,7 @@ void CPeopleInterraction::refreshActiveUserChats() } //================================================================================================================= -void CPeopleInterraction::talkInDynamicChannel(uint32 channelNb,ucstring sentence) +void CPeopleInterraction::talkInDynamicChannel(uint32 channelNb,string sentence) { if(channelNbgetName(peopleIndex)); + CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8()); } } }; @@ -2160,7 +2159,7 @@ class CHandlerTellContact : public IActionHandler uint peopleIndex; if (PeopleInterraction.getPeopleFromContainerID(gc->getId(), list, peopleIndex)) { - CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex)); + CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8()); } } @@ -2416,7 +2415,7 @@ class CHandlerValidatePartyChatName : public IActionHandler if (!gc) return; CGroupEditBox *eb = dynamic_cast(gc->getGroup("eb")); if (!eb) return; - ucstring title = eb->getInputStringAsUtf16(); + string title = eb->getInputString(); // TODO GAMEDEV : create (or join ?) a new channel. Each channel (party chat) should have a unique name in the game // moreover, it should not have the name of another available chat window (for example, it shouldn't be named 'Around Me') @@ -2425,7 +2424,7 @@ class CHandlerValidatePartyChatName : public IActionHandler if (!PeopleInterraction.testValidPartyChatName(title)) { - displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiInvalidPartyChatName")); + displayVisibleSystemMsg(title + " : " + CI18N::get("uiInvalidPartyChatName")); return; } @@ -3315,7 +3314,7 @@ REGISTER_INTERFACE_USER_FCT("getNumUserChatLeft", getNumUserChatLeft) // STATIC FUNCTIONS IMPLEMENTATIONS // ////////////////////////////////////// -static void displayVisibleSystemMsg(const ucstring &msg, const string &cat) +static void displayVisibleSystemMsg(const string &msg, const string &cat) { CInterfaceManager *im = CInterfaceManager::getInstance(); im->displaySystemInfo(msg, cat); @@ -3328,7 +3327,7 @@ static void displayVisibleSystemMsg(const ucstring &msg, const string &cat) #if !FINAL_VERSION NLMISC_COMMAND(testSI, "tmp", "tmp") { - PeopleInterraction.ChatInput.DebugInfo.displayMessage(ucstring("test"), CRGBA::Red); + PeopleInterraction.ChatInput.DebugInfo.displayMessage("test", CRGBA::Red); return true; } #endif diff --git a/ryzom/client/src/interface_v3/people_interraction.h b/ryzom/client/src/interface_v3/people_interraction.h index 591a005e2..a88db2a65 100644 --- a/ryzom/client/src/interface_v3/people_interraction.h +++ b/ryzom/client/src/interface_v3/people_interraction.h @@ -250,14 +250,14 @@ public: // Test if the given chat is a user chat (this includes the main chat) bool isUserChat(CChatWindow *cw) const; - void talkInDynamicChannel(uint32 channelNb,ucstring sentence); + void talkInDynamicChannel(uint32 channelNb,std::string sentence); CChatGroupWindow *getChatGroupWindow() const; void updateAllFreeTellerHeaders(); void removeAllFreeTellers(); - static void displayTellInMainChat(const ucstring &playerName); + static void displayTellInMainChat(const std::string &playerName); private: // create various chat & people lists void createTeamChat(); diff --git a/ryzom/client/src/interface_v3/people_list.cpp b/ryzom/client/src/interface_v3/people_list.cpp index 3f0481b1f..e5426ccfb 100644 --- a/ryzom/client/src/interface_v3/people_list.cpp +++ b/ryzom/client/src/interface_v3/people_list.cpp @@ -449,7 +449,7 @@ void CPeopleList::setContactId(uint index, uint32 contactId) } //================================================================== -void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, const ucstring &msg,uint numBlinks /*=0*/) +void CPeopleList::displayLocalPlayerTell(const string &receiver, uint index, const string &msg,uint numBlinks /*=0*/) { if (_ContactType == CPeopleListDesc::Ignore) { @@ -473,13 +473,13 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c } string csr = CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""; - string finalMsg = csr + CI18N::get("youTell") + ": " + msg.toUtf8(); + string finalMsg = csr + CI18N::get("youTell") + ": " + msg; // display msg with good color CInterfaceProperty prop; prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); string s = CI18N::get("youTellPlayer"); - strFindReplace(s, "%name", receiver.toUtf8()); + strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA())); CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); @@ -497,7 +497,7 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c //================================================================== -void CPeopleList::displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA col, uint /* numBlinks */ /*= 0*/) +void CPeopleList::displayMessage(uint index, const string &msg, NLMISC::CRGBA col, uint /* numBlinks */ /*= 0*/) { if (_ContactType == CPeopleListDesc::Ignore) { @@ -951,7 +951,7 @@ class CHandlerContactEntry : public IActionHandler pWin->displayTellMessage(final, prop.getRGBA(), pWin->getFreeTellerName(str)); string s = CI18N::get("youTellPlayer"); - strFindReplace(s, "%name", pWin->getFreeTellerName(str).toUtf8()); + strFindReplace(s, "%name", pWin->getFreeTellerName(str)); strFindReplace(final, CI18N::get("youTell"), s); CInterfaceManager::getInstance()->log(final, CChatGroup::groupTypeToString(CChatGroup::tell)); } diff --git a/ryzom/client/src/interface_v3/people_list.h b/ryzom/client/src/interface_v3/people_list.h index 32317b6b8..da7556aa5 100644 --- a/ryzom/client/src/interface_v3/people_list.h +++ b/ryzom/client/src/interface_v3/people_list.h @@ -113,8 +113,8 @@ public: /** Display a message for the given people * If the window is closed, it causes it to blink (and also the parent window) */ - void displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA col, uint numBlinks = 0); - void displayLocalPlayerTell(const ucstring &receiver, uint index, const ucstring &msg, uint numBlinks = 0); + void displayMessage(uint index, const std::string &msg, NLMISC::CRGBA col, uint numBlinks = 0); + void displayLocalPlayerTell(const std::string &receiver, uint index, const std::string &msg, uint numBlinks = 0); // Is the given people window visible ? bool isPeopleChatVisible(uint index) const; // reset remove everything from the interface diff --git a/ryzom/client/src/item_group_manager.cpp b/ryzom/client/src/item_group_manager.cpp index 5e5f0d6c9..ad35a2a97 100644 --- a/ryzom/client/src/item_group_manager.cpp +++ b/ryzom/client/src/item_group_manager.cpp @@ -697,10 +697,9 @@ void CItemGroupManager::listGroup() for(int i=0;i<_Groups.size();i++) { CItemGroup group = _Groups[i]; - ucstring msg = NLMISC::CI18N::get("cmdListGroupLine"); + string msg = NLMISC::CI18N::get("cmdListGroupLine"); //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(group.name); + string nameUC = group.name; NLMISC::strFindReplace(msg, "%name", nameUC); NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.Items.size())); pIM->displaySystemInfo(msg); diff --git a/ryzom/client/src/main_loop.cpp b/ryzom/client/src/main_loop.cpp index d9de05961..881e14431 100644 --- a/ryzom/client/src/main_loop.cpp +++ b/ryzom/client/src/main_loop.cpp @@ -1165,7 +1165,7 @@ bool mainLoop() if (BanMsgCountdown < 0.f) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgPermanentlyBanned"); + string msg = CI18N::get("msgPermanentlyBanned"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); BanMsgCountdown = BanMsgRepeatTime; @@ -3448,11 +3448,11 @@ NLMISC_COMMAND(dumpFontTexture, "Write font texture to file", "") { std::string fname = CFile::findNewFile("font-texture.tga"); TextContext->dumpCacheTexture(fname.c_str()); - im->displaySystemInfo(ucstring(fname + " created"), "SYS"); + im->displaySystemInfo(fname + " created", "SYS"); } else { - im->displaySystemInfo(ucstring("Error: TextContext == NULL"), "SYS"); + im->displaySystemInfo("Error: TextContext == NULL", "SYS"); } return true; } diff --git a/ryzom/client/src/misc.cpp b/ryzom/client/src/misc.cpp index ee247e921..9816202d4 100644 --- a/ryzom/client/src/misc.cpp +++ b/ryzom/client/src/misc.cpp @@ -871,14 +871,14 @@ bool setVect(CVector &vectToChange, const CVector &vect, bool compute, bool chec return true; }// setVect // -NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest) +NLMISC::CRGBA interpClientCfgColor(const string &src, string &dest) { CRGBA color = CRGBA::White; if (src.size() >= 3) { - if (src[0] == (ucchar) '&') + if (src[0] == '&') { - ucstring::size_type nextPos = src.find((ucchar) '&', 1); + string::size_type nextPos = src.find('&', 1); if (nextPos != ucstring::npos) { std::string colorCode; @@ -911,7 +911,7 @@ NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest) return color; } -std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAddSysByDefault) +std::string getStringCategory(const string &src, string &dest, bool alwaysAddSysByDefault) { std::string str = getStringCategoryIfAny(src, dest); if (alwaysAddSysByDefault) @@ -921,41 +921,41 @@ std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAd } -std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest) +std::string getStringCategoryIfAny(const string &src, string &dest) { std::string colorCode; if (src.size() >= 3) { - uint startPos = 0; + size_t startPos = 0; // Skip or if present at beginning - ucstring preTag; - const uint PreTagSize = 5; - const ucstring newTag(""); + string preTag; + const size_t PreTagSize = 5; + static const string newTag = ""; if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == newTag) ) { startPos = PreTagSize; preTag = newTag; } - const ucstring chgTag(""); + static const string chgTag = ""; if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == chgTag) ) { startPos = PreTagSize; preTag = chgTag; } - if (src[startPos] == (ucchar) '&') + if (src[startPos] == '&') { - ucstring::size_type nextPos = src.find((ucchar) '&', startPos+1); - if (nextPos != ucstring::npos) + string::size_type nextPos = src.find('&', startPos+1); + if (nextPos != string::npos) { - uint codeSize = (uint)nextPos - startPos - 1; + size_t codeSize = nextPos - startPos - 1; colorCode.resize( codeSize ); - for(uint k = 0; k < codeSize; ++k) + for(ptrdiff_t k = 0; k < (ptrdiff_t)codeSize; ++k) { colorCode[k] = tolower((char) src[k + startPos + 1]); } - ucstring destTmp; + string destTmp; if ( startPos != 0 ) destTmp = preTag; // leave or in the dest string destTmp += src.substr(nextPos + 1); diff --git a/ryzom/client/src/misc.h b/ryzom/client/src/misc.h index 49127d100..96568c22e 100644 --- a/ryzom/client/src/misc.h +++ b/ryzom/client/src/misc.h @@ -165,11 +165,11 @@ bool setVect(NLMISC::CVector &vectToChange, const NLMISC::CVector &vect, bool co // read color from client cfg system info colors -NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest); +NLMISC::CRGBA interpClientCfgColor(const std::string &src, std::string &dest); // Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return "SYS" -std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAddSysByDefault = true); +std::string getStringCategory(const std::string &src, std::string &dest, bool alwaysAddSysByDefault = true); // Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return "" -std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest); +std::string getStringCategoryIfAny(const std::string &src, std::string &dest); bool getRelativeFloatFromString(const std::string src, float &dst); void updateVector(const std::string part, NLMISC::CVector &dst, float value, bool add = false); diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index 9f05fe860..f4ceb511c 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -600,21 +600,21 @@ void impulsePermanentUnban(NLMISC::CBitMemStream &impulse) class CInterfaceChatDisplayer : public CClientChatManager::IChatDisplayer { public: - virtual void displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer=0); - virtual void displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName); + virtual void displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer=0); + virtual void displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName); virtual void clearChannel(CChatGroup::TGroupType mode, uint32 dynChatDbIndex); private: // Add colorization tag for sender name - void colorizeSender(ucstring &text, const ucstring &senderName, CRGBA baseColor); + void colorizeSender(string &text, const string &senderName, CRGBA baseColor); }; static CInterfaceChatDisplayer InterfaceChatDisplayer; -void CInterfaceChatDisplayer::colorizeSender(ucstring &text, const ucstring &senderName, CRGBA baseColor) +void CInterfaceChatDisplayer::colorizeSender(string &text, const string &senderName, CRGBA baseColor) { // find the sender/text separator to put color tags - ucstring::size_type pos = senderName.toUtf8().length() - 1; + ucstring::size_type pos = senderName.length() - 1; if (pos != ucstring::npos) { string str; @@ -624,36 +624,36 @@ void CInterfaceChatDisplayer::colorizeSender(ucstring &text, const ucstring &sen CChatWindow::encodeColorTag(prop.getRGBA(), str, false); - str += text.toUtf8().substr(0, pos+1); + str += text.substr(0, pos+1); CChatWindow::encodeColorTag(baseColor, str, true); - str += text.toUtf8().substr(pos+1); + str += text.substr(pos+1); - text.fromUtf8(str); + text = str; } } // display a chat from network to interface -void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer) +void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring finalString; + string finalString; string stringCategory = getStringCategory(ucstr, finalString); bool bubbleWanted = true; // Subtract rawMessage from ucstr so that the 'sender' part remains. - ucstring senderPart = ucstr.luabind_substr(0, ucstr.length() - rawMessage.length()); + string senderPart = ucstr.substr(0, ucstr.length() - rawMessage.length()); // search a "{no_bubble}" tag { - ucstring::size_type index = finalString.find(ucstring("{no_bubble}")); + string::size_type index = finalString.find("{no_bubble}"); const size_t tokenSize= 11; // length of "{no_bubble}" - if (index != ucstring::npos) + if (index != string::npos) { bubbleWanted = false; - finalString = finalString.luabind_substr(0, index) + finalString.substr(index+tokenSize,finalString.size()); + finalString = finalString.substr(0, index) + finalString.substr(index+tokenSize,finalString.size()); } } @@ -665,9 +665,9 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c // Remove all {break} for(;;) { - ucstring::size_type index = finalString.find(ucstring("{break}")); + string::size_type index = finalString.find("{break}"); if (index == ucstring::npos) break; - finalString = finalString.luabind_substr(0, index) + finalString.luabind_substr(index+7,finalString.size()); + finalString = finalString.substr(0, index) + finalString.substr(index+7,finalString.size()); } // select DB @@ -716,10 +716,10 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c // find the sender/text separator to put color tags if (senderPart.empty() && stringCategory == "emt") { - size_t pos = finalString.find(ucstring(": "), 0); - if (pos != ucstring::npos) + size_t pos = finalString.find(": ", 0); + if (pos != string::npos) { - senderPart = finalString.luabind_substr(0, pos + 2); + senderPart = finalString.substr(0, pos + 2); } } colorizeSender(finalString, senderPart, col); @@ -786,16 +786,16 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c if (pIM->getLogState()) { // Add dyn chan number before string - ucstring prefix("[" + NLMISC::toString(dbIndex) + "]"); + string prefix = "[" + NLMISC::toString(dbIndex) + "]"; // Find position to put the new string // After timestamp? - size_t pos = finalString.find(ucstring("]")); - size_t colonpos = finalString.find(ucstring(": @{")); + size_t pos = finalString.find("]"); + size_t colonpos = finalString.find(": @{"); // If no ] found or if found but after the colon (so part of the user chat) - if (pos == ucstring::npos || (colonpos < pos)) + if (pos == string::npos || (colonpos < pos)) { // No timestamp, so put it right after the color and add a space - pos = finalString.find(ucstring("}"));; + pos = finalString.find("}");; prefix += " "; } finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1); @@ -803,28 +803,28 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c if (node && node->getValueBool()) { uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex); - ucstring title; + string title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); - prefix = title.empty() ? ucstring("") : ucstring(" ") + title; - pos = finalString.find(ucstring("] ")); + prefix = (title.empty() ? "" : " ") + title; + pos = finalString.find("] "); finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos); } } } else { - nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.toString().c_str()); + nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.c_str()); } } else { - ucstring::size_type index = finalString.find(ucstring("")); + string::size_type index = finalString.find(""); if (index != ucstring::npos) { bubbleWanted = false; finalString = finalString.substr(index+6,finalString.size()); - ucstring::size_type index2 = finalString.find(ucstring(" ")); - ucstring playerName; + string::size_type index2 = finalString.find(string(" ")); + string playerName; if (index2 < (finalString.size()-3)) { playerName = finalString.substr(0,index2); @@ -832,7 +832,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c } if (!senderName.empty()) { - CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()), true, true); + CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName), true, true); if (senderEntity) { if (senderEntity->Type != CEntityCL::Player) @@ -840,16 +840,16 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c if (playerName.empty()) { senderEntity->removeStateFx(); - senderEntity->setStateFx(finalString.toString()); + senderEntity->setStateFx(finalString); nlinfo("empty"); } else { - CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName.toUtf8()), false, true); + CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName), false, true); if (destEntity) { destEntity->removeStateFx(); - destEntity->setStateFx(finalString.toString()); + destEntity->setStateFx(finalString); nlinfo("no empty"); } } @@ -866,7 +866,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c // if tell, bkup sendername if (mode == CChatGroup::tell && windowVisible && !senderName.empty()) { - PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()); + PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName); } } @@ -876,7 +876,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c // **** Process chat entry for the bubbles // todo hulud : registering a chat callback would be better than calling this hardcoded action handler - ucstring finalRawMessage; + string finalRawMessage; // remove color qualifier from raw string getStringCategory(rawMessage, finalRawMessage); if (bubbleWanted) @@ -902,7 +902,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c channel = "#" + toString((uint32)mode); } } - if (!stringCategory.empty() && NLMISC::toUpper(stringCategory) != "SYS") + if (!stringCategory.empty() && NLMISC::compareCaseInsensitive(stringCategory.c_str(), "SYS")) // Not empty and not 'SYS' { channel = channel + "/" + stringCategory; } @@ -912,13 +912,13 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c // display a tell from network to interface -void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName) +void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName) { - ucstring finalString = ucstr; + string finalString = ucstr; // for now, '&' are removed by server so use another format until a special msg is made - if (strFindReplace(finalString, ucstring(""), ucstring())) + if (strFindReplace(finalString, "", string())) { CLuaManager::getInstance().executeLuaScript("RingAccessPoint:forceRefresh()"); } @@ -928,13 +928,13 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); bool windowVisible; - ucstring goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()); + string goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName); // The sender part is up to and including the first ":" after the goodSenderName - ucstring::size_type pos = finalString.find(goodSenderName); + string::size_type pos = finalString.find(goodSenderName); pos = finalString.find(':', pos); pos = finalString.find(' ', pos); - ucstring senderPart = finalString.substr(0, pos+1); + string senderPart = finalString.substr(0, pos+1); colorizeSender(finalString, senderPart, prop.getRGBA()); PeopleInterraction.ChatInput.Tell.displayTellMessage(/*senderIndex, */finalString, goodSenderName, prop.getRGBA(), 2, &windowVisible); @@ -2125,7 +2125,7 @@ void impulseWhere(NLMISC::CBitMemStream &impulse) sprintf(buf,"Your server position is : X= %g Y= %g Z= %g",xf,yf,zf); nlinfo(buf); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(buf)); + CInterfaceManager::getInstance()->displaySystemInfo(buf); }// impulseWhere // //----------------------------------------------- @@ -4204,7 +4204,7 @@ std::string WebServer; NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", " ") { if (args.empty()) return false; - ucstring player = args[0]; + string player = args[0]; std::string msg; if (args.size() >= 2) { @@ -4215,7 +4215,7 @@ NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", " ") { if (args.empty()) return false; - ucstring player = args[0]; + string player = args[0]; std::string msg; if (args.size() >= 2) { @@ -4234,7 +4234,7 @@ NLMISC_COMMAND(localTell, "Temp : simulate a tell in local mode", " } } // TDataSetIndex dsi = INVALID_DATASET_ROW; - InterfaceChatDisplayer.displayTell(/*dsi, */ucstring(msg), player); + InterfaceChatDisplayer.displayTell(/*dsi, */msg, player); return true; } diff --git a/ryzom/client/src/user_entity.cpp b/ryzom/client/src/user_entity.cpp index a09256703..b2dcb0cab 100644 --- a/ryzom/client/src/user_entity.cpp +++ b/ryzom/client/src/user_entity.cpp @@ -2948,7 +2948,7 @@ bool CUserEntity::sit(bool s) // autowalk disabled UserControls.autowalkState(false); - const string msgName = "COMMAND:SIT"; + static const string msgName = "COMMAND:SIT"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -2963,7 +2963,7 @@ bool CUserEntity::sit(bool s) // display sit msg CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgUserIsSitting"); + string msg = CI18N::get("msgUserIsSitting"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); } @@ -2976,7 +2976,7 @@ bool CUserEntity::sit(bool s) { if(mode(MBEHAV::NORMAL)) { - const string msgName = "COMMAND:SIT"; + static const string msgName = "COMMAND:SIT"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -2991,7 +2991,7 @@ bool CUserEntity::sit(bool s) // display stand msg CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgUserIsStanding"); + string msg = CI18N::get("msgUserIsStanding"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); } @@ -3067,7 +3067,7 @@ void CUserEntity::setAFK(bool b, string afkTxt) } // send afk state - string msgName = "COMMAND:AFK"; + static const string msgName = "COMMAND:AFK"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -3081,15 +3081,15 @@ void CUserEntity::setAFK(bool b, string afkTxt) ucstring ucstr; ucstr.fromUtf8( afkTxt ); CBitMemStream outTxt; - msgName = "STRING:AFK_TXT"; - if( GenericMsgHeaderMngr.pushNameToStream(msgName,outTxt) ) + static const string msgNameTxt = "STRING:AFK_TXT"; + if( GenericMsgHeaderMngr.pushNameToStream(msgNameTxt,outTxt) ) { outTxt.serial( ucstr ); NetMngr.push( outTxt ); } else { - nlwarning("CUserEntity:setAFK: unknown message named '%s'.", msgName.c_str()); + nlwarning("CUserEntity:setAFK: unknown message named '%s'.", msgNameTxt.c_str()); } @@ -3111,7 +3111,7 @@ void CUserEntity::rollDice(sint16 min, sint16 max, bool local) } sint16 roll = min + (sint16)dice->rand(max-min); - ucstring msg = CI18N::get("msgRollDiceLocal"); + string msg = CI18N::get("msgRollDiceLocal"); strFindReplace(msg, "%min", toString(min)); strFindReplace(msg, "%max", toString(max)); strFindReplace(msg, "%roll", toString(roll)); @@ -3143,7 +3143,7 @@ bool CUserEntity::canEngageCombat() { // display "you can't fight while sitting" message) CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgCantFightSit"); + string msg = CI18N::get("msgCantFightSit"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); @@ -3154,7 +3154,7 @@ bool CUserEntity::canEngageCombat() { // display "you can't fight while swiming" message) CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgCantFightSwim"); + string msg = CI18N::get("msgCantFightSwim"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); @@ -3165,7 +3165,7 @@ bool CUserEntity::canEngageCombat() { // display "you can't fight while swimming" message) CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgCantFightRide"); + string msg = CI18N::get("msgCantFightRide"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); @@ -4140,7 +4140,7 @@ void CUserEntity::switchVelocity(bool userRequest) // display message : your are running, you are walking CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg; + string msg; if( _Run ) msg = CI18N::get("msgUserIsRunning"); else diff --git a/ryzom/common/src/game_share/msg_client_server.h b/ryzom/common/src/game_share/msg_client_server.h index 08dc0e171..c66e7856a 100644 --- a/ryzom/common/src/game_share/msg_client_server.h +++ b/ryzom/common/src/game_share/msg_client_server.h @@ -633,7 +633,7 @@ public: uint8 ChatMode; // uint32 DynChatChanID; NLMISC::CEntityId DynChatChanID; - ucstring Content; + ucstring Content; // FIXME: UTF-8 (serial) CChatMsg() { @@ -650,7 +650,7 @@ public: f.serial( ChatMode ); if(ChatMode==CChatGroup::dyn_chat) f.serial(DynChatChanID); - f.serial( Content ); + f.serial( Content ); // FIXME: UTF-8 (serial) } }; @@ -669,7 +669,7 @@ public: uint32 SenderNameId; uint8 ChatMode; uint32 PhraseId; - ucstring CustomTxt; + ucstring CustomTxt; // FIXME: UTF-8 (serial) CChatMsg2() { @@ -685,7 +685,7 @@ public: f.serial( SenderNameId ); f.serial( ChatMode ); f.serial( PhraseId ); - f.serial( CustomTxt ); + f.serial( CustomTxt ); // FIXME: UTF-8 (serial) } }; @@ -700,8 +700,8 @@ public: class CFarTellMsg { public: - ucstring SenderName; - ucstring Text; + ucstring SenderName; // FIXME: UTF-8 (serial) + ucstring Text; // FIXME: UTF-8 (serial) void serial(NLMISC::CBitMemStream &f) { From 72d9f8ea4f464116ced6961602673418d801cede Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 12:21:39 +0800 Subject: [PATCH 114/205] UTF-8 various, ryzom/ryzomcore#335 --- nel/include/nel/gui/view_text_id.h | 6 +-- nel/include/nel/misc/common.h | 1 + ryzom/client/src/connection.cpp | 4 +- ryzom/client/src/contextual_cursor.cpp | 4 +- ryzom/client/src/contextual_cursor.h | 2 +- ryzom/client/src/cursor_functions.cpp | 13 +++---- ryzom/client/src/entities.cpp | 4 +- ryzom/client/src/game_context_menu.cpp | 12 +++--- .../src/interface_v3/action_handler_game.cpp | 12 +++--- .../src/interface_v3/action_handler_help.cpp | 4 +- .../src/interface_v3/action_handler_item.cpp | 10 +++-- .../src/interface_v3/action_handler_misc.cpp | 14 +++---- .../src/interface_v3/action_handler_misc.h | 6 +-- .../bot_chat_page_dynamic_mission.cpp | 10 ++--- .../client/src/interface_v3/dbctrl_sheet.cpp | 18 ++++----- .../interface_v3/dbgroup_list_sheet_text.cpp | 4 +- .../interface_v3/dbgroup_list_sheet_trade.cpp | 4 +- .../src/interface_v3/encyclopedia_manager.cpp | 8 ++-- .../client/src/interface_v3/group_compas.cpp | 34 ++++++++--------- ryzom/client/src/interface_v3/group_compas.h | 6 +-- .../src/interface_v3/group_html_forum.cpp | 4 +- .../interface_v3/group_in_scene_bubble.cpp | 10 ++--- .../interface_v3/group_in_scene_user_info.cpp | 10 ++--- ryzom/client/src/interface_v3/group_map.cpp | 30 +++++++-------- .../client/src/interface_v3/guild_manager.cpp | 38 +++++++++---------- ryzom/client/src/interface_v3/guild_manager.h | 8 ++-- .../src/interface_v3/interface_manager.cpp | 18 ++++----- .../src/interface_v3/interface_manager.h | 2 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 12 +++--- .../src/interface_v3/people_interraction.cpp | 22 +++++------ ryzom/client/src/net_manager.cpp | 14 +++---- ryzom/client/src/string_manager_client.h | 4 +- 32 files changed, 173 insertions(+), 175 deletions(-) diff --git a/nel/include/nel/gui/view_text_id.h b/nel/include/nel/gui/view_text_id.h index abba8cb39..292f1728a 100644 --- a/nel/include/nel/gui/view_text_id.h +++ b/nel/include/nel/gui/view_text_id.h @@ -59,10 +59,8 @@ namespace NLGUI { public: virtual ~IViewTextProvider(){} - bool getString(uint32 stringId, std::string &result) { ucstring temp; bool res = getString(stringId, temp); result = temp.toUtf8(); return res; } - bool getDynString(uint32 dynStringId, std::string &result) { ucstring temp; bool res = getDynString(dynStringId, temp); result = temp.toUtf8(); return res; } - virtual bool getString( uint32 stringId, ucstring &result ) = 0; // TODO: UTF-8 - virtual bool getDynString( uint32 dynStringId, ucstring &result ) = 0; // TODO: UTF-8 + virtual bool getString(uint32 stringId, std::string &result) = 0; + virtual bool getDynString(uint32 dynStringId, std::string &result) = 0; }; CViewTextID(const TCtorParam ¶m) : CViewText(param) diff --git a/nel/include/nel/misc/common.h b/nel/include/nel/misc/common.h index 6a4480e5a..bca3372bd 100644 --- a/nel/include/nel/misc/common.h +++ b/nel/include/nel/misc/common.h @@ -253,6 +253,7 @@ void appendToUpper(std::string &res, const std::string &str, ptrdiff_t &i); /** UTF-8 case insensitive compare */ int compareCaseInsensitive(const char *a, const char *b); int compareCaseInsensitive(const char *a, size_t lenA, const char *b, size_t lenB); +inline int compareCaseInsensitive(const std::string &a, const std::string &b) { return compareCaseInsensitive(&a[0], a.size(), &b[0], b.size()); } /** diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 1fa7efb9f..6e5276755 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -3345,10 +3345,10 @@ class CAHLoadScenario : public IActionHandler if(val!=0) { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - ucstring res; + string res; if (pSMC->getString(val,res)) { - string charName = CEntityCL::removeTitleAndShardFromName(res.toUtf8()); + string charName = CEntityCL::removeTitleAndShardFromName(res); sessionBrowser.inviteCharacterByName(sessionBrowser._LastScheduleSessionCharId, charName); if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_invokeResult"))) diff --git a/ryzom/client/src/contextual_cursor.cpp b/ryzom/client/src/contextual_cursor.cpp index 24c95a96c..2a4d053d1 100644 --- a/ryzom/client/src/contextual_cursor.cpp +++ b/ryzom/client/src/contextual_cursor.cpp @@ -130,7 +130,7 @@ void CContextualCursor::del(const std::string &contextName) // context : // Select a nex context. //----------------------------------------------- -bool CContextualCursor::context(const std::string &contextName, float dist, const ucstring &cursName) +bool CContextualCursor::context(const std::string &contextName, float dist, const std::string &cursName) { // Delete the context. TContext::iterator it = _Contexts.find(contextName); @@ -163,7 +163,7 @@ bool CContextualCursor::context(const std::string &contextName, float dist, cons if(cursName.empty()) cursor->setString(CI18N::get(functions.cursor)); else - cursor->setString(cursName.toUtf8()); + cursor->setString(cursName); } } } diff --git a/ryzom/client/src/contextual_cursor.h b/ryzom/client/src/contextual_cursor.h index 6dfd20749..31ba7a3c5 100644 --- a/ryzom/client/src/contextual_cursor.h +++ b/ryzom/client/src/contextual_cursor.h @@ -68,7 +68,7 @@ public: void del(const std::string &contextName); // Select a nex context. - bool context(const std::string &contextName, float dist = 0, const ucstring &cursName = ucstring("")); + bool context(const std::string &contextName, float dist = 0, const std::string &cursName = std::string()); inline const std::string &context() const {return _Context;} // Check if there is an entity under the cursor. diff --git a/ryzom/client/src/cursor_functions.cpp b/ryzom/client/src/cursor_functions.cpp index 44e2dde7e..8773e84f7 100644 --- a/ryzom/client/src/cursor_functions.cpp +++ b/ryzom/client/src/cursor_functions.cpp @@ -197,7 +197,7 @@ static bool testMissionOption(sint32 priorityWanted) // Get the Text for the cursor if(textID) { - ucstring result; + string result; bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, result); if (!res) result = NLMISC::CI18N::get("uiMissionOptionNotReceived"); @@ -224,7 +224,7 @@ static bool testMissionRing() uint32 textID = pNL->getValue32(); // if the string is not received display a temp string - ucstring missionRingText; + string missionRingText; if(!STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, missionRingText)) missionRingText = NLMISC::CI18N::get("uiMissionRingNameNotReceived"); @@ -445,7 +445,7 @@ void checkUnderCursor() uint32 textID = pNL->getValue32(); // if the string is not received display a temp string - ucstring webPageText; + string webPageText; if(!STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, webPageText)) webPageText = NLMISC::CI18N::get("uiWebPageNameNotReceived"); @@ -463,8 +463,8 @@ void checkUnderCursor() { // get the outpost name CSheetId outpostSheet(pNL->getValue32()); - ucstring outpostName; - outpostName= ucstring(STRING_MANAGER::CStringManagerClient::getOutpostLocalizedName(outpostSheet)); + string outpostName; + outpostName= STRING_MANAGER::CStringManagerClient::getOutpostLocalizedName(outpostSheet); // display the cursor if(ContextCur.context("OUTPOST", 0.f, outpostName)) @@ -570,8 +570,7 @@ void checkUnderCursor() else { cursor->setCursor("curs_pick.tga"); - ucstring contextText; - contextText.fromUtf8(instref.ContextText); + string contextText = instref.ContextText; if (ContextCur.context("WEBIG", 0.f, contextText)) return; } diff --git a/ryzom/client/src/entities.cpp b/ryzom/client/src/entities.cpp index 9ecadba93..99caacf45 100644 --- a/ryzom/client/src/entities.cpp +++ b/ryzom/client/src/entities.cpp @@ -178,7 +178,7 @@ public : CCompassTarget ct = pGC->getTarget(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - ucstring oldName; + string oldName; if (!pSMC->getDynString(leaf->getOldValue32(), oldName)) { nlwarning("Can't get compass target name"); @@ -201,7 +201,7 @@ public : { // TODO : maybe the following code could be include in CGroupMap::checkCoords, but it is not called when the map is not visible... STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - ucstring name; + string name; if (pSMC->getDynString((*tmpIt)->getValue32(), name)) { // if (_AlreadyReceived.count(name) == 0) diff --git a/ryzom/client/src/game_context_menu.cpp b/ryzom/client/src/game_context_menu.cpp index 47ca97a80..3a283022c 100644 --- a/ryzom/client/src/game_context_menu.cpp +++ b/ryzom/client/src/game_context_menu.cpp @@ -713,13 +713,13 @@ void CGameContextMenu::updateContextMenuMissionsOptions( bool forceHide ) uint32 textID = (uint32) _MissionOption[k]->getValue32(); if (textID) { - ucstring result; + string result; bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, result); if (!res) { result = NLMISC::CI18N::get("uiMissionOptionNotReceived"); } - pVTM->setText(result.toUtf8()); + pVTM->setText(result); pVTM->setActive(true); } else @@ -754,13 +754,13 @@ void CGameContextMenu::updateContextMenuWebPage(uint options) uint32 textID = (uint32) _WebPageTitle->getValue32(); if (textID) { - ucstring result; + string result; bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, result); if (!res) { result = NLMISC::CI18N::get("uiWebPageNameNotReceived"); } - pVTM->setText(result.toUtf8()); + pVTM->setText(result); } else { @@ -834,13 +834,13 @@ void CGameContextMenu::updateContextMenuMissionRing() // if the textId is ok and Flag is set. if ( textId ) { - ucstring result; + string result; bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, result); if (!res) { result = NLMISC::CI18N::get("uiMissionRingNameNotReceived"); } - pVTM->setText(result.toUtf8()); + pVTM->setText(result); pVTM->setActive(true); } else diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index d574a7248..3b3738c38 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -1943,13 +1943,13 @@ public: sint32 Slot; - bool cbIDStringReceived(ucstring &inout) + bool cbIDStringReceived(string &inout) { if (UserEntity != NULL) { if (UserEntity->selection() == Slot) { - ucstring copyInout = inout; + string copyInout = inout; CStringPostProcessRemoveTitle::cbIDStringReceived(inout); if (inout.empty()) { @@ -1959,13 +1959,13 @@ public: if (pChar != NULL) womanTitle = pChar->getGender() == GSGENDER::female; - STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout.toUtf8()), womanTitle); + copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle); // Sometimes translation contains another title - ucstring::size_type pos = copyInout.find('$'); + string::size_type pos = copyInout.find('$'); if (pos != ucstring::npos) { - copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout.toUtf8()), womanTitle); + copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle); } CStringPostProcessRemoveTitle::cbIDStringReceived(copyInout); @@ -1987,7 +1987,7 @@ public: sint32 Slot; - bool cbIDStringReceived(ucstring &inout) + bool cbIDStringReceived(string &inout) { if (UserEntity != NULL) { diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index c00328ef0..e8c36809f 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -3625,11 +3625,11 @@ public: return; } - ucstring txt; + string txt; CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:NAME", index)); if (node && CStringManagerClient::instance()->getDynString(node->getValue32(), txt)) { - CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt.toUtf8())); + CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt)); } } }; diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 2df888285..7a87719ab 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -1732,10 +1732,11 @@ void CItemMenuInBagInfoWaiter::infoValidated(CDBCtrlSheet* ctrlSheet) // get the CreatorTextID bool isCraftedByUserEntity = false; - ucstring creatorNameString; + string creatorNameString; if( STRING_MANAGER::CStringManagerClient::instance()->getString ( itemInfo.CreatorName, creatorNameString) ) { - if ( toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString.toUtf8())) + std::string userNameString = UserEntity->getEntityName() + PlayerSelectedHomeShardNameWithParenthesis; + if (NLMISC::compareCaseInsensitive(userNameString, creatorNameString) == 0) isCraftedByUserEntity = true; } @@ -1840,10 +1841,11 @@ class CHandlerItemMenuCheck : public IActionHandler if (getInventory().isItemInfoUpToDate(getInventory().getItemSlotId(pCS))) { // get the CreatorTextID - ucstring creatorNameString; + string creatorNameString; if( STRING_MANAGER::CStringManagerClient::instance()->getString ( getInventory().getItemInfo(getInventory().getItemSlotId(pCS)).CreatorName, creatorNameString) ) { - if (toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString.toUtf8())) + string userNameString = UserEntity->getEntityName() + PlayerSelectedHomeShardNameWithParenthesis; + if (NLMISC::compareCaseInsensitive(userNameString, creatorNameString) == 0) isTextEditionActive = true; } } diff --git a/ryzom/client/src/interface_v3/action_handler_misc.cpp b/ryzom/client/src/interface_v3/action_handler_misc.cpp index d6d41e32b..8b144f844 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -913,10 +913,10 @@ NLMISC_COMMAND(slsn, "Temp : set the name of the last sender.", "") } // *************************************************************************** -bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut) +bool CStringPostProcessRemoveName::cbIDStringReceived(string &inOut) { // extract the replacement id - string strNewTitle = CEntityCL::getTitleFromName(inOut.toUtf8()); + string strNewTitle = CEntityCL::getTitleFromName(inOut); // retrieve the translated string if (!strNewTitle.empty()) @@ -927,7 +927,7 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut) ucstring::size_type pos = inOut.find('$'); if (pos != ucstring::npos) { - inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(inOut.toUtf8()), Woman); + inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(inOut), Woman); } } } @@ -938,16 +938,16 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut) } // *************************************************************************** -bool CStringPostProcessRemoveTitle::cbIDStringReceived(ucstring &inOut) +bool CStringPostProcessRemoveTitle::cbIDStringReceived(string &inOut) { - inOut = CEntityCL::removeTitleAndShardFromName(inOut.toUtf8()); + inOut = CEntityCL::removeTitleAndShardFromName(inOut); return true; } // *************************************************************************** -bool CStringPostProcessNPCRemoveTitle::cbIDStringReceived(ucstring &inOut) +bool CStringPostProcessNPCRemoveTitle::cbIDStringReceived(string &inOut) { - ucstring sOut = CEntityCL::removeTitleAndShardFromName(inOut.toUtf8()); + string sOut = CEntityCL::removeTitleAndShardFromName(inOut); if (sOut.empty()) { CStringPostProcessRemoveName SPPRM; diff --git a/ryzom/client/src/interface_v3/action_handler_misc.h b/ryzom/client/src/interface_v3/action_handler_misc.h index d820963ac..93db8080b 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.h +++ b/ryzom/client/src/interface_v3/action_handler_misc.h @@ -157,7 +157,7 @@ class CStringPostProcessRemoveName : public CInterfaceManager::IStringProcess public: CStringPostProcessRemoveName():Woman(false) {} bool Woman; - bool cbIDStringReceived(ucstring &inOut); + bool cbIDStringReceived(std::string &inOut); }; // *************************************************************************** @@ -165,7 +165,7 @@ public: class CStringPostProcessRemoveTitle : public CInterfaceManager::IStringProcess { public: - bool cbIDStringReceived(ucstring &inOut); + bool cbIDStringReceived(std::string &inOut); }; // *************************************************************************** @@ -173,7 +173,7 @@ public: class CStringPostProcessNPCRemoveTitle : public CInterfaceManager::IStringProcess { public: - bool cbIDStringReceived(ucstring &inOut); + bool cbIDStringReceived(std::string &inOut); }; diff --git a/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp b/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp index 78a38051e..c8190e8e7 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp @@ -164,11 +164,11 @@ void CBotChatPageDynamicMission::update() { uint32 textID = (uint32) NLGUI::CDBManager::getInstance()->getDbProp(toString(DM_CHOICE "%d:%d:TEXT", (int) k, (int) l))->getValue32(); // see if text has been receive - ucstring result; + string result; bool received = CStringManagerClient::instance()->getDynString(textID, result); if (received) { - _ChoiceCB[k]->setText(l, result.toUtf8()); + _ChoiceCB[k]->setText(l, result); _TextReceived[k][l] = true; } } @@ -180,11 +180,11 @@ void CBotChatPageDynamicMission::update() uint32 textID = (uint32) NLGUI::CDBManager::getInstance()->getDbProp(toString(DM_CHOICE "%d:%d:TEXT", (int) k, (int) l))->getValue32(); if (textID == 0 && !ClientCfg.Local) break; // see if text has been received - ucstring result; + string result; bool received = CStringManagerClient::instance()->getDynString(textID, result); if (received) { - _ChoiceCB[k]->addText(result.toUtf8()); + _ChoiceCB[k]->addText(result); _TextReceived[k][l] = true; } else @@ -207,7 +207,7 @@ void CBotChatPageDynamicMission::update() uint32 textID = NLGUI::CDBManager::getInstance()->getDbProp(DM_TITLE_DB_PATH)->getValue32(); if (textID != 0) { - ucstring result; + string result; if (CStringManagerClient::instance()->getDynString(textID, result)) { textID = NLGUI::CDBManager::getInstance()->getDbProp(DM_DESCRIPTION_DB_PATH)->getValue32(); diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index e9575f776..7196bdac9 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -207,9 +207,9 @@ int CDBCtrlSheet::luaGetCreatorName(CLuaState &ls) { uint32 itemSlotId = getInventory().getItemSlotId(this); CClientItemInfo itemInfo = getInventory().getItemInfo(itemSlotId); - ucstring creatorName; + string creatorName; STRING_MANAGER::CStringManagerClient::instance()->getString(itemInfo.CreatorName, creatorName); - CLuaIHM::push(ls, creatorName); + CLuaIHM::push(ls, ucstring::makeFromUtf8(creatorName)); // FIXME: Lua UTF-8 return 1; } @@ -1460,7 +1460,7 @@ void CDBCtrlSheet::setupMission() void CDBCtrlSheet::setupGuildFlag () { // Find the guild name - ucstring usGuildName; + string usGuildName; sint32 nGuildName = _SheetId.getSInt32(); if (_LastSheetId != nGuildName || _NeedSetup) { @@ -4570,7 +4570,7 @@ ucstring CDBCtrlSheet::getItemActualName() const return ucstring(); else { - ucstring ret; + string ret; // If NameId not 0, get from StringManager uint32 nameId= getItemNameId(); if(nameId) @@ -4602,21 +4602,21 @@ ucstring CDBCtrlSheet::getItemActualName() const { // get description string for item format std::string formatID = getItemRMFaberStatType() != RM_FABER_STAT_TYPE::Unknown ? "uihelpItemFaberPrefixAndSuffix" : "uihelpItemFaberPrefix"; - ucstring format; + string format; if (!CI18N::hasTranslation(formatID)) { - format = ucstring("%p %n %s"); // not found, uses default string + format = "%p %n %s"; // not found, uses default string } else { format = CI18N::get(formatID); } // suffix - strFindReplace(format, ucstring("%p"), RM_CLASS_TYPE::toLocalString(getItemRMClassType())); + strFindReplace(format, "%p", RM_CLASS_TYPE::toLocalString(getItemRMClassType())); // name - strFindReplace(format, ucstring("%n"), ret); + strFindReplace(format, "%n", ret); // prefix - strFindReplace(format, ucstring("%s"), CI18N::get(toString("mpstatItemQualifier%d", (int) getItemRMFaberStatType()).c_str())); + strFindReplace(format, "%s", CI18N::get(toString("mpstatItemQualifier%d", (int) getItemRMFaberStatType()).c_str())); ret = format; diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp index 7e47e740c..02d009661 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp @@ -313,7 +313,7 @@ void CDBGroupListSheetText::updateCoords () else { // if not received, must insert in list of pending dynstring to check each frame - ucstring result; + string result; if( !STRING_MANAGER::CStringManagerClient::instance()->getDynString ( curNameId, result) ) _NameIdToUpdate.insert( _SheetChildren[i] ); } @@ -492,7 +492,7 @@ void CDBGroupListSheetText::checkCoords () { CSheetChild * cst = (*it); // String result - ucstring result; + string result; if( STRING_MANAGER::CStringManagerClient::instance()->getDynString ( cst->NameId, result) ) { set< CSheetChild *>::iterator itTmp = it; 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 2b52de9b0..21a56ec4f 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -689,10 +689,10 @@ void CDBGroupListSheetTrade::checkCoords () { CSheetChildTrade * cst = (*it); // String result - ucstring result; + string result; if( pSMC->getString ( cst->LastVendorNameId, result) ) { - cst->VendorNameString = CEntityCL::removeShardFromName(result.toUtf8()); + cst->VendorNameString = CEntityCL::removeShardFromName(result); set< CSheetChildTrade *>::iterator itTmp = it; ++it; VendorNameIdToUpdate.erase(itTmp); diff --git a/ryzom/client/src/interface_v3/encyclopedia_manager.cpp b/ryzom/client/src/interface_v3/encyclopedia_manager.cpp index 25f5bc2e8..8de31a438 100644 --- a/ryzom/client/src/interface_v3/encyclopedia_manager.cpp +++ b/ryzom/client/src/interface_v3/encyclopedia_manager.cpp @@ -194,7 +194,7 @@ void CEncyclopediaManager::rebuildAlbumList() nlassert(pTree != NULL); CGroupTree::SNode *pRoot = new CGroupTree::SNode; - ucstring res; + string res; // Add all albums for (uint32 i = 0; i < _Albums.size(); ++i) @@ -206,7 +206,7 @@ void CEncyclopediaManager::rebuildAlbumList() if (_Albums[i].Name == _AlbumNameSelected) pAlb->Opened = true; if (pSMC->getDynString(_Albums[i].Name, res)) - pAlb->Text = res.toUtf8(); + pAlb->Text = res; else nlwarning("try to construct album without name"); @@ -218,7 +218,7 @@ void CEncyclopediaManager::rebuildAlbumList() pThm->AHName = "ency_click_thema"; pThm->AHParams = toString(_Albums[i].Themas[j].Name); if (pSMC->getDynString(_Albums[i].Themas[j].Name, res)) - pThm->Text = res.toUtf8(); + pThm->Text = res; else nlwarning("try to construct thema without name"); @@ -426,7 +426,7 @@ bool CEncyclopediaManager::isStringWaiting() for (uint32 i = 0; i < _Albums.size(); ++i) { - ucstring res; + string res; if (!pSMC->getDynString(_Albums[i].Name, res)) return true; for (uint32 j = 0; j < _Albums[i].Themas.size(); ++j) diff --git a/ryzom/client/src/interface_v3/group_compas.cpp b/ryzom/client/src/interface_v3/group_compas.cpp index fc0f2a5a5..bee955ba4 100644 --- a/ryzom/client/src/interface_v3/group_compas.cpp +++ b/ryzom/client/src/interface_v3/group_compas.cpp @@ -394,18 +394,18 @@ void CGroupCompas::draw() // The text char message[50]; - ucstring distText; + string distText; if (displayedTarget.getType() != CCompassTarget::North) { if (dist > 999.0f) { smprintf (message, 50, "%.1f ", dist/1000.0f); - distText = ucstring (message) + CI18N::get("uiKilometerUnit"); + distText = message + CI18N::get("uiKilometerUnit"); } else { smprintf (message, 50, "%.0f ", dist); - distText = ucstring (message) + CI18N::get("uiMeterUnit"); + distText = message + CI18N::get("uiMeterUnit"); } distText = distText + " - " + displayedTarget.Name; } @@ -415,7 +415,7 @@ void CGroupCompas::draw() } if (_DistViewText != distText) { - _DistView->setText(distText.toUtf8()); + _DistView->setText(distText); _DistViewText = distText; } } @@ -558,9 +558,9 @@ bool buildCompassTargetFromTeamMember(CCompassTarget &ct, uint teamMemberId) ct.setPositionState(tracker); CStringManagerClient *pSMC = CStringManagerClient::instance(); - ucstring name; + string name; if (pSMC->getString(nameNode->getValue32(), name)) - ct.Name = CEntityCL::removeTitleAndShardFromName(name.toUtf8()); // TODO : dynamic support for name + ct.Name = CEntityCL::removeTitleAndShardFromName(name); // TODO : dynamic support for name else ct.Name = CI18N::get("uiNotReceived"); return true; @@ -711,7 +711,7 @@ void CGroupCompasMenu::setActive (bool state) ct.setType(CCompassTarget::North); ct.Name = CI18N::get("uiNorth"); Targets.push_back(ct); - getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); // Home CCDBNodeLeaf *pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":HOME_POINT"); sint32 px = (sint32) (pos->getValue64() >> 32); @@ -721,7 +721,7 @@ void CGroupCompasMenu::setActive (bool state) ct.setType(CCompassTarget::Home); ct.Name = CI18N::get("uiHome"); Targets.push_back(ct); - getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); } // Respawn pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":BIND_POINT"); @@ -732,7 +732,7 @@ void CGroupCompasMenu::setActive (bool state) ct.setType(CCompassTarget::Respawn); ct.Name = CI18N::get("uiRespawn"); Targets.push_back(ct); - getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); } // As of 6/5/2007 : The option to point the selection is always proposed even if no slot is currently targeted @@ -777,7 +777,7 @@ void CGroupCompasMenu::setActive (bool state) CCDBNodeLeaf *textIDLeaf = NLGUI::CDBManager::getInstance()->getDbProp(baseDbPath + toString(":%d:TARGET%d:TITLE", (int) k, (int) l), false); if (textIDLeaf) { - ucstring name; + string name; if (CStringManagerClient::instance()->getDynString(textIDLeaf->getValue32(), name)) { CCDBNodeLeaf *leafPosX= NLGUI::CDBManager::getInstance()->getDbProp(baseDbPath + toString(":%d:TARGET%d:X", (int) k, (int) l), false); @@ -790,7 +790,7 @@ void CGroupCompasMenu::setActive (bool state) ct.setPositionState(tracker); ct.Name = name; Targets.push_back(ct); - missionSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + missionSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } @@ -847,7 +847,7 @@ void CGroupCompasMenu::setActive (bool state) ct.Pos = currCont->ContLandMarks[k].Pos; ct.Name = CStringManagerClient::getPlaceLocalizedName(currCont->ContLandMarks[k].TitleTextID); Targets.push_back(ct); - landMarkSubMenu->addLineAtIndex(contLandMarkIndex++, ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + landMarkSubMenu->addLineAtIndex(contLandMarkIndex++, ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } // separator? @@ -868,9 +868,9 @@ void CGroupCompasMenu::setActive (bool state) CCompassTarget ct; ct.setType(CCompassTarget::UserLandMark); ct.Pos = sortedLandmarks[k].Pos; - ct.Name = sortedLandmarks[k].Title; + ct.Name = sortedLandmarks[k].Title.toUtf8(); Targets.push_back(ct); - landMarkSubMenus[sortedLandmarks[k].Type]->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + landMarkSubMenus[sortedLandmarks[k].Type]->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } @@ -901,7 +901,7 @@ void CGroupCompasMenu::setActive (bool state) if (buildCompassTargetFromTeamMember(ct, k)) { Targets.push_back(ct); - teamSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + teamSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } @@ -924,7 +924,7 @@ void CGroupCompasMenu::setActive (bool state) if (buildCompassTargetFromAnimalMember(ct, k)) { Targets.push_back(ct); - animalSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + animalSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } @@ -952,7 +952,7 @@ void CGroupCompasMenu::setActive (bool state) CSmartPtr tracker = new CDialogEntityPositionState( i ); ct.setPositionState(tracker); Targets.push_back(ct); - dialogsSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + dialogsSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } diff --git a/ryzom/client/src/interface_v3/group_compas.h b/ryzom/client/src/interface_v3/group_compas.h index c9ba106ef..6a57b0294 100644 --- a/ryzom/client/src/interface_v3/group_compas.h +++ b/ryzom/client/src/interface_v3/group_compas.h @@ -46,7 +46,7 @@ class CCompassTarget public: enum TType { North = 0, Selection, Home, Respawn, ContinentLandMark, UserLandMark, PosTracker, NumTypes }; NLMISC::CVector2f Pos; // Used for static target (ie not the current selection, a team member ...) - ucstring Name; + std::string Name; CCompassTarget(); TType getType() const { return _Type; } void setType(TType type) { if (type == _Type) return; setPositionState(NULL); _Type = type; } @@ -124,11 +124,11 @@ private: bool _Blinking; double _StartBlinkTime; - ucstring _CurrTargetName; + std::string _CurrTargetName; // The dist text CViewText *_DistView; - ucstring _DistViewText; + std::string _DistViewText; CViewRadar *_RadarView; CViewText *_RadarRangeView; diff --git a/ryzom/client/src/interface_v3/group_html_forum.cpp b/ryzom/client/src/interface_v3/group_html_forum.cpp index 641f9b43e..4b74732f3 100644 --- a/ryzom/client/src/interface_v3/group_html_forum.cpp +++ b/ryzom/client/src/interface_v3/group_html_forum.cpp @@ -60,7 +60,7 @@ void CGroupHTMLForum::addHTTPGetParams (string &url, bool /*trustedDomain*/) { ucstring user_name = UserEntity->getLoginName (); const SGuild &guild = CGuildManager::getInstance()->getGuild(); - string gname = guild.Name.toUtf8(); + string gname = guild.Name; if (!gname.empty()) { @@ -92,7 +92,7 @@ void CGroupHTMLForum::addHTTPPostParams (SFormFields &formfields, bool /*trusted { ucstring user_name = UserEntity->getLoginName (); const SGuild &guild = CGuildManager::getInstance()->getGuild(); - string gname = guild.Name.toUtf8(); + string gname = guild.Name; if (!gname.empty()) { 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 c3edc87f9..06f81f762 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -456,7 +456,7 @@ void CGroupInSceneBubbleManager::update () { if (_DynBubbles[i].DescWaiting != 0) { - ucstring res; + string res; STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); if (pSMC->getDynString(_DynBubbles[i].DescWaiting,res)) { @@ -1317,14 +1317,14 @@ class CAHDynChatClickOption : public IActionHandler if (isBGDownloadEnabled()) { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - ucstring result; + string result; if (!pSMC->getDynString(optStrId, result)) { return; // shouldn't happen since the button isn't visible as long as the text has not been received ... } static volatile bool forceWarning = false; // for debug - ucstring::size_type pos= result.find(ucstring("{ros_exit}")); - if(pos != ucstring::npos || forceWarning) + string::size_type pos= result.find("{ros_exit}"); + if(pos != string::npos || forceWarning) { if (AvailablePatchs != 0) { @@ -1334,7 +1334,7 @@ class CAHDynChatClickOption : public IActionHandler } } - const string sMsg = "BOTCHAT:DYNCHAT_SEND"; + static const string sMsg = "BOTCHAT:DYNCHAT_SEND"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) { diff --git a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index e5021ca00..ee2f6c526 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -992,9 +992,9 @@ void CGroupInSceneUserInfo::updateDynamicData () if (_GuildName) { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - ucstring ucsTmp; + string ucsTmp; if (pSMC->getString (_Entity->getGuildNameID(), ucsTmp)) - _GuildName->setText(ucsTmp.toUtf8()); + _GuildName->setText(ucsTmp); // guildname color is the pvp color _GuildName->setColor(entityColor); @@ -1018,9 +1018,9 @@ void CGroupInSceneUserInfo::updateDynamicData () if (_EventFaction) { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - ucstring ucsTmp; - if (pSMC->getString (_Entity->getEventFactionID(), ucsTmp)) - _EventFaction->setText(ucsTmp.toUtf8()); + string ucsTmp; + if (pSMC->getString(_Entity->getEventFactionID(), ucsTmp)) + _EventFaction->setText(ucsTmp); // guildname color depends of PVP faction or not _EventFaction->setColor(entityColor); diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index b5302885e..8582b938e 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -1176,10 +1176,10 @@ void CGroupMap::checkCoords() // update text if needed if (!_MissionTargetTextReceived[k]) { - ucstring result; + string result; if (STRING_MANAGER::CStringManagerClient::instance()->getDynString(_MissionTargetTextIDs[k], result)) { - _MissionLM[k]->setDefaultContextHelp(result.toUtf8()); + _MissionLM[k]->setDefaultContextHelp(result); _MissionTargetTextReceived[k] = true; } } @@ -1401,11 +1401,11 @@ void CGroupMap::checkCoords() CInterfaceManager *im = CInterfaceManager::getInstance(); uint32 val = NLGUI::CDBManager::getInstance()->getDbProp(NLMISC::toString("SERVER:GROUP:%d:NAME",i))->getValue32(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - ucstring res; + string res; - if (pSMC->getString(val,res)) + if (pSMC->getString(val, res)) { - std::string res2 = CEntityCL::removeTitleAndShardFromName(res.toUtf8()); + std::string res2 = CEntityCL::removeTitleAndShardFromName(res); _TeammateLM[i]->setDefaultContextHelp(res2); } } @@ -3197,7 +3197,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) if (it != _ContinentLM.end()) { ct.setType(CCompassTarget::ContinentLandMark); - (*it)->getContextHelpAsUtf16(ct.Name); + (*it)->getContextHelp(ct.Name); mapToWorld(ct.Pos, (*it)->Pos); found = true; } @@ -3210,7 +3210,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) if (it != _MissionLM.end()) { ct.setPositionState(_MissionPosStates[it - _MissionLM.begin()]); - (*it)->getContextHelpAsUtf16(ct.Name); + (*it)->getContextHelp(ct.Name); mapToWorld(ct.Pos, (*it)->Pos); found = true; } @@ -3224,7 +3224,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) if (it != _UserLM.end()) { ct.setType(CCompassTarget::UserLandMark); - (*it)->getContextHelpAsUtf16(ct.Name); + (*it)->getContextHelp(ct.Name); mapToWorld(ct.Pos, (*it)->Pos); found = true; } @@ -3252,7 +3252,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) if (!isIsland()) { ct.setType(CCompassTarget::Respawn); - (*it)->getContextHelpAsUtf16(ct.Name); + (*it)->getContextHelp(ct.Name); mapToWorld(ct.Pos, (*it)->Pos); found = true; } @@ -3298,7 +3298,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) { if(_AnimalLM[i]==lm) { - _AnimalLM[i]->getContextHelpAsUtf16(ct.Name); + _AnimalLM[i]->getContextHelp(ct.Name); // copy The Animal Pos retriever into the compass ct.setPositionState(_AnimalPosStates[i]); found = true; @@ -3316,7 +3316,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm) { if(_TeammateLM[i]==lm) { - _TeammateLM[i]->getContextHelpAsUtf16(ct.Name); + _TeammateLM[i]->getContextHelp(ct.Name); // copy The Animal Pos retriever into the compass ct.setPositionState(_TeammatePosStates[i]); found = true; @@ -3346,7 +3346,7 @@ void CGroupMap::targetLandmarkResult(uint32 index) CCompassTarget ct; ct.Pos = _MatchedLandmarks[index].Pos; - ct.Name = _MatchedLandmarks[index].Title; + ct.Name = _MatchedLandmarks[index].Title.toUtf8(); // type sets compass arrow color ct.setType(CCompassTarget::UserLandMark); @@ -3440,7 +3440,7 @@ bool CGroupMap::targetLandmarkByName(const ucstring &search, bool startsWith) co { ct.setType(CCompassTarget::UserLandMark); mapToWorld(ct.Pos, lm->Pos); - lm->getContextHelpAsUtf16(ct.Name); + lm->getContextHelp(ct.Name); closest = dist; found = true; } @@ -3453,7 +3453,7 @@ bool CGroupMap::targetLandmarkByName(const ucstring &search, bool startsWith) co { ct.setType(CCompassTarget::ContinentLandMark); mapToWorld(ct.Pos, lm->Pos); - lm->getContextHelpAsUtf16(ct.Name); + lm->getContextHelp(ct.Name); closest = dist; found = true; } @@ -3464,7 +3464,7 @@ bool CGroupMap::targetLandmarkByName(const ucstring &search, bool startsWith) co { ct.setType(CCompassTarget::ContinentLandMark); mapToWorld(ct.Pos, lmt->Pos); - ct.Name = CUtfStringView(lmt->getText()).toUtf16(); + ct.Name = lmt->getText(); closest = dist; found = true; } diff --git a/ryzom/client/src/interface_v3/guild_manager.cpp b/ryzom/client/src/interface_v3/guild_manager.cpp index 74dc5d991..39fe7e05e 100644 --- a/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/ryzom/client/src/interface_v3/guild_manager.cpp @@ -245,11 +245,11 @@ bool CGuildManager::isLeaderOfTheGuild() } // *************************************************************************** -ucstring CGuildManager::getGuildName() +string CGuildManager::getGuildName() { if (_InGuild) return _Guild.Name; - return ucstring(""); + return string(); } // *************************************************************************** @@ -359,7 +359,7 @@ void CGuildManager::update() for (uint i = 0; i < _GuildMembers.size(); ++i) { if (!pSMC->getString (_GuildMembers[i].NameID, _GuildMembers[i].Name)) bAllValid = false; - else _GuildMembers[i].Name = CEntityCL::removeTitleAndShardFromName(_GuildMembers[i].Name.toUtf8()); + else _GuildMembers[i].Name = CEntityCL::removeTitleAndShardFromName(_GuildMembers[i].Name); } // If all is valid no more need update and if guild is opened update the interface @@ -369,13 +369,13 @@ void CGuildManager::update() if (node && node->getValueBool()) { // See if we need to show any online/offline messages - static map CachedGuildMembers; + static map CachedGuildMembers; const string &onlineMessage = CI18N::get("uiPlayerOnline"); const string &offlineMessage = CI18N::get("uiPlayerOffline"); for (uint i = 0; i < _GuildMembers.size(); ++i) { - map::const_iterator it = CachedGuildMembers.find(_GuildMembers[i].Name); + map::const_iterator it = CachedGuildMembers.find(_GuildMembers[i].Name); if ( it != CachedGuildMembers.end() ) { if ( (*it).second.Online == _GuildMembers[i].Online) @@ -391,7 +391,7 @@ void CGuildManager::update() } string msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage; - strFindReplace(msg, "%s", _GuildMembers[i].Name.toUtf8()); + strFindReplace(msg, "%s", _GuildMembers[i].Name); string cat = getStringCategory(msg, msg); map::const_iterator it; NLMISC::CRGBA col = CRGBA::Yellow; @@ -418,7 +418,7 @@ void CGuildManager::update() { uint i; _Grade = EGSPD::CGuildGrade::Member; - ucstring sUserName = toLower(UserEntity->getEntityName()); + string sUserName = toLower(UserEntity->getEntityName()); for (i = 0; i < _GuildMembers.size(); ++i) { if (toLower(_GuildMembers[i].Name) == sUserName) @@ -471,7 +471,7 @@ void CGuildManager::update() { CViewText *pJoinPropPhraseView = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_JOIN_PROPOSAL_PHRASE)); if (pJoinPropPhraseView != NULL) - pJoinPropPhraseView->setText(_JoinPropPhrase.toUtf8()); + pJoinPropPhraseView->setText(_JoinPropPhrase); pJoinProp->setActive(true); CWidgetManager::getInstance()->setTopWindow(pJoinProp); @@ -722,10 +722,10 @@ bool CDBGroupListAscensor::CSheetChildAscensor::isInvalidated(CDBGroupListSheetT STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); uint32 nameID = NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:ASCENSOR:" + toString(Index) + ":NAME")->getValue32(); - ucstring name; + string name; if (nameID && pSMC->getDynString(nameID, name)) { - Text->setText(name.toUtf8()); + Text->setText(name); uint64 icon = NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:ASCENSOR:" + toString(Index) + ":ICON")->getValue64(); @@ -831,7 +831,7 @@ class CAHGuildSheetOpen : public IActionHandler // Set name CViewText *pViewName = dynamic_cast(pLine->getView(TEMPLATE_GUILD_MEMBER_NAME)); if (pViewName != NULL) - pViewName->setText (rGuildMembers[i].Name.toUtf8()); + pViewName->setText (rGuildMembers[i].Name); // Set Grade CViewText *pViewGrade = dynamic_cast(pLine->getView(TEMPLATE_GUILD_MEMBER_GRADE)); @@ -875,7 +875,7 @@ class CAHGuildSheetOpen : public IActionHandler CCtrlBase *inviteButton = pLine->getCtrl("invite_button"); if (inviteButton != NULL) - inviteButton->setActive(rGuildMembers[i].Online != ccs_offline && rGuildMembers[i].Name.toUtf8() != UserEntity->getEntityName()); + inviteButton->setActive(rGuildMembers[i].Online != ccs_offline && rGuildMembers[i].Name != UserEntity->getEntityName()); // Enter Date CViewText *pViewEnterDate = dynamic_cast(pLine->getView(TEMPLATE_GUILD_MEMBER_ENTER_DATE)); @@ -883,13 +883,13 @@ class CAHGuildSheetOpen : public IActionHandler { CRyzomTime rt; rt.updateRyzomClock(rGuildMembers[i].EnterDate); - ucstring str = toString("%04d", rt.getRyzomYear()) + " "; + string str = toString("%04d", rt.getRyzomYear()) + " "; str += CI18N::get("uiJenaYear") + " : "; str += CI18N::get("uiAtysianCycle") + " "; str += toString("%01d", rt.getRyzomCycle()+1) +", "; str += CI18N::get("ui"+MONTH::toString( (MONTH::EMonth)rt.getRyzomMonthInCurrentCycle() )) + ", "; str += toString("%02d", rt.getRyzomDayOfMonth()+1); - pViewEnterDate->setText(str.toUtf8()); + pViewEnterDate->setText(str); } // Add to the list @@ -989,12 +989,12 @@ class CAHGuildSheetMenuOpen : public IActionHandler public: // Current selection static sint32 MemberIndexSelected; // Index of the member selected when right clicked - static ucstring MemberNameSelected; // Name of the member selected when right clicked (for extra check) + static std::string MemberNameSelected; // Name of the member selected when right clicked (for extra check) }; REGISTER_ACTION_HANDLER (CAHGuildSheetMenuOpen, "guild_member_menu_open"); sint32 CAHGuildSheetMenuOpen::MemberIndexSelected= -1; -ucstring CAHGuildSheetMenuOpen::MemberNameSelected; +std::string CAHGuildSheetMenuOpen::MemberNameSelected; // *************************************************************************** @@ -1084,17 +1084,17 @@ public: MemberIndexSelected= nLineNb; MemberNameSelected = rGuildMembers[nLineNb].Name; - CPeopleInterraction::displayTellInMainChat(MemberNameSelected.toUtf8()); + CPeopleInterraction::displayTellInMainChat(MemberNameSelected); } // Current selection static sint32 MemberIndexSelected; // Index of the member selected when left clicked - static ucstring MemberNameSelected; // Name of the member selected when lef clicked + static std::string MemberNameSelected; // Name of the member selected when lef clicked }; REGISTER_ACTION_HANDLER(CAHGuildSheetTellMember, "guild_tell_member"); sint32 CAHGuildSheetTellMember::MemberIndexSelected= -1; -ucstring CAHGuildSheetTellMember::MemberNameSelected; +string CAHGuildSheetTellMember::MemberNameSelected; // *************************************************************************** class CAHGuildSheetSetLeader : public IActionHandler diff --git a/ryzom/client/src/interface_v3/guild_manager.h b/ryzom/client/src/interface_v3/guild_manager.h index 7b8b94df2..11c44210c 100644 --- a/ryzom/client/src/interface_v3/guild_manager.h +++ b/ryzom/client/src/interface_v3/guild_manager.h @@ -37,7 +37,7 @@ struct SGuildMember { uint32 Index; // Index in the DB uint32 NameID; - ucstring Name; + std::string Name; EGSPD::CGuildGrade::TGuildGrade Grade; TCharConnectionState Online; uint32 EnterDate; @@ -54,7 +54,7 @@ struct SGuildMember struct SGuild { uint32 NameID; - ucstring Name; + std::string Name; uint64 Icon; bool QuitGuildAvailable; @@ -131,7 +131,7 @@ public: bool isLeaderOfTheGuild(); /// If the player is in a guild get the guild name else return empty - ucstring getGuildName(); + std::string getGuildName(); /// If the player is in a guild get the amount of money the guild owns else return zero uint64 getMoney(); @@ -270,7 +270,7 @@ private: // Join Proposal handling uint32 _JoinPropPhraseID; - ucstring _JoinPropPhrase; + std::string _JoinPropPhrase; bool _JoinPropUpdate; }; diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 4330782bc..0fa12432b 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -310,12 +310,12 @@ public: class CStringManagerTextProvider : public CViewTextID::IViewTextProvider { - bool getString( uint32 stringId, ucstring &result ) + bool getString( uint32 stringId, string &result ) { return STRING_MANAGER::CStringManagerClient::instance()->getString( stringId, result ); } - bool getDynString( uint32 dynStringId, ucstring &result ) + bool getDynString( uint32 dynStringId, string &result ) { return STRING_MANAGER::CStringManagerClient::instance()->getDynString( dynStringId, result ); } @@ -400,7 +400,7 @@ public: } } // get the title translated - ucstring sTitleTranslated = botName; // FIXME: UTF-8 + string sTitleTranslated = botName; // FIXME: UTF-8 CStringPostProcessRemoveName spprn; spprn.Woman = womanTitle; spprn.cbIDStringReceived(sTitleTranslated); @@ -412,14 +412,14 @@ public: { // But if there is no name, display only the title if (botName.empty()) - botName = sTitleTranslated.toUtf8(); + botName = sTitleTranslated; } else { // Else we want the title ! if (!botName.empty()) botName += " "; - botName += sTitleTranslated.toUtf8(); + botName += sTitleTranslated; } formatedResult += botName; @@ -2347,7 +2347,7 @@ void CInterfaceManager::processServerIDString() for (uint32 i = 0; i < _IDStringWaiters.size(); ++i) { bool bAffect = false; - ucstring ucstrToAffect; + string ucstrToAffect; SIDStringWaiter *pISW = _IDStringWaiters[i]; if (pISW->IdOrString == true) // ID ! { @@ -2374,7 +2374,7 @@ void CInterfaceManager::processServerIDString() if (bValid) { ucstrToAffect = STRING_MANAGER::CStringManagerClient::getLocalizedName(ucstrToAffect); - val.setString (ucstrToAffect.toUtf8()); + val.setString (ucstrToAffect); CInterfaceLink::setTargetProperty (pISW->Target, val); } @@ -4243,10 +4243,10 @@ bool CInterfaceManager::parseTokens(string& ucstr) else if (token_param == "guild") { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - ucstring ucGuildName; + string ucGuildName; if (pSMC->getString(pTokenSubjectEntity->getGuildNameID(), ucGuildName)) { - token_replacement = ucGuildName.empty() ? token_replacement : ucGuildName.toUtf8(); + token_replacement = ucGuildName.empty() ? token_replacement : ucGuildName; } } else if (token_param.substr(0, 3) == "gs(" && diff --git a/ryzom/client/src/interface_v3/interface_manager.h b/ryzom/client/src/interface_v3/interface_manager.h index 39fd12dc4..2aed09dc5 100644 --- a/ryzom/client/src/interface_v3/interface_manager.h +++ b/ryzom/client/src/interface_v3/interface_manager.h @@ -249,7 +249,7 @@ public: { public: virtual ~IStringProcess() { } - virtual bool cbIDStringReceived(ucstring &inOut) = 0; // called when string or id is received (return true if valid the change) + virtual bool cbIDStringReceived(std::string &inOut) = 0; // called when string or id is received (return true if valid the change) }; void addServerString (const std::string &sTarget, uint32 id, IStringProcess *cb = NULL); diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index fec5ff3fe..55d31bf54 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -3276,9 +3276,7 @@ void CLuaIHMRyzom::browseNpcWebPage(const std::string &htmlId, const std::string { userName = UserEntity->getDisplayName(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - ucstring ucsTmp; - pSMC->getString(UserEntity->getGuildNameID(), ucsTmp); - guildName = ucsTmp.toString(); + pSMC->getString(UserEntity->getGuildNameID(), guildName); while (guildName.find(' ') != string::npos) { @@ -3329,16 +3327,16 @@ void CLuaIHMRyzom::clearHtmlUndoRedo(const std::string &htmlId) ucstring CLuaIHMRyzom::getDynString(sint32 dynStringId) { //H_AUTO(Lua_CLuaIHM_getDynString) - ucstring result; + string result; STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynStringId, result); - return result; + return ucstring::makeFromUtf8(result); // TODO: Lua UTF-8 } // *************************************************************************** bool CLuaIHMRyzom::isDynStringAvailable(sint32 dynStringId) { //H_AUTO(Lua_CLuaIHM_isDynStringAvailable) - ucstring result; + string result; bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynStringId, result); return res; } @@ -3490,7 +3488,7 @@ string CLuaIHMRyzom::getGuildMemberName(sint32 nMemberId) if ((nMemberId < 0) || (nMemberId >= getNbGuildMembers())) return ""; - return CGuildManager::getInstance()->getGuildMembers()[nMemberId].Name.toString(); + return CGuildManager::getInstance()->getGuildMembers()[nMemberId].Name; } // *************************************************************************** diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index eaf6386c2..e1a01400d 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -934,7 +934,7 @@ class CHandlerChatGroupFilter : public IActionHandler case CChatGroup::dyn_chat: uint32 index = PeopleInterraction.TheUserChat.Filter.getTargetDynamicChannelDbIndex(); uint32 textId = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DYN_CHAT:CHANNEL"+toString(index)+":NAME")->getValue32(); - ucstring title; + string title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); if (title.empty()) { @@ -944,7 +944,7 @@ class CHandlerChatGroupFilter : public IActionHandler } else { - pUserBut->setHardText(title.toUtf8()); + pUserBut->setHardText(title); } break; } @@ -1297,7 +1297,7 @@ void CPeopleInterraction::addContactInList(uint32 contactId, const ucstring &nam //================================================================================================================= void CPeopleInterraction::addContactInList(uint32 contactId, uint32 nameID, TCharConnectionState online, uint8 nList) { - ucstring name; + string name; STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); if (pSMC->getString(nameID, name)) { @@ -1357,7 +1357,7 @@ void CPeopleInterraction::updateWaitingContacts() for (uint32 i = 0; i < WaitingContacts.size();) { SWaitingContact &w = WaitingContacts[i]; - ucstring name; + string name; STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); if (pSMC->getString(w.NameId, name)) { @@ -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; - ucstring name = toLower(FriendList.getName(index)); + string name = toLower(FriendList.getName(index).toUtf8()); for (uint i = 0; i < GuildMembers.size(); ++i) { if (toLower(GuildMembers[i].Name) == name) @@ -2635,12 +2635,12 @@ public: uint32 canWrite = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DYN_CHAT:CHANNEL"+s+":WRITE_RIGHT")->getValue32(); if (canWrite != 0) { - ucstring title; + string title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); // replace dynamic channel name and shortcut string res = CI18N::get("uiFilterMenuDynamic"); - strFindReplace(res, "%channel", title.toUtf8()); + strFindReplace(res, "%channel", title); strFindReplace(res, "%shortcut", s); pMenu->addLineAtIndex(5 + insertion_index, res, "chat_target_selected", "dyn"+s, "dyn"+s); @@ -2828,9 +2828,9 @@ class CHandlerSelectChatSource : public IActionHandler pVTM->setActive(active); if (active) { - ucstring title; + string title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); - pVTM->setText("["+s+"] " + title.toUtf8()); + pVTM->setText("["+s+"] " + title); } } } @@ -2953,9 +2953,9 @@ class CHandlerSelectChatSource : public IActionHandler bool active = (textId != 0); if (active) { - ucstring title; + string title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); - menu->addLineAtIndex(insertionIndex, "["+s+"] " + title.toUtf8(), FILTER_TOGGLE, "dyn"+s); + menu->addLineAtIndex(insertionIndex, "["+s+"] " + title, FILTER_TOGGLE, "dyn"+s); menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, "dyn"+s, pi.ChatInput.DynamicChat[i].isListeningWindow(cw))); ++insertionIndex; } diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index f4ceb511c..cdb4261c0 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -3266,8 +3266,8 @@ private: STRING_MANAGER::CStringManagerClient *pSMC= STRING_MANAGER::CStringManagerClient::instance(); // get the content string (should have been received!) - ucstring contentStr; - ucstring titleStr; + string contentStr; + string titleStr; if(!pSMC->getDynString(_TextId[ContentType], contentStr)) return; @@ -3294,8 +3294,8 @@ private: } if(i != digitMaxEnd) { - ucstring web_app = contentStr.substr(digitStart, i-digitStart); - contentStr = ucstring(ClientCfg.WebIgMainDomain + "/") + web_app + ucstring("/index.php?") + contentStr.substr((size_t)i + 1); + string web_app = contentStr.substr(digitStart, i-digitStart); + contentStr = string(ClientCfg.WebIgMainDomain + "/") + web_app + string("/index.php?") + contentStr.substr((size_t)i + 1); } else { @@ -3329,7 +3329,7 @@ private: if (is_webig) { CGroupHTML *groupHtml; - string group = titleStr.toString(); + string group = titleStr; // group = group.substr(9, group.size()-10); groupHtml = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:"+group+":content:html")); @@ -3352,7 +3352,7 @@ private: { if (group == "webig") pGC->setActive(true); - string url = contentStr.toString(); + string url = contentStr; addWebIGParams(url, true); groupHtml->browse(url.c_str()); CWidgetManager::getInstance()->setTopWindow(pGC); @@ -3372,7 +3372,7 @@ private: // must set the text by hand CViewText *vt= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("server_message_box_content_view_text"))); if(vt) - vt->setTextFormatTaged(contentStr.toUtf8()); + vt->setTextFormatTaged(contentStr); // open CWidgetManager::getInstance()->setTopWindow(pGC); diff --git a/ryzom/client/src/string_manager_client.h b/ryzom/client/src/string_manager_client.h index 5179318f4..e29f78b6f 100644 --- a/ryzom/client/src/string_manager_client.h +++ b/ryzom/client/src/string_manager_client.h @@ -64,11 +64,11 @@ public: void flushStringCache(); bool getString(uint32 stringId, std::string &result); - bool getString(uint32 stringId, ucstring &result) { std::string temp; bool res = getString(stringId, temp); result.fromUtf8(temp); return res; } // FIXME: UTF-8 + // bool getString(uint32 stringId, ucstring &result) { std::string temp; bool res = getString(stringId, temp); result.fromUtf8(temp); return res; } // FIXME: UTF-8 void waitString(uint32 stringId, const IStringWaiterRemover *premover, std::string *result); void waitString(uint32 stringId, IStringWaitCallback *pcallback); bool getDynString(uint32 dynStringId, std::string &result); - bool getDynString(uint32 dynStringId, ucstring &result) { std::string temp; bool res = getString(dynStringId, temp); result.fromUtf8(temp); return res; } // FIXME: UTF-8 + // bool getDynString(uint32 dynStringId, ucstring &result) { std::string temp; bool res = getString(dynStringId, temp); result.fromUtf8(temp); return res; } // FIXME: UTF-8 void waitDynString(uint32 stringId, const IStringWaiterRemover *premover, std::string *result); void waitDynString(uint32 stringId, IStringWaitCallback *pcallback); From d201b8a39250df3cd6abfc93253d73c9e3d0939f Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 13:47:52 +0800 Subject: [PATCH 115/205] UTF-8 various, ryzom/ryzomcore#335 --- ryzom/client/src/candidate.h | 3 +- ryzom/client/src/character_cl.cpp | 16 ++--- ryzom/client/src/client_cfg.cpp | 7 +-- ryzom/client/src/client_cfg.h | 4 +- ryzom/client/src/client_chat_manager.cpp | 24 ++++---- ryzom/client/src/client_chat_manager.h | 2 +- ryzom/client/src/commands.cpp | 14 ++--- ryzom/client/src/connection.cpp | 6 +- ryzom/client/src/continent.h | 2 +- ryzom/client/src/entities.cpp | 17 +++--- ryzom/client/src/entities.h | 4 +- ryzom/client/src/entity_cl.cpp | 14 ++--- ryzom/client/src/entity_cl.h | 8 +-- ryzom/client/src/far_tp.cpp | 4 +- ryzom/client/src/forage_source_cl.cpp | 2 +- ryzom/client/src/init.cpp | 8 +-- ryzom/client/src/init_main_loop.cpp | 4 +- .../src/interface_v3/action_handler_game.cpp | 58 +++++++++---------- .../src/interface_v3/flying_text_manager.cpp | 4 +- .../src/interface_v3/flying_text_manager.h | 2 +- .../interface_v3/group_in_scene_bubble.cpp | 51 +++++++--------- .../src/interface_v3/group_in_scene_bubble.h | 16 ++--- ryzom/client/src/main_loop.cpp | 2 +- ryzom/client/src/net_manager.cpp | 8 +-- .../src/r2/dmc/client_edition_module.cpp | 2 +- ryzom/client/src/string_manager_client.h | 2 - .../src/game_share/generic_xml_msg_mngr.cpp | 10 ++++ .../src/game_share/generic_xml_msg_mngr.h | 8 +++ 28 files changed, 151 insertions(+), 151 deletions(-) diff --git a/ryzom/client/src/candidate.h b/ryzom/client/src/candidate.h index aa190111a..41d04e681 100644 --- a/ryzom/client/src/candidate.h +++ b/ryzom/client/src/candidate.h @@ -15,7 +15,7 @@ // along with this program. If not, see . - +#if 0 #ifndef CL_CANDIDATE_H #define CL_CANDIDATE_H @@ -39,3 +39,4 @@ struct Candidate #endif // CL_CANDIDATE_H +#endif \ No newline at end of file diff --git a/ryzom/client/src/character_cl.cpp b/ryzom/client/src/character_cl.cpp index 676bf11f4..411795200 100644 --- a/ryzom/client/src/character_cl.cpp +++ b/ryzom/client/src/character_cl.cpp @@ -809,9 +809,9 @@ bool CCharacterCL::build(const CEntitySheet *sheet) // virtual if (Type == Fauna) { // Get the fauna name in the sheet - const ucstring creatureName(STRING_MANAGER::CStringManagerClient::getCreatureLocalizedName(_Sheet->Id)); - if (creatureName.find(ucstring("Id); + if (!FINAL_VERSION || !NLMISC::startsWith(creatureName, "Id)); - if (name.find(ucstring("Id); + if (!FINAL_VERSION || !NLMISC::startsWith(name, "render3D(mat, name); } } @@ -7674,9 +7674,9 @@ void CCharacterCL::displayModifiers() // virtual } else if (TimeInSec >= mod.Time) { - ucstring hpModifier; + string hpModifier; if (mod.Text.empty()) - hpModifier = ucstring(toString("%d", mod.Value)); + hpModifier = toString("%d", mod.Value); else hpModifier = mod.Text; double t = TimeInSec-mod.Time; diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index 21d73859e..f7f91e7ad 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -2278,14 +2278,13 @@ string CClientConfig::getHtmlLanguageCode() const } // *************************************************************************** -ucstring CClientConfig::buildLoadingString( const ucstring& ucstr ) const +string CClientConfig::buildLoadingString( const string& ucstr ) const { if( LoadingStringCount > 0 ) { uint index = rand()%LoadingStringCount; - string tipId = "uiLoadingString"+toString(index); - ucstring randomUCStr = CI18N::get(tipId); - return randomUCStr; + string tipId = "uiLoadingString" + toString(index); + return CI18N::get(tipId); } else return ucstr; diff --git a/ryzom/client/src/client_cfg.h b/ryzom/client/src/client_cfg.h index a8404fb39..47c32d003 100644 --- a/ryzom/client/src/client_cfg.h +++ b/ryzom/client/src/client_cfg.h @@ -893,10 +893,10 @@ public: float getActualLandscapeThreshold() const; // Return LanguageCode but if "wk", then return "en" - string getHtmlLanguageCode() const; + std::string getHtmlLanguageCode() const; // return a random loading tip or, if there are not, return the string in argument - ucstring buildLoadingString( const ucstring& ucstr ) const; + std::string buildLoadingString(const std::string &ucstr) const; /// get the path to client_default.cfg including the filename itself. bool getDefaultConfigLocation(std::string& fileLocation) const; diff --git a/ryzom/client/src/client_chat_manager.cpp b/ryzom/client/src/client_chat_manager.cpp index a6ec40bdd..ec8da3eb1 100644 --- a/ryzom/client/src/client_chat_manager.cpp +++ b/ryzom/client/src/client_chat_manager.cpp @@ -285,11 +285,11 @@ void CClientChatManager::init( const string& /* staticDBFileName */ ) void CClientChatManager::chat( const string& strIn, bool isChatTeam ) { // Truncate to 255 chars max (because of server restriction) - ucstring str= ucstring(strIn).substr(0,255); + ucstring str= ucstring(strIn).substr(0,255); // FIXME: UTF-8 (serial) // send str to IOS CBitMemStream bms; - string msgType; + const char *msgType; if (isChatTeam) { @@ -303,13 +303,13 @@ void CClientChatManager::chat( const string& strIn, bool isChatTeam ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) { - bms.serial( str ); // FIXME: UTF-8 + bms.serial( str ); // FIXME: UTF-8 (serial) NetMngr.push( bms ); //nlinfo("impulseCallBack : %s %s sent", msgType.c_str(), str.toString().c_str()); } else { - nlwarning(" unknown message name : %s", msgType.c_str()); + nlwarning(" unknown message name : %s", msgType); } if (UserEntity != NULL) UserEntity->setAFK(false); @@ -324,8 +324,8 @@ void CClientChatManager::chat( const string& strIn, bool isChatTeam ) void CClientChatManager::tell( const string& receiverIn, const string& strIn ) { // Truncate to 255 chars max (because of server restriction) - string receiver= receiverIn.substr(0,255); - ucstring str= ucstring(strIn).substr(0,255); + string receiver= receiverIn.substr(0,255); // FIXME: UTF-8 (serial) + ucstring str= ucstring(strIn).substr(0,255); // FIXME: UTF-8 (serial) // *** send str CBitMemStream bms; @@ -454,7 +454,7 @@ void CClientChatManager::processTellString(NLMISC::CBitMemStream& bms, IChatDisp // Serial. For tell message, there is no chat mode, coz we know we are in tell mode ! bms.serial (chatMsg.CompressedIndex); bms.serial (chatMsg.SenderNameId); - bms.serial (chatMsg.Content); // FIXME: UTF-8 + bms.serial (chatMsg.Content); // FIXME: UTF-8 (serial) if (PermanentlyBanned) return; @@ -718,7 +718,7 @@ string CClientChatManager::getString( CBitMemStream& bms, string& ucstr ) string::size_type idx = ucstr.find(ucstrTmp); // if there's a parameter in the string - if( idx != ucstring::npos ) + if( idx != string::npos ) { char c = (char)ucstr[idx+ucstrTmp.size()]; switch( c ) @@ -967,8 +967,8 @@ void CClientChatManager::buildTellSentence(const string &sender, const string &m name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); { // Sometimes translation contains another title - ucstring::size_type pos = name.find('$'); - if (pos != ucstring::npos) + string::size_type pos = name.find('$'); + if (pos != string::npos) { name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name), bWoman); } @@ -1048,8 +1048,8 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); { // Sometimes translation contains another title - ucstring::size_type pos = senderName.find('$'); - if (pos != ucstring::npos) + string::size_type pos = senderName.find('$'); + if (pos != string::npos) { senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName), bWoman); } diff --git a/ryzom/client/src/client_chat_manager.h b/ryzom/client/src/client_chat_manager.h index 06792a50f..19afcab15 100644 --- a/ryzom/client/src/client_chat_manager.h +++ b/ryzom/client/src/client_chat_manager.h @@ -304,7 +304,7 @@ private : uint8 ChatMode; NLMISC::CEntityId DynChatChanID; // For Chat and Tell messages - ucstring Content; + ucstring Content; // FIXME: UTF-8 (serial) // For Chat2 and Tell2 messages uint32 PhraseId; // Use PhraseId or Content? diff --git a/ryzom/client/src/commands.cpp b/ryzom/client/src/commands.cpp index 3fea9a2a7..e64796b28 100644 --- a/ryzom/client/src/commands.cpp +++ b/ryzom/client/src/commands.cpp @@ -924,9 +924,7 @@ NLMISC_COMMAND(a, "Execute an admin command on you"," ") cmd = args[0]; for (uint i = 1; i < args.size(); i++) { - // temporary fix for utf-8 - // servers commands are not decoded so convert them to ansi - std::string tmp = ucstring::makeFromUtf8(args[i]).toString(); + std::string tmp = args[i]; if (!arg.empty()) arg += ' '; @@ -968,9 +966,7 @@ NLMISC_COMMAND(b, "Execute an admin command on your target"," ") cmd = args[0]; for (uint i = 1; i < args.size(); i++) { - // temporary fix for utf-8 - // servers commands are not decoded so convert them to ansi - std::string tmp = ucstring::makeFromUtf8(args[i]).toString(); + std::string tmp = args[i]; if (!arg.empty()) arg += ' '; @@ -1015,9 +1011,7 @@ NLMISC_COMMAND(c, "Execute an admin command on character name"," cmd = args[1]; for (uint i = 2; i < args.size(); i++) { - // temporary fix for utf-8 - // servers commands are not decoded so convert them to ansi - std::string tmp = ucstring::makeFromUtf8(args[i]).toString(); + std::string tmp = args[i]; if (!arg.empty()) arg += ' '; @@ -3863,7 +3857,7 @@ NLMISC_COMMAND(testLongBubble, "To display a bubble with a long text", " fromString(args[0], entityId); CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring text("test\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\n"); + string text("test\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\n"); uint duration = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutBubbles).getValSInt32(); CEntityCL *entity = EntitiesMngr.entity(entityId); diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 6e5276755..6054b6a07 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -360,7 +360,7 @@ bool connection (const string &cookie, const string &fsaddr) // Preload continents { - const ucstring nmsg("Loading continents..."); + const string nmsg("Loading continents..."); ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); ContinentMngr.preloadSheets(); @@ -398,7 +398,7 @@ bool connection (const string &cookie, const string &fsaddr) // Init out game setOutGameFullScreen(); - ucstring nmsg("Initializing outgame..."); + string nmsg("Initializing outgame..."); ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); pIM->initOutGame(); @@ -542,7 +542,7 @@ bool reconnection() // Preload continents { - const ucstring nmsg ("Loading continents..."); + const string nmsg ("Loading continents..."); ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); ContinentMngr.preloadSheets(); } diff --git a/ryzom/client/src/continent.h b/ryzom/client/src/continent.h index 7e0d599b4..f48b4b043 100644 --- a/ryzom/client/src/continent.h +++ b/ryzom/client/src/continent.h @@ -109,7 +109,7 @@ public: }; NLMISC::CVector2f Pos; // Pos in local map - ucstring Title; + ucstring Title; // FIXME: UTF-8 (serial) uint8 Type; //User LandMarks Colors diff --git a/ryzom/client/src/entities.cpp b/ryzom/client/src/entities.cpp index 99caacf45..80d64c35a 100644 --- a/ryzom/client/src/entities.cpp +++ b/ryzom/client/src/entities.cpp @@ -2268,7 +2268,7 @@ void CEntityManager::dumpXML(class NLMISC::IStream &f) f.xmlPushBegin("Name"); // Set a property name f.xmlSetAttrib ("string"); - ucstring n = _Entities[i]->getEntityName(); + string n = _Entities[i]->getEntityName(); f.serial(n); // Close the new node header f.xmlPushEnd(); @@ -2361,11 +2361,11 @@ CEntityCL *CEntityManager::getEntityByName (uint32 stringId) const } //----------------------------------------------- -CEntityCL *CEntityManager::getEntityByKeywords (const std::vector &keywords, bool onlySelectable) const +CEntityCL *CEntityManager::getEntityByKeywords (const std::vector &keywords, bool onlySelectable) const { if (keywords.empty()) return NULL; - std::vector lcKeywords; + std::vector lcKeywords; lcKeywords.resize(keywords.size()); for(uint k = 0; k < keywords.size(); k++) { @@ -2382,14 +2382,13 @@ CEntityCL *CEntityManager::getEntityByKeywords (const std::vector &key if (onlySelectable && !_Entities[i]->properties().selectable()) continue; - ucstring lcName; - lcName = toLower(_Entities[i]->getDisplayName()); + string lcName = toLower(_Entities[i]->getDisplayName()); if (lcName.empty()) continue; bool match = true; for (uint k = 0; k < lcKeywords.size(); ++k) { - if (lcName.find(lcKeywords[k]) == ucstring::npos) + if (lcName.find(lcKeywords[k]) == string::npos) { match = false; break; @@ -2418,9 +2417,9 @@ CEntityCL *CEntityManager::getEntityByKeywords (const std::vector &key } //----------------------------------------------- -CEntityCL *CEntityManager::getEntityByName (const ucstring &name, bool caseSensitive, bool complete) const +CEntityCL *CEntityManager::getEntityByName (const string &name, bool caseSensitive, bool complete) const { - ucstring source = name; + string source = name; const uint size = (uint)source.size(); if (!caseSensitive) { @@ -2438,7 +2437,7 @@ CEntityCL *CEntityManager::getEntityByName (const ucstring &name, bool caseSensi { if(_Entities[i]) { - ucstring value = _Entities[i]->getDisplayName(); + string value = _Entities[i]->getDisplayName(); bool foundEntity = false; uint j; diff --git a/ryzom/client/src/entities.h b/ryzom/client/src/entities.h index 48707d5cf..d6d286ced 100644 --- a/ryzom/client/src/entities.h +++ b/ryzom/client/src/entities.h @@ -308,13 +308,13 @@ public: * \param caseSensitive type of test to perform * \param complete : if true, the name must match the full name of the entity. */ - CEntityCL *getEntityByName (const ucstring &name, bool caseSensitive, bool complete) const; + CEntityCL *getEntityByName (const std::string &name, bool caseSensitive, bool complete) const; /** * Case insensitive match against entity name. All listed keywords must match. * \param keywords to match * \param onlySelectable : if true, match only entity that can be selected */ - CEntityCL *getEntityByKeywords (const std::vector &keywords, bool onlySelectable) const; + CEntityCL *getEntityByKeywords (const std::vector &keywords, bool onlySelectable) const; CEntityCL *getEntityBySheetName (const std::string &sheet) const; /// Get an entity by dataset index. Returns NULL if the entity is not found. CEntityCL *getEntityByCompressedIndex(TDataSetIndex compressedIndex) const; diff --git a/ryzom/client/src/entity_cl.cpp b/ryzom/client/src/entity_cl.cpp index 5071f771d..77d1e3c65 100644 --- a/ryzom/client/src/entity_cl.cpp +++ b/ryzom/client/src/entity_cl.cpp @@ -2276,11 +2276,11 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) // check if there is any replacement tag in the string string::size_type p1 = _EntityName.find('$'); - if (p1 != ucstring::npos) + if (p1 != string::npos) { // we found a replacement point begin tag string::size_type p2 = _EntityName.find('$', p1+1); - if (p2 != ucstring::npos) + if (p2 != string::npos) { // ok, we have the second replacement point! // extract the replacement id @@ -2300,7 +2300,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) // Sometimes translation contains another title { string::size_type pos = replacement.find('$'); - if (pos != ucstring::npos) + if (pos != string::npos) { _EntityName = _EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(sn.substr(0, pos)); string::size_type pos2 = replacement.find('$', pos + 1); @@ -2318,7 +2318,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) _EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(_EntityName.substr(0, p1)); // + _Name.substr(p2+1) // Get extended name _NameEx = replacement; - newtitle = _NameEx.toUtf8(); + newtitle = _NameEx; } CHARACTER_TITLE::ECharacterTitle titleEnum = CHARACTER_TITLE::toCharacterTitle( _TitleRaw ); if ( titleEnum >= CHARACTER_TITLE::BeginGmTitle && titleEnum <= CHARACTER_TITLE::EndGmTitle ) @@ -2372,7 +2372,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) std::string CEntityCL::getTitleFromName(const std::string &name) { std::string::size_type p1 = name.find('$'); - if (p1 != ucstring::npos) + if (p1 != string::npos) { std::string::size_type p2 = name.find('$', p1 + 1); if (p2 != std::string::npos) @@ -2388,14 +2388,14 @@ std::string CEntityCL::getTitleFromName(const std::string &name) std::string CEntityCL::removeTitleFromName(const std::string &name) { std::string::size_type p1 = name.find('$'); - if (p1 == ucstring::npos) + if (p1 == string::npos) { return name; } else { std::string::size_type p2 = name.find('$', p1 + 1); - if (p2 != ucstring::npos) + if (p2 != string::npos) { return name.substr(0, p1) + name.substr(p2 + 1); } diff --git a/ryzom/client/src/entity_cl.h b/ryzom/client/src/entity_cl.h index 0f1296780..04689a3ac 100644 --- a/ryzom/client/src/entity_cl.h +++ b/ryzom/client/src/entity_cl.h @@ -638,7 +638,7 @@ public: // Add hit points gain/lost by this entity. void addHPOutput(sint16 hp, NLMISC::CRGBA color, float dt=0.0f) { if(_HPModifiers.size()<20) _HPModifiers.push_back(CHPModifier(hp,color,dt));} - void addHPOutput(const ucstring &text, NLMISC::CRGBA color, float dt=0.0f) { if(_HPModifiers.size()<20 && !text.empty()) _HPModifiers.push_back(CHPModifier(text,color,dt));} + void addHPOutput(const std::string &text, NLMISC::CRGBA color, float dt=0.0f) { if(_HPModifiers.size()<20 && !text.empty()) _HPModifiers.push_back(CHPModifier(text,color,dt));} /// Return the entity sheet scale. (return 1.0 if there is any problem). virtual float getSheetScale() const {return 1.0f;} @@ -944,7 +944,7 @@ protected: bool _HasReservedTitle; // Extended Name - ucstring _NameEx; + std::string _NameEx; // String ID uint32 _NameId; // Primitive used for the collision in PACS @@ -995,10 +995,10 @@ protected: CHPModifier() {} virtual ~CHPModifier() {} CHPModifier (sint16 value, NLMISC::CRGBA color, float dt) : Value(value), Color(color), DeltaT(dt) {} - CHPModifier (const ucstring &text, NLMISC::CRGBA color, float dt) : Text(text), Color(color), DeltaT(dt) {} + CHPModifier (const std::string &text, NLMISC::CRGBA color, float dt) : Text(text), Color(color), DeltaT(dt) {} sint16 Value; // If Text.empty(), take the Value - ucstring Text; + std::string Text; NLMISC::CRGBA Color; float DeltaT; }; diff --git a/ryzom/client/src/far_tp.cpp b/ryzom/client/src/far_tp.cpp index c250aec95..fa3d9720d 100644 --- a/ryzom/client/src/far_tp.cpp +++ b/ryzom/client/src/far_tp.cpp @@ -927,7 +927,7 @@ retryJoinEdit: } } pIM->messageBoxWithHelp( - CI18N::get(requestRetToMainland ? "uiSessionVanishedFarTP" : "uiSessionUnreachable") + ucstring(errorMsg), + CI18N::get(requestRetToMainland ? "uiSessionVanishedFarTP" : "uiSessionUnreachable") + errorMsg, letReturnToCharSelect ? "ui:outgame:charsel" : "ui:interface"); // Info in the log @@ -1117,7 +1117,7 @@ void CFarTP::disconnectFromPreviousShard() // Start progress bar and display background ProgressBar.reset (BAR_STEP_TP); - ucstring nmsg("Loading..."); + string nmsg("Loading..."); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); ProgressBar.progress(0); diff --git a/ryzom/client/src/forage_source_cl.cpp b/ryzom/client/src/forage_source_cl.cpp index e813912df..7141ad62f 100644 --- a/ryzom/client/src/forage_source_cl.cpp +++ b/ryzom/client/src/forage_source_cl.cpp @@ -623,7 +623,7 @@ void CForageSourceCL::displayModifiers() { uint16 qttyDelta = ((uint16)mod.Value) & 0xFF; uint16 qlty = ((uint16)mod.Value) >> 8; - ucstring hpModifier = ucstring(toString("%u ", qttyDelta) + CI18N::get("uittQualityAbbrev") + toString(" %u", qlty)); + string hpModifier = toString("%u ", qttyDelta) + CI18N::get("uittQualityAbbrev") + toString(" %u", qlty); double t = TimeInSec-mod.Time; // Compute the position for the Modifier. CVector pos= namePos + CVector(0.0f, 0.0f, 0.3f+(float)t*1.0f/totalDuration); diff --git a/ryzom/client/src/init.cpp b/ryzom/client/src/init.cpp index 41c924baf..b9e701e92 100644 --- a/ryzom/client/src/init.cpp +++ b/ryzom/client/src/init.cpp @@ -262,7 +262,7 @@ char *XmlStrdup4NeL (const char *str) #ifdef NL_OS_WINDOWS -static ucstring CurrentErrorMessage; +static std::wstring CurrentErrorMessage; static INT_PTR CALLBACK ExitClientErrorDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM /* lParam */) { @@ -338,7 +338,7 @@ void ExitClientError (const char *format, ...) } #ifdef NL_OS_WINDOWS - CurrentErrorMessage.fromUtf8(str); + CurrentErrorMessage = NLMISC::utf8ToWide(str); DialogBox(HInstance, MAKEINTRESOURCE(IDD_ERROR_HELP_MESSAGE_BOX), NULL, ExitClientErrorDialogProc); /* ucstring ucstr; @@ -937,7 +937,7 @@ void prelogInit() initDebugMemory(); // Load the application configuration. - ucstring nmsg("Loading config file..."); + string nmsg("Loading config file..."); ProgressBar.newMessage (nmsg); ClientCfg.init(ConfigFileName); @@ -1532,7 +1532,7 @@ void postlogInit() Driver->clearBuffers(CRGBA::Black); Driver->swapBuffers(); CNiceInputAuto niceInputs; - ucstring nmsg; + string nmsg; try { diff --git a/ryzom/client/src/init_main_loop.cpp b/ryzom/client/src/init_main_loop.cpp index e2566e48f..0714d1553 100644 --- a/ryzom/client/src/init_main_loop.cpp +++ b/ryzom/client/src/init_main_loop.cpp @@ -469,7 +469,7 @@ void initMainLoop() // Progress bar for init_main_loop() ProgressBar.reset (BAR_STEP_INIT_MAIN_LOOP); - ucstring nmsg; + string nmsg; FPU_CHECKER_ONCE @@ -1017,7 +1017,7 @@ void initMainLoop() // PreLoad Fauna and Characters if (!ClientCfg.Light && ClientCfg.PreCacheShapes) { - ucstring nmsg("Loading character shapes ..."); + string nmsg("Loading character shapes ..."); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 3b3738c38..ee243a5a2 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -192,9 +192,9 @@ public: CEntityCL *selection = EntitiesMngr.entity(UserEntity->selection()); if (selection && selection->Type == CEntityCL::Player) { - ucstring name = CEntityCL::removeTitleAndShardFromName(selection->getEntityName()); + string name = CEntityCL::removeTitleAndShardFromName(selection->getEntityName()); if (name.empty()) return; - CAHManager::getInstance()->runActionHandler("enter_tell", pCaller, "player=" + name.toString()); + CAHManager::getInstance()->runActionHandler("enter_tell", pCaller, "player=" + name); } } protected: @@ -1963,7 +1963,7 @@ public: // Sometimes translation contains another title string::size_type pos = copyInout.find('$'); - if (pos != ucstring::npos) + if (pos != string::npos) { copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle); } @@ -2038,8 +2038,8 @@ class CActionHandlerSetTargetName : public IActionHandler { sint32 nSlot = (sint32)evValue.getInteger(); - ucstring TargetName; - ucstring TargetTitle; + string TargetName; + string TargetTitle; // Get from nSlot if (nSlot > -1) @@ -2074,9 +2074,9 @@ class CActionHandlerSetTargetName : public IActionHandler // Set to target CInterfaceExprValue evUCStr; TargetName = STRING_MANAGER::CStringManagerClient::getLocalizedName(TargetName); - evUCStr.setString(TargetName.toUtf8()); + evUCStr.setString(TargetName); CInterfaceLink::setTargetProperty(sNameTarget, evUCStr); - evUCStr.setString(TargetTitle.toUtf8()); + evUCStr.setString(TargetTitle); CInterfaceLink::setTargetProperty(sTitleTarget, evUCStr); } } @@ -2424,28 +2424,27 @@ class CAHTarget : public IActionHandler { virtual void execute (CCtrlBase * /* pCaller */, const string &Params) { - ucstring entityName; - entityName.fromUtf8(getParam(Params, "entity")); + string entityName = getParam(Params, "entity"); if (entityName.empty()) return; string completeMatch = getParam(Params, "prefer_complete_match"); bool quiet = (getParam (Params, "quiet") == "true"); - vector keywords; - NLMISC::splitUCString(entityName, ucstring(" "), keywords); - if (!keywords.empty() && keywords[0].size() > 0 && keywords[0][0] == (ucchar)'"') + vector keywords; + NLMISC::splitString(entityName, " ", keywords); + if (!keywords.empty() && keywords[0].size() > 0 && keywords[0][0] == '"') { // entity name is in quotes, do old style match with 'starts with' filter // search for optional second parameter from old command for prefer_complete_match param keywords.clear(); - ucstring::size_type lastOf = entityName.rfind(ucstring("\"")); + string::size_type lastOf = entityName.rfind("\""); if (lastOf == 0) - lastOf = ucstring::npos; + lastOf = string::npos; // override the value only when there is no 'prefer_complete_match' parameter set if (completeMatch.empty() && lastOf < entityName.size()) - completeMatch = trim(entityName.substr(lastOf+1).toUtf8()); + completeMatch = trim(entityName.substr(lastOf+1)); entityName = entityName.substr(1, lastOf-1); } @@ -2474,7 +2473,7 @@ class CAHTarget : public IActionHandler if (entity == NULL) { //Get the entity with a sheetName - entity = EntitiesMngr.getEntityBySheetName(entityName.toUtf8()); + entity = EntitiesMngr.getEntityBySheetName(entityName); } if (entity && entity->properties().selectable() && !entity->getDisplayName().empty()) @@ -2758,8 +2757,7 @@ class CAHAssist : public IActionHandler virtual void execute (CCtrlBase * /* pCaller */, const string &Params) { // Get the entity name to target - ucstring entityName; - entityName.fromUtf8 (getParam (Params, "entity")); + string entityName = getParam (Params, "entity"); if (!entityName.empty()) { // Get the entity @@ -4026,7 +4024,7 @@ 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(ucstring &str, const string &dbScore, SCORES::TScores score, const string &ttFormat) +static void fillPlayerBarText(std::string &str, const string &dbScore, SCORES::TScores score, const string &ttFormat) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); CCDBNodeLeaf *node; @@ -4056,10 +4054,10 @@ public: { CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring str; + string str; fillPlayerBarText(str, "HP", SCORES::hit_points, "uittPlayerLifeFormat"); - CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(str); } }; REGISTER_ACTION_HANDLER(CHandlerPlayerTTLife, "player_tt_life"); @@ -4073,10 +4071,10 @@ public: { CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring str; + string str; fillPlayerBarText(str, "STA", SCORES::stamina, "uittPlayerStaminaFormat"); - CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(str); } }; REGISTER_ACTION_HANDLER(CHandlerPlayerTTStamina, "player_tt_stamina"); @@ -4090,10 +4088,10 @@ public: { CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring str; + string str; fillPlayerBarText(str, "SAP", SCORES::sap, "uittPlayerSapFormat"); - CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(str); } }; REGISTER_ACTION_HANDLER(CHandlerPlayerTTSap, "player_tt_sap"); @@ -4107,10 +4105,10 @@ public: { CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring str; + string str; fillPlayerBarText(str, "FOCUS", SCORES::focus, "uittPlayerFocusFormat"); - CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(str); } }; REGISTER_ACTION_HANDLER(CHandlerPlayerTTFocus, "player_tt_focus"); @@ -4137,10 +4135,10 @@ public: maxVal= node->getValue32(); // Replace in the formated text - ucstring str= CI18N::get("uittBulkFormat"); + string str= CI18N::get("uittBulkFormat"); strFindReplace(str, "%v", toString("%.2f", val) ); strFindReplace(str, "%m", toString(maxVal) ); - CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(str); } }; REGISTER_ACTION_HANDLER(CHandlerGetTTBulk, "get_tt_bulk"); @@ -4552,7 +4550,7 @@ public: CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { - ucstring ucstr; + ucstring ucstr; // FIXME: UTF-8 (serial) ucstr.fromUtf8(sCustomPhrase); if( sCustomPhrase == "none" ) diff --git a/ryzom/client/src/interface_v3/flying_text_manager.cpp b/ryzom/client/src/interface_v3/flying_text_manager.cpp index 3f2e510e1..37daf2f9e 100644 --- a/ryzom/client/src/interface_v3/flying_text_manager.cpp +++ b/ryzom/client/src/interface_v3/flying_text_manager.cpp @@ -121,7 +121,7 @@ void CFlyingTextManager::releaseInGame() } // *************************************************************************** -void CFlyingTextManager::addFlyingText(void *key, const ucstring &text, const NLMISC::CVector &pos, CRGBA color, float scale, sint offsetX) +void CFlyingTextManager::addFlyingText(void *key, const string &text, const NLMISC::CVector &pos, CRGBA color, float scale, sint offsetX) { // key exist in the map? TInSceneCurrentMap::iterator it= _InSceneCurrent.find(key); @@ -144,7 +144,7 @@ void CFlyingTextManager::addFlyingText(void *key, const ucstring &text, const NL gi.UsedThisFrame= true; // update infos - gi.ViewText->setText(text.toUtf8()); + gi.ViewText->setText(text); gi.ViewText->setColor(color); gi.GroupInScene->Position= pos; gi.GroupInScene->Scale= scale; diff --git a/ryzom/client/src/interface_v3/flying_text_manager.h b/ryzom/client/src/interface_v3/flying_text_manager.h index 95746b6c0..14e24c887 100644 --- a/ryzom/client/src/interface_v3/flying_text_manager.h +++ b/ryzom/client/src/interface_v3/flying_text_manager.h @@ -49,7 +49,7 @@ public: /** add a flying text at a position (called during entity display). NB: may fail if no more free groups * \param offsetx: screen offsetx of the group in scene */ - void addFlyingText(void *key, const ucstring &text, const NLMISC::CVector &pos, NLMISC::CRGBA color, float scale, sint offsetX=0); + void addFlyingText(void *key, const std::string &text, const NLMISC::CVector &pos, NLMISC::CRGBA color, float scale, sint offsetX=0); /// release no more used flying text (called by CEntityManager at each draw) void releaseNotUsedFlyingText(); 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 06f81f762..35cc56ebe 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -488,7 +488,7 @@ void CGroupInSceneBubbleManager::update () // *************************************************************************** -CGroupInSceneBubble *CGroupInSceneBubbleManager::newBubble (const ucstring &text) +CGroupInSceneBubble *CGroupInSceneBubbleManager::newBubble (const string &text) { if (!text.empty() && !_Bubbles.empty()) { @@ -576,7 +576,7 @@ void CGroupInSceneBubbleManager::addSkillPopup (uint skillId, sint delta, uint t // *************************************************************************** -void CGroupInSceneBubbleManager::addMessagePopup (const ucstring &message, CRGBA color, uint time) +void CGroupInSceneBubbleManager::addMessagePopup (const string &message, CRGBA color, uint time) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); @@ -599,7 +599,7 @@ void CGroupInSceneBubbleManager::addMessagePopup (const ucstring &message, CRGBA CViewText *pViewName = dynamic_cast(group->getView("name")); if (pViewName != NULL) { - pViewName->setText (message.toUtf8()); + pViewName->setText (message); pViewName->setColor (color); } @@ -625,7 +625,7 @@ void CGroupInSceneBubbleManager::addMessagePopup (const ucstring &message, CRGBA // *************************************************************************** -void CGroupInSceneBubbleManager::addMessagePopupCenter (const ucstring &message, CRGBA color, uint time) +void CGroupInSceneBubbleManager::addMessagePopupCenter (const string &message, CRGBA color, uint time) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); @@ -648,7 +648,7 @@ void CGroupInSceneBubbleManager::addMessagePopupCenter (const ucstring &message, CViewText *pViewName = dynamic_cast(group->getView("name")); if (pViewName != NULL) { - pViewName->setTextFormatTaged(message.toUtf8()); + pViewName->setTextFormatTaged(message); pViewName->setColor (color); } @@ -757,9 +757,9 @@ CGroupInSceneBubbleManager::CPopupContext *CGroupInSceneBubbleManager::buildCont // *************************************************************************** -void CGroupInSceneBubbleManager::addContextHelp (const ucstring &message, const string &targetName, uint time) +void CGroupInSceneBubbleManager::addContextHelp (const string &message, const string &targetName, uint time) { - std::string finalMessage = message.toUtf8(); + std::string finalMessage = message; CInterfaceElement *target; CPopupContext *context = CGroupInSceneBubbleManager::buildContextHelp ("context_help_", targetName, target, time); if (context) @@ -835,7 +835,7 @@ void CGroupInSceneBubbleManager::ignoreContextHelp (CInterfaceGroup *groupToRemo // *************************************************************************** -void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText, uint bubbleTimer) +void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const std::string &ucsText, uint bubbleTimer) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); @@ -1065,9 +1065,7 @@ void CGroupInSceneBubbleManager::webIgChatOpen (uint32 nBotUID, string text, con // Update the bubble's texts - ucstring ucText; - ucText.fromUtf8(text); - bubble->setText(ucText); + bubble->setText(text); id = bubble->getId() + ":header_opened:window:"; CViewText *pVT; CCtrlLink *pCL; @@ -1092,9 +1090,8 @@ void CGroupInSceneBubbleManager::webIgChatOpen (uint32 nBotUID, string text, con if (pVT != NULL) { pVT->setActive(true); - ucstring optionText; - optionText.fromUtf8(strs[j]); - pVT->setText(optionText.toUtf8()); + string optionText = strs[j]; + pVT->setText(optionText); pCL = dynamic_cast(bubble->getElement(id+"optb"+toString(j))); if (pCL != NULL) { @@ -1425,19 +1422,19 @@ void CGroupInSceneBubble::unlink () // *************************************************************************** -void CGroupInSceneBubble::setText (const ucstring &text) +void CGroupInSceneBubble::setText (const string &text) { if (text.empty()) return; _TextParts.clear(); // Look for "{break}" in the message - ucstring finalMsg = text; - ucstring tmpMsg; + string finalMsg = text; + string tmpMsg; for(;;) { - ucstring::size_type index = finalMsg.find (ucstring("{break}")); - if (index == ucstring::npos) break; + string::size_type index = finalMsg.find ("{break}"); + if (index == string::npos) break; tmpMsg = finalMsg.substr (0, index); if (!tmpMsg.empty()) _TextParts.push_back(tmpMsg); @@ -1478,14 +1475,14 @@ void CGroupInSceneBubble::skip() // *************************************************************************** -void CGroupInSceneBubble::setRawText (const ucstring &text) +void CGroupInSceneBubble::setRawText (const string &text) { _CanBeShown = !text.empty(); CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceElement *pVTIE = CWidgetManager::getInstance()->getElementFromId(getId()+":header_opened:window:text"); CViewText *pVT= dynamic_cast(pVTIE); if (pVT != NULL) - pVT->setText(text.toUtf8()); + pVT->setText(text); } // *************************************************************************** @@ -1584,8 +1581,7 @@ class CHandlerCharacterBubble : public IActionHandler CInterfaceManager *pIM = CInterfaceManager::getInstance(); uint entityId; fromString(getParam (sParams, "entity"), entityId); - ucstring text; - text.fromUtf8(getParam (sParams, "text")); + string text = getParam (sParams, "text"); string sTime = getParam (sParams, "time"); uint duration; if (sTime.empty()) @@ -1633,10 +1629,8 @@ class CHandlerMessagePopup : public IActionHandler void execute (CCtrlBase * /* pCaller */, const std::string &sParams) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring text0; - text0.fromUtf8(getParam (sParams, "text0").c_str()); - ucstring text1; - text1.fromUtf8(getParam (sParams, "text1").c_str()); + string text0 = getParam (sParams, "text0"); + string text1 = getParam (sParams, "text1"); string sTime = getParam (sParams, "time"); uint duration; if (sTime.empty()) @@ -1660,8 +1654,7 @@ class CHandlerContextHelp : public IActionHandler string targetName = getParam (sParams, "target"); string text = getParam (sParams, "text"); - ucstring itext; - itext.fromUtf8 (getParam (sParams, "itext")); + string itext = getParam (sParams, "itext"); if (itext.empty()) itext = CI18N::get(text); diff --git a/ryzom/client/src/interface_v3/group_in_scene_bubble.h b/ryzom/client/src/interface_v3/group_in_scene_bubble.h index 288853488..f341153fa 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_bubble.h +++ b/ryzom/client/src/interface_v3/group_in_scene_bubble.h @@ -39,19 +39,19 @@ public: void update (); // Get a CGroupBubble - class CGroupInSceneBubble *newBubble (const ucstring &text); + class CGroupInSceneBubble *newBubble (const std::string &text); // Add a message popup. if 0, get the OptionTimeoutMessages - void addMessagePopup (const ucstring &message, NLMISC::CRGBA col = CRGBA::White, uint time = 0); + void addMessagePopup (const std::string &message, NLMISC::CRGBA col = CRGBA::White, uint time = 0); // The same as previous but centered in the screen. if 0, get the OptionTimeoutMessages - void addMessagePopupCenter (const ucstring &message, NLMISC::CRGBA col = CRGBA::White, uint time = 0); + void addMessagePopupCenter (const std::string &message, NLMISC::CRGBA col = CRGBA::White, uint time = 0); // Add a skill popup void addSkillPopup (uint skillId, sint delta, uint time); // Add a context help with a string - void addContextHelp (const ucstring &message, const std::string &target, uint time); + void addContextHelp (const std::string &message, const std::string &target, uint time); // Add a context help void addContextHelpHTML (const std::string &filename, const std::string &target, uint time); @@ -60,7 +60,7 @@ public: void ignoreContextHelp (CInterfaceGroup *groupToRemove); // Open a bubble chat (with next and skip button) - void chatOpen (uint32 nUID, const ucstring &ucsText, uint bubbleTimer = 0); + void chatOpen (uint32 nUID, const std::string &ucsText, uint bubbleTimer = 0); // Dynamic Chat @@ -199,7 +199,7 @@ public: void unlink (); // Set text - void setText (const ucstring &text); + void setText (const std::string &text); // Called from action handler void next(); @@ -217,7 +217,7 @@ public: private: - void setRawText (const ucstring &text); + void setRawText (const std::string &text); void displayNextAndSkip (bool show); private: @@ -233,7 +233,7 @@ private: CCharacterCL *_Character; // Multi part bubble - std::vector _TextParts; + std::vector _TextParts; uint32 _CurrentPart; }; diff --git a/ryzom/client/src/main_loop.cpp b/ryzom/client/src/main_loop.cpp index 881e14431..299972b15 100644 --- a/ryzom/client/src/main_loop.cpp +++ b/ryzom/client/src/main_loop.cpp @@ -1124,7 +1124,7 @@ bool mainLoop() // #define BAR_STEP_TP 2 ProgressBar.reset (BAR_STEP_TP); - ucstring nmsg("Loading..."); + string nmsg("Loading..."); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); ProgressBar.progress(0); ContinentMngr.select(UserEntity->pos(), ProgressBar); diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index cdb4261c0..d412fa7c8 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -1527,7 +1527,7 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason) // start progress bar and display background ProgressBar.reset (BAR_STEP_TP); - ucstring nmsg("Loading..."); + string nmsg("Loading..."); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); @@ -3463,7 +3463,7 @@ void impulseCombatFlyingHpDelta(NLMISC::CBitMemStream &impulse) CRGBA color((uint8)(rgba>>24&255), (uint8)(rgba>>16&255), (uint8)(rgba>>8&255), (uint8)(rgba&255)); CEntityCL *entity = EntitiesMngr.getEntityByCompressedIndex(entityID); if (entity) - entity->addHPOutput(ucstring(toString("%d", hpDelta)), color); + entity->addHPOutput(toString("%d", hpDelta), color); } void impulseCombatFlyingTextItemSpecialEffectProc(NLMISC::CBitMemStream &impulse) @@ -3477,7 +3477,7 @@ void impulseCombatFlyingTextItemSpecialEffectProc(NLMISC::CBitMemStream &impulse impulse.serial(effect); impulse.serial(param); CRGBA color((uint8)(rgba>>24&255), (uint8)(rgba>>16&255), (uint8)(rgba>>8&255), (uint8)(rgba&255)); - ucstring text = CI18N::get(toString("uiItemSpecialEffectFlyingText%s", ITEM_SPECIAL_EFFECT::toString((ITEM_SPECIAL_EFFECT::TItemSpecialEffect)effect).c_str())); + string text = CI18N::get(toString("uiItemSpecialEffectFlyingText%s", ITEM_SPECIAL_EFFECT::toString((ITEM_SPECIAL_EFFECT::TItemSpecialEffect)effect).c_str())); strFindReplace(text, "%param", toString("%d", param)); CEntityCL *entity = EntitiesMngr.getEntityByCompressedIndex(entityID); if (entity) @@ -3493,7 +3493,7 @@ void impulseCombatFlyingText(NLMISC::CBitMemStream &impulse) COMBAT_FLYING_TEXT::TCombatFlyingText type = (COMBAT_FLYING_TEXT::TCombatFlyingText)tmp; CRGBA color(255, 255, 255); - ucstring text(""); + string text(""); float dt = 0.0f; switch (type) diff --git a/ryzom/client/src/r2/dmc/client_edition_module.cpp b/ryzom/client/src/r2/dmc/client_edition_module.cpp index 73e231d4a..0898711eb 100644 --- a/ryzom/client/src/r2/dmc/client_edition_module.cpp +++ b/ryzom/client/src/r2/dmc/client_edition_module.cpp @@ -1868,7 +1868,7 @@ void CClientEditionModule::onTpPositionSimulated(NLNET::IModuleProxy * /* sender beginLoading (LoadingBackground); #define BAR_STEP_TP 2 // fixme : this define is duplicated.... ProgressBar.reset (BAR_STEP_TP); - ucstring nmsg("Loading..."); + string nmsg("Loading..."); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); ProgressBar.progress(0); ContinentMngr.select(dest, ProgressBar); diff --git a/ryzom/client/src/string_manager_client.h b/ryzom/client/src/string_manager_client.h index e29f78b6f..864c80c1f 100644 --- a/ryzom/client/src/string_manager_client.h +++ b/ryzom/client/src/string_manager_client.h @@ -64,11 +64,9 @@ public: void flushStringCache(); bool getString(uint32 stringId, std::string &result); - // bool getString(uint32 stringId, ucstring &result) { std::string temp; bool res = getString(stringId, temp); result.fromUtf8(temp); return res; } // FIXME: UTF-8 void waitString(uint32 stringId, const IStringWaiterRemover *premover, std::string *result); void waitString(uint32 stringId, IStringWaitCallback *pcallback); bool getDynString(uint32 dynStringId, std::string &result); - // bool getDynString(uint32 dynStringId, ucstring &result) { std::string temp; bool res = getString(dynStringId, temp); result.fromUtf8(temp); return res; } // FIXME: UTF-8 void waitDynString(uint32 stringId, const IStringWaiterRemover *premover, std::string *result); void waitDynString(uint32 stringId, IStringWaitCallback *pcallback); diff --git a/ryzom/common/src/game_share/generic_xml_msg_mngr.cpp b/ryzom/common/src/game_share/generic_xml_msg_mngr.cpp index 5e46d9923..3568cf7d2 100644 --- a/ryzom/common/src/game_share/generic_xml_msg_mngr.cpp +++ b/ryzom/common/src/game_share/generic_xml_msg_mngr.cpp @@ -159,6 +159,16 @@ bool CGenericXmlMsgHeaderManager::pushNameToStream(const string &msgName, CBitMe return res; } +// +bool CGenericXmlMsgHeaderManager::pushNameToStream(const char *msgName, CBitMemStream &strm) +{ + bool res = (_Root->select(msgName, strm) != NULL); + + if (!res) nlwarning("pushNameToStream failed: Unknown message name '%s'", msgName); + + return res; +} + // void CGenericXmlMsgHeaderManager::popNameFromStream(string &resultName, CBitMemStream &strm) { diff --git a/ryzom/common/src/game_share/generic_xml_msg_mngr.h b/ryzom/common/src/game_share/generic_xml_msg_mngr.h index a6a6a7167..45a89ec8c 100644 --- a/ryzom/common/src/game_share/generic_xml_msg_mngr.h +++ b/ryzom/common/src/game_share/generic_xml_msg_mngr.h @@ -231,6 +231,14 @@ public: */ bool pushNameToStream(const std::string &msgName, NLMISC::CBitMemStream &strm); + /** + * Convert and write a Message Name into a stream. + * \param string msgName : Message Name to convert and write into the stream. + * \param CBitMemStream strm : the stream to receive the Message Name. + * \return bool : 'false' if the method cannot write the message Name into the stream (probably because de message name is wrong). + */ + bool pushNameToStream(const char *msgName, NLMISC::CBitMemStream &strm); + /** * Convert and return the Message Name from a stream. * \param string resultName: The result for the Message Name. From e2afa4db5bcd6ddbd91fa011f5755b1df78ea863 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 14:05:06 +0800 Subject: [PATCH 116/205] Sanitize downloaded HTML encoding --- nel/src/gui/group_html.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index d2c6d4cf3..508d60361 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -4177,7 +4177,8 @@ namespace NLGUI } else { - renderHtmlString(content); + // Sanitize downloaded HTML UTF-8 encoding, and render + renderHtmlString(CUtfStringView(content).toUtf8(true)); } } From 32ce3667a32d7a762f25c862ed9fa2eac791be5a Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 14:24:31 +0800 Subject: [PATCH 117/205] Fix FV --- ryzom/client/src/commands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/src/commands.cpp b/ryzom/client/src/commands.cpp index e64796b28..d756c938c 100644 --- a/ryzom/client/src/commands.cpp +++ b/ryzom/client/src/commands.cpp @@ -1344,7 +1344,7 @@ NLMISC_COMMAND(db, "Modify Database"," ") else pIM->displaySystemInfo(toString("DB '%s' does not exist.", args[0].c_str())); #else - pIM->displaySystemInfo(ucstring("Can't write to DB when in Final Version.")); + pIM->displaySystemInfo("Can't write to DB when in Final Version."); #endif } else if (size == 1) From 3a2922021e1d707869bc0261c4a4a3eb90a64167 Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Sat, 31 Oct 2020 14:53:20 +0800 Subject: [PATCH 118/205] Update cursor_functions.cpp --- ryzom/client/src/cursor_functions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/src/cursor_functions.cpp b/ryzom/client/src/cursor_functions.cpp index 8773e84f7..0354e11f8 100644 --- a/ryzom/client/src/cursor_functions.cpp +++ b/ryzom/client/src/cursor_functions.cpp @@ -564,7 +564,7 @@ void checkUnderCursor() cursor->setCursor("r2ed_tool_select_move_over.tga"); InstanceId = instance_idx; - if (ContextCur.context("ARKITECT", 0.f, ucstring("Edit"))) + if (ContextCur.context("ARKITECT", 0.f, "Edit")) return; } else From eac2aed175ad07180ff42fc3910e6998729784f6 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 14:58:23 +0800 Subject: [PATCH 119/205] Fix serial --- ryzom/client/src/interface_v3/group_compas.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ryzom/client/src/interface_v3/group_compas.cpp b/ryzom/client/src/interface_v3/group_compas.cpp index bee955ba4..a78c94681 100644 --- a/ryzom/client/src/interface_v3/group_compas.cpp +++ b/ryzom/client/src/interface_v3/group_compas.cpp @@ -75,11 +75,20 @@ void CCompassTarget::serial(NLMISC::IStream &f) } } f.serialCheck(NELID("CTAR")); - f.serialVersion(0); + sint version = f.serialVersion(1); f.serial(Pos); // for the name, try to save a string identifier if possible, because language may be changed between // save & reload - f.serial(Name); + if (version < 1) + { + ucstring name; // Serial old version + f.serial(name); + Name = name.toUtf8(); + } + else + { + f.serial(Name); + } std::string language = toLower(ClientCfg.LanguageCode); f.serial(language); f.serialEnum(_Type); From 7249546db62bce93b6a46e94eff8cbb574581aba Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 16:20:21 +0800 Subject: [PATCH 120/205] Merge some things from atys branch --- CMakeLists.txt | 16 +- nel/include/nel/gui/ctrl_scroll.h | 1 + nel/src/gui/ctrl_scroll.cpp | 42 +++++ nel/src/gui/widget_manager.cpp | 4 +- ryzom/client/src/client_cfg.cpp | 9 - ryzom/client/src/connection.cpp | 246 ++++++++++++++++++++++++++- ryzom/client/src/events_listener.cpp | 19 +-- 7 files changed, 309 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54b133ac3..07fe11c8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ SET(YEAR "2001-${CURRENT_YEAR}") SET(AUTHOR "Winch Gate and The Ryzom Core Community") SET(RYZOM_VERSION_MAJOR 3) -SET(RYZOM_VERSION_MINOR 5) +SET(RYZOM_VERSION_MINOR 6) SET(RYZOM_VERSION_PATCH 0) #----------------------------------------------------------------------------- @@ -175,6 +175,20 @@ IF(WITH_STATIC) IF(LIBLZMA_LIBRARIES) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES}) ENDIF() + + # under Linux and OS X, recent libxml2 versions are linked against libicu + # FIND_PACKAGE(Icu) + FIND_LIBRARY(ICU_LIBRARY icuuc) + IF(ICU_LIBRARY) + FIND_LIBRARY(ICU_DATA_LIBRARY icudata) + IF(ICU_LIBRARY) + MESSAGE(STATUS "ICU UC was found: ${ICU_LIBRARY}") + ELSE() + MESSAGE(STATUS "ICU UC was NOT found") + ENDIF() + SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_DATA_LIBRARY} ${ICU_LIBRARY}) + ENDIF() + ENDIF() ENDIF() diff --git a/nel/include/nel/gui/ctrl_scroll.h b/nel/include/nel/gui/ctrl_scroll.h index 76827dd29..4052e6cea 100644 --- a/nel/include/nel/gui/ctrl_scroll.h +++ b/nel/include/nel/gui/ctrl_scroll.h @@ -177,6 +177,7 @@ namespace NLGUI bool _MouseDown : 1; bool _CallingAH : 1; bool _Cancelable : 1; // true if the slider may be cancelled when pressed on the mouse right button + bool _Keyboard : 1; bool _Frozen : 1; bool _Scale : 1; diff --git a/nel/src/gui/ctrl_scroll.cpp b/nel/src/gui/ctrl_scroll.cpp index b40498186..d9191e770 100644 --- a/nel/src/gui/ctrl_scroll.cpp +++ b/nel/src/gui/ctrl_scroll.cpp @@ -57,6 +57,7 @@ namespace NLGUI _MouseDown = false; _CallingAH = false; _Cancelable = false; + _Keyboard = false; _Target = NULL; _Inverted = false; _IsDBLink = false; @@ -225,6 +226,11 @@ namespace NLGUI return toString( _Cancelable ); } else + if( name == "keyboard" ) + { + return toString( _Keyboard ); + } + else if( name == "frozen" ) { return toString( _Frozen ); @@ -405,6 +411,14 @@ namespace NLGUI return; } else + if( name == "keyboard" ) + { + bool b; + if( fromString( value, b ) ) + _Keyboard = b; + return; + } + else if( name == "frozen" ) { bool b; @@ -474,6 +488,7 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "target_stepy", BAD_CAST toString( _TargetStepY ).c_str() ); xmlSetProp( node, BAD_CAST "step_value", BAD_CAST toString( _StepValue ).c_str() ); xmlSetProp( node, BAD_CAST "cancelable", BAD_CAST toString( _Cancelable ).c_str() ); + xmlSetProp( node, BAD_CAST "keyboard", BAD_CAST toString( _Keyboard ).c_str() ); xmlSetProp( node, BAD_CAST "frozen", BAD_CAST toString( _Frozen ).c_str() ); return node; @@ -589,6 +604,9 @@ namespace NLGUI prop = (char*) xmlGetProp( node, (xmlChar*)"cancelable" ); if (prop) _Cancelable = convertBool(prop); + prop = (char*) xmlGetProp( node, (xmlChar*)"keyboard" ); + if (prop) _Keyboard = convertBool(prop); + prop= (char*) xmlGetProp (node, (xmlChar*)"frozen"); _Frozen = false; if (prop) @@ -912,6 +930,30 @@ namespace NLGUI return true; } } + else if (event.getType() == NLGUI::CEventDescriptor::key) + { + const NLGUI::CEventDescriptorKey &eventDesc = (const NLGUI::CEventDescriptorKey &)event; + + if (eventDesc.getKeyEventType() == NLGUI::CEventDescriptorKey::keydown) + { + if (_Keyboard) + { + sint32 i = 0; + // direction + if (eventDesc.getKey() == KeyNEXT) i++; + else if (eventDesc.getKey() == KeyPRIOR) i--; + else + return false; + + if (_Vertical) + moveTrackY(-(i * _TargetStepY)); + else + moveTrackX(-(i * _TargetStepX)); + + return true; + } + } + } return false; } diff --git a/nel/src/gui/widget_manager.cpp b/nel/src/gui/widget_manager.cpp index 9ce889a95..df4f5d706 100644 --- a/nel/src/gui/widget_manager.cpp +++ b/nel/src/gui/widget_manager.cpp @@ -2297,7 +2297,7 @@ namespace NLGUI // Hide menu if the key is pushed // if ((eventDesc.getKeyEventType() == CEventDescriptorKey::keydown) && !_ModalStack.empty() && !eventDesc.getKeyAlt() && !eventDesc.getKeyCtrl() && !eventDesc.getKeyShift()) // Hide menu (or popup menu) is ESCAPE pressed - if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE ) + if( eventDesc.getKeyEventType() == CEventDescriptorKey::keydown && eventDesc.getKey() == NLMISC::KeyESCAPE ) { if( hasModal() ) { @@ -2308,7 +2308,7 @@ namespace NLGUI } // Manage "quit window" If the Key is ESCAPE, no captureKeyboard - if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE ) + if( eventDesc.getKeyEventType() == CEventDescriptorKey::keydown && eventDesc.getKey() == NLMISC::KeyESCAPE ) { // Get the last escapable active top window. NB: this is ergonomically better. CInterfaceGroup *win= getLastEscapableTopWindow(); diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index f7f91e7ad..41df9430f 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -326,17 +326,8 @@ CClientConfig::CClientConfig() Local = false; // Default is Net Mode. FSHost = ""; // Default Host. -#if 1 // Yubo hack - // The order is important here, because in a layer, global texture are rendered through this order - TexturesInterface.push_back("texture_interfaces_v3"); - // DXTC contain all items and bricks bitmaps, they must come after standard texture - TexturesInterface.push_back("new_texture_interfaces_dxtc"); - // Added icons by Yubo's Team 2009 - TexturesInterface.push_back("texture_extra"); -#else TexturesInterface.push_back("texture_interfaces_v3"); TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc"); -#endif TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui"); diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 6054b6a07..cf0abdbfd 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -157,9 +157,11 @@ std::string RingEditorKeySet = "keys_r2ed.xml"; string ScenarioFileName; sint LoginCharsel = -1; -static const char *KeySetVarName = "BuiltInKeySets"; +std::string ImportCharacter; +static const char *KeySetVarName = "BuiltInKeySets"; +#define GROUP_LIST_CHARACTER "ui:outgame:charsel_import:import_list" #define GROUP_LIST_MAINLAND "ui:outgame:appear_mainland:mainland_list" #define GROUP_LIST_KEYSET "ui:outgame:appear_keyset:keyset_list" vector Mainlands; @@ -2138,7 +2140,7 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); + //CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND)); if (pList == NULL) @@ -2217,7 +2219,7 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); + //CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND)); pList->clearGroups(); } @@ -2458,7 +2460,7 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); + //CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET)); pList->clearGroups(); } @@ -3435,3 +3437,239 @@ class CAHOpenRingSessions : public IActionHandler } }; REGISTER_ACTION_HANDLER (CAHOpenRingSessions, "open_ring_sessions"); + +// *************************************************************************** +class CAHInitImportCharacter : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) + { + CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER)); + if (!list) + { + nlwarning("element " GROUP_LIST_CHARACTER " not found probably bad outgame.xml"); + return; + } + + // retrieve saved files + std::vector savedCharacters; + CPath::getPathContent("save/", false, false, true, savedCharacters); + + CInterfaceGroup *newLine; + CInterfaceGroup *prevLine; + + for (uint i = 0; i < savedCharacters.size(); ++i) + { + // search saved characters only + if (testWildCard(CFile::getFilename(savedCharacters[i]), "character_*.save")) + { + const std::string id = CFile::getFilenameWithoutExtension(savedCharacters[i]).substr(strlen("character_")); + if (id.empty()) + continue; + + std::vector> params; + params.clear(); + params.push_back(std::pair("id", id)); + // adjust ref + if (list->getNumGroup() > 0) + params.push_back(std::pair("posref", "BL TL")); + + newLine = CWidgetManager::getInstance()->getParser()->createGroupInstance("t_import", GROUP_LIST_CHARACTER, params); + if (newLine) + { + CViewText *text = dynamic_cast(newLine->getView("name")); + if (text) + text->setText(ucstring(savedCharacters[i])); + + // first button is pushed + CCtrlButton *button = dynamic_cast(newLine->getCtrl("but")); + if (button && list->getNumGroup() == 0) + button->setPushed(true); + + // add to the list now + newLine->setParent(list); + newLine->setParentSize(list); + newLine->setParentPos(prevLine); + + list->addGroup(newLine); + + prevLine = newLine; + } + } + } + // none case + if (list->getNumGroup() == 0) + CLuaManager::getInstance().executeLuaScript("outgame:procCharselNotifaction(3)"); + + list->invalidateCoords(); + } +}; +REGISTER_ACTION_HANDLER( CAHInitImportCharacter, "import_char_init" ); + +// *************************************************************************** +class CAHResetImportCharacter : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) + { + CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER)); + if (list) + list->clearGroups(); + + if (!ImportCharacter.empty()) + ImportCharacter = ""; + } +}; +REGISTER_ACTION_HANDLER( CAHResetImportCharacter, "import_char_reset" ); + +// *************************************************************************** +class CAHSelectImportCharacter : public IActionHandler +{ + virtual void execute (CCtrlBase *pCaller, const std::string &Params) + { + struct CUnpush : public CInterfaceElementVisitor + { + CCtrlBase *Ref; + virtual void visitCtrl(CCtrlBase *ctrl) + { + if (ctrl == Ref) return; + CCtrlBaseButton *but = dynamic_cast(ctrl); + if (but) + { + but->setPushed(false); + } + } + }; + CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER)); + if (!list) + return; + + // unselect + if (Params.empty()) + { + CUnpush unpusher; + unpusher.Ref = pCaller; + list->visit(&unpusher); + } + + // now select + std::string name; + if (Params.empty()) + { + CCtrlButton *pCB = dynamic_cast(pCaller); + if (!pCB) + return; + + std::string id = pCB->getId(); + id = id.substr(0, id.rfind(':')); + + if (!fromString(id.substr(id.rfind(':')+1, id.size()), name)) + return; + + pCB->setPushed(true); + } + else + if (!fromString(Params, name)) + return; + + ImportCharacter = ""; + // check filename and store + if (CFile::fileExists(toString("save/character_%s.save", name.c_str()))) + ImportCharacter = name; + } +}; +REGISTER_ACTION_HANDLER( CAHSelectImportCharacter, "import_char_select" ); + +// *************************************************************************** +class CAHImportCharacter : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) + { + if (ImportCharacter.empty()) + return; + + if (!CFile::fileExists(toString("save/character_%s.save", ImportCharacter.c_str()))) + return; + + bool success = false; + + CIFile fd; + CCharacterSummary CS; + // use temporary file until close() + if (fd.open(toString("save/character_%s.save", ImportCharacter.c_str()))) + { + try + { + CS.serial(fd); + SCharacter3DSetup::setupDBFromCharacterSummary("UI:TEMP:CHAR3D", CS); + + // validate import + CDBManager::getInstance()->getDbProp("UI:TEMP:IMPORT")->setValue32(1); + success = true; + } + catch (const EStream &e) + { + nlwarning(e.what()); + } + fd.close(); + } + else + nlwarning("Failed to open file: save/character_%s.save", ImportCharacter.c_str()); + + // user notification + if (!success) + CLuaManager::getInstance().executeLuaScript("outgame:procCharselNotifaction(2)"); + else + CAHManager::getInstance()->runActionHandler("proc", NULL, "proc_charsel_create_new"); + } +}; +REGISTER_ACTION_HANDLER( CAHImportCharacter, "import_char" ); + +// *************************************************************************** +class CAHExportCharacter : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params) + { + if (Params.empty()) + return; + + sint32 slot = -1; + if (!fromString(getParam(Params, "slot"), slot)) + return; + + if (slot >= CharacterSummaries.size() || slot < 0) + return; + + // retrieve infos + CCharacterSummary &CS = CharacterSummaries[slot]; + if (CS.Name.empty()) + return; + + // extract name + const std::string name = buildPlayerNameForSaveFile(CS.Name.toString()); + + COFile fd; + bool success = false; + // use temporary file until close() + if (fd.open(toString("save/character_%s.save", name.c_str()), false, false, true)) + { + try + { + fd.serial(CS); + fd.flush(); + // validate + success = true; + } + catch (const EStream &e) + { + nlwarning(e.what()); + } + fd.close(); + } + else + nlwarning("Failed to open file: save/character_%s.save", name.c_str()); + + const uint8 val = (success == true) ? 0 : 1; + // user notification + CLuaManager::getInstance().executeLuaScript(toString("outgame:procCharselNotifaction(%i)", val)); + } +}; +REGISTER_ACTION_HANDLER( CAHExportCharacter, "export_char" ); diff --git a/ryzom/client/src/events_listener.cpp b/ryzom/client/src/events_listener.cpp index 879bd5a2a..cfa9d2b3c 100644 --- a/ryzom/client/src/events_listener.cpp +++ b/ryzom/client/src/events_listener.cpp @@ -172,16 +172,12 @@ void CEventsListener::operator()(const CEvent& event) // Get in pixel space, centered uint32 drW, drH; Driver->getWindowSize(drW, drH); - float fX = mouseEvent->X; // from 0 to 1.0 - float fY = (ClientCfg.FreeLookInverted ? -mouseEvent->Y : mouseEvent->Y); - sint scX = (sint32)(fX * (float)drW) - ((sint32)drW >> 1); // in pixels, centered - sint scY = (sint32)(fY * (float)drH) - ((sint32)drH >> 1); + sint scX = (sint32)(mouseEvent->X * (float)drW) - ((sint32)drW >> 1); // in pixels, centered + sint scY = (sint32)(mouseEvent->Y * (float)drH) - ((sint32)drH >> 1); if (!s_MouseFreeLookReady) { - float pfX = _MouseX; - float pfY = (ClientCfg.FreeLookInverted ? -_MouseY : _MouseY); - sint pscX = (sint32)(pfX * (float)drW) - ((sint32)drW >> 1); // in pixels, centered - sint pscY = (sint32)(pfY * (float)drH) - ((sint32)drH >> 1); + sint pscX = (sint32)(_MouseX * (float)drW) - ((sint32)drW >> 1); // in pixels, centered + sint pscY = (sint32)(_MouseY * (float)drH) - ((sint32)drH >> 1); s_MouseFreeLookReady = true; s_MouseFreeLookLastX = pscX; s_MouseFreeLookLastY = pscY; @@ -199,13 +195,12 @@ void CEventsListener::operator()(const CEvent& event) } // Get delta since last center - sint scXd = scX - s_MouseFreeLookLastX; - sint scYd = scY - s_MouseFreeLookLastY; + s_MouseFreeLookFrameX += (scX - s_MouseFreeLookLastX); + s_MouseFreeLookFrameY += (scY - s_MouseFreeLookLastY) * (ClientCfg.FreeLookInverted ? -1 : 1); + s_MouseFreeLookLastX = scX; s_MouseFreeLookLastY = scY; - s_MouseFreeLookFrameX += scXd; - s_MouseFreeLookFrameY += scYd; // updateFreeLookPos is called in updateMouseSmoothing per frame // Center cursor From cd8ed8ab576747bce8f2273f87068e50c90bc4b7 Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Sat, 31 Oct 2020 16:23:41 +0800 Subject: [PATCH 121/205] Update entity_cl.cpp --- ryzom/client/src/entity_cl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/src/entity_cl.cpp b/ryzom/client/src/entity_cl.cpp index 77d1e3c65..4c1b4a842 100644 --- a/ryzom/client/src/entity_cl.cpp +++ b/ryzom/client/src/entity_cl.cpp @@ -2302,7 +2302,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) string::size_type pos = replacement.find('$'); if (pos != string::npos) { - _EntityName = _EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(sn.substr(0, pos)); + _EntityName = _EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(replacement.substr(0, pos)); string::size_type pos2 = replacement.find('$', pos + 1); _TitleRaw = replacement.substr(pos+1, pos2 - pos - 1); replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle); From 04805ec38c6807be2aa308d88565e6fa3ee767b0 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 31 Oct 2020 16:46:00 +0800 Subject: [PATCH 122/205] Fix build --- ryzom/client/src/connection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index cf0abdbfd..2885ee1ac 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -3478,7 +3478,7 @@ class CAHInitImportCharacter : public IActionHandler { CViewText *text = dynamic_cast(newLine->getView("name")); if (text) - text->setText(ucstring(savedCharacters[i])); + text->setText(string(savedCharacters[i])); // first button is pushed CCtrlButton *button = dynamic_cast(newLine->getCtrl("but")); From a1337dbda9ae73222cc7e68dc168362f7ddad10b Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Sun, 1 Nov 2020 02:45:39 +0800 Subject: [PATCH 123/205] Update string_manager_client.cpp --- ryzom/client/src/string_manager_client.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ryzom/client/src/string_manager_client.cpp b/ryzom/client/src/string_manager_client.cpp index 0ef667dc9..734b3bea6 100644 --- a/ryzom/client/src/string_manager_client.cpp +++ b/ryzom/client/src/string_manager_client.cpp @@ -1178,9 +1178,9 @@ bool CStringManagerClient::checkWordFileDates(vector &fileChecks, co // *************************************************************************** void CStringManagerClient::initI18NSpecialWords(const string &languageCode) { - ucstring womenNameColIdent = "women_name"; - ucstring descColIdent = "description"; - ucstring descColIdent2 = "description2"; + ucstring womenNameColIdent = ucstring("women_name"); + ucstring descColIdent = ucstring("description"); + ucstring descColIdent2 = ucstring("description2"); // List of words to append to the local CI18N system. static const char *specialWords[]= From da9254e7480dcf6551fb0977f3238539e2643c14 Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Sun, 1 Nov 2020 04:53:32 +0800 Subject: [PATCH 124/205] Update release.cpp --- ryzom/client/src/release.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ryzom/client/src/release.cpp b/ryzom/client/src/release.cpp index 889bcee11..7a7cc91eb 100644 --- a/ryzom/client/src/release.cpp +++ b/ryzom/client/src/release.cpp @@ -30,6 +30,7 @@ #include "nel/misc/async_file_manager.h" #include "nel/misc/system_utils.h" #include "nel/misc/streamed_package_manager.h" +#include "nel/web/http_package_provider.h" // 3D Interface. #include "nel/3d/bloom_effect.h" #include "nel/3d/fxaa.h" From 6c247256d29f030093748adf3fb665f1ccc74e5d Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Sun, 1 Nov 2020 04:55:29 +0800 Subject: [PATCH 125/205] Update string_manager_client.cpp --- ryzom/client/src/string_manager_client.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ryzom/client/src/string_manager_client.cpp b/ryzom/client/src/string_manager_client.cpp index 734b3bea6..98483bd6b 100644 --- a/ryzom/client/src/string_manager_client.cpp +++ b/ryzom/client/src/string_manager_client.cpp @@ -1629,13 +1629,13 @@ const char *CStringManagerClient::getTitleLocalizedName(const string &titleId, b } -const ucchar *CStringManagerClient::getLocalizedName(const ucstring &uctext) +const ucchar *CStringManagerClient::getLocalizedName(const string &uctext) { - string text = uctext.toUtf8(); + string text = uctext; if (text[0] == '[') { vector textLocalizations; - static ucstring defaultText; + static string defaultText; splitString(text.substr(1), "[", textLocalizations); if (!textLocalizations.empty()) { @@ -1643,12 +1643,12 @@ const ucchar *CStringManagerClient::getLocalizedName(const ucstring &uctext) { if (textLocalizations[i].substr(0, 3) == CI18N::getCurrentLanguageCode()+"]") { - defaultText.fromUtf8(textLocalizations[i].substr(3)); + defaultText = textLocalizations[i].substr(3); return defaultText.c_str(); } else if (textLocalizations[i].substr(0, 3) == "wk]") { - defaultText.fromUtf8(textLocalizations[i].substr(3)); + defaultText = extLocalizations[i].substr(3); } } } From afa22ee22bec1ee1722e38cc9ae48c1d0d6dd29b Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Sun, 1 Nov 2020 06:15:03 +0800 Subject: [PATCH 126/205] Update string_manager_client.cpp --- ryzom/client/src/string_manager_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/src/string_manager_client.cpp b/ryzom/client/src/string_manager_client.cpp index 98483bd6b..623a66152 100644 --- a/ryzom/client/src/string_manager_client.cpp +++ b/ryzom/client/src/string_manager_client.cpp @@ -1629,7 +1629,7 @@ const char *CStringManagerClient::getTitleLocalizedName(const string &titleId, b } -const ucchar *CStringManagerClient::getLocalizedName(const string &uctext) +const char *CStringManagerClient::getLocalizedName(const string &uctext) { string text = uctext; if (text[0] == '[') From 2bb13937e85ef6418d7ce609e124ce3065bad11c Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Sun, 1 Nov 2020 06:57:53 +0800 Subject: [PATCH 127/205] Update string_manager_client.cpp --- ryzom/client/src/string_manager_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/src/string_manager_client.cpp b/ryzom/client/src/string_manager_client.cpp index 623a66152..79a0ee36d 100644 --- a/ryzom/client/src/string_manager_client.cpp +++ b/ryzom/client/src/string_manager_client.cpp @@ -1648,7 +1648,7 @@ const char *CStringManagerClient::getLocalizedName(const string &uctext) } else if (textLocalizations[i].substr(0, 3) == "wk]") { - defaultText = extLocalizations[i].substr(3); + defaultText = textLocalizations[i].substr(3); } } } From 9d3891f1aa1ae5c7de2687b49bfd2814df7d7230 Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Sun, 1 Nov 2020 10:33:53 +0800 Subject: [PATCH 128/205] Update action_handler_item.cpp --- ryzom/client/src/interface_v3/action_handler_item.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 7a87719ab..8cbeaf678 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -161,28 +161,29 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() } else { + const char *localDesc = STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id); if (itemInfo.CustomText.empty()) - display->setTextFormatTaged(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)); + display->setTextFormatTaged(localDesc); else { - ucstring text = itemInfo.CustomText; + string text = itemInfo.CustomText.toUtf8(); if (text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') { CGroupHTML *pGH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html")); if (pGH) - pGH->browse(text.substr(4, text.size()-4).toString().c_str()); + pGH->browse(text.substr(4, text.size()-4).c_str()); text = localDesc; } else if (text.size() > 3 && text[0]=='@' && text[1]=='L' && text[2]=='U' && text[3]=='A') { - string code = text.substr(4, text.size()-4).toString(); + string code = text.substr(4, text.size()-4); if (!code.empty()) CLuaManager::getInstance().executeLuaScript(code); text = localDesc; } if (!text.empty()) { - display->setTextFormatTaged(text.toUtf8()); + display->setTextFormatTaged(text); group->setActive(true); } } From f859a39da483f602db24f5d7ffd751eab6b7be4d Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Sun, 1 Nov 2020 10:34:51 +0800 Subject: [PATCH 129/205] Update action_handler_item.cpp --- ryzom/client/src/interface_v3/action_handler_item.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 8cbeaf678..1f8cd61b0 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -305,27 +305,28 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() // Finish the display or add the waiter if (getInventory().isItemInfoUpToDate(ItemSlotId)) { + const char *localDesc = STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id); if (itemInfo.CustomText.empty()) - display->setTextFormatTaged(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id)); + display->setTextFormatTaged(localDesc); else { - ucstring text = itemInfo.CustomText; + string text = itemInfo.CustomText.toUtf8(); if (text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') { CGroupHTML *pGH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html")); if (pGH) - pGH->browse(text.substr(4, text.size()-4).toUtf8().c_str()); + pGH->browse(text.substr(4, text.size()-4).c_str()); text = localDesc; } else if (text.size() > 3 && text[0]=='@' && text[1]=='L' && text[2]=='U' && text[3]=='A') { - string code = text.substr(4, text.size()-4).toUtf8(); + string code = text.substr(4, text.size()-4); if (!code.empty()) CLuaManager::getInstance().executeLuaScript(code); text = localDesc; } if (!text.empty()) - display->setTextFormatTaged(text.toUtf8()); + display->setTextFormatTaged(text); } } else From c069b70ce8ec156b9a3c1638fee2d6dbc1d321a6 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 1 Nov 2020 05:13:39 +0800 Subject: [PATCH 130/205] 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; From 298e9129491c39b9da159733872f1f34eda0f1b0 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 1 Nov 2020 05:22:31 +0800 Subject: [PATCH 131/205] UTF-8 login patcher, ryzom/ryzomcore#335 --- ryzom/client/src/item_group_manager.cpp | 2 +- ryzom/client/src/login.cpp | 90 +++++++++++----------- ryzom/client/src/login_patch.cpp | 86 ++++++++++----------- ryzom/client/src/login_patch.h | 20 ++--- ryzom/tools/client/client_patcher/main.cpp | 4 +- 5 files changed, 101 insertions(+), 101 deletions(-) diff --git a/ryzom/client/src/item_group_manager.cpp b/ryzom/client/src/item_group_manager.cpp index ad35a2a97..2cbb86dac 100644 --- a/ryzom/client/src/item_group_manager.cpp +++ b/ryzom/client/src/item_group_manager.cpp @@ -698,7 +698,7 @@ void CItemGroupManager::listGroup() { CItemGroup group = _Groups[i]; string msg = NLMISC::CI18N::get("cmdListGroupLine"); - //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 = group.name; NLMISC::strFindReplace(msg, "%name", nameUC); NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.Items.size())); diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index e39d406ff..d0f6243b8 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -199,7 +199,7 @@ void setLoginFinished( bool f ) // *************************************************************************** // Pop a fatal error message box, giving the option to 'quit' the client, plus a help button -static void fatalMessageBox(const ucstring &msg) +static void fatalMessageBox(const std::string &msg) { CInterfaceManager *im = CInterfaceManager::getInstance(); im->messageBoxWithHelp(msg, "ui:login", "login_quit"); @@ -207,7 +207,7 @@ static void fatalMessageBox(const ucstring &msg) // *************************************************************************** // Pop an error message box, giving the option to go back to main menu, plus a help button -static void errorMessageBox(const ucstring &msg) +static void errorMessageBox(const std::string &msg) { CInterfaceManager *im = CInterfaceManager::getInstance(); im->messageBoxWithHelp(msg, "ui:login", "on_back_to_login"); @@ -281,25 +281,25 @@ void initEula() } // *************************************************************************** -static void setDataScanLog(const ucstring &text) +static void setDataScanLog(const std::string &text) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:log_txt:log")); if (pVT != NULL) { - pVT->setText(text.toUtf8()); + pVT->setText(text); } } // *************************************************************************** -static void setDataScanState(const ucstring &text, ucstring progress= ucstring()) +static void setDataScanState(const std::string &text, const std::string &progress = string()) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:state")); - if (pVT != NULL) pVT->setText(text.toUtf8()); + if (pVT != NULL) pVT->setText(text); pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:progress")); - if (pVT != NULL) pVT->setText(progress.toUtf8()); + if (pVT != NULL) pVT->setText(progress); } void initCatDisplay() @@ -332,24 +332,24 @@ void initReboot() // *************************************************************************** -static void setPatcherStateText(const std::string &baseUIPath, const ucstring &str) +static void setPatcherStateText(const std::string &baseUIPath, const std::string &str) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(baseUIPath + ":content:state")); if (pVT != NULL) { - pVT->setText(str.toUtf8()); + pVT->setText(str); } } // *************************************************************************** -static void setPatcherProgressText(const std::string &baseUIPath, const ucstring &str) +static void setPatcherProgressText(const std::string &baseUIPath, const std::string &str) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(baseUIPath + ":content:progress")); if (pVT != NULL) { - pVT->setText(str.toUtf8()); + pVT->setText(str); } } @@ -365,7 +365,7 @@ static void updatePatchingInfoText(const std::string &baseUIPath) if (bgDownloader.getDownloadThreadPriority() == BGDownloader::ThreadPriority_Paused) { setPatcherStateText(baseUIPath, CI18N::get("uiBGD_Paused")); - setPatcherProgressText(baseUIPath, ucstring()); + setPatcherProgressText(baseUIPath, string()); } else { @@ -376,15 +376,15 @@ static void updatePatchingInfoText(const std::string &baseUIPath) } else { - setPatcherProgressText(baseUIPath, ucstring()); + setPatcherProgressText(baseUIPath, string()); } } } else #endif { - ucstring state; - vector log; + string state; + vector log; if(pPM->getThreadState(state, log)) { setPatcherStateText(baseUIPath, state); @@ -394,7 +394,7 @@ static void updatePatchingInfoText(const std::string &baseUIPath) } else { - setPatcherProgressText(baseUIPath, ucstring()); + setPatcherProgressText(baseUIPath, string()); } } } @@ -481,8 +481,8 @@ void loginMainLoop() if (finished) { - setPatcherStateText("ui:login:checking", ucstring()); - setPatcherProgressText("ui:login:checking", ucstring()); + setPatcherStateText("ui:login:checking", string()); + setPatcherProgressText("ui:login:checking", string()); #ifdef RYZOM_BG_DOWNLOADER if (isBGDownloadEnabled()) @@ -561,7 +561,7 @@ void loginMainLoop() } else { - ucstring errMsg = CI18N::get("uiErrChecking"); + string errMsg = CI18N::get("uiErrChecking"); if (!pPM->getLastErrorMessage().empty()) { errMsg = pPM->getLastErrorMessage(); @@ -604,14 +604,14 @@ void loginMainLoop() setDataScanState(CI18N::get("uiScanDataSucess")); else { - ucstring fmt= CI18N::get("uiScanDataErrors"); + string fmt= CI18N::get("uiScanDataErrors"); strFindReplace(fmt, "%d", toString(numFiles)); setDataScanState(fmt); } } else { - ucstring errMsg = CI18N::get("uiErrDataScanning"); + string errMsg = CI18N::get("uiErrDataScanning"); if (!pPM->getLastErrorMessage().empty()) { errMsg = pPM->getLastErrorMessage(); @@ -620,7 +620,7 @@ void loginMainLoop() } // the log may have changed - ucstring dsLog; + string dsLog; if(pPM->getDataScanLog(dsLog)) setDataScanLog(dsLog); } @@ -628,8 +628,8 @@ void loginMainLoop() else { // update inteface content - ucstring state; - vector log; + string state; + vector log; // get state if(pPM->getThreadState(state, log)) { @@ -637,7 +637,7 @@ void loginMainLoop() setDataScanState(state, toString("%d/%d", pPM->getCurrentFilesToGet(), pPM->getTotalFilesToGet())); } // set special data scan log - ucstring dsLog; + string dsLog; if(pPM->getDataScanLog(dsLog)) setDataScanLog(dsLog); } @@ -704,7 +704,7 @@ void loginMainLoop() } else { - ucstring errMsg = CI18N::get("uiErrPatchApply"); + string errMsg = CI18N::get("uiErrPatchApply"); if (!pPM->getLastErrorMessage().empty()) { errMsg = pPM->getLastErrorMessage(); @@ -1157,8 +1157,8 @@ void initPatchCheck() #endif NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKING); - setPatcherStateText("ui:login:checking", ucstring()); - setPatcherProgressText("ui:login:checking", ucstring()); + setPatcherStateText("ui:login:checking", string()); + setPatcherProgressText("ui:login:checking", string()); } void initShardDisplay() @@ -1717,8 +1717,8 @@ void initPatch() if (closeBtn) closeBtn->setActive(false); - setPatcherStateText("ui:login:patching", ucstring()); - setPatcherProgressText("ui:login:patching", ucstring()); + setPatcherStateText("ui:login:patching", string()); + setPatcherProgressText("ui:login:patching", string()); } // *************************************************************************** @@ -2274,7 +2274,7 @@ void initDataScan() CPatchManager *pPM = CPatchManager::getInstance(); // reset the log - setDataScanLog(ucstring()); + setDataScanLog(string()); // Start Scanning pPM->startScanDataThread(); @@ -2442,26 +2442,26 @@ bool initCreateAccount() if(!CurlHttpClient.sendGet(url, params, pPM->isVerboseLog())) { - ucstring errorMessage("Can't send (error code 60)"); + string errorMessage("Can't send (error code 60)"); errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); + nlwarning(errorMessage.c_str()); return false; } string res; if(!CurlHttpClient.receive(res, pPM->isVerboseLog())) { - ucstring errorMessage("Can't receive (error code 61)"); + string errorMessage("Can't receive (error code 61)"); errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); + nlwarning(errorMessage.c_str()); return false; } if(res.empty()) { - ucstring errorMessage("Empty result (error code 13)"); + string errorMessage("Empty result (error code 13)"); errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); + nlwarning(errorMessage.c_str()); return false; } @@ -2618,9 +2618,9 @@ class CAHOnCreateAccountSubmit : public IActionHandler if (!CurlHttpClient.connect(url)) { - ucstring errorMessage("Can't connect"); + string errorMessage("Can't connect"); errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); + nlwarning(errorMessage.c_str()); return; } @@ -2645,26 +2645,26 @@ class CAHOnCreateAccountSubmit : public IActionHandler if(!CurlHttpClient.sendPost(url, params, pPM->isVerboseLog())) { - ucstring errorMessage("Can't send (error code 60)"); + string errorMessage("Can't send (error code 60)"); errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); + nlwarning(errorMessage.c_str()); return; } string res; if(!CurlHttpClient.receive(res, pPM->isVerboseLog())) { - ucstring errorMessage("Can't receive (error code 61)"); + string errorMessage("Can't receive (error code 61)"); errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); + nlwarning(errorMessage.c_str()); return; } if(res.empty()) { - ucstring errorMessage("Empty result (error code 13)"); + string errorMessage("Empty result (error code 13)"); errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); + nlwarning(errorMessage.c_str()); return; } diff --git a/ryzom/client/src/login_patch.cpp b/ryzom/client/src/login_patch.cpp index 650531773..2b7d0c1ba 100644 --- a/ryzom/client/src/login_patch.cpp +++ b/ryzom/client/src/login_patch.cpp @@ -189,7 +189,7 @@ void CPatchManager::setClientRootPath(const std::string& clientRootPath) } // **************************************************************************** -void CPatchManager::setErrorMessage(const ucstring &message) +void CPatchManager::setErrorMessage(const std::string &message) { _ErrorMessage = message; } @@ -656,7 +656,7 @@ bool CPatchManager::isPatchThreadEnded (bool &ok) // **************************************************************************** // Called in main thread -bool CPatchManager::getThreadState (ucstring &stateOut, vector &stateLogOut) +bool CPatchManager::getThreadState (std::string &stateOut, vector &stateLogOut) { if ((PatchThread == NULL) && (CheckThread == NULL) && (ScanDataThread==NULL)) return false; @@ -685,7 +685,7 @@ bool CPatchManager::getThreadState (ucstring &stateOut, vector &stateL // verbose log if (isVerboseLog() && !stateLogOut.empty()) for (uint32 i = 0; i < stateLogOut.size(); ++i) - nlinfo("%s", stateLogOut[i].toUtf8().c_str()); + nlinfo("%s", stateLogOut[i].c_str()); return changed; } @@ -1120,28 +1120,28 @@ float CPatchManager::getCurrentFileProgress() const // **************************************************************************** void CPatchManager::setRWAccess (const string &filename, bool bThrowException) { - ucstring s = CI18N::get("uiSetAttrib") + " " + CFile::getFilename(filename); + string s = CI18N::get("uiSetAttrib") + " " + CFile::getFilename(filename); setState(true, s); if (!NLMISC::CFile::setRWAccess(filename) && bThrowException) { s = CI18N::get("uiAttribErr") + " " + CFile::getFilename(filename) + " (" + toString(errno) + "," + strerror(errno) + ")"; setState(true, s); - throw Exception (s.toUtf8()); + throw Exception (s); } } // **************************************************************************** string CPatchManager::deleteFile (const string &filename, bool bThrowException, bool bWarning) { - ucstring s = CI18N::get("uiDelFile") + " " + CFile::getFilename(filename); + string s = CI18N::get("uiDelFile") + " " + CFile::getFilename(filename); setState(true, s); if (!NLMISC::CFile::fileExists(filename)) { s = CI18N::get("uiDelNoFile"); setState(true, s); - return s.toUtf8(); + return s; } if (!NLMISC::CFile::deleteFile(filename)) @@ -1150,8 +1150,8 @@ string CPatchManager::deleteFile (const string &filename, bool bThrowException, if(bWarning) setState(true, s); if(bThrowException) - throw Exception (s.toUtf8()); - return s.toUtf8(); + throw Exception (s); + return s; } return ""; } @@ -1159,20 +1159,20 @@ string CPatchManager::deleteFile (const string &filename, bool bThrowException, // **************************************************************************** void CPatchManager::renameFile (const string &src, const string &dst) { - ucstring s = CI18N::get("uiRenameFile") + " " + NLMISC::CFile::getFilename(src); + string s = CI18N::get("uiRenameFile") + " " + NLMISC::CFile::getFilename(src); setState(true, s); if (!NLMISC::CFile::moveFile(dst, src)) { s = CI18N::get("uiRenameErr") + " " + src + " -> " + dst + " (" + toString(errno) + "," + strerror(errno) + ")"; setState(true, s); - throw Exception (s.toUtf8()); + throw Exception (s); } } // **************************************************************************** // Take care this function is called by the thread -void CPatchManager::setState (bool bOutputToLog, const ucstring &ucsNewState) +void CPatchManager::setState (bool bOutputToLog, const string &ucsNewState) { { CSynchronized::CAccessor as(&State); @@ -1342,7 +1342,7 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const try { - ucstring s = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename(srcName); + string s = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename(srcName); setState(true, s); // get the new file @@ -1364,13 +1364,13 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const // if emergency patch server, this is a real issue, rethrow exception if (UsedServer < 0) { - ucstring s = CI18N::get("uiDLFailed"); + string s = CI18N::get("uiDLFailed"); setState(true, s); throw Exception(e.what()); } - ucstring s = CI18N::get("uiDLURIFailed") + " " + serverDisplayPath; + string s = CI18N::get("uiDLURIFailed") + " " + serverDisplayPath; setState(true, s); // this server is unavailable @@ -1384,7 +1384,7 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const // scanned all servers? use alternative if (nextServer == UsedServer) { - ucstring s = CI18N::get("uiNoMoreURI"); + string s = CI18N::get("uiNoMoreURI"); setState(true, s); UsedServer = -1; nlwarning("EXCEPTION CATCH: getServerFile() failed - no alternative found"); @@ -1409,7 +1409,7 @@ void CPatchManager::downloadFileWithCurl (const string &source, const string &de try { #ifdef USE_CURL - ucstring s = CI18N::get("uiDLWithCurl") + " " + CFile::getFilename(dest); + string s = CI18N::get("uiDLWithCurl") + " " + CFile::getFilename(dest); setState(true, s); // user agent = nel_launcher @@ -1417,7 +1417,7 @@ void CPatchManager::downloadFileWithCurl (const string &source, const string &de CURL *curl; CURLcode res; - ucstring sTranslate = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename (source); + string sTranslate = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename (source); setState(true, sTranslate); CurrentFile = NLMISC::CFile::getFilename (source); @@ -1566,7 +1566,7 @@ void CPatchManager::downloadFile (const string &source, const string &dest, NLMI void CPatchManager::decompressFile (const string &filename) { - ucstring sTranslate = CI18N::get("uiDecompressing") + " " + NLMISC::CFile::getFilename(filename); + string sTranslate = CI18N::get("uiDecompressing") + " " + NLMISC::CFile::getFilename(filename); setState(true, sTranslate); //if(isVerboseLog()) nlinfo("Calling gzopen('%s','rb')", filename.c_str()); @@ -1664,7 +1664,7 @@ void CPatchManager::applyDate (const string &sFilename, uint32 nDate) if(nDate != 0) { setRWAccess(sFilename, false); - ucstring s = CI18N::get("uiChangeDate") + " " + NLMISC::CFile::getFilename(sFilename) + " " + timestampToHumanReadable(NLMISC::CFile::getFileModificationDate (sFilename)) + + string s = CI18N::get("uiChangeDate") + " " + NLMISC::CFile::getFilename(sFilename) + " " + timestampToHumanReadable(NLMISC::CFile::getFileModificationDate (sFilename)) + " -> " + timestampToHumanReadable(nDate); setState(true,s); @@ -1786,7 +1786,7 @@ void CPatchManager::getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn, // If the version cannot be found with size and time try with sha1 if (nVersionFound == 0xFFFFFFFF) { - ucstring sTranslate = CI18N::get("uiCheckInt") + " " + rFilename; + string sTranslate = CI18N::get("uiCheckInt") + " " + rFilename; setState(true, sTranslate); CHashKey hkLocalSHA1 = getSHA1(sFilePath); for (j = 0; j < rFile.versionCount(); ++j) @@ -1806,7 +1806,7 @@ void CPatchManager::getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn, // No version available found if (nVersionFound == 0xFFFFFFFF) { - ucstring sTranslate = CI18N::get("uiNoVersionFound"); + string sTranslate = CI18N::get("uiNoVersionFound"); setState(true, sTranslate); // Get all patches from beginning (first patch is reference file) ftpOut.FileName = rFilename; @@ -1827,7 +1827,7 @@ void CPatchManager::getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn, } else // A version of the file has been found { - ucstring sTranslate = CI18N::get("uiVersionFound") + " " + toString(nVersionFound); + string sTranslate = CI18N::get("uiVersionFound") + " " + toString(nVersionFound); setState(true, sTranslate); // Get All patches from this version ! ftpOut.FileName = rFilename; @@ -1883,7 +1883,7 @@ bool CPatchManager::bnpUnpack(const string &srcBigfile, const string &dstPath, v else DestPath = CPath::standardizePath (dstPath); - ucstring s = CI18N::get("uiUnpack") + " " + NLMISC::CFile::getFilename(SourceName); + string s = CI18N::get("uiUnpack") + " " + NLMISC::CFile::getFilename(SourceName); setState(true,s); // Read Header of the BNP File @@ -1892,7 +1892,7 @@ bool CPatchManager::bnpUnpack(const string &srcBigfile, const string &dstPath, v if (!bnpFile.readHeader()) { - ucstring s = CI18N::get("uiUnpackErrHead") + " " + CFile::getFilename(SourceName); + string s = CI18N::get("uiUnpackErrHead") + " " + CFile::getFilename(SourceName); setState(true,s); return false; } @@ -1938,8 +1938,8 @@ int CPatchManager::validateProgress(void *foo, double t, double d, double /* ult CPatchManager *pPM = CPatchManager::getInstance(); double pour1 = t!=0.0?d*100.0/t:0.0; - ucstring sTranslate = CI18N::get("uiLoginGetFile") + ucstring::makeFromUtf8(toString(" %s : %s / %s (%.02f %%)", NLMISC::CFile::getFilename(pPM->CurrentFile).c_str(), - NLMISC::bytesToHumanReadableUnits((uint64)d, units).c_str(), NLMISC::bytesToHumanReadableUnits((uint64)t, units).c_str(), pour1)); + string sTranslate = CI18N::get("uiLoginGetFile") + toString(" %s : %s / %s (%.02f %%)", NLMISC::CFile::getFilename(pPM->CurrentFile).c_str(), + NLMISC::bytesToHumanReadableUnits((uint64)d, units).c_str(), NLMISC::bytesToHumanReadableUnits((uint64)t, units).c_str(), pour1); pPM->setState(false, sTranslate); if (foo) { @@ -1953,7 +1953,7 @@ void CPatchManager::MyPatchingCB::progress(float f) { CPatchManager *pPM = CPatchManager::getInstance(); double p = 100.0*f; - ucstring sTranslate = CI18N::get("uiApplyingDelta") + ucstring::makeFromUtf8(toString(" %s (%.02f %%)", CFile::getFilename(patchFilename).c_str(), p)); + string sTranslate = CI18N::get("uiApplyingDelta") + toString(" %s (%.02f %%)", CFile::getFilename(patchFilename).c_str(), p); pPM->setState(false, sTranslate); } @@ -2079,7 +2079,7 @@ uint CPatchManager::applyScanDataResult() } // *************************************************************************** -bool CPatchManager::getDataScanLog(ucstring &text) +bool CPatchManager::getDataScanLog(string &text) { text.clear(); bool changed= false; @@ -2092,7 +2092,7 @@ bool CPatchManager::getDataScanLog(ucstring &text) { for(uint i=0;igetClientVersion(); string sServerVersion = pPM->getServerVersion(); - ucstring sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") "; + string sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") "; sTranslate += CI18N::get("uiServerVersion") + " (" + sServerVersion + ")"; pPM->setState(true, sTranslate); @@ -2216,7 +2216,7 @@ void CCheckThread::run () for (i = 0; i < rDescFiles.fileCount(); ++i) { CPatchManager::SFileToPatch ftp; - sTranslate = CI18N::get("uiCheckingFile") + " " + ucstring::makeFromUtf8(rDescFiles.getFile(i).getFileName()); + sTranslate = CI18N::get("uiCheckingFile") + " " + rDescFiles.getFile(i).getFileName(); pPM->setState(true, sTranslate); // get list of patch to apply to this file. don't to a full checksum test if possible nlwarning(rDescFiles.getFile(i).getFileName().c_str()); @@ -2408,7 +2408,7 @@ void CCheckThread::run () catch (const Exception &e) { nlwarning("EXCEPTION CATCH: CCheckThread::run() failed"); - ucstring sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what(); + string sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what(); pPM->setState(true, CI18N::get("uiCheckEndWithErr")); pPM->setErrorMessage(sTranslate); CheckOk = false; @@ -2478,7 +2478,7 @@ void CPatchThread::run() CurrentFilePatched = 0.f; - ucstring sTranslate; + string sTranslate; try { // First do all ref files @@ -2536,7 +2536,7 @@ void CPatchThread::run() catch(const Exception &e) { nlwarning("EXCEPTION CATCH: CPatchThread::run() failed"); - pPM->setState(true, ucstring(e.what())); + pPM->setState(true, string(e.what())); sTranslate = CI18N::get("uiPatchEndWithErr"); bErr = true; } @@ -2649,7 +2649,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) rFTP.LocalFileExists = false; } - ucstring sTranslate; + string sTranslate; sTranslate = CI18N::get("uiProcessing") + " " + rFTP.FileName; pPM->setState(true, sTranslate); @@ -2984,7 +2984,7 @@ void CScanDataThread::run () uint32 i; // Check if the client version is the same as the server version string sClientVersion = pPM->getClientVersion(); - ucstring sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") "; + string sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") "; pPM->setState(true, sTranslate); // For all bnp in the description file get all patches to apply @@ -3023,7 +3023,7 @@ void CScanDataThread::run () catch (const Exception &e) { nlwarning("EXCEPTION CATCH: CScanDataThread::run() failed"); - ucstring sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what(); + string sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what(); pPM->setState(true, sTranslate); CheckOk = false; Ended = true; @@ -3157,7 +3157,7 @@ bool CPatchManager::download(const std::string& patchFullname, const std::string catch ( const std::exception& e) { nlwarning("%s", e.what()); - pPM->setState(true, ucstring(e.what()) ); + pPM->setState(true, string(e.what()) ); return false; } @@ -3408,7 +3408,7 @@ void CDownloadThread::run() catch ( const std::exception& e) { nlwarning("%s", e.what()); - pPM->setState(true, ucstring(e.what()) ); + pPM->setState(true, string(e.what()) ); pPM->fatalError("uiCanNotDownload", patchName.c_str(), ""); } catch (...) @@ -3525,7 +3525,7 @@ void CInstallThread::run() catch ( const std::exception& e) { nlwarning("%s", e.what()); - pPM->setState(true, ucstring(e.what()) ); + pPM->setState(true, string(e.what()) ); pPM->fatalError("uiCanNotInstall", patchName.c_str(), ""); return; diff --git a/ryzom/client/src/login_patch.h b/ryzom/client/src/login_patch.h index 2b108994d..dfd46b49c 100644 --- a/ryzom/client/src/login_patch.h +++ b/ryzom/client/src/login_patch.h @@ -56,7 +56,7 @@ public: class IPatchManagerStateListener { public: - virtual void setState (bool /* bOutputToLog */, const ucstring &/* ucsNewState */){} + virtual void setState (bool /* bOutputToLog */, const std::string &/* ucsNewState */){} }; // Get Info of file to install @@ -154,12 +154,12 @@ public: // Get the string information about what the threads are doing // Return true if the state has changed - bool getThreadState (ucstring &state, std::vector &stateLog); + bool getThreadState (std::string &state, std::vector &stateLog); /** Get the error message (filled after a patch of check) * May be empty if the cause of error is unknown or unhandled */ - const ucstring &getLastErrorMessage() { return _ErrorMessage; } + const std::string &getLastErrorMessage() { return _ErrorMessage; } // --------------------- // First Part : Checking @@ -235,7 +235,7 @@ public: uint applyScanDataResult(); // get the current info Log for data Scan (true if some change from last get, else text is not filled) - bool getDataScanLog(ucstring &text); + bool getDataScanLog(std::string &text); CProductDescriptionForClient &getDescFile() { return DescFile; } @@ -284,7 +284,7 @@ private: friend class CPatchThreadDownloadProgress; // Set the thread state (called by threads to let us know what they are doing) - void setState (bool bOutputToLog, const ucstring &ucsState); + void setState (bool bOutputToLog, const std::string &ucsState); void touchState(); /// Get the version of the server given during init() @@ -330,7 +330,7 @@ private: // add a file to the scan data log void addDataScanLogCorruptedFile(const SFileToPatch &ftp); void clearDataScanLog(); - static void getCorruptedFileInfo(const SFileToPatch &ftp, ucstring &sTranslate); + static void getCorruptedFileInfo(const SFileToPatch &ftp, std::string &sTranslate); static bool downloadAndUnpack(const std::string& patchPath, const std::string& sourceFilename, const std::string& extractPath, const std::string& tmpDirectory, uint32 timestamp); // Forward message to Installation Software @@ -404,7 +404,7 @@ private: std::vector FilesToPatch; std::vector OptionalCat; - ucstring _ErrorMessage; + std::string _ErrorMessage; // Threads CPatchThread *PatchThread; @@ -417,8 +417,8 @@ private: // State struct CState { - ucstring State; - std::vector StateLog; + std::string State; + std::vector StateLog; bool StateChanged; CState() { @@ -470,7 +470,7 @@ private: bool _StartRyzomAtEnd; public: // used by threads to signal error at the end of execution - void setErrorMessage(const ucstring &message); + void setErrorMessage(const std::string &message); }; /** diff --git a/ryzom/tools/client/client_patcher/main.cpp b/ryzom/tools/client/client_patcher/main.cpp index e7d57a335..3f5cb04ee 100644 --- a/ryzom/tools/client/client_patcher/main.cpp +++ b/ryzom/tools/client/client_patcher/main.cpp @@ -252,8 +252,8 @@ int main(int argc, char *argv[]) pPM->init(patchURLs, PatchUrl, ""); pPM->startCheckThread(true /* include background patchs */); - ucstring state; - vector log; + string state; + vector log; bool res = false; bool finished = false; From 52e3ca024fed660ecc925466c7bc960668d7a12a Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 1 Nov 2020 05:40:32 +0800 Subject: [PATCH 132/205] UTF-8 various, ryzom/ryzomcore#335 --- .../src/interface_v3/group_html_forum.cpp | 8 +-- .../src/interface_v3/group_html_mail.cpp | 8 +-- .../src/interface_v3/group_html_webig.cpp | 6 +-- ryzom/client/src/net_manager.cpp | 54 +++++++++---------- ryzom/client/src/progress.cpp | 6 +-- .../client/src/r2/displayer_visual_entity.cpp | 10 ++-- ryzom/client/src/string_manager_client.cpp | 28 +++++----- ryzom/client/src/string_manager_client.h | 12 ++--- ryzom/client/src/text_manager.cpp | 13 ++--- ryzom/client/src/text_manager.h | 12 +++-- ryzom/client/src/user_entity.cpp | 7 ++- ryzom/client/src/user_entity.h | 4 +- 12 files changed, 82 insertions(+), 86 deletions(-) diff --git a/ryzom/client/src/interface_v3/group_html_forum.cpp b/ryzom/client/src/interface_v3/group_html_forum.cpp index 4b74732f3..e6e6ff34f 100644 --- a/ryzom/client/src/interface_v3/group_html_forum.cpp +++ b/ryzom/client/src/interface_v3/group_html_forum.cpp @@ -58,7 +58,7 @@ CGroupHTMLForum::~CGroupHTMLForum() void CGroupHTMLForum::addHTTPGetParams (string &url, bool /*trustedDomain*/) { - ucstring user_name = UserEntity->getLoginName (); + string user_name = UserEntity->getLoginName (); const SGuild &guild = CGuildManager::getInstance()->getGuild(); string gname = guild.Name; @@ -76,7 +76,7 @@ void CGroupHTMLForum::addHTTPGetParams (string &url, bool /*trustedDomain*/) url += ((url.find('?') != string::npos) ? "&" : "?") + string("shard=") + toString(CharacterHomeSessionId) + - string("&user_login=") + user_name.toString() + + string("&user_login=") + user_name + string("&forum=") + gname + string("&session_cookie=") + NetMngr.getLoginCookie().toString(); } @@ -90,14 +90,14 @@ void CGroupHTMLForum::addHTTPGetParams (string &url, bool /*trustedDomain*/) void CGroupHTMLForum::addHTTPPostParams (SFormFields &formfields, bool /*trustedDomain*/) { - ucstring user_name = UserEntity->getLoginName (); + string user_name = UserEntity->getLoginName (); const SGuild &guild = CGuildManager::getInstance()->getGuild(); string gname = guild.Name; if (!gname.empty()) { formfields.add("shard", toString(CharacterHomeSessionId)); - formfields.add("user_login", user_name.toString()); + formfields.add("user_login", user_name); formfields.add("forum", gname); formfields.add("session_cookie", NetMngr.getLoginCookie().toString()); } diff --git a/ryzom/client/src/interface_v3/group_html_mail.cpp b/ryzom/client/src/interface_v3/group_html_mail.cpp index ac2241523..eb49e5d78 100644 --- a/ryzom/client/src/interface_v3/group_html_mail.cpp +++ b/ryzom/client/src/interface_v3/group_html_mail.cpp @@ -57,10 +57,10 @@ CGroupHTMLMail::~CGroupHTMLMail() void CGroupHTMLMail::addHTTPGetParams (string &url, bool /*trustedDomain*/) { - ucstring user_name = UserEntity->getLoginName (); + string user_name = UserEntity->getLoginName (); url += ((url.find('?') != string::npos) ? "&" : "?") + string("shard=") + toString(CharacterHomeSessionId) + - string("&user_login=") + user_name.toString() + + string("&user_login=") + user_name + // FIXME: UrlEncode string("&session_cookie=") + NetMngr.getLoginCookie().toString() + string("&lang=") + CI18N::getCurrentLanguageCode(); } @@ -69,9 +69,9 @@ void CGroupHTMLMail::addHTTPGetParams (string &url, bool /*trustedDomain*/) void CGroupHTMLMail::addHTTPPostParams (SFormFields &formfields, bool /*trustedDomain*/) { - ucstring user_name = UserEntity->getLoginName (); + string user_name = UserEntity->getLoginName (); formfields.add("shard", toString(CharacterHomeSessionId)); - formfields.add("user_login", user_name.toString()); + formfields.add("user_login", user_name); // FIXME: UrlEncode formfields.add("session_cookie", NetMngr.getLoginCookie().toString()); formfields.add("lang", CI18N::getCurrentLanguageCode()); } diff --git a/ryzom/client/src/interface_v3/group_html_webig.cpp b/ryzom/client/src/interface_v3/group_html_webig.cpp index d190b83b6..7dda8b004 100644 --- a/ryzom/client/src/interface_v3/group_html_webig.cpp +++ b/ryzom/client/src/interface_v3/group_html_webig.cpp @@ -66,7 +66,7 @@ static string getWebAuthKey() // authkey = uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot; string rawKey = toString(CharacterHomeSessionId) + - UserEntity->getLoginName().toString() + + UserEntity->getLoginName() + toString(cid) + NetMngr.getLoginCookie().toString(); string key = getMD5((const uint8*)rawKey.c_str(), (uint32)rawKey.size()).toString(); @@ -85,7 +85,7 @@ void addWebIGParams (string &url, bool trustedDomain) uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot; url += ((url.find('?') != string::npos) ? "&" : "?") + string("shardid=") + toString(CharacterHomeSessionId) + - string("&name=") + UserEntity->getLoginName().toUtf8() + + string("&name=") + UserEntity->getLoginName() + // FIXME: UrlEncode string("&lang=") + CI18N::getCurrentLanguageCode() + string("&datasetid=") + toString(UserEntity->dataSetId()) + string("&ig=1"); @@ -384,7 +384,7 @@ void CGroupHTMLAuth::addHTTPPostParams (SFormFields &formfields, bool trustedDom uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot; formfields.add("shardid", toString(CharacterHomeSessionId)); - formfields.add("name", UserEntity->getLoginName().toUtf8()); + formfields.add("name", UserEntity->getLoginName()); formfields.add("lang", CI18N::getCurrentLanguageCode()); formfields.add("ig", "1"); if (trustedDomain) diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index c06389f0c..2c94b956d 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -614,8 +614,8 @@ static CInterfaceChatDisplayer InterfaceChatDisplayer; void CInterfaceChatDisplayer::colorizeSender(string &text, const string &senderName, CRGBA baseColor) { // find the sender/text separator to put color tags - ucstring::size_type pos = senderName.length() - 1; - if (pos != ucstring::npos) + string::size_type pos = senderName.length() - 1; + if (pos != string::npos) { string str; @@ -666,7 +666,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c for(;;) { string::size_type index = finalString.find("{break}"); - if (index == ucstring::npos) break; + if (index == string::npos) break; finalString = finalString.substr(0, index) + finalString.substr(index+7,finalString.size()); } @@ -819,7 +819,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c else { string::size_type index = finalString.find(""); - if (index != ucstring::npos) + if (index != string::npos) { bubbleWanted = false; finalString = finalString.substr(index+6,finalString.size()); @@ -1015,7 +1015,7 @@ void inpulseDynStringInChatGroup(NLMISC::CBitMemStream &impulse) // impulse.serialBit(huff); // // uint32 index; -// ucstring ucstr; +// ucstring ucstr; // OLD // // impulse.serial( index ); // impulse.serial( ucstr ); @@ -1109,15 +1109,15 @@ void setFakeNews () CViewText *inter2 = (CViewText *)inter->getView("title0"); nlassert (inter2 != NULL); - inter2->setText(ucstring(shortNews[rnd*3])); + inter2->setText(ucstring(shortNews[rnd*3])); // OLD CViewText *inter3 = (CViewText *)inter->getView("title1"); nlassert (inter3 != NULL); - inter3->setText(ucstring(shortNews[rnd*3+1])); + inter3->setText(ucstring(shortNews[rnd*3+1])); // OLD CViewText *inter4 = (CViewText *)inter->getView("title2"); nlassert (inter4 != NULL); - inter4->setText(ucstring(shortNews[rnd*3+2])); + inter4->setText(ucstring(shortNews[rnd*3+2])); // OLD } { // set test for the neutral main string iname; @@ -1134,11 +1134,11 @@ void setFakeNews () CViewText *inter2 = (CViewText *)inter->getView("title0"); nlassert (inter2 != NULL); - inter2->setText(ucstring(shortNews[rnd*3])); + inter2->setText(ucstring(shortNews[rnd*3])); // OLD CViewText *inter3 = (CViewText *)inter->getView("title1"); nlassert (inter3 != NULL); - inter3->setText(ucstring(shortNews[rnd*3+1])); + inter3->setText(ucstring(shortNews[rnd*3+1])); // OLD } { // set test for the more news string iname; @@ -1155,15 +1155,15 @@ void setFakeNews () CViewText *inter2 = (CViewText *)inter->getView("title0"); nlassert (inter2 != NULL); - inter2->setText(ucstring(longNews[rnd*3])); + inter2->setText(ucstring(longNews[rnd*3])); // OLD CViewText *inter3 = (CViewText *)inter->getView("title1"); nlassert (inter3 != NULL); - inter3->setText(ucstring(longNews[rnd*3+1])); + inter3->setText(ucstring(longNews[rnd*3+1])); // OLD CViewText *inter4 = (CViewText *)inter->getView("title2"); nlassert (inter4 != NULL); - inter4->setText(ucstring(longNews[rnd*3+2])); + inter4->setText(ucstring(longNews[rnd*3+2])); // OLD } } } @@ -1180,7 +1180,7 @@ void setFakeNews () static void setupBotChatChoiceList(CInterfaceGroup *botChatGroup) { // Temp for test. Should then be read from server msg - std::vector choices; + std::vector choices; for(uint k = 0; k < 90; ++k) { choices.push_back("Choice " + toString(k)); @@ -1195,7 +1195,7 @@ static void setupBotChatChoiceList(CInterfaceGroup *botChatGroup) /* static void setupBotChatDescription(CInterfaceGroup *botChatGroup) { - ucstring desc; + string desc; for(uint k = 0; k < 90; ++k) { desc += "This is a multi line description. "; @@ -1216,7 +1216,7 @@ static void setupBotChatBotGift(CInterfaceGroup *botChatGroup) NLGUI::CDBManager::getInstance()->getDbProp("SERVER:INVENTORY:20:0:QUALITY")->setValue32(0); NLGUI::CDBManager::getInstance()->getDbProp("SERVER:INVENTORY:20:1:SHEET")->setValue32(CSheetId("fyros_sword_lvl_01_05.item").asInt()); NLGUI::CDBManager::getInstance()->getDbProp("SERVER:INVENTORY:20:1:QUALITY")->setValue32(2); - CBotChat::setBotGift(botChatGroup, ucstring("Thanks to have succeeded the mission"), ucstring("Here's your reward"), ucstring("The bot has taken the object quest from your inventory")); + CBotChat::setBotGift(botChatGroup, "Thanks to have succeeded the mission", "Here's your reward", "The bot has taken the object quest from your inventory"); } */ @@ -1798,7 +1798,7 @@ void impulseTeamContactInit(NLMISC::CBitMemStream &impulse) { vector vFriendListName; vector vFriendListOnline; - vector vIgnoreListName; + vector vIgnoreListName; // TODO: UTF-8 (serial) impulse.serialCont(vFriendListName); uint32 nbState; @@ -2136,9 +2136,9 @@ void impulseWhere(NLMISC::CBitMemStream &impulse) void impulseWho(NLMISC::CBitMemStream &impulse) { nlinfo("impulseWho Received"); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("Players currently in the game :")); + CInterfaceManager::getInstance()->displaySystemInfo("Players currently in the game :"); - ucstring name; + ucstring name; // OLD uint32 loginId; uint16 dist; uint8 dirshort; @@ -2176,7 +2176,7 @@ void impulseWho(NLMISC::CBitMemStream &impulse) }; str = toString (" - uid %d - distance %hu meters - direction ", loginId, dist); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(name + ucstring(str) + CI18N::get(txts[direction]))); + CInterfaceManager::getInstance()->displaySystemInfo(name + str + CI18N::get(txts[direction])); } }// impulseWho // */ @@ -2185,9 +2185,9 @@ void impulseWho(NLMISC::CBitMemStream &impulse) void impulseWhoGM(NLMISC::CBitMemStream &impulse) { nlinfo("impulseWhoGM Received"); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("Players currently in the game :")); + CInterfaceManager::getInstance()->displaySystemInfo("Players currently in the game :"); - ucstring name; + ucstring name; // OLD uint32 loginId; uint16 dist; uint8 dirshort; @@ -2225,7 +2225,7 @@ void impulseWhoGM(NLMISC::CBitMemStream &impulse) }; str = toString (" - uid %d - distance %hu meters - direction ", loginId, dist); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(name + ucstring(str) + CI18N::get(txts[direction]))); + CInterfaceManager::getInstance()->displaySystemInfo(name + str + CI18N::get(txts[direction])); } }// impulseWho // */ @@ -3115,12 +3115,12 @@ void impulsePVPChooseClan(NLMISC::CBitMemStream &impulse) CCtrlTextButton * butClan1 = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:join_pvp_clan_proposal:content:clan1")); if( butClan1 == NULL ) return; - butClan1->setText( ucstring(EGSPD::CPeople::toString( clan1 )) ); + butClan1->setText( EGSPD::CPeople::toString( clan1 ) ); CCtrlTextButton * butClan2 = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:join_pvp_clan_proposal:content:clan2")); if( butClan2 == NULL ) return; - butClan2->setText( ucstring(EGSPD::CPeople::toString( clan2 )) ); + butClan2->setText( EGSPD::CPeople::toString( clan2 ) ); } */ @@ -3316,8 +3316,8 @@ private: if(i!=digitMaxEnd) { // get the width - ucstring digitStr= contentStr.substr(digitStart, i-digitStart); - fromString(digitStr.toString(), w); + string digitStr= contentStr.substr(digitStart, i-digitStart); + fromString(digitStr, w); // remove the first tag contentStr= contentStr.substr(i+1); } diff --git a/ryzom/client/src/progress.cpp b/ryzom/client/src/progress.cpp index 534ae46e9..620b5486d 100644 --- a/ryzom/client/src/progress.cpp +++ b/ryzom/client/src/progress.cpp @@ -312,7 +312,7 @@ void CProgress::internalProgress (float value) // More help TextContext->setFontSize((uint)(12.f * fontFactor)); /* todo tips of the day uncomment - ucstring ucstr = CI18N::get ("uiTipsEnd"); + string ucstr = CI18N::get ("uiTipsEnd"); TextContext->printAt(0.5f, fY, ucstr); */ fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY); fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY); @@ -360,11 +360,9 @@ void CProgress::internalProgress (float value) (uint)RT.getRyzomTime(), CI18N::get ("uiSeason"+toStringEnum(CRyzomTime::getSeasonByDay(day))).c_str(), CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName).c_str()); - ucstring ucstr; - ucstr.fromUtf8 (str); TextContext->setHotSpot(UTextContext::MiddleBottom); TextContext->setColor(CRGBA(186, 179, 163, 255)); - TextContext->printAt(0.5f, 25/768.f, ucstr); + TextContext->printAt(0.5f, 25/768.f, str); } // apply text commands diff --git a/ryzom/client/src/r2/displayer_visual_entity.cpp b/ryzom/client/src/r2/displayer_visual_entity.cpp index 01eaf0bc0..81c24342a 100644 --- a/ryzom/client/src/r2/displayer_visual_entity.cpp +++ b/ryzom/client/src/r2/displayer_visual_entity.cpp @@ -968,9 +968,7 @@ void CDisplayerVisualEntity::updateName() //H_AUTO(R2_CDisplayerVisualEntity_updateName) if (!_Entity) return; - std::string name = getString(&getProps(), "Name"); - ucstring ucName; - ucName.fromUtf8(name); + std::string ucName = getString(&getProps(), "Name"); if (ucName.empty()) { ucName = CI18N::get("uiR2EDNoName"); @@ -1011,13 +1009,11 @@ void CDisplayerVisualEntity::updateName() actName = NLMISC::toString(" [%s]", actName.c_str()); - ucstring ucActName; - ucActName.fromUtf8(actName); - ucName += ucActName; + ucName += actName; { //BENCH(setEntityName) - _Entity->setEntityName(ucName.toUtf8()); + _Entity->setEntityName(ucName); } { //BENCH(buildInSceneInterface) diff --git a/ryzom/client/src/string_manager_client.cpp b/ryzom/client/src/string_manager_client.cpp index 79a0ee36d..71b8ddc81 100644 --- a/ryzom/client/src/string_manager_client.cpp +++ b/ryzom/client/src/string_manager_client.cpp @@ -971,7 +971,7 @@ restartLoop: return referenceFile; } - void CLoadProxy::loadStringFile(const string &filename, ucstring &text) + void CLoadProxy::loadStringFile(const string &filename, ucstring &text) // TODO: UTF-8 (serial) { vector reference; vector addition; @@ -1015,7 +1015,7 @@ restartLoop: context.Diff.push_back(context.Addition[addIndex]); //nldebug("Adding new string '%s' in CI18N", context.Addition[addIndex].Identifier.c_str()); if (ClientCfg.DebugStringManager) - context.Diff.back().Text = ucstring("")+context.Diff.back().Text; + context.Diff.back().Text = ucstring("")+context.Diff.back().Text; // TODO: UTF-8 (serial) } void CLoadProxy::onRemove(uint /* addIndex */, uint /* refIndex */, TStringDiffContext &/* context */) { @@ -1027,7 +1027,7 @@ restartLoop: context.Diff.push_back(context.Addition[addIndex]); //nldebug("Using changed string '%s' in CI18N", context.Addition[addIndex].Identifier.c_str()); if (ClientCfg.DebugStringManager) - context.Diff.back().Text = ucstring("")+context.Diff.back().Text; + context.Diff.back().Text = ucstring("")+context.Diff.back().Text; // TODO: UTF-8 (serial) } void CLoadProxy::onSwap(uint /* newIndex */, uint /* refIndex */, TStringDiffContext &/* context */) { @@ -1041,7 +1041,7 @@ restartLoop: class CReadWorkSheetFile : public TWorkSheetDiff::IDiffCallback { public: - void readWorkSheetFile(const string &filename, ucstring &text) + void readWorkSheetFile(const string &filename, ucstring &text) // TODO: UTF-8 (serial) { TWorksheet addition; TWorksheet reference; @@ -1178,9 +1178,9 @@ bool CStringManagerClient::checkWordFileDates(vector &fileChecks, co // *************************************************************************** void CStringManagerClient::initI18NSpecialWords(const string &languageCode) { - ucstring womenNameColIdent = ucstring("women_name"); - ucstring descColIdent = ucstring("description"); - ucstring descColIdent2 = ucstring("description2"); + ucstring womenNameColIdent = ucstring("women_name"); // TODO: UTF-8 (serial) + ucstring descColIdent = ucstring("description"); // TODO: UTF-8 (serial) + ucstring descColIdent2 = ucstring("description2"); // TODO: UTF-8 (serial) // List of words to append to the local CI18N system. static const char *specialWords[]= @@ -1219,11 +1219,11 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode) { uint32 profile0= (uint32)ryzomGetLocalTime(); - ucstring ucs; + ucstring ucs; // TODO: UTF-8 (serial) string fileName = fileNames[i]; string keyExtenstion = specialWords[i*3+2]; - // read the ucstring and make diffs with data in ./translation/work. + // read the ucstring and make diffs with data in ./translation/work. // TODO: UTF-8 (serial) CReadWorkSheetFile rwsf; rwsf.readWorkSheetFile(fileName, ucs); if(ucs.empty()) @@ -1235,9 +1235,9 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode) // Get the Key and Data ColIndex. uint nameColIndex = 0, keyColIndex = 0; - if( !ws.findCol(ucstring("name"), nameColIndex) ) + if( !ws.findCol(ucstring("name"), nameColIndex) ) // TODO: UTF-8 (serial) continue; - if( !ws.findCol(ucstring(specialWords[i*3+1]), keyColIndex) ) + if( !ws.findCol(ucstring(specialWords[i*3+1]), keyColIndex) ) // TODO: UTF-8 (serial) continue; // Get the women name index if possible. @@ -1282,7 +1282,7 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode) // insert in map of Women Name if OK. if(womenNameColIndex!=std::numeric_limits::max()) { - const ucstring &womenName= ws.getData(j, womenNameColIndex); + const ucstring &womenName= ws.getData(j, womenNameColIndex); // TODO: UTF-8 (serial) _SpecItem_TempMap[keyStr].WomenName= womenName.toUtf8(); // replace all \n in the women name with true \n while(strFindReplace(_SpecItem_TempMap[keyStr].WomenName, "\\n", "\n")); @@ -1291,7 +1291,7 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode) // insert in map of Description if OK. if(descColIndex!=std::numeric_limits::max()) { - const ucstring &desc= ws.getData(j, descColIndex); + const ucstring &desc= ws.getData(j, descColIndex); // TODO: UTF-8 (serial) _SpecItem_TempMap[keyStr].Desc= desc.toUtf8(); // replace all \n in the desc with true \n while(strFindReplace(_SpecItem_TempMap[keyStr].Desc, "\\n", "\n")); @@ -1300,7 +1300,7 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode) // insert in map of Description2 if OK. if(descColIndex2!=std::numeric_limits::max()) { - const ucstring &desc= ws.getData(j, descColIndex2); + const ucstring &desc= ws.getData(j, descColIndex2); // TODO: UTF-8 (serial) _SpecItem_TempMap[keyStr].Desc2= desc.toUtf8(); // replace all \n in the desc with true \n while(strFindReplace(_SpecItem_TempMap[keyStr].Desc2, "\\n", "\n")); diff --git a/ryzom/client/src/string_manager_client.h b/ryzom/client/src/string_manager_client.h index 864c80c1f..e3cd736fd 100644 --- a/ryzom/client/src/string_manager_client.h +++ b/ryzom/client/src/string_manager_client.h @@ -187,7 +187,7 @@ private: struct TStringWaiter { - /// Pointer to the ucstring to fill + /// Pointer to the utf-8 string to fill std::string *Result; /// Pointer to the remover that contains this string reference const IStringWaiterRemover *Remover; @@ -277,10 +277,10 @@ private: else { nlassert(f.isReading()); - ucstring name; - ucstring womenName; - ucstring desc; - ucstring desc2; + ucstring name; // Old UTF-16 serial + ucstring womenName; // Old UTF-16 serial + ucstring desc; // Old UTF-16 serial + ucstring desc2; // Old UTF-16 serial f.serial(name); if (ver >= 1) f.serial(womenName); @@ -419,7 +419,7 @@ public: */ class CLoadProxy : public NLMISC::CI18N::ILoadProxy, public TStringDiff::IDiffCallback { - void loadStringFile(const std::string &filename, ucstring &text); + void loadStringFile(const std::string &filename, ucstring &text); // TODO: UTF-8 (serial) void onEquivalent(uint addIndex, uint refIndex, TStringDiffContext &context); void onAdd(uint addIndex, uint refIndex, TStringDiffContext &context); diff --git a/ryzom/client/src/text_manager.cpp b/ryzom/client/src/text_manager.cpp index bb78bffff..9873b4986 100644 --- a/ryzom/client/src/text_manager.cpp +++ b/ryzom/client/src/text_manager.cpp @@ -15,7 +15,7 @@ // along with this program. If not, see . - +#if 0 #include "stdpch.h" @@ -55,14 +55,14 @@ CTextManager::CTextManager() //----------------------------------------------- /// Return the text according to the Id. //----------------------------------------------- -ucstring CTextManager::text(uint textId) +ucstring CTextManager::text(uint textId) // OLD { - map::iterator it = _Texts.find(textId); + map::iterator it = _Texts.find(textId); // OLD if(it != _Texts.end()) return (*it).second; // Return an empty string. - return ucstring(); + return ucstring(); // OLD } //----------------------------------------------- @@ -70,13 +70,14 @@ ucstring CTextManager::text(uint textId) //----------------------------------------------- void CTextManager::text(uint textId, const std::string &str) { - _Texts.insert(make_pair(textId, ucstring(str))); + _Texts.insert(make_pair(textId, ucstring(str))); // OLD } //----------------------------------------------- /// Set the text for 'textId'. //----------------------------------------------- -void CTextManager::text(uint textId, const ucstring &str) +void CTextManager::text(uint textId, const ucstring &str) // OLD { _Texts.insert(make_pair(textId, str)); } +#endif diff --git a/ryzom/client/src/text_manager.h b/ryzom/client/src/text_manager.h index 371d6bac9..d154541e3 100644 --- a/ryzom/client/src/text_manager.h +++ b/ryzom/client/src/text_manager.h @@ -14,8 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +// Lost code - +#if 0 #ifndef NL_TEXT_MANAGER_H #define NL_TEXT_MANAGER_H @@ -25,7 +26,7 @@ ///////////// // Misc #include "nel/misc/types_nl.h" -#include "nel/misc/ucstring.h" +#include "nel/misc/ucstring.h" // OLD // Std #include @@ -42,18 +43,18 @@ class CTextManager { protected: - std::map _Texts; + std::map _Texts; // OLD public: /// Constructor CTextManager(); /// Return the text according to the Id. - ucstring text(uint textId); + ucstring text(uint textId); // OLD /// Set the text for 'textId'. void text(uint textId, const std::string &str); /// Set the text for 'textId'. - void text(uint textId, const ucstring &str); + void text(uint textId, const ucstring &str); // OLD }; @@ -65,5 +66,6 @@ extern CTextManager TextMngr; #endif // NL_TEXT_MANAGER_H +#endif /* End of text_manager.h */ diff --git a/ryzom/client/src/user_entity.cpp b/ryzom/client/src/user_entity.cpp index b2dcb0cab..dce3191dd 100644 --- a/ryzom/client/src/user_entity.cpp +++ b/ryzom/client/src/user_entity.cpp @@ -3078,7 +3078,7 @@ void CUserEntity::setAFK(bool b, string afkTxt) nlwarning("CUserEntity:setAFK: unknown message named '%s'.", msgName.c_str()); // custom afk txt - ucstring ucstr; + ucstring ucstr; // TODO: UTF-8 (serial) ucstr.fromUtf8( afkTxt ); CBitMemStream outTxt; static const string msgNameTxt = "STRING:AFK_TXT"; @@ -3828,11 +3828,10 @@ void CUserEntity::CSkillPointsObserver::update(ICDBNode* node ) string deltaStr = toString("%+d", delta); // get the sp title - ucstring spTitle; - spTitle= CI18N::get(toString("uiSkillPointsBold%d",SpType)); + const string &spTitle = CI18N::get(toString("uiSkillPointsBold%d",SpType)); // run the popup - CAHManager::getInstance()->runActionHandler("message_popup", NULL, "text1="+deltaStr+"|text0="+spTitle.toUtf8()); + CAHManager::getInstance()->runActionHandler("message_popup", NULL, "text1="+deltaStr+"|text0="+spTitle); // Context help contextHelp ("skill_point"); diff --git a/ryzom/client/src/user_entity.h b/ryzom/client/src/user_entity.h index 382a7d810..3dccc362a 100644 --- a/ryzom/client/src/user_entity.h +++ b/ryzom/client/src/user_entity.h @@ -485,7 +485,7 @@ public: /// true if current behaviour allows to change front bool canChangeFront(); - ucstring getLoginName() + string getLoginName() { if (_LoginName.empty()) _LoginName = getDisplayName(); @@ -772,7 +772,7 @@ private: CItemSnapshot _PreviousRightHandItem; CItemSnapshot _PreviousLeftHandItem; - ucstring _LoginName; + std::string _LoginName; }; /// Out game received position From c27547c3a3bfc2f53130a186a862212f76e2f707 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 1 Nov 2020 06:23:58 +0800 Subject: [PATCH 133/205] UTF-8 various, ryzom/ryzomcore#335 --- .../src/interface_v3/interface_manager.cpp | 2 +- .../src/interface_v3/interface_manager.h | 2 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 18 +++++----- ryzom/client/src/login.cpp | 34 +++++++------------ ryzom/client/src/misc.cpp | 4 +-- ryzom/client/src/misc.h | 4 +-- ryzom/client/src/net_manager.cpp | 2 +- .../src/game_share/bg_downloader_msg.cpp | 4 +-- .../common/src/game_share/bg_downloader_msg.h | 2 +- 9 files changed, 32 insertions(+), 40 deletions(-) diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 963093235..1b36c91d5 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -2413,7 +2413,7 @@ void CInterfaceManager::messageBox(const ucstring &text, const string &masterGro // ------------------------------------------------------------------------------------------------ -void CInterfaceManager::messageBoxWithHelp(const ucstring &text, const std::string &masterGroup, +void CInterfaceManager::messageBoxWithHelp(const std::string &text, const std::string &masterGroup, const std::string &ahOnOk, const std::string ¶msOnOk, TCaseMode caseMode) { diff --git a/ryzom/client/src/interface_v3/interface_manager.h b/ryzom/client/src/interface_v3/interface_manager.h index 2aed09dc5..91178677d 100644 --- a/ryzom/client/src/interface_v3/interface_manager.h +++ b/ryzom/client/src/interface_v3/interface_manager.h @@ -310,7 +310,7 @@ public: * The help button with open a browser on ryzom.com faq * ui:interface:message_box_with_help must be defined in xml, with a "text" ViewText son */ - void messageBoxWithHelp(const ucstring &text, const std::string &masterGroup="ui:interface", + void messageBoxWithHelp(const std::string &text, const std::string &masterGroup="ui:interface", const std::string &ahOnOk = std::string(), const std::string ¶msOnOk= std::string(), TCaseMode caseMode = CaseFirstSentenceLetterUp); diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 4e6599fa1..0e97c73f7 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -527,9 +527,9 @@ void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls) luabind::def("messageBox", (void(*)(const ucstring &, const std::string &)) &messageBox), luabind::def("messageBox", (void(*)(const ucstring &, const std::string &, int caseMode)) &messageBox), luabind::def("messageBox", (void(*)(const std::string &)) &messageBox), - luabind::def("messageBoxWithHelp", (void(*)(const ucstring &)) &messageBoxWithHelp), - luabind::def("messageBoxWithHelp", (void(*)(const ucstring &, const std::string &)) &messageBoxWithHelp), - luabind::def("messageBoxWithHelp", (void(*)(const ucstring &, const std::string &, int caseMode)) &messageBoxWithHelp), + luabind::def("messageBoxWithHelp", (void(*)(const ucstring &)) &messageBoxWithHelp), // TODO: Lua UTF-8 + luabind::def("messageBoxWithHelp", (void(*)(const ucstring &, const std::string &)) &messageBoxWithHelp), // TODO: Lua UTF-8 + luabind::def("messageBoxWithHelp", (void(*)(const ucstring &, const std::string &, int caseMode)) &messageBoxWithHelp), // TODO: Lua UTF-8 luabind::def("messageBoxWithHelp", (void(*)(const std::string &)) &messageBoxWithHelp), LUABIND_FUNC(replacePvpEffectParam), LUABIND_FUNC(secondsSince1970ToHour), @@ -2929,23 +2929,23 @@ void CLuaIHMRyzom::messageBox(const std::string &text) } // *************************************************************************** -void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text) +void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text) // TODO: Lua UTF-8 { //H_AUTO(Lua_CLuaIHM_messageBox) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->messageBoxWithHelp(text); + pIM->messageBoxWithHelp(text.toUtf8()); } // *************************************************************************** -void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text, const std::string &masterGroup) +void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text, const std::string &masterGroup) // TODO: Lua UTF-8 { //H_AUTO(Lua_CLuaIHM_messageBox) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->messageBoxWithHelp(text, masterGroup); + pIM->messageBoxWithHelp(text.toUtf8(), masterGroup); } // *************************************************************************** -void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text, const std::string &masterGroup, int caseMode) +void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text, const std::string &masterGroup, int caseMode) // TODO: Lua UTF-8 { if (caseMode < 0 || caseMode >= CaseCount) { @@ -2954,7 +2954,7 @@ void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text, const std::string & //H_AUTO(Lua_CLuaIHM_messageBox) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->messageBoxWithHelp(text, masterGroup, "" , "", (TCaseMode) caseMode); + pIM->messageBoxWithHelp(text.toUtf8(), masterGroup, "" , "", (TCaseMode) caseMode); } // *************************************************************************** diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index d0f6243b8..bedd66f7c 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -243,7 +243,7 @@ void createOptionalCatUI() pVT = dynamic_cast(pNewLine->getView("size")); if (pVT != NULL) { - pVT->setText(BGDownloader::getWrittenSize(InfoOnPatch.OptCat[i].Size).toUtf8()); + pVT->setText(BGDownloader::getWrittenSize(InfoOnPatch.OptCat[i].Size)); } // Add to the list @@ -467,8 +467,8 @@ void loginMainLoop() bool res = false; BGDownloader::TTaskResult taskResult = BGDownloader::TaskResult_Unknown; bool finished = false; - ucstring bgDownloaderError; #ifdef RYZOM_BG_DOWNLOADER + string bgDownloaderError; if (isBGDownloadEnabled()) { finished = bgDownloader.isTaskEnded(taskResult, bgDownloaderError); @@ -657,7 +657,7 @@ void loginMainLoop() totalPatchSize = bgDownloader.getTotalSize(); BGDownloader::TTaskResult taskResult; bool finished = false; - ucstring bgDownloaderError; + string bgDownloaderError; finished = bgDownloader.isTaskEnded(taskResult, bgDownloaderError); if (finished) { @@ -670,8 +670,8 @@ void loginMainLoop() if (taskResult == BGDownloader::TaskResult_Error) { - setPatcherStateText("ui:login:patching", ucstring()); - setPatcherProgressText("ui:login:patching", ucstring()); + setPatcherStateText("ui:login:patching", string()); + setPatcherProgressText("ui:login:patching", string()); if (!fatalMessageBoxShown) { @@ -723,10 +723,10 @@ void loginMainLoop() } CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_TOTAL_SIZE_PATCH)); - ucstring sTmp; + string sTmp; sTmp = BGDownloader::getWrittenSize(currentPatchingSize); sTmp += " / " + BGDownloader::getWrittenSize(totalPatchSize); - if (pVT != NULL) pVT->setText(sTmp.toUtf8()); + if (pVT != NULL) pVT->setText(sTmp); } // else if (screen == UI_VARIABLES_SCREEN_CATDISP) // If we are displaying patch info else if (LoginSM.getCurrentState() == CLoginStateMachine::st_display_cat) @@ -775,10 +775,10 @@ void loginMainLoop() // Total size of the patches is optional cats + required cat (f(optCat)) + non opt cat CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_TOTAL_SIZE)); - if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(TotalPatchSize).toUtf8()); + if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(TotalPatchSize)); pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_NON_OPTIONAL_SIZE)); - if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(nNonOptSize).toUtf8()); + if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(nNonOptSize)); } } } @@ -802,7 +802,7 @@ void initLoginScreen() // version std::string ext; - if (ClientApp.find("ryzom_") != ucstring::npos) + if (ClientApp.find("ryzom_") != string::npos) ext = " (" + ClientApp.substr(6) + ")"; CViewText *pV = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:ver_value")); @@ -1878,7 +1878,7 @@ class CAHReboot : public IActionHandler } catch (const std::exception &e) { - im->messageBoxWithHelp(ucstring::makeFromUtf8(e.what()), "ui:login", "login_quit"); + im->messageBoxWithHelp(e.what(), "ui:login", "login_quit"); } } }; @@ -2354,10 +2354,6 @@ inline string parseTooltip(const string & initString, const string & tagName) tooltip = tooltip.substr(0, tooltip.find("<")); } - ucstring uc; - uc.fromUtf8(tooltip);; - tooltip = uc.toString(); - return tooltip; } @@ -2377,10 +2373,6 @@ inline string parseCommentError(const string & initString, const string & tagNam error = error.substr(0, error.find("<")); } - ucstring uc; - uc.fromUtf8(error);; - error = uc.toString(); - return error; } @@ -3304,7 +3296,7 @@ void loginIntro() if (i != 0) { beginLoading(IntroNVidia); - ucstring nmsg(""); + string nmsg(""); ProgressBar.newMessage (nmsg); } @@ -3330,7 +3322,7 @@ void loginIntro() Driver->AsyncListener.isKeyPushed (KeySPACE)) break; - const ucstring nmsg(""); + const string nmsg(""); ProgressBar.newMessage (nmsg); IngameDbMngr.flushObserverCalls(); NLGUI::CDBManager::getInstance()->flushObserverCalls(); diff --git a/ryzom/client/src/misc.cpp b/ryzom/client/src/misc.cpp index 9816202d4..4e35cfc2a 100644 --- a/ryzom/client/src/misc.cpp +++ b/ryzom/client/src/misc.cpp @@ -879,7 +879,7 @@ NLMISC::CRGBA interpClientCfgColor(const string &src, string &dest) if (src[0] == '&') { string::size_type nextPos = src.find('&', 1); - if (nextPos != ucstring::npos) + if (nextPos != string::npos) { std::string colorCode; colorCode.resize(nextPos - 1); @@ -980,7 +980,7 @@ std::string getStringCategoryIfAny(const string &src, string &dest) // *************************************************************************** -sint ucstrnicmp(const ucstring &s0, uint p0, uint n0, const ucstring &s1) +sint ucstrnicmp(const ucstring &s0, uint p0, uint n0, const ucstring &s1) // OLD { // start const ucchar *start1= s1.c_str(); diff --git a/ryzom/client/src/misc.h b/ryzom/client/src/misc.h index 96568c22e..c48b18137 100644 --- a/ryzom/client/src/misc.h +++ b/ryzom/client/src/misc.h @@ -193,8 +193,8 @@ enum TFilter3d RYZOM_MAX_FILTER_3D, }; -// compare 2 ucstring s0 and s1, without regard to case. give start and size for sequence p0 -sint ucstrnicmp(const ucstring &s0, uint p0, uint n0, const ucstring &s1); +// compare 2 ucstring s0 and s1, without regard to case. give start and size for sequence p0 // OLD +sint ucstrnicmp(const ucstring &s0, uint p0, uint n0, const ucstring &s1); // OLD /** Compute a non-continuous noise with uniform repartition in [0, 1], with the given noise object * By default repartition is not uniform for noise diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index 2c94b956d..6b73acba2 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -4340,7 +4340,7 @@ NLMISC_COMMAND(testDuelInvite, "","") //{ // uint32 index; // fromString(args[0], index); -// ucstring ucstr = args[1]; +// ucstring ucstr = args[1]; // OLD // // vector code; // diff --git a/ryzom/common/src/game_share/bg_downloader_msg.cpp b/ryzom/common/src/game_share/bg_downloader_msg.cpp index 297770ddb..e26aad9be 100644 --- a/ryzom/common/src/game_share/bg_downloader_msg.cpp +++ b/ryzom/common/src/game_share/bg_downloader_msg.cpp @@ -26,10 +26,10 @@ namespace BGDownloader const wchar_t *DownloaderMutexName = L"RyzomBgDownloader"; -ucstring getWrittenSize(uint32 nSize) +std::string getWrittenSize(uint32 nSize) { float fSize = ((float)nSize)/(1024.0f*1024.0f); - ucstring ucs = NLMISC::toString("%.1f", fSize) + " " + NLMISC::CI18N::get("uiMb"); + std::string ucs = NLMISC::toString("%.1f", fSize) + " " + NLMISC::CI18N::get("uiMb"); return ucs; } diff --git a/ryzom/common/src/game_share/bg_downloader_msg.h b/ryzom/common/src/game_share/bg_downloader_msg.h index da903493f..4ed562168 100644 --- a/ryzom/common/src/game_share/bg_downloader_msg.h +++ b/ryzom/common/src/game_share/bg_downloader_msg.h @@ -137,7 +137,7 @@ extern const wchar_t *DownloaderMutexName; // get patch written size in megabytes -ucstring getWrittenSize(uint32 nSize); +std::string getWrittenSize(uint32 nSize); std::string toString(TMsgType msgType); From 0dfff69c6f9d17c71c71b8f8bea1b47a71b5268e Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 1 Nov 2020 09:57:33 +0800 Subject: [PATCH 134/205] UTF-8 various, ryzom/ryzomcore#335 --- nel/include/nel/misc/utf_string_view.h | 3 + nel/src/misc/utf_string_view.cpp | 15 +++++ ryzom/client/src/connection.cpp | 2 +- ryzom/client/src/entities.cpp | 26 ++------ ryzom/client/src/entity_cl.cpp | 2 +- .../src/interface_v3/action_handler_help.cpp | 8 +-- .../src/interface_v3/action_handler_misc.cpp | 6 +- .../interface_v3/action_handler_phrase.cpp | 4 +- .../src/interface_v3/action_phrase_faber.cpp | 8 +-- .../src/interface_v3/bot_chat_page_trade.cpp | 2 +- .../src/interface_v3/bot_chat_page_trade.h | 4 +- ryzom/client/src/interface_v3/chat_filter.cpp | 3 +- ryzom/client/src/interface_v3/chat_window.cpp | 59 +++++++++---------- ryzom/client/src/interface_v3/chat_window.h | 30 +++++----- .../client/src/interface_v3/dbctrl_sheet.cpp | 20 +++---- ryzom/client/src/interface_v3/dbctrl_sheet.h | 4 +- .../client/src/interface_v3/group_career.cpp | 6 +- .../interface_expr_user_fct_game.cpp | 4 +- .../interface_expr_user_fct_items.cpp | 2 +- .../src/interface_v3/interface_manager.cpp | 2 +- .../src/interface_v3/inventory_manager.cpp | 26 ++++---- .../src/interface_v3/inventory_manager.h | 10 ++-- .../src/interface_v3/item_special_effect.cpp | 4 +- .../client/src/interface_v3/macrocmd_key.cpp | 6 +- .../client/src/interface_v3/music_player.cpp | 10 +++- .../src/interface_v3/people_interraction.cpp | 40 +++++++------ .../src/interface_v3/people_interraction.h | 14 ++--- ryzom/client/src/interface_v3/people_list.cpp | 27 ++++----- ryzom/client/src/interface_v3/people_list.h | 7 +-- .../client/src/interface_v3/skill_manager.cpp | 8 +-- .../src/interface_v3/sphrase_manager.cpp | 13 ++-- .../src/interface_v3/view_bitmap_faber_mp.cpp | 6 +- ryzom/client/src/misc.cpp | 4 +- ryzom/client/src/net_manager.cpp | 2 +- ryzom/client/src/zone_util.cpp | 4 +- 35 files changed, 198 insertions(+), 193 deletions(-) diff --git a/nel/include/nel/misc/utf_string_view.h b/nel/include/nel/misc/utf_string_view.h index 572d39ac4..309377578 100644 --- a/nel/include/nel/misc/utf_string_view.h +++ b/nel/include/nel/misc/utf_string_view.h @@ -147,6 +147,9 @@ public: static void append(IStream &s, u32char c); static u32char get(IStream &s); + /// Get an UTF-8 string from an undefined ASCII-based codepage + static std::string fromAscii(std::string &str); + private: typedef u32char (*TIterator)(const void **addr); static u32char utf8Iterator(const void **addr); diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp index 64f2f8e55..dd7a88868 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -174,6 +174,21 @@ std::string CUtfStringView::toAscii() const return res; } +std::string CUtfStringView::fromAscii(std::string &str) +{ + std::string res; + res.reserve(str.size()); + for (std::string::iterator it(str.begin()), end(str.end()); it != end; ++it) + { + unsigned char c = *it; + if (c < 0x80) + res += (char)c; + else + res += '?'; + } + return res; +} + std::wstring CUtfStringView::toWide() const { #ifdef NL_OS_WINDOWS diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 63b8a6dd8..e31bd37fd 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -804,7 +804,7 @@ std::string buildPlayerNameForSaveFile(const std::string &playerNameIn) (c>='0' && c<='9') || (c=='_') ) { - ret[i]= tolower(c); + ret[i]= tolower(c); // TODO: toLowerAscii } else ret[i]= '_'; diff --git a/ryzom/client/src/entities.cpp b/ryzom/client/src/entities.cpp index 11c403403..7743cb02e 100644 --- a/ryzom/client/src/entities.cpp +++ b/ryzom/client/src/entities.cpp @@ -2419,14 +2419,8 @@ CEntityCL *CEntityManager::getEntityByKeywords (const std::vector &keywo //----------------------------------------------- CEntityCL *CEntityManager::getEntityByName (const string &name, bool caseSensitive, bool complete) const { - string source = name; - const uint size = (uint)source.size(); - if (!caseSensitive) - { - uint j; - for (j=0; jgetDisplayName(); + string value = caseSensitive ? _Entities[i]->getDisplayName() : toLower(_Entities[i]->getDisplayName()); // TODO: toLowerInsensitive bool foundEntity = false; - uint j; - if (!caseSensitive) - { - for (j=0; j= size) - { - if (std::operator==(source, value.substr (0, size))) - foundEntity = true; - } + if (NLMISC::startsWith(value, source)) + foundEntity = true; } if (foundEntity) diff --git a/ryzom/client/src/entity_cl.cpp b/ryzom/client/src/entity_cl.cpp index 4c1b4a842..8f96cb96b 100644 --- a/ryzom/client/src/entity_cl.cpp +++ b/ryzom/client/src/entity_cl.cpp @@ -2355,7 +2355,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value) if (pVT != NULL) pVT->setText(_Title); CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:player")); - if (pGC != NULL) pGC->setUCTitle(_EntityName); + if (pGC != NULL) pGC->setTitle(_EntityName); CSkillManager *pSM = CSkillManager::getInstance(); pSM->setPlayerTitle(_TitleRaw); diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index 3ba05a570..9cad50e25 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -973,12 +973,12 @@ class CHandlerBrowse : public IActionHandler { if(params[i]=='%' && igetItemActualName().toUtf8(); + string title = setup.SrcSheet->getItemActualName(); setupHelpTitle(setup.HelpWindow, title ); getItemText (setup.SrcSheet, itemText, pIS); diff --git a/ryzom/client/src/interface_v3/action_handler_misc.cpp b/ryzom/client/src/interface_v3/action_handler_misc.cpp index 8b144f844..73c967bcb 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -836,7 +836,7 @@ class CAHReplyTeller : public IActionHandler { w->setKeyboardFocus(); w->enableBlink(1); - PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName.toUtf8())); + PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName)); CGroupEditBox *eb = w->getEditBox(); if (eb != NULL) { @@ -863,7 +863,7 @@ class CAHReplyTellerOnce : public IActionHandler { w->setKeyboardFocus(); w->enableBlink(1); - w->setCommand(ucstring("tell ") + CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName.toUtf8()) + ucstring(" "), false); + w->setCommand("tell " + CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName) + " ", false); CGroupEditBox *eb = w->getEditBox(); if (eb != NULL) { @@ -908,7 +908,7 @@ REGISTER_ACTION_HANDLER (CAHCycleTell, "cycle_tell") NLMISC_COMMAND(slsn, "Temp : set the name of the last sender.", "") { if (args.size() != 1) return false; - PeopleInterraction.LastSenderName = ucstring(args[0]); + PeopleInterraction.LastSenderName = args[0]; return true; } diff --git a/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 56382bf54..16a65e336 100644 --- a/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -279,9 +279,9 @@ void launchPhraseComposition(bool creation) // Set the Text of the Window if(creation) - window->setUCTitle(CI18N::get("uiPhraseCreate")); + window->setTitle(CI18N::get("uiPhraseCreate")); else - window->setUCTitle(CI18N::get("uiPhraseEdit")); + window->setTitle(CI18N::get("uiPhraseEdit")); // clear the sentence for a New Phrase creation. buildSentenceTarget->clearBuildingPhrase(); diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index 3eacf8a60..47fda6d00 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -188,8 +188,8 @@ void CActionPhraseFaber::launchFaberCastWindow(sint32 memoryLine, uint memoryIn window->setActive(true); // Setup the Title with a default text - ucstring title= CI18N::get("uiPhraseFaberExecuteNoPlan"); - window->setUCTitle (title); + string title= CI18N::get("uiPhraseFaberExecuteNoPlan"); + window->setTitle (title); } // **** setup DB observer! @@ -570,9 +570,9 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick if(window) { // Setup the Title with the item built - ucstring title= CI18N::get("uiPhraseFaberExecute"); + string title= CI18N::get("uiPhraseFaberExecute"); strFindReplace(title, "%item", STRING_MANAGER::CStringManagerClient::getItemLocalizedName(_ExecuteFromItemPlanBrick->FaberPlan.ItemBuilt) ); - window->setUCTitle (title); + window->setTitle (title); } diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index ce4ec3173..13e60fff8 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -250,7 +250,7 @@ void CBotChatPageTrade::begin() if (gc) { // set the title - gc->setUCTitle(_Title); + gc->setTitle(_Title); // show the buy mean CInterfaceGroup *money = dynamic_cast(gc->getGroup("money")); if (money) money->setActive((_BuyMean == Money) || (_BuyMean == MoneyFactionPoints)); diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.h b/ryzom/client/src/interface_v3/bot_chat_page_trade.h index ae11a2008..58a4e572d 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.h +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.h @@ -72,7 +72,7 @@ public: // set the buy mean (must be called before 'begin' is called) void setBuyMean(TBuyMean buyMean) { _BuyMean = buyMean; } // set the title of the window (actually applied when 'begin' is called) - void setTitle(const ucstring &title) { _Title = title; } + void setTitle(const std::string &title) { _Title = title; } // update the 'buy' dialog window for the given sphrase sheet (the player has changed an equipped weapon => action stats change) void updateSPhraseBuyDialog(); // invalidate window coords @@ -134,7 +134,7 @@ private: uint32 _CurrItemInventory; bool _BuyOnly; TBuyMean _BuyMean; - ucstring _Title; + std::string _Title; bool _ResaleEdit; bool _QuantityEdit; sint32 _QuantityCheck; diff --git a/ryzom/client/src/interface_v3/chat_filter.cpp b/ryzom/client/src/interface_v3/chat_filter.cpp index 237106170..c77a93fa5 100644 --- a/ryzom/client/src/interface_v3/chat_filter.cpp +++ b/ryzom/client/src/interface_v3/chat_filter.cpp @@ -363,8 +363,7 @@ void CChatTargetFilter::setTargetGroup(CChatGroup::TGroupType groupType, uint32 if (_Chat) { // set the prompt - const ucstring prompt(""); - _Chat->setPrompt(prompt + (ucchar) '>'); + _Chat->setPrompt(">"); // set the color string entry="UI:SAVE:CHAT:COLORS:"; diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index 58dc5d52a..816a2016a 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -135,10 +135,7 @@ bool CChatWindow::create(const CChatWindowDesc &desc, const std::string &chatId) return false; } _Chat->setLocalize (desc.Localize); - if (desc.Localize) - _Chat->setTitle(desc.Title.toString()); - else - _Chat->setUCTitle(desc.Title); + _Chat->setTitle(desc.Title); _Chat->setSavable(desc.Savable); // groups like system info don't have edit box. @@ -259,12 +256,12 @@ void CChatWindow::setMenu(const std::string &menuName) } //================================================================================= -void CChatWindow::setPrompt(const ucstring &prompt) +void CChatWindow::setPrompt(const string &prompt) { if (!_Chat) return; CGroupEditBox *eb = dynamic_cast(_Chat->getGroup("eb")); if (!eb) return; - eb->setPrompt(prompt.toUtf8()); + eb->setPrompt(prompt); } void CChatWindow::setPromptColor(NLMISC::CRGBA col) @@ -312,7 +309,7 @@ void CChatWindow::deleteContainer() } //================================================================================= -bool CChatWindow::rename(const ucstring &newName, bool newNameLocalize) +bool CChatWindow::rename(const string &newName, bool newNameLocalize) { return getChatWndMgr().rename(getTitle(), newName, newNameLocalize); } @@ -362,22 +359,22 @@ void CChatWindow::setCommand(const ucstring &command,bool execute) //================================================================================= -void CChatWindow::setEntry(const ucstring &entry) +void CChatWindow::setEntry(const string &entry) { if (!_EB) return; - _EB->setInputStringAsUtf16(entry); + _EB->setInputString(entry); } //================================================================================= -ucstring CChatWindow::getTitle() const +string CChatWindow::getTitle() const { if (!_Chat) { - return ucstring(""); + return string(); } else { - return _Chat->getUCTitle(); + return _Chat->getTitle(); } } @@ -472,7 +469,7 @@ void CChatWindow::setHeaderColor(const std::string &n) } //================================================================================= -void CChatWindow::displayLocalPlayerTell(const ucstring &receiver, const ucstring &msg, uint numBlinks /*= 0*/) +void CChatWindow::displayLocalPlayerTell(const string &receiver, const string &msg, uint numBlinks /*= 0*/) { string finalMsg; CInterfaceProperty prop; @@ -483,10 +480,10 @@ void CChatWindow::displayLocalPlayerTell(const ucstring &receiver, const ucstrin finalMsg += csr + CI18N::get("youTell") + ": "; prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); encodeColorTag(prop.getRGBA(), finalMsg, true); - finalMsg += msg.toUtf8(); + finalMsg += msg; string s = CI18N::get("youTellPlayer"); - strFindReplace(s, "%name", receiver.toUtf8()); + strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); displayMessage(finalMsg, prop.getRGBA(), CChatGroup::tell, 0, numBlinks); CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); @@ -730,13 +727,13 @@ const string CChatGroupWindow::getValidUiStringId(const string &stringId) } //================================================================================= -CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, const string &winColor) +CGroupContainer *CChatGroupWindow::createFreeTeller(const string &winNameIn, const string &winColor) { // must parse the entity name, and eventually make it Full with shard name (eg: 'ani.yoyo' becomes 'yoyo(Aniro)') - string winNameFull= CShardNames::getInstance().makeFullNameFromRelative(PlayerSelectedMainland, winNameIn.toString()); + string winNameFull= CShardNames::getInstance().makeFullNameFromRelative(PlayerSelectedMainland, winNameIn); // remove shard name if necessary - ucstring winName= CEntityCL::removeShardFromName(winNameFull); + string winName= CEntityCL::removeShardFromName(winNameFull); // get the color string sWinColor = winColor; @@ -745,12 +742,12 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c // Look if the free teller do not already exists uint32 i; - string sWinName = winName.toString(); + string sWinName = winName; sWinName = toLower(sWinName); for (i = 0; i < _FreeTellers.size(); ++i) { CGroupContainer *pGC = _FreeTellers[i]; - if (toLower(pGC->getUCTitle().toString()) == sWinName) + if (toLower(pGC->getTitle()) == sWinName) break; } // Create container if not present @@ -772,11 +769,11 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c if (!pGC) { delete pIG; - nlwarning(" group is not a container.(%s)", winName.toString().c_str()); + nlwarning(" group is not a container.(%s)", winName.c_str()); return NULL; } // set title from the name - pGC->setUCTitle(winName); + pGC->setTitle(winName); // pGC->setSavable(true); pGC->setEscapable(true); @@ -834,7 +831,7 @@ void CChatGroupWindow::updateAllFreeTellerHeaders() //================================================================================= void CChatGroupWindow::updateFreeTellerHeader(CGroupContainer &ft) { - ucstring name = ft.getUCTitle(); + string name = ft.getTitle(); CCtrlBaseButton *newFriendBut = dynamic_cast(ft.getCtrl("new_friend")); CCtrlBaseButton *ignoreBut = dynamic_cast(ft.getCtrl("ignore")); CCtrlBaseButton *inviteBut = dynamic_cast(ft.getCtrl("invite")); @@ -868,7 +865,7 @@ void CChatGroupWindow::updateFreeTellerHeader(CGroupContainer &ft) } //================================================================================= -void CChatGroupWindow::setActiveFreeTeller(const ucstring &winName, bool bActive) +void CChatGroupWindow::setActiveFreeTeller(const string &winName, bool bActive) { CGroupContainer *pGC = createFreeTeller(winName); if (pGC != NULL) @@ -1166,7 +1163,7 @@ CChatWindow *CChatWindowManager::createChatGroupWindow(const CChatWindowDesc &de } //================================================================================= -CChatWindow *CChatWindowManager::getChatWindow(const ucstring &title) +CChatWindow *CChatWindowManager::getChatWindow(const string &title) { TChatWindowMap::iterator it = _ChatWindowMap.find(title); if (it == _ChatWindowMap.end()) @@ -1179,12 +1176,12 @@ CChatWindow *CChatWindowManager::getChatWindow(const ucstring &title) } //================================================================================= -void CChatWindowManager::removeChatWindow(const ucstring &title) +void CChatWindowManager::removeChatWindow(const string &title) { TChatWindowMap::iterator it = _ChatWindowMap.find(title); if (it == _ChatWindowMap.end()) { - nlwarning("Unknown chat window '%s'", title.toUtf8().c_str()); + nlwarning("Unknown chat window '%s'", title.c_str()); return; } it->second->deleteContainer(); @@ -1213,11 +1210,11 @@ CChatWindow *CChatWindowManager::getChatWindowFromCaller(CCtrlBase *caller) } if (!father) return NULL; - return getChatWindow(father->getUCTitle()); + return getChatWindow(father->getTitle()); } //================================================================================= -bool CChatWindowManager::rename(const ucstring &oldName, const ucstring &newName, bool newNameLocalize) +bool CChatWindowManager::rename(const string &oldName, const string &newName, bool newNameLocalize) { // if (oldName == newName) return true; CChatWindow *newWin = getChatWindow(newName); @@ -1225,8 +1222,8 @@ bool CChatWindowManager::rename(const ucstring &oldName, const ucstring &newName TChatWindowMap::iterator it = _ChatWindowMap.find(oldName); if (it == _ChatWindowMap.end()) return false; _ChatWindowMap[newName] = it->second; - it->second->getContainer()->setLocalize(false); - it->second->getContainer()->setTitle(newName.toUtf8()); + it->second->getContainer()->setLocalize(newNameLocalize); + it->second->getContainer()->setTitle(newName); _ChatWindowMap.erase(it); return true; } diff --git a/ryzom/client/src/interface_v3/chat_window.h b/ryzom/client/src/interface_v3/chat_window.h index 39fc448f9..9a299ebfb 100644 --- a/ryzom/client/src/interface_v3/chat_window.h +++ b/ryzom/client/src/interface_v3/chat_window.h @@ -23,7 +23,7 @@ #ifndef CL_CHAT_WINDOW_H #define CL_CHAT_WINDOW_H -#include "nel/misc/ucstring.h" +#include "nel/misc/ucstring.h" // REMOVE #include "nel/misc/smart_ptr.h" #include "game_share/chat_group.h" @@ -57,7 +57,7 @@ struct CChatWindowDesc { typedef std::vector > TTemplateParams; - ucstring Title; // unique title for the window + std::string Title; // unique title for the window std::string FatherContainer; // name of the father container. If empty, the chat box must be added manually in the hierarchy std::string ChatTemplate; // Template for the chat interface, or "" to use the default one TTemplateParams ChatTemplateParams; // optional template parameters @@ -94,7 +94,7 @@ public: // called by a CChatWindow when it is deleted virtual void chatWindowRemoved(CChatWindow * /* cw */) {} // called by a CChatWindow when a msg has been displayed in it ('displayMessage' has been called) - //virtual void displayMessage(CChatWindow *cw, const ucstring &msg, NLMISC::CRGBA col, uint numBlinks = 0) {} + //virtual void displayMessage(CChatWindow *cw, const std::string &msg, NLMISC::CRGBA col, uint numBlinks = 0) {} }; public: // display a message in this chat box with the given color @@ -110,16 +110,16 @@ public: // set a command to be displayed and eventually executed in this chat window. std::string version for backward compatibility void setCommand(const std::string &command, bool execute); // set a command to be displayed and eventually executed in this chat window - void setCommand(const ucstring &command, bool execute); + void setCommand(const ucstring &command, bool execute); // REMOVE // set a string to be displayed in the edit box of this window (if it has one) - void setEntry(const ucstring &entry); + void setEntry(const std::string &entry); // Set listener to react to a chat entry void setListener(IChatWindowListener *listener) { _Listener = listener; } IChatWindowListener *getListener() const { return _Listener; } // Set the menu for the chat void setMenu(const std::string &menuName); // Set a new prompt for the chat window - void setPrompt(const ucstring &prompt); + void setPrompt(const std::string &prompt); // Set the color for the chat window void setPromptColor(NLMISC::CRGBA col); /** Get the container associated with this chat window @@ -131,7 +131,7 @@ public: /** try to rename the chat window * \return true if success */ - bool rename(const ucstring &newName, bool newNameLocalize); + bool rename(const std::string &newName, bool newNameLocalize); /** delete the container * Don't do it in the dtor, because done automatically at the end of the app by the interface manager. * Useful only if querried by the user @@ -140,7 +140,7 @@ public: // get the last chat window from which a command has been called static CChatWindow *getChatWindowLaunchingCommand() { return _ChatWindowLaunchingCommand; } // get the title of this chat window - ucstring getTitle() const; + std::string getTitle() const; // observers void addObserver(IObserver *obs); void removeObserver(IObserver *obs); @@ -154,7 +154,7 @@ public: void setAHOnCloseButtonParams(const std::string &n); void setHeaderColor(const std::string &n); // - void displayLocalPlayerTell(const ucstring &receiver, const ucstring &msg, uint numBlinks = 0); + void displayLocalPlayerTell(const std::string &receiver, const std::string &msg, uint numBlinks = 0); /// Encode a color tag '@{RGBA}' in the text. If append is true, append at end of text, otherwise, replace the text static void encodeColorTag(const NLMISC::CRGBA &color, std::string &text, bool append=true); @@ -196,8 +196,8 @@ public: void setTabIndex(sint32 n); // Free Teller - NLGUI::CGroupContainer *createFreeTeller(const ucstring &winName, const std::string &winColor=""); - void setActiveFreeTeller(const ucstring &winName, bool bActive=true); + NLGUI::CGroupContainer *createFreeTeller(const std::string &winName, const std::string &winColor=""); + void setActiveFreeTeller(const std::string &winName, bool bActive=true); std::string getFreeTellerName(const std::string &containerID); bool removeFreeTeller(const std::string &containerID); // Return true if free teller found void removeAllFreeTellers(); @@ -245,9 +245,9 @@ public: CChatWindow *createChatGroupWindow(const CChatWindowDesc &desc); // Get a chat window by its title - CChatWindow *getChatWindow(const ucstring &title); + CChatWindow *getChatWindow(const std::string &title); /// Remove a chat window by its title - void removeChatWindow(const ucstring &title); + void removeChatWindow(const std::string &title); // Remove a chat window by its pointer void removeChatWindow(CChatWindow *cw); /// from a ctrl of a chat box that triggered a menu, or an event, retrieve the associated chat box @@ -255,14 +255,14 @@ public: // Singleton pattern applied to the chat window manager static CChatWindowManager &getInstance(); // try to rename a window - bool rename(const ucstring &oldName, const ucstring &newName, bool newNameLocalize); + bool rename(const std::string &oldName, const std::string &newName, bool newNameLocalize); // warning : this is slow uint getNumChatWindow() const { return (uint)_ChatWindowMap.size(); } // warning : this is slow : for debug only CChatWindow *getChatWindowByIndex(uint index); /////////////////////////////////////////////////////////////////////////////////////// private: - typedef std::map > TChatWindowMap; + typedef std::map > TChatWindowMap; private: // TChatWindowMap _ChatWindowMap; diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 63392c583..dcfdc1fc9 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -102,9 +102,9 @@ void CControlSheetInfoWaiter::infoReceived() } -ucstring CControlSheetInfoWaiter::infoValidated() const +string CControlSheetInfoWaiter::infoValidated() const { - ucstring help; + ucstring help; // FIXME: Lua UTF-8 if (CtrlSheet && !LuaMethodName.empty()) { // delegate setup of context he help ( & window ) to lua @@ -131,7 +131,7 @@ ucstring CControlSheetInfoWaiter::infoValidated() const } } - return help; + return help.toUtf8(); } // *************************************************************************** @@ -3443,10 +3443,10 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const { // call lua function to update tooltip window _ItemInfoWaiter.sendRequest(); - help = _ItemInfoWaiter.infoValidated().toUtf8(); + help = _ItemInfoWaiter.infoValidated(); // its expected to get at least item name back if (help.empty()) - help = getItemActualName().toUtf8(); + help = getItemActualName(); } else if (!_ContextHelp.empty()) { @@ -3454,7 +3454,7 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const } else { - help = getItemActualName().toUtf8();; + help = getItemActualName();; } } else @@ -3575,7 +3575,7 @@ void CDBCtrlSheet::getContextHelpToolTip(std::string &help) const if (useItemInfoForFamily(item->Family)) { _ItemInfoWaiter.sendRequest(); - help = _ItemInfoWaiter.infoValidated().toUtf8(); + help = _ItemInfoWaiter.infoValidated(); return; } } @@ -4563,11 +4563,11 @@ void CDBCtrlSheet::initArmourColors() // *************************************************************************** -ucstring CDBCtrlSheet::getItemActualName() const +string CDBCtrlSheet::getItemActualName() const { const CItemSheet *pIS= asItemSheet(); if(!pIS) - return ucstring(); + return string(); else { string ret; @@ -4587,7 +4587,7 @@ ucstring CDBCtrlSheet::getItemActualName() const if (pIS->Family == ITEMFAMILY::SCROLL_R2) { const R2::TMissionItem *mi = R2::getEditor().getPlotItemInfos(getSheetId()); - if (mi) return mi->Name; + if (mi) return mi->Name.toUtf8(); } // if item is not a mp, append faber_quality & faber_stat_type // Don't append quality and stat type for Named Items!!! diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.h b/ryzom/client/src/interface_v3/dbctrl_sheet.h index 9440222f4..dfe3b7140 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -73,7 +73,7 @@ public: : IItemInfoWaiter(), Requesting(false) { } public: - ucstring infoValidated() const; + std::string infoValidated() const; void sendRequest(); virtual void infoReceived(); }; @@ -582,7 +582,7 @@ public: void setItemColor(sint32 val) {if(_UserColor) _UserColor->setValue32(val);} // Get the Actual item name. Localized version of SheetId, or given by server through NAMEID. - ucstring getItemActualName() const; + std::string getItemActualName() const; /// true if support drag copy (with CTRL). action handler has to check control. bool canDragCopy() const {return _DragCopy;} diff --git a/ryzom/client/src/interface_v3/group_career.cpp b/ryzom/client/src/interface_v3/group_career.cpp index d3f3e2563..10cfca35e 100644 --- a/ryzom/client/src/interface_v3/group_career.cpp +++ b/ryzom/client/src/interface_v3/group_career.cpp @@ -63,13 +63,13 @@ bool CGroupCareer::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) if (Career >= ROLES::NB_ROLES) Career = ROLES::fighter; - ucstring sTmp = ROLES::roleToUCString(Career); + string sTmp = ROLES::roleToUCString(Career); for (uint32 i= 0; i < sTmp.size(); ++i) if (sTmp[i] < 128) if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') ) sTmp[i] = sTmp[i] - 'a' + 'A'; - setUCTitle (sTmp); + setTitle (sTmp); return true; } @@ -133,7 +133,7 @@ bool CGroupJob::parse (xmlNodePtr /* cur */, CInterfaceGroup * /* parentGroup */ // if (sTmp[i] < 128) // if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') ) // sTmp[i] = sTmp[i] - 'a' + 'A'; -// setUCTitle (sTmp); +// seUCTitle (sTmp); // // return true; } diff --git a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp index 9494deacf..4c21fee47 100644 --- a/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp +++ b/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp @@ -626,11 +626,11 @@ static DECLARE_INTERFACE_USER_FCT(getChatWin) CChatWindowManager &rCWM = CChatWindowManager::getInstance(); - ucstring title = CI18N::get(args[0].getString()); + string title = CI18N::get(args[0].getString()); CChatWindow *window = rCWM.getChatWindow(title); if (!window) { - nlwarning("Can't find window named %s", title.toString().c_str()); + nlwarning("Can't find window named %s", title.c_str()); return false; } string sTmp = window->getContainer()->getId(); diff --git a/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp b/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp index cae4b9d77..7744be7eb 100644 --- a/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp +++ b/ryzom/client/src/interface_v3/interface_expr_user_fct_items.cpp @@ -313,7 +313,7 @@ static DECLARE_INTERFACE_USER_FCT(getSheetName) // if from ctrlSheet, then take the correct ACTUAL name (ie from NAMEID if not 0) if(ctrlSheet) { - result.setString(ctrlSheet->getItemActualName().toUtf8()); + result.setString(ctrlSheet->getItemActualName()); return true; } // Standard (but less accurate) way diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index 1b36c91d5..aa38b6dbf 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -982,7 +982,7 @@ void CInterfaceManager::initInGame() // flush system msg buffer for( uint i=0; i(CWidgetManager::getInstance()->getElementFromId(WIN_TEMPINV)); - pGC->setUCTitle( title ); + pGC->setTitle( title ); } isInUpdateForageQQ = false; @@ -2199,7 +2199,7 @@ bool SBagOptions::parse(xmlNodePtr cur, CInterfaceGroup * /* parentGroup */) } // *************************************************************************** -void SBagOptions::setSearchFilter(const ucstring &s) +void SBagOptions::setSearchFilter(const string &s) { SearchQualityMin = 0; SearchQualityMax = 999; @@ -2208,13 +2208,13 @@ void SBagOptions::setSearchFilter(const ucstring &s) if (!s.empty()) { - std::vector words; - splitUCString(toLower(s), ucstring(" "), words); + std::vector words; + splitString(toLower(s), string(" "), words); size_t pos; for(int i = 0; i 0) { bool match = true; - ucstring lcName = toLower(pCS->getItemActualName()); + string lcName = toLower(pCS->getItemActualName()); // add item quality as a keyword to match if (pCS->getQuality() > 1) { - lcName += ucstring(" " + toString(pCS->getQuality())); + lcName += string(" " + toString(pCS->getQuality())); } for (uint i = 0; i< SearchFilter.size(); ++i) { - if (lcName.find(SearchFilter[i]) == ucstring::npos) + if (lcName.find(SearchFilter[i]) == string::npos) { return false; } @@ -2741,7 +2741,7 @@ class CHandlerInvSearchButton : public IActionHandler return; } - ucstring filter; + string filter; std::string id = btn->getParent()->getId() + ":" + sParams + ":eb"; CGroupEditBox *eb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id)); if (!eb) @@ -2755,7 +2755,7 @@ class CHandlerInvSearchButton : public IActionHandler { CWidgetManager::getInstance()->setCaptureKeyboard(eb); eb->setSelectionAll(); - filter = eb->getInputStringAsUtf16(); + filter = eb->getInputString(); } CDBGroupListSheetBag *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(btn->getParent()->getId() + ":bag_list")); @@ -2805,10 +2805,10 @@ class CHandlerInvSetSearch : public IActionHandler std::string id = pCaller->getParent()->getParent()->getId(); CDBGroupListSheetBag *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id + ":bag_list")); - if (pList != NULL) pList->setSearchFilter(eb->getInputStringAsUtf16()); + if (pList != NULL) pList->setSearchFilter(eb->getInputString()); CDBGroupIconListBag *pIcons = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id + ":bag_icons")); - if (pIcons != NULL) pIcons->setSearchFilter(eb->getInputStringAsUtf16()); + if (pIcons != NULL) pIcons->setSearchFilter(eb->getInputString()); } }; REGISTER_ACTION_HANDLER( CHandlerInvSetSearch, "inv_set_search" ); diff --git a/ryzom/client/src/interface_v3/inventory_manager.h b/ryzom/client/src/interface_v3/inventory_manager.h index 8c365a0be..6af8414de 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.h +++ b/ryzom/client/src/interface_v3/inventory_manager.h @@ -520,7 +520,7 @@ struct SSortStruct { CDBGroupListSheetText::CSheetChild *SheetText; CDBGroupListSheet::CSheetChild *SheetIcon; - ucstring Pos; + std::string Pos; bool operator < (const SSortStruct &o) const { return Pos < o.Pos; } }; @@ -558,7 +558,7 @@ struct SBagOptions bool SearchFilterChanged; uint16 SearchQualityMin; uint16 SearchQualityMax; - std::vector SearchFilter; + std::vector SearchFilter; // ----------------------- SBagOptions() @@ -576,7 +576,7 @@ struct SBagOptions bool isSomethingChanged(); // From last call ? bool isSearchFilterChanged() const { return SearchFilterChanged; } - void setSearchFilter(const ucstring &s); + void setSearchFilter(const std::string &s); bool getFilterArmor() const { @@ -674,7 +674,7 @@ public: // Return true if the sheet can be displayed due to filters bool canDisplay(CDBCtrlSheet *pCS) { return _BO.canDisplay(pCS); } - void setSearchFilter(const ucstring &s) { _BO.setSearchFilter(s); } + void setSearchFilter(const std::string &s) { _BO.setSearchFilter(s); } private: @@ -707,7 +707,7 @@ public: // Return true if the sheet can be displayed due to filters bool canDisplay(CDBCtrlSheet *pCS) const { return _BO.canDisplay(pCS); } - void setSearchFilter(const ucstring &s) { _BO.setSearchFilter(s); } + void setSearchFilter(const std::string &s) { _BO.setSearchFilter(s); } ////////////////////////////////////////////////////////////////////////// diff --git a/ryzom/client/src/interface_v3/item_special_effect.cpp b/ryzom/client/src/interface_v3/item_special_effect.cpp index 7b659fe6d..fdb53a0ec 100644 --- a/ryzom/client/src/interface_v3/item_special_effect.cpp +++ b/ryzom/client/src/interface_v3/item_special_effect.cpp @@ -51,8 +51,8 @@ void CItemSpecialEffectHelper::registerItemSpecialEffect(const string &name) vector params; // get ui string - ucstring ucs = CI18N::get("uiItemFX_" + name); - CSString p, s = ucs.toString(); + string ucs = CI18N::get("uiItemFX_" + name); + CSString p, s = ucs; // locate and store parameters // %p : percent diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index aa6ffe213..21977f0bc 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -87,7 +87,7 @@ using namespace NLMISC; // *************************************************************************** // Add the template key to the parent -void addKeyLine (CGroupList *pParent, const ucstring &keyName, const ucstring &shortcutName, bool grayed) +void addKeyLine (CGroupList *pParent, const string &keyName, const string &shortcutName, bool grayed) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); CMacroCmdManager *pMCM = CMacroCmdManager::getInstance(); @@ -104,14 +104,14 @@ void addKeyLine (CGroupList *pParent, const ucstring &keyName, const ucstring &s CViewText *pViewKeyName = dynamic_cast(pKeysLine->getView(TEMPLATE_KEYS_KEY_NAME)); if (pViewKeyName != NULL) { - pViewKeyName->setText (keyName.toUtf8()); + pViewKeyName->setText (keyName); pViewKeyName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); } CViewText *pViewShortcutName = dynamic_cast(pKeysLine->getView(TEMPLATE_KEYS_SHORTCUT_NAME)); if (pViewShortcutName != NULL) { - pViewShortcutName->setText (shortcutName.toUtf8()); + pViewShortcutName->setText (shortcutName); pViewShortcutName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); } diff --git a/ryzom/client/src/interface_v3/music_player.cpp b/ryzom/client/src/interface_v3/music_player.cpp index 790949352..c7c9e89eb 100644 --- a/ryzom/client/src/interface_v3/music_player.cpp +++ b/ryzom/client/src/interface_v3/music_player.cpp @@ -586,9 +586,17 @@ static void addFromPlaylist(const std::string &playlist, const std::vectorgetTitle().toString()).c_str()); + nlwarning("Window %d : %s", (int) k, (cwm.getChatWindowByIndex(k)->getTitle()).c_str()); } } } @@ -1121,7 +1121,7 @@ void CPeopleInterraction::askAddContact(const string &contactName, CPeopleList * if (pl == &FriendList) list = 0; - ucstring temp = contactName; // TODO: UTF-8 serial + ucstring temp = ucstring::makeFromUtf8(contactName); // TODO: UTF-8 (serial) out.serial(temp); out.serial(list); NetMngr.push(out); @@ -1192,7 +1192,7 @@ void CPeopleInterraction::askMoveContact(uint peopleIndexInSrc, CPeopleList *plS // Fake Local simulation if (ClientCfg.Local) { - ucstring peopleName= plSRC->getName(peopleIndexInSrc); + string peopleName= plSRC->getName(peopleIndexInSrc); plSRC->removePeople(peopleIndexInSrc); sint dstIndex = plDST->addPeople(peopleName); plDST->setOnline(dstIndex, ccs_online); @@ -1252,7 +1252,7 @@ void CPeopleInterraction::askRemoveContact(uint peopleIndex, CPeopleList *pl) //================================================================================================================= void CPeopleInterraction::initContactLists( const std::vector &vFriendListName, const std::vector &vFriendListOnline, - const std::vector &vIgnoreListName ) + const std::vector &vIgnoreListName ) // TODO: UTF-8 (serial) { // clear the current lists if any @@ -1264,18 +1264,18 @@ void CPeopleInterraction::initContactLists( const std::vector &vFriendLi for (uint i = 0; i < vFriendListName.size(); ++i) addContactInList(contactIdPool++, vFriendListName[i], vFriendListOnline[i], 0); for (uint i = 0; i < vIgnoreListName.size(); ++i) - addContactInList(contactIdPool++, vIgnoreListName[i], ccs_offline, 1); + addContactInList(contactIdPool++, vIgnoreListName[i].toUtf8(), ccs_offline, 1); updateAllFreeTellerHeaders(); } //================================================================================================================= -void CPeopleInterraction::addContactInList(uint32 contactId, const ucstring &nameIn, TCharConnectionState online, uint8 nList) +void CPeopleInterraction::addContactInList(uint32 contactId, const string &nameIn, TCharConnectionState online, uint8 nList) { // select correct people list CPeopleList &pl= nList==0?FriendList:IgnoreList; // remove the shard name if possible - string name= CEntityCL::removeShardFromName(nameIn.toUtf8()); + string name= CEntityCL::removeShardFromName(nameIn); // add the contact to this list sint index = pl.getIndexFromName(name); @@ -1321,12 +1321,12 @@ void CPeopleInterraction::addContactInList(uint32 contactId, uint32 nameID, TCha } //================================================================================================================= -bool CPeopleInterraction::isContactInList(const ucstring &nameIn, uint8 nList) const +bool CPeopleInterraction::isContactInList(const string &nameIn, uint8 nList) const { // select correct people list const CPeopleList &pl= nList==0?FriendList:IgnoreList; // remove the shard name if possible - string name= CEntityCL::removeShardFromName(nameIn.toUtf8()); + string name= CEntityCL::removeShardFromName(nameIn); return pl.getIndexFromName(name) != -1; } @@ -1455,12 +1455,14 @@ void CPeopleInterraction::removeContactFromList(uint32 contactId, uint8 nList) } //================================================================================================================= -bool CPeopleInterraction::testValidPartyChatName(const ucstring &title) +bool CPeopleInterraction::testValidPartyChatName(const string &title) { if (title.empty()) return false; // shouldn't begin like 'user chat 1-5' - ucstring userChatStr = CI18N::get("uiUserChat"); - if (title.substr(0, userChatStr.length()) == userChatStr) return false; + const string &userChatStr = CI18N::get("uiUserChat"); + if (NLMISC::startsWith(title, userChatStr)) return false; + // can't match a translation identifier + if (CI18N::hasTranslation(title)) return false; for(uint k = 0; k < PartyChats.size(); ++k) // there shouldn't be that much party chat simultaneously so a linear search is ok { if (PartyChats[k].Window->getTitle() == title) return false; @@ -1471,9 +1473,9 @@ bool CPeopleInterraction::testValidPartyChatName(const ucstring &title) if (GuildChat && title == GuildChat->getTitle()) return false; if (TeamChat && title == TeamChat->getTitle()) return false; sint index; - index = FriendList.getIndexFromName(title.toUtf8()); + index = FriendList.getIndexFromName(title); if (index != -1) return false; - index = IgnoreList.getIndexFromName(title.toUtf8()); + index = IgnoreList.getIndexFromName(title); if (index != -1) return false; // TODO_GAMEDEV server test for the name (not only local), & modify callers of this function // The party chat should NOT have the name of a player @@ -1526,7 +1528,7 @@ void CPeopleInterraction::assignPartyChatMenu(CChatWindow *partyChat) } //================================================================================================================= -bool CPeopleInterraction::createNewPartyChat(const ucstring &title) +bool CPeopleInterraction::createNewPartyChat(const string &title) { // now there are no party chat windows, party chat phrases must be filtered from the main chat @@ -1851,8 +1853,8 @@ void CPeopleInterraction::createUserChat(uint index) return; } CChatWindowDesc chatDesc; - ucstring userChatStr = CI18N::get("uiUserChat"); - userChatStr += ucchar(' ') + ucstring(toString(index + 1)); + string userChatStr = CI18N::get("uiUserChat"); + userChatStr += ' ' + toString(index + 1); //chatDesc.FatherContainer = "ui:interface:communication"; chatDesc.FatherContainer = "ui:interface:contact_list"; chatDesc.Title = userChatStr; @@ -2592,7 +2594,7 @@ public: { for(uint l = 0; l < pl.PartyChats.size(); ++l) { - menu->addLineAtIndex(insertionIndex, pl.PartyChats[l].Window->getTitle().toUtf8(), "chat_target_selected", toString(pl.PartyChats[l].ID)); + menu->addLineAtIndex(insertionIndex, pl.PartyChats[l].Window->getTitle(), "chat_target_selected", toString(pl.PartyChats[l].ID)); ++ insertionIndex; } } @@ -2939,7 +2941,7 @@ class CHandlerSelectChatSource : public IActionHandler { if (pc[l].Filter != NULL) { - menu->addLineAtIndex(insertionIndex, pc[l].Window->getTitle().toUtf8(), FILTER_TOGGLE, toString(pc[l].ID)); + menu->addLineAtIndex(insertionIndex, pc[l].Window->getTitle(), FILTER_TOGGLE, toString(pc[l].ID)); menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, toString(pc[l].ID), pc[l].Filter->isListeningWindow(cw))); ++ insertionIndex; } diff --git a/ryzom/client/src/interface_v3/people_interraction.h b/ryzom/client/src/interface_v3/people_interraction.h index 59230853f..8181c1705 100644 --- a/ryzom/client/src/interface_v3/people_interraction.h +++ b/ryzom/client/src/interface_v3/people_interraction.h @@ -156,12 +156,12 @@ public: CFilteredChat UserChat[MaxNumUserChats]; CFilteredChat TheUserChat; // Id of last people who talked - ucstring LastSenderName; + std::string LastSenderName; // system message struct CSysMsg { - ucstring Str; + std::string Str; std::string Cat; }; // system message buffer @@ -195,13 +195,13 @@ public: */ CFilteredChat *getFilteredChatFromChatWindow(CChatWindow *cw); - bool testValidPartyChatName(const ucstring &name); + bool testValidPartyChatName(const std::string &name); bool removePartyChat(CChatWindow *window); void removeAllPartyChat(); /** * create a named party chat. */ - bool createNewPartyChat(const ucstring &title); + bool createNewPartyChat(const std::string &title); static void assignPartyChatMenu(CChatWindow *partyChat); @@ -215,11 +215,11 @@ public: // init contact list (from server typically) void initContactLists( const std::vector &vFriendListName, const std::vector &vFriendListOnline, - const std::vector &vIgnoreListName ); + const std::vector &vIgnoreListName ); // TODO: UTF-8 (serial) // Friend list == 0 // Ignore list == 1 void addContactInList(uint32 contactId, uint32 nameID, TCharConnectionState Online, uint8 nList); - void addContactInList(uint32 contactId, const ucstring &name, TCharConnectionState Online, uint8 nList); - bool isContactInList(const ucstring &name, uint8 nList) const; + void addContactInList(uint32 contactId, const std::string &name, TCharConnectionState Online, uint8 nList); + bool isContactInList(const std::string &name, uint8 nList) const; // Called each frame to receive name from IOS void updateWaitingContacts(); // server decide to remove a contact (if it does not exists anymore) diff --git a/ryzom/client/src/interface_v3/people_list.cpp b/ryzom/client/src/interface_v3/people_list.cpp index f056f4cc5..6650b7ef2 100644 --- a/ryzom/client/src/interface_v3/people_list.cpp +++ b/ryzom/client/src/interface_v3/people_list.cpp @@ -127,10 +127,7 @@ bool CPeopleList::create(const CPeopleListDesc &desc, const CChatWindowDesc *cha _BaseContainer->setSavable(desc.Savable); _BaseContainer->setLocalize(desc.Localize); - if (desc.Localize) - _BaseContainer->setTitle(desc.PeopleListTitle.toString()); - else - _BaseContainer->setUCTitle(desc.PeopleListTitle); + _BaseContainer->setTitle(desc.PeopleListTitle); //_BaseContainer->setId("ui:interface:" + desc.Id); // create the chat window if there's one @@ -162,7 +159,7 @@ sint CPeopleList::getIndexFromName(const string &name) const string sNameIn = toLower(name); for(uint k = 0; k < _Peoples.size(); ++k) { - string sPeopleName = toLower(_Peoples[k].getName().toUtf8()); + string sPeopleName = toLower(_Peoples[k].getName()); if (sPeopleName == sNameIn) return k; } return -1; @@ -198,8 +195,8 @@ bool CPeopleList::sortExByContactId(const CPeople& a, const CPeople& b) //================================================================== bool CPeopleList::sortExByName(const CPeople& a, const CPeople& b) { - ucstring name_a = toUpper(a.getName()); - ucstring name_b = toUpper(b.getName()); + string name_a = toUpper(a.getName()); + string name_b = toUpper(b.getName()); return (name_a < name_b); } @@ -207,8 +204,8 @@ bool CPeopleList::sortExByName(const CPeople& a, const CPeople& b) //================================================================== bool CPeopleList::sortExByOnline(const CPeople& a, const CPeople& b) { - ucstring name_a = toUpper(a.getName()); - ucstring name_b = toUpper(b.getName()); + string name_a = toUpper(a.getName()); + string name_b = toUpper(b.getName()); // We want order: online/alpha, offworld/alpha, offline/alpha if (a.Online == b.Online) @@ -331,13 +328,13 @@ bool CPeopleList::isPeopleWindowVisible(uint index) const */ //================================================================== -sint CPeopleList::addPeople(const ucstring &name, uint teamMateIndex /*= 0*/) +sint CPeopleList::addPeople(const string &name, uint teamMateIndex /*= 0*/) { if (!_BaseContainer) return - 1; // check if not already inserted - if (getIndexFromName(name.toUtf8()) != -1) + if (getIndexFromName(name) != -1) { - nlwarning(" people %s inserted twice.", name.toString().c_str()); + nlwarning(" people %s inserted twice.", name.c_str()); } vector > properties; @@ -371,11 +368,11 @@ sint CPeopleList::addPeople(const ucstring &name, uint teamMateIndex /*= 0*/) if (!gc) { delete group; - nlwarning(" group is not a container.", name.toString().c_str()); + nlwarning(" group is not a container.", name.c_str()); return -1; } // set title from the name - gc->setUCTitle(name); + gc->setTitle(name); // People inside list are not savable ! gc->setSavable(false); // @@ -694,7 +691,7 @@ std::string CPeopleList::getName(uint index) const nlwarning("bad index"); return "BAD INDEX!"; } - return _Peoples[index].getName().toUtf8(); + return _Peoples[index].getName(); } //================================================================== diff --git a/ryzom/client/src/interface_v3/people_list.h b/ryzom/client/src/interface_v3/people_list.h index 91dbf50d3..ccd8e2f41 100644 --- a/ryzom/client/src/interface_v3/people_list.h +++ b/ryzom/client/src/interface_v3/people_list.h @@ -28,7 +28,6 @@ #include "chat_window.h" #include "interface_pointer.h" // NeL -#include "nel/misc/ucstring.h" #include "nel/misc/rgba.h" @@ -40,7 +39,7 @@ struct CPeopleListDesc { enum TContactType { Team, Contact, Ignore, Unknown }; - ucstring PeopleListTitle; // title of the people list + std::string PeopleListTitle; // title of the people list TContactType ContactType; std::string FatherContainer; // name of the father container std::string BaseContainerTemplateName; // name of the template for the base container @@ -99,7 +98,7 @@ public: /** Add a people to the list, and returns its index or -1 if the creation failed * If this is a team mate, tells its index so that ic can be bound to the database in the right location */ - sint addPeople(const ucstring &name, uint teamMateIndex = 0); + sint addPeople(const std::string &name, uint teamMateIndex = 0); // swap people position between the 2 given indexs void swapPeople(uint index1, uint index2); // Remove the people at the given index @@ -159,7 +158,7 @@ private: bool Blocked; uint32 ContactId; bool operator < (const CPeople &other) const { return getName() < other.getName(); } - ucstring getName() const { return Container->getUCTitle(); } + std::string getName() const { return Container->getTitle(); } }; typedef std::vector TPeopleVect; private: diff --git a/ryzom/client/src/interface_v3/skill_manager.cpp b/ryzom/client/src/interface_v3/skill_manager.cpp index cf35e6bd6..9d10cde0a 100644 --- a/ryzom/client/src/interface_v3/skill_manager.cpp +++ b/ryzom/client/src/interface_v3/skill_manager.cpp @@ -588,8 +588,8 @@ void CSkillManager::checkTitleUnblocked(CHARACTER_TITLE::ECharacterTitle i, bool // This is a new title, send a message string titleStr = CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)i); bool womenTitle = (UserEntity && UserEntity->getGender() == GSGENDER::female); - const ucstring newtitle(CStringManagerClient::getTitleLocalizedName(titleStr, womenTitle)); - CAHManager::getInstance()->runActionHandler("message_popup", NULL, "text1="+newtitle.toUtf8()+"|text0="+CI18N::get("uiNewTitleBold")); + const char *newtitle(CStringManagerClient::getTitleLocalizedName(titleStr, womenTitle)); + CAHManager::getInstance()->runActionHandler("message_popup", NULL, string("text1=") + newtitle + "|text0=" + CI18N::get("uiNewTitleBold")); } else { @@ -1097,8 +1097,8 @@ public: { string titleStr = CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)i); bool womenTitle = (UserEntity && UserEntity->getGender() == GSGENDER::female); - const ucstring s(CStringManagerClient::getTitleLocalizedName(titleStr,womenTitle)); - pCB->addText(s.toUtf8()); + const char *s = CStringManagerClient::getTitleLocalizedName(titleStr, womenTitle); + pCB->addText(s); pSM->_UIUnblockedTitles.push_back((CHARACTER_TITLE::ECharacterTitle)i); } } diff --git a/ryzom/client/src/interface_v3/sphrase_manager.cpp b/ryzom/client/src/interface_v3/sphrase_manager.cpp index c42d544d1..cf4950fdd 100644 --- a/ryzom/client/src/interface_v3/sphrase_manager.cpp +++ b/ryzom/client/src/interface_v3/sphrase_manager.cpp @@ -3632,7 +3632,7 @@ public: bool Castable; uint32 Type; uint32 Icon; - ucstring Text; + string Text; bool operator<(const CPhraseSortEntry &pse) const { @@ -3840,9 +3840,9 @@ void CSPhraseManager::computePhraseProgression() // replace each number with 001 format. toLower for(uint k=0;ksetText(ucstring(toString(_SheetId.getSInt32()))); + _SheetText->setText(toString(_SheetId.getSInt32())); _SheetText->draw(xOffset,yOffset+20); - _QuantityText->setText(ucstring(toString(_Quantity.getSInt32()))); + _QuantityText->setText(toString(_Quantity.getSInt32())); _QuantityText->draw(xOffset,yOffset+10); - _QualityText->setText(ucstring(toString(_Quality.getSInt32()))); + _QualityText->setText(toString(_Quality.getSInt32())); _QualityText->draw(xOffset,yOffset); */ diff --git a/ryzom/client/src/misc.cpp b/ryzom/client/src/misc.cpp index 4e35cfc2a..0432abf1a 100644 --- a/ryzom/client/src/misc.cpp +++ b/ryzom/client/src/misc.cpp @@ -885,7 +885,7 @@ NLMISC::CRGBA interpClientCfgColor(const string &src, string &dest) colorCode.resize(nextPos - 1); for(uint k = 0; k < nextPos - 1; ++k) { - colorCode[k] = tolower((char) src[k + 1]); + colorCode[k] = tolower((char) src[k + 1]); // TODO: toLowerAscii } std::map::const_iterator it = ClientCfg.SystemInfoParams.find(colorCode); if (it != ClientCfg.SystemInfoParams.end()) @@ -953,7 +953,7 @@ std::string getStringCategoryIfAny(const string &src, string &dest) colorCode.resize( codeSize ); for(ptrdiff_t k = 0; k < (ptrdiff_t)codeSize; ++k) { - colorCode[k] = tolower((char) src[k + startPos + 1]); + colorCode[k] = tolower((char) src[k + startPos + 1]); // TODO: toLowerAscii } string destTmp; if ( startPos != 0 ) diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index 6b73acba2..e98d13fe9 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -2494,7 +2494,7 @@ void impulseRemoteAdmin (NLMISC::CBitMemStream &impulse) impulse.serial (cmd); // remove the 2 first rc character if exists, only there to say to the EGS that is a remote command - if (cmd.size()>2 && tolower(cmd[0])=='r' && tolower(cmd[1])=='c') + if (cmd.size()>2 && tolower(cmd[0])=='r' && tolower(cmd[1])=='c') // FIXME: toLowerAscii cmd = cmd.substr(2); mdDisplayVars.clear (); diff --git a/ryzom/client/src/zone_util.cpp b/ryzom/client/src/zone_util.cpp index 33b7fdf68..d7da6810c 100644 --- a/ryzom/client/src/zone_util.cpp +++ b/ryzom/client/src/zone_util.cpp @@ -53,7 +53,7 @@ bool getPosFromZoneName(const std::string &name,NLMISC::CVector2f &dest) while (i < zoneName.size()) { if (!::isalpha(zoneName[i])) return false; - xStr += (char) ::toupper(zoneName[i]); ++i; + xStr += (char) NLMISC::toUpper(zoneName[i]); ++i; } if (xStr.size() != 2) return false; dest.x = 160.f * ((xStr[0] - 'A') * 26 + (xStr[1] - 'A')); @@ -89,7 +89,7 @@ bool getZonePosFromZoneName(const std::string &name, sint &x, sint &y) while (i < zoneName.size()) { if (!::isalpha(zoneName[i])) return false; - xStr += (char) ::toupper(zoneName[i]); ++i; + xStr += (char) NLMISC::toUpper(zoneName[i]); ++i; } if (xStr.size() != 2) return false; x = (xStr[0] - 'A') * 26 + (xStr[1] - 'A'); From 11b453baaa0d5de55eedc08277be3f66c78f443f Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 1 Nov 2020 10:10:48 +0800 Subject: [PATCH 135/205] Safe 7-bit upper- and lowercase --- nel/include/nel/misc/common.h | 11 ++++++++ nel/src/misc/common.cpp | 50 +++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/nel/include/nel/misc/common.h b/nel/include/nel/misc/common.h index bca3372bd..1e99b5e70 100644 --- a/nel/include/nel/misc/common.h +++ b/nel/include/nel/misc/common.h @@ -255,6 +255,17 @@ int compareCaseInsensitive(const char *a, const char *b); int compareCaseInsensitive(const char *a, size_t lenA, const char *b, size_t lenB); inline int compareCaseInsensitive(const std::string &a, const std::string &b) { return compareCaseInsensitive(&a[0], a.size(), &b[0], b.size()); } +/** ASCII to lowercase. Useful for internal identifiers. +* Characters outside of the 7-bit ASCII space, and control characters, are replaced. +*/ +std::string toLowerAscii(const std::string &str, char replacement); +void toLowerAscii(char *str, char replacement); + +/** ASCII to uppercase. Useful for internal identifiers. +* Characters outside of the 7-bit ASCII space, and control characters, are replaced. +*/ +std::string toUpperAscii(const std::string &str, char replacement); +void toUpperAscii(char *str, char replacement); /** * Convert to an hexadecimal std::string diff --git a/nel/src/misc/common.cpp b/nel/src/misc/common.cpp index 8d046c97c..fce6af69c 100644 --- a/nel/src/misc/common.cpp +++ b/nel/src/misc/common.cpp @@ -689,6 +689,56 @@ void toUpper(char *str) } } +std::string toLowerAscii(const std::string &str, char replacement) +{ + std::string res; + res.reserve(str.size()); + for (std::string::const_iterator it(str.begin()), end(str.end()); it != end; ++it) + { + char c = *it; + if ((sint8)(c + '\x01') < (sint8)(' ' + '\x01')) res += replacement; + else if (c >= 'A' && c <= 'Z') res += c + ('a' - 'A'); + else res += c; + } + return res; +} + +void toLowerAscii(char *str, char replacement) +{ + for (ptrdiff_t i = 0; str[i]; ++i) + { + char c = str[i]; + if ((sint8)(c + '\x01') < (sint8)(' ' + '\x01')) str[i] = replacement; + else if (c >= 'A' && c <= 'Z') str[i] = c + ('a' - 'A'); + else str[i] = c; + } +} + +std::string toUpperAscii(const std::string &str, char replacement) +{ + std::string res; + res.reserve(str.size()); + for (std::string::const_iterator it(str.begin()), end(str.end()); it != end; ++it) + { + char c = *it; + if ((sint8)(c + '\x01') < (sint8)(' ' + '\x01')) res += replacement; + else if (c >= 'a' && c <= 'z') res += c - ('a' - 'A'); + else res += c; + } + return res; +} + +void toUpperAscii(char *str, char replacement) +{ + for (ptrdiff_t i = 0; str[i]; ++i) + { + char c = str[i]; + if ((sint8)(c + '\x01') < (sint8)(' ' + '\x01')) str[i] = replacement; + else if (c >= 'a' && c <= 'z') str[i] = c - ('a' - 'A'); + else str[i] = c; + } +} + std::string toHexa(const uint8 &b) { return toString("%02hhx", b); From 73b8ba9e4ec054610d345a89f931ab22957207a9 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 1 Nov 2020 11:37:22 +0800 Subject: [PATCH 136/205] UTF-8 various, ryzom/ryzomcore#335 --- nel/include/nel/gui/view_text_id.h | 2 +- nel/src/gui/view_text_id.cpp | 4 +-- .../src/interface_v3/action_handler_help.cpp | 22 ++++++------ .../src/interface_v3/action_handler_item.cpp | 25 +++++++------- .../src/interface_v3/action_handler_misc.cpp | 4 +-- .../interface_v3/action_handler_phrase.cpp | 4 +-- .../src/interface_v3/action_phrase_faber.cpp | 8 ++--- .../bot_chat_page_create_guild.cpp | 6 ++-- .../src/interface_v3/bot_chat_page_trade.cpp | 12 +++---- .../src/interface_v3/chat_text_manager.cpp | 6 ++-- .../src/interface_v3/chat_text_manager.h | 1 - ryzom/client/src/interface_v3/chat_window.cpp | 9 +---- ryzom/client/src/interface_v3/chat_window.h | 3 -- .../client/src/interface_v3/dbctrl_sheet.cpp | 16 ++++----- ryzom/client/src/interface_v3/dbctrl_sheet.h | 2 +- .../src/interface_v3/dbgroup_build_phrase.cpp | 4 +-- .../dbgroup_list_sheet_icon_phrase.cpp | 4 +-- .../interface_v3/dbgroup_list_sheet_mission.h | 2 +- ...roup_list_sheet_text_brick_composition.cpp | 16 ++++----- .../dbgroup_list_sheet_text_phrase.cpp | 4 +-- .../interface_v3/dbgroup_list_sheet_trade.cpp | 2 +- .../interface_v3/dbgroup_list_sheet_trade.h | 2 +- .../client/src/interface_v3/group_career.cpp | 2 +- .../client/src/interface_v3/group_compas.cpp | 4 +-- .../interface_v3/group_in_scene_bubble.cpp | 6 ++-- .../interface_v3/group_in_scene_user_info.cpp | 20 +++++------ ryzom/client/src/interface_v3/group_map.cpp | 2 +- .../group_phrase_skill_filter.cpp | 6 ++-- .../client/src/interface_v3/guild_manager.cpp | 2 +- .../client/src/interface_v3/interface_ddx.cpp | 4 +-- ryzom/client/src/interface_v3/interface_ddx.h | 2 +- .../src/interface_v3/interface_manager.cpp | 34 +++++++++---------- .../src/interface_v3/interface_manager.h | 10 +++--- .../src/interface_v3/item_special_effect.cpp | 2 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 10 +++--- .../src/interface_v3/people_interraction.cpp | 8 ++--- .../src/interface_v3/sbrick_manager.cpp | 2 +- .../src/interface_v3/sphrase_manager.cpp | 6 ++-- ryzom/client/src/r2/editor.cpp | 6 ++-- ryzom/client/src/zone_util.cpp | 8 ++--- ryzom/common/src/game_share/character_title.h | 4 +-- ryzom/common/src/game_share/utils.h | 9 +++-- 42 files changed, 148 insertions(+), 157 deletions(-) diff --git a/nel/include/nel/gui/view_text_id.h b/nel/include/nel/gui/view_text_id.h index 292f1728a..d29721481 100644 --- a/nel/include/nel/gui/view_text_id.h +++ b/nel/include/nel/gui/view_text_id.h @@ -39,7 +39,7 @@ namespace NLGUI public: virtual ~IOnReceiveTextId() {} // the deriver may change the input text - virtual void onReceiveTextId(ucstring &str) =0; + virtual void onReceiveTextId(std::string &str) =0; }; // *************************************************************************** diff --git a/nel/src/gui/view_text_id.cpp b/nel/src/gui/view_text_id.cpp index 61d97b523..bea55a04d 100644 --- a/nel/src/gui/view_text_id.cpp +++ b/nel/src/gui/view_text_id.cpp @@ -231,9 +231,7 @@ namespace NLGUI // Modify the text? if (_StringModifier) { - ucstring tmp = ucstring::makeFromUtf8(result); - _StringModifier->onReceiveTextId(tmp); // FIXME: UTF-8 - result = tmp.toUtf8(); + _StringModifier->onReceiveTextId(result); } // Set the Text diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index 9cad50e25..102307909 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -2104,9 +2104,7 @@ void getItemText (CDBCtrlSheet *item, string &itemText, const CItemSheet*pIS) INVENTORIES::TInventory inventory = (INVENTORIES::TInventory)item->getInventoryIndex(); sint32 slot = item->getIndexInDB(); string debugText = NLMISC::toString("inventory: %s\nslot: %d\n", INVENTORIES::toString(inventory).c_str(), slot); - ucstring debugText2; - debugText2.fromUtf8(debugText); - itemText = debugText2 + itemText; + itemText = debugText + itemText; #endif } @@ -2536,10 +2534,10 @@ void refreshItemHelp(CSheetHelpSetup &setup) // itemText += CI18N::get("uiRingPlotItemDesc"); // itemText += mi->Description.empty() ? CI18N::get("uiRingPlotItemEmpty") // : mi->Description; -// //itemText += ucstring("\n@{6F6F}") + CI18N::get("uiRingPlotItemComment") + ucstring("\n"); +// //itemText += "\n@{6F6F}" + CI18N::get("uiRingPlotItemComment") + "\n"; // /* // itemText += mi->Comment.empty() ? CI18N::get("uiRingPlotItemEmpty") -// : (ucstring("\n") + mi->Comment); +// : ("\n" + mi->Comment); // */ // } // } @@ -2761,9 +2759,9 @@ void refreshMissionHelp(CSheetHelpSetup &setup, const CPrerequisitInfos &infos) // *************************************************************************** class CPlayerShardNameRemover : public IOnReceiveTextId { - virtual void onReceiveTextId(ucstring &str) + virtual void onReceiveTextId(std::string &str) { - str= CEntityCL::removeShardFromName(str.toUtf8()); + str= CEntityCL::removeShardFromName(str); } }; static CPlayerShardNameRemover PlayerShardNameRemover; @@ -2968,7 +2966,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, string &brickText) if( pBR->getSkill()==SKILLS::unknown ) { string::size_type pos0= brickText.find(killSkill); - if(pos0 != ucstring::npos) + if(pos0 != string::npos) { string::size_type pos1= brickText.find(killSkill, pos0 + killSkill.size() ); if(pos1 != string::npos) @@ -3668,7 +3666,7 @@ public: } } - ucstring str; + string str; BOMB_IF( minTimeRemaining < 0, "at least one animal should be dead", return; ); str += CI18N::get("uittAnimalDeadPopupToolTip"); @@ -3676,7 +3674,7 @@ public: str += toString(minTimeRemaining); // replace the context help that is required. - CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(str); } }; REGISTER_ACTION_HANDLER( CHandlerAnimalDeadPopupTooltip, "animal_dead_popup_tooltip"); @@ -3800,13 +3798,13 @@ static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const s CViewText *viewText= dynamic_cast(groupMp->getElement(groupMp->getId()+":text" )); if(viewText) { - ucstring mpCraft; + string mpCraft; // add the Origin filter. string originFilterKey= "iompf" + ITEM_ORIGIN::enumToString((ITEM_ORIGIN::EItemOrigin)itemPart.OriginFilter); mpCraft+= CI18N::get(originFilterKey); - viewText->setText(mpCraft.toUtf8()); + viewText->setText(mpCraft); } diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 1f8cd61b0..cdd47be2a 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -141,14 +141,14 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() } else { - ucstring customText; + string customText; if (!itemInfo.CustomText.empty()) { - customText = itemInfo.CustomText; - strFindReplace(customText, "%mfc", ucstring()); + customText = itemInfo.CustomText.toUtf8(); // TODO: UTF-8 (serial) + strFindReplace(customText, "%mfc", string()); } - editBoxShort->setInputStringAsUtf16(customText); + editBoxShort->setInputString(customText); editShort->setActive(true); editBoxShort->setActive(true); @@ -263,14 +263,14 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() else { - ucstring customText; + string customText; if (!itemInfo.CustomText.empty()) { - customText = itemInfo.CustomText; - strFindReplace(customText, "%mfc", ucstring()); + customText = itemInfo.CustomText.toUtf8(); + strFindReplace(customText, "%mfc", string()); } - editBoxShort->setInputStringAsUtf16(customText); + editBoxShort->setInputString(customText); editShort->setActive(true); editBoxShort->setActive(true); @@ -407,11 +407,11 @@ void CInterfaceItemEdition::CItemEditionWindow::validate() if (group && editShort && editBoxShort && editLarge && editBoxLarge && display && editButtons && closeButton && background) { bool textValid = editShort->getActive(); - ucstring text = editBoxShort->getInputStringAsUtf16(); + string text = editBoxShort->getInputString(); if (!textValid) { textValid = editLarge->getActive(); - text = editBoxLarge->getInputStringAsUtf16(); + text = editBoxLarge->getInputString(); } if (textValid) @@ -428,7 +428,8 @@ void CInterfaceItemEdition::CItemEditionWindow::validate() out.serial(uiInventory); uint32 uiSlot = (uint32)pCSItem->getIndexInDB(); out.serial(uiSlot); - out.serial(text); + ucstring ucText = ucstring::makeFromUtf8(text); // TODO: UTF-8 (serial) + out.serial(ucText); NetMngr.push(out); //nlinfo("impulseCallBack : %s %s %d \"%s\" sent", msgName.c_str(), INVENTORIES::toString((INVENTORIES::TInventory)pCSItem->getInventoryIndex()).c_str(), pCSItem->getIndexInDB(), text.toUtf8().c_str()); } @@ -2123,7 +2124,7 @@ class CHandlerItemMenuCheck : public IActionHandler { std::string name = groupNames[i]; std::string ahParams = "name=" + name; - //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) pGroupMenu->addLine(name, "", "", name); CGroupSubMenu* pNewSubMenu = new CGroupSubMenu(CViewBase::TCtorParam()); pGroupMenu->setSubMenu(pGroupMenu->getNumLine()-1, pNewSubMenu); diff --git a/ryzom/client/src/interface_v3/action_handler_misc.cpp b/ryzom/client/src/interface_v3/action_handler_misc.cpp index 73c967bcb..b9c71bc56 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -924,8 +924,8 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(string &inOut) inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(strNewTitle, Woman); { // Sometimes translation contains another title - ucstring::size_type pos = inOut.find('$'); - if (pos != ucstring::npos) + string::size_type pos = inOut.find('$'); + if (pos != string::npos) { inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(inOut), Woman); } diff --git a/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 16a65e336..489dcbc35 100644 --- a/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1692,7 +1692,7 @@ public: if(!ctrlSheet) return; - ucstring str(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(CSheetId(ctrlSheet->getSheetId()))); + string str(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(CSheetId(ctrlSheet->getSheetId()))); // According to locked state if(ctrlSheet->getGrayed()) @@ -1700,7 +1700,7 @@ public: else strFindReplace(str, "%comp", CI18N::get("uittPhraseCombatRestrictOK")); - CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(str); } }; REGISTER_ACTION_HANDLER( CHandlerCombatRestrictTooltip, "phrase_combat_restrict_tooltip"); diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index 47fda6d00..f23152b8a 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -510,7 +510,7 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick CViewText *viewText= dynamic_cast(itemReqLineGroup->getView(FaberPhraseText)); if(viewText) { - ucstring text; + string text; if(mpBuild.RequirementType==CMPBuild::ItemPartReq) { text= CI18N::get("uihelpFaberMpHeader"); @@ -524,7 +524,7 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick { nlstop; } - viewText->setText( text.toUtf8() ); + viewText->setText(text); } // Set as Icon the required MP FaberType / or Sheet Texture (directly...) @@ -1687,7 +1687,7 @@ void CActionPhraseFaber::updateItemResult() CViewText *successView= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(FaberPhraseFpSuccessText)); if(successView) { - ucstring text= CI18N::get("uiPhraseFaberSuccessRate"); + string text= CI18N::get("uiPhraseFaberSuccessRate"); // Get the success rate of the related phrase uint phraseSlot= pPM->getMemorizedPhrase(_ExecuteFromMemoryLine, _ExecuteFromMemoryIndex); @@ -1725,7 +1725,7 @@ void CActionPhraseFaber::updateItemResult() + "@{FFFF})"; } strFindReplace(text, "%success", successStr ); - successView->setTextFormatTaged(text.toUtf8()); + successView->setTextFormatTaged(text); } diff --git a/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp b/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp index 143a71837..649f2bd16 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp @@ -71,10 +71,10 @@ class CHandlerGuildCreate : public IActionHandler CGroupEditBox *pDesc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(guildDescWin)); - ucstring guildName = pGEB->getInputStringAsUtf16(); + ucstring guildName = pGEB->getInputStringAsUtf16(); // FIXME: UTF-8 (serial) - ucstring guildDesc; - if (pDesc != NULL) guildDesc = pDesc->getInputStringAsUtf16(); + ucstring guildDesc; // FIXME: UTF-8 (serial) + if (pDesc != NULL) guildDesc = pDesc->getInputStringAsUtf16(); // FIXME: UTF-8 (serial) uint64 icon = CGuildManager::iconMake((uint8)pCS->getGuildBack(), (uint8)pCS->getGuildSymbol(), pCS->getInvertGuildSymbol(), pCS->getGuildColor1(), pCS->getGuildColor2()); diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 13e60fff8..2725eedc9 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -1011,9 +1011,9 @@ void CBotChatPageTrade::startSellDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCal CViewText *itemNameView = dynamic_cast(ig->getView("object_name")); if (itemNameView) { - ucstring itemName; + string itemName; itemName = sheet->getItemActualName(); - itemNameView->setText(itemName.toUtf8()); + itemNameView->setText(itemName); } // set help for item @@ -1678,16 +1678,16 @@ void CBotChatPageTrade::setupFactionPointPrice(bool /* sellMode */, uint default CViewText *vt= dynamic_cast(fpGroup->getView("unit_price_header")); if(vt) { - ucstring fmt= CI18N::get("uiUnitFPPrice"); + string fmt= CI18N::get("uiUnitFPPrice"); strFindReplace(fmt, "%fac", factionName); - vt->setText(fmt.toUtf8()); + vt->setText(fmt); } vt= dynamic_cast(fpGroup->getView("total_price_header")); if(vt) { - ucstring fmt= CI18N::get("uiTotalFPPrice"); + string fmt= CI18N::get("uiTotalFPPrice"); strFindReplace(fmt, "%fac", factionName); - vt->setText(fmt.toUtf8()); + vt->setText(fmt); } // setup icon according to pvp clan diff --git a/ryzom/client/src/interface_v3/chat_text_manager.cpp b/ryzom/client/src/interface_v3/chat_text_manager.cpp index 3e99cd8b5..eb79f4211 100644 --- a/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -156,14 +156,14 @@ static CInterfaceGroup *buildLineWithCommand(CInterfaceGroup *commandGroup, CVie return group; } -static inline bool isUrlTag(const ucstring &s, ucstring::size_type index, ucstring::size_type textSize) +static inline bool isUrlTag(const string &s, string::size_type index, string::size_type textSize) { // Format http://, https:// // or markdown style (title)[http://..] if(textSize > index+7) { bool markdown = false; - ucstring::size_type i = index; + string::size_type i = index; // advance index to url section if markdown style link is detected if (s[i] == '(') { @@ -188,7 +188,7 @@ static inline bool isUrlTag(const ucstring &s, ucstring::size_type index, ucstri if (textSize > i + 7) { - bool isUrl = (toLower(s.substr(i, 7)) == ucstring("http://") || toLower(s.substr(i, 8)) == ucstring("https://")); + bool isUrl = (toLower(s.substr(i, 7)) == "http://" || toLower(s.substr(i, 8)) == "https://"); // match "text http://" and not "texthttp://" if (isUrl && i > 0 && !markdown) { diff --git a/ryzom/client/src/interface_v3/chat_text_manager.h b/ryzom/client/src/interface_v3/chat_text_manager.h index 1cf66730e..2cc71dd0e 100644 --- a/ryzom/client/src/interface_v3/chat_text_manager.h +++ b/ryzom/client/src/interface_v3/chat_text_manager.h @@ -30,7 +30,6 @@ namespace NLGUI class CInterfaceGroup; } -class ucstring; namespace NLMISC{ class CCDBNodeLeaf; } diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index 816a2016a..e1667839d 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -351,13 +351,6 @@ void CChatWindow::setCommand(const std::string &command, bool execute) _EB->setCommand(command, execute); } -void CChatWindow::setCommand(const ucstring &command,bool execute) -{ - if (!_EB) return; - _EB->setCommand(command.toUtf8(), execute); -} - - //================================================================================= void CChatWindow::setEntry(const string &entry) { @@ -624,7 +617,7 @@ void CChatGroupWindow::displayMessage(const string &msg, NLMISC::CRGBA col, CCha prefix = (title.empty() ? "" : " ") + title; pos = newmsg.find("] "); - if (pos == ucstring::npos) + if (pos == string::npos) newmsg = prefix + newmsg; else newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos); diff --git a/ryzom/client/src/interface_v3/chat_window.h b/ryzom/client/src/interface_v3/chat_window.h index 9a299ebfb..88104e4f9 100644 --- a/ryzom/client/src/interface_v3/chat_window.h +++ b/ryzom/client/src/interface_v3/chat_window.h @@ -23,7 +23,6 @@ #ifndef CL_CHAT_WINDOW_H #define CL_CHAT_WINDOW_H -#include "nel/misc/ucstring.h" // REMOVE #include "nel/misc/smart_ptr.h" #include "game_share/chat_group.h" @@ -109,8 +108,6 @@ public: void enableBlink(uint numBlinks); // set a command to be displayed and eventually executed in this chat window. std::string version for backward compatibility void setCommand(const std::string &command, bool execute); - // set a command to be displayed and eventually executed in this chat window - void setCommand(const ucstring &command, bool execute); // REMOVE // set a string to be displayed in the edit box of this window (if it has one) void setEntry(const std::string &entry); // Set listener to react to a chat entry diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index dcfdc1fc9..ee01fc913 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -1665,7 +1665,7 @@ void CDBCtrlSheet::setupSBrick () } // *************************************************************************** -void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector &bricks, const ucstring &phraseName) +void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector &bricks, const string &phraseName) { CSBrickManager *pBM = CSBrickManager::getInstance(); @@ -1718,7 +1718,7 @@ void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector &bri { // Compute the text from the phrase only if needed // string iconName= phraseName.toString(); - string iconName= phraseName.toUtf8(); + const string &iconName = phraseName; if( _NeedSetup || iconName != _OptString ) { // recompute text @@ -1741,7 +1741,7 @@ void CDBCtrlSheet::setupSPhrase() CSPhraseSheet *pSPS = dynamic_cast(SheetMngr.get(CSheetId(sheet))); if (pSPS && !pSPS->Bricks.empty()) { - const ucstring phraseName(STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(CSheetId(sheet))); + const char *phraseName = STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(CSheetId(sheet)); setupDisplayAsPhrase(pSPS->Bricks, phraseName); } else @@ -1799,7 +1799,7 @@ void CDBCtrlSheet::setupSPhraseId () } else { - setupDisplayAsPhrase(phrase.Bricks, phrase.Name); + setupDisplayAsPhrase(phrase.Bricks, phrase.Name.toUtf8()); // FIXME: UTF-8 (serial) } } @@ -3512,11 +3512,11 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const game = game["game"]; game.callMethodByNameNoThrow("updatePhraseTooltip", 1, 1); // retrieve result from stack - ucstring tmpHelp; + ucstring tmpHelp; // FIXME: Lua UTF-8 if (!ls->empty()) { CLuaIHM::pop(*ls, tmpHelp); // FIXME: Lua UTF-8 - help = tmpHelp.toUtf8(); + help = tmpHelp.toUtf8(); // FIXME: Lua UTF-8 } else { @@ -3537,10 +3537,10 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const if (phraseSheetID != 0) { // is it a built-in phrase? - ucstring desc = STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId(phraseSheetID)); + string desc = STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId(phraseSheetID)); if (!desc.empty()) { - help += ucstring("\n\n@{CCCF}") + desc; + help += "\n\n@{CCCF}" + desc; } } */ diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.h b/ryzom/client/src/interface_v3/dbctrl_sheet.h index dfe3b7140..a26a74b22 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -626,7 +626,7 @@ protected: // optSheet is for special faber void setupDisplayAsSBrick(sint32 sheet, sint32 optSheet= 0); // setup icon from phrases - void setupDisplayAsPhrase(const std::vector &bricks, const ucstring &phraseName); + void setupDisplayAsPhrase(const std::vector &bricks, const std::string &phraseName); // draw a number and returns the width of the drawn number sint32 drawNumber(sint32 x, sint32 y, sint32 wSheet, sint32 hSheet, NLMISC::CRGBA color, sint32 value, bool rightAlign=true); diff --git a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp index 4f173088d..cbc183f35 100644 --- a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp @@ -296,7 +296,7 @@ void CDBGroupBuildPhrase::startComposition(const CSPhraseCom &phrase) CSBrickManager *pBM= CSBrickManager::getInstance(); - ucstring name; + string name; // if phrase empty (new phrase), invent a new name if(phrase.empty()) @@ -310,7 +310,7 @@ void CDBGroupBuildPhrase::startComposition(const CSPhraseCom &phrase) else { // copy name - name= phrase.Name; + name= phrase.Name.toUtf8(); // get the root Brick. Must exist. CSBrickSheet *rootBrick= pBM->getBrick(phrase.Bricks[0]); diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp index 19083e4ee..e0d4654c8 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp @@ -136,13 +136,13 @@ void CDBGroupListSheetIconPhrase::setSectionGroupId(CInterfaceGroup *pIG, uin CViewText *name = dynamic_cast(pIG->getView("name")); if (name != NULL) { - ucstring sectionText= CI18N::get("uiPhraseSectionFmt"); + string sectionText= CI18N::get("uiPhraseSectionFmt"); uint32 minLevel, maxLevel; CSPhraseManager *pPM= CSPhraseManager::getInstance(); pPM->getPhraseLevelFromSection(sectionId, minLevel, maxLevel); strFindReplace(sectionText, "%min", toString(minLevel)); strFindReplace(sectionText, "%max", toString(maxLevel)); - name->setText (sectionText.toUtf8()); + name->setText (sectionText); } } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.h b/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.h index b2781eff6..59913998d 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.h +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.h @@ -36,7 +36,7 @@ public: // A child node struct CSheetChildMission : public CDBGroupListSheetText::CSheetChild { - virtual void updateText(CDBGroupListSheetText * /* pFather */, ucstring &/* text */) {} + //virtual void updateText(CDBGroupListSheetText * /* pFather */, std::string &/* text */) {} virtual CViewText *createViewText() const; virtual void updateViewText(CDBGroupListSheetText *pFather); virtual bool isInvalidated(CDBGroupListSheetText *pFather); diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp index e8ad3a2e8..842cb4ba7 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp @@ -110,11 +110,11 @@ void CDBGroupListSheetTextBrickComposition::CSheetChildBrick::init(CDBGroupListS // *************************************************************************** -bool hasOnlyBlankChars(const ucstring &str) +bool hasOnlyBlankChars(const char *str) { - for(uint i=0;i!=str.size();++i) + for (ptrdiff_t i = 0; str[i]; ++i) { - if(str[i]!=' ') + if (str[i] != ' ') return false; } @@ -128,20 +128,20 @@ void CDBGroupListSheetTextBrickComposition::CSheetChildBrick::updateViewText(CDB CSBrickManager *pBM= CSBrickManager::getInstance(); CDBGroupListSheetTextBrickComposition *compoList= (CDBGroupListSheetTextBrickComposition*)pFather; - ucstring text; + string text; if(Ctrl->getType()!=CCtrlSheetInfo::SheetType_SBrick) return; // Get the compo description of the phrase (Desc2) CSheetId brickSheetId= CSheetId(Ctrl->getSheetId()); // Temp if the Desc2 is empty, set Name - ucstring desc2(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedCompositionDescription(brickSheetId)); - if( !desc2.empty() && !hasOnlyBlankChars(desc2)) // tolerate Blank error in translation - Text->setText(desc2.toUtf8()); + const char *desc2(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedCompositionDescription(brickSheetId)); + if( *desc2 && !hasOnlyBlankChars(desc2)) // tolerate Blank error in translation + Text->setText(desc2); else { desc2 = STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(brickSheetId); - Text->setText(desc2.toUtf8()); + Text->setText(desc2); } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp index cad06e699..80209c99e 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp @@ -168,13 +168,13 @@ void CDBGroupListSheetTextPhrase::setSectionGroupId(CInterfaceGroup *pIG, uin CViewText *name = dynamic_cast(pIG->getView("name")); if (name != NULL) { - ucstring sectionText= CI18N::get("uiPhraseSectionFmt"); + string sectionText= CI18N::get("uiPhraseSectionFmt"); uint32 minLevel, maxLevel; CSPhraseManager *pPM= CSPhraseManager::getInstance(); pPM->getPhraseLevelFromSection(sectionId, minLevel, maxLevel); strFindReplace(sectionText, "%min", toString(minLevel)); strFindReplace(sectionText, "%max", toString(maxLevel)); - name->setText (sectionText.toUtf8()); + name->setText (sectionText); } } 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 f8b5d4b56..a09e69801 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -432,7 +432,7 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT // else display the name of the vendor (not if this is the player himself, to avoid flood) else if (LastSellerType == BOTCHATTYPE::Resale) { - text+= "\n" + CI18N::get("uiBotChatVendorTag") + VendorNameString.toUtf8(); + text+= "\n" + CI18N::get("uiBotChatVendorTag") + VendorNameString; } } } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.h b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.h index 5d6e121d5..0678ab145 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.h +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.h @@ -96,7 +96,7 @@ public: CInterfaceProperty CurrentVendorNameId; CInterfaceProperty CurrentFactionType; CInterfaceProperty CurrentFactionPointPrice; - ucstring VendorNameString; + std::string VendorNameString; virtual void init(CDBGroupListSheetText *pFather, uint index); virtual bool isInvalidated(CDBGroupListSheetText *pFather); diff --git a/ryzom/client/src/interface_v3/group_career.cpp b/ryzom/client/src/interface_v3/group_career.cpp index 10cfca35e..c04d98841 100644 --- a/ryzom/client/src/interface_v3/group_career.cpp +++ b/ryzom/client/src/interface_v3/group_career.cpp @@ -128,7 +128,7 @@ bool CGroupJob::parse (xmlNodePtr /* cur */, CInterfaceGroup * /* parentGroup */ // return false; // } // -// ucstring sTmp = JOBS::jobToUCString(Job); +// string sTmp = JOBS::jobToUCString(Job); // for (uint32 i= 0; i < sTmp.size(); ++i) // if (sTmp[i] < 128) // if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') ) diff --git a/ryzom/client/src/interface_v3/group_compas.cpp b/ryzom/client/src/interface_v3/group_compas.cpp index a78c94681..f36e6a637 100644 --- a/ryzom/client/src/interface_v3/group_compas.cpp +++ b/ryzom/client/src/interface_v3/group_compas.cpp @@ -750,8 +750,8 @@ void CGroupCompasMenu::setActive (bool state) /*CEntityCL *entity = EntitiesMngr.entity(UserEntity->selection()); if (entity != NULL) {*/ - //ucstring targetName = CI18N::get("uiTargetTwoPoint") + entity->removeTitleAndShardFromName(entity->getEntityName()); - std::string targetName = CI18N::get("uiTarget"); + //string targetName = CI18N::get("uiTargetTwoPoint") + entity->removeTitleAndShardFromName(entity->getEntityName()); + string targetName = CI18N::get("uiTarget"); ct.setType(CCompassTarget::Selection); ct.Name = targetName; Targets.push_back(ct); 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 9f03834c8..ab9f1c6c7 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -472,11 +472,11 @@ void CGroupInSceneBubbleManager::update () // Send to the around me window // TODO must get the name of the bot etc... /* - ucstring finalString = res; + string finalString = res; for(;;) { - std::string::size_type index = finalString.find (ucstring("{break}")); - if (index == ucstring::npos) break; + std::string::size_type index = finalString.find ("{break}"); + if (index == string::npos) break; finalString = finalString.substr (0, index) + finalString.substr(index+7,finalString.size()); } diff --git a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index ee2f6c526..276f248a5 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -212,10 +212,10 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) entityTitle.clear(); } - ucstring entityTag1 = entity->getTag(1); - ucstring entityTag2 = entity->getTag(2); - ucstring entityTag3 = entity->getTag(3); - ucstring entityTag4 = entity->getTag(4); + string entityTag1 = entity->getTag(1); + string entityTag2 = entity->getTag(2); + string entityTag3 = entity->getTag(3); + string entityTag4 = entity->getTag(4); string entityPermanentContent = entity->getPermanentStatutIcon(); @@ -471,17 +471,17 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) { bitmap = dynamic_cast(leftGroup->getView ("rp_logo_1")); if (bitmap) - bitmap->setTexture(entityTag1.toString()); + bitmap->setTexture(entityTag1); bitmap = dynamic_cast(leftGroup->getView ("rp_logo_2")); if (bitmap) - bitmap->setTexture(entityTag2.toString()); + bitmap->setTexture(entityTag2); } bitmap = dynamic_cast(leftGroup->getView ("rp_logo_3")); if (bitmap) - bitmap->setTexture(entityTag3.toString()); + bitmap->setTexture(entityTag3); bitmap = dynamic_cast(leftGroup->getView ("rp_logo_4")); if (bitmap) - bitmap->setTexture(entityTag4.toString()); + bitmap->setTexture(entityTag4); } // Get the permanent content bitmap @@ -959,14 +959,14 @@ void CGroupInSceneUserInfo::updateDynamicData () { _Name->setColor(entityColor); _Name->setModulateGlobalColor(false); - ucstring entityName = _Entity->getDisplayName(); + string entityName = _Entity->getDisplayName(); if (entityName.empty()) entityName = _Entity->getTitle(); if (pPlayer != NULL) if (pPlayer->isAFK()) entityName += CI18N::get("uiAFK"); - _Name->setText(entityName.toUtf8()); + _Name->setText(entityName); // Title color get the PVP color if (_Title) diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index 8582b938e..45bcf79c2 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -146,7 +146,7 @@ static void popupLandMarkNameDialog() else { NLGUI::CDBManager::getInstance()->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(cb->getTextPos(CUserLandMark::Misc)); - eb->setInputStringAsUtf16(ucstring()); + eb->setInputString(string()); } CWidgetManager::getInstance()->setCaptureKeyboard(eb); diff --git a/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp b/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp index 7d2054fc4..48d3bd8d4 100644 --- a/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp +++ b/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp @@ -191,9 +191,9 @@ void CGroupPhraseSkillFilter::rebuild() uint nCounter = 0; // local variable (avoid realloc in loop) - vector< pair > tempVec(2); - ucstring sSkillName; - string sDBNameSkillValue; + // vector< pair > tempVec(2); + // string sSkillName; + // string sDBNameSkillValue; // Build the hierarchy while ((!bQuit) && (nCounter < 32)) // Counter is used to not infinitly loop diff --git a/ryzom/client/src/interface_v3/guild_manager.cpp b/ryzom/client/src/interface_v3/guild_manager.cpp index 39fe7e05e..6d8a0f864 100644 --- a/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/ryzom/client/src/interface_v3/guild_manager.cpp @@ -1266,7 +1266,7 @@ class CHandlerInvGuildToBag : public IActionHandler if (!bPlaceFound) { - ucstring msg = CI18N::get("msgCantPutItemInBag"); + string msg = CI18N::get("msgCantPutItemInBag"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); return; diff --git a/ryzom/client/src/interface_v3/interface_ddx.cpp b/ryzom/client/src/interface_v3/interface_ddx.cpp index 36bd17e62..230b7a2c2 100644 --- a/ryzom/client/src/interface_v3/interface_ddx.cpp +++ b/ryzom/client/src/interface_v3/interface_ddx.cpp @@ -351,7 +351,7 @@ void CInterfaceDDX::CParam::updateScrollView(sint32 nVal) { if(ResultView) { - ResultView->setText(toString(nVal) + ResultUnit.toUtf8()); + ResultView->setText(toString(nVal) + ResultUnit); } } @@ -362,7 +362,7 @@ void CInterfaceDDX::CParam::updateScrollView(double nVal) { // allow N digits string fmt= toString("%%.%df", ResultDecimal); - ResultView->setText(toString(fmt.c_str(), nVal) + ResultUnit.toUtf8()); + ResultView->setText(toString(fmt.c_str(), nVal) + ResultUnit); } } diff --git a/ryzom/client/src/interface_v3/interface_ddx.h b/ryzom/client/src/interface_v3/interface_ddx.h index 48f329053..2be1c84b4 100644 --- a/ryzom/client/src/interface_v3/interface_ddx.h +++ b/ryzom/client/src/interface_v3/interface_ddx.h @@ -79,7 +79,7 @@ private: // The tex view, result of the scroll CViewTextPtr ResultView; // The unit to append to the result string - ucstring ResultUnit; + std::string ResultUnit; // For ScrollBarFloat widget only uint8 ResultDecimal; // For ScrollBarFloat widget only diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index aa38b6dbf..3329a2aae 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1527,7 +1527,7 @@ void CInterfaceManager::updateFrameEvents() if ((T0 - _UpdateWeatherTime) > (1 * 3 * 1000)) { _UpdateWeatherTime = T0; - ucstring str = CI18N::get ("uiTheSeasonIs") + + string str = CI18N::get ("uiTheSeasonIs") + CI18N::get ("uiSeason"+toStringEnum(computeCurrSeason())) + CI18N::get ("uiAndTheWeatherIs") + CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName) + @@ -1537,7 +1537,7 @@ void CInterfaceManager::updateFrameEvents() CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather")); if (pVT != NULL) - pVT->setText(str.toUtf8()); + pVT->setText(str); CCtrlBase *pTooltip= dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather_tt")); if (pTooltip != NULL) @@ -1571,7 +1571,7 @@ void CInterfaceManager::updateFrameEvents() pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:time")); if (pVT != NULL) - pVT->setText(str.toUtf8()); + pVT->setText(str); str.clear(); // Update the clock in the compass if enabled. @@ -1584,7 +1584,7 @@ void CInterfaceManager::updateFrameEvents() str = getTimestampHuman("%I:%M %p"); else str = getTimestampHuman("%H:%M"); - pVT->setText(str.toUtf8()); + pVT->setText(str); } } } @@ -2389,7 +2389,7 @@ void CInterfaceManager::processServerIDString() } // ------------------------------------------------------------------------------------------------ -void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucstring &text, const string &masterGroup, TCaseMode caseMode) +void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const string &text, const string &masterGroup, TCaseMode caseMode) { CInterfaceGroup *group= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(masterGroup+":" + msgBoxGroup)); CViewText *viewText= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(masterGroup+":" + msgBoxGroup + ":text")); @@ -2397,7 +2397,7 @@ void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucst if (group && viewText) { viewText->setCaseMode(caseMode); - viewText->setText(text.toUtf8()); + viewText->setText(text); CWidgetManager::getInstance()->enableModalWindow(NULL, group); // don't understand why but need to update coords here group->updateCoords(); @@ -2406,7 +2406,7 @@ void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucst } // ------------------------------------------------------------------------------------------------ -void CInterfaceManager::messageBox(const ucstring &text, const string &masterGroup, TCaseMode caseMode) +void CInterfaceManager::messageBox(const string &text, const string &masterGroup, TCaseMode caseMode) { messageBoxInternal("message_box", text, masterGroup, caseMode); } @@ -2435,7 +2435,7 @@ void CInterfaceManager::messageBoxWithHelp(const std::string &text, const std::s // ------------------------------------------------------------------------------------------------ -void CInterfaceManager::validMessageBox(TValidMessageIcon icon, const ucstring &text, const std::string &ahOnOk, +void CInterfaceManager::validMessageBox(TValidMessageIcon icon, const std::string &text, const std::string &ahOnOk, const std::string ¶msOnOk, const std::string &ahOnCancel, const std::string ¶msOnCancel, const string &masterGroup) { CInterfaceGroup *group= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(masterGroup+":valid_message_box")); @@ -2450,7 +2450,7 @@ void CInterfaceManager::validMessageBox(TValidMessageIcon icon, const ucstring & CWidgetManager::getInstance()->setProcedureAction("proc_valid_message_box_cancel", 1, ahOnCancel, paramsOnCancel); // set text and icon - viewText->setText(text.toUtf8()); + viewText->setText(text); if(viewBitmap) { bool active= true; @@ -2978,7 +2978,7 @@ bool CInterfaceManager::deletePlayerKeys (const std::string &playerFileIdent) } // *************************************************************************** -void CInterfaceManager::log(const ucstring &str, const std::string &cat) +void CInterfaceManager::log(const std::string &str, const std::string &cat) { if (_LogState) { @@ -2987,7 +2987,7 @@ void CInterfaceManager::log(const ucstring &str, const std::string &cat) FILE *f = nlfopen(fileName, "at"); if (f != NULL) { - const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " (" + NLMISC::toUpper(cat) + ") * " + str.toUtf8(); + const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " (" + NLMISC::toUpper(cat) + ") * " + str; fprintf(f, "%s\n", finalString.c_str()); fclose(f); } @@ -3176,8 +3176,8 @@ struct CEmoteEntry string::size_type pos1 = path1.find('|'); string::size_type pos2 = path2.find('|'); - ucstring s1 = toUpper(CI18N::get(path1.substr(0, pos1))); - ucstring s2 = toUpper(CI18N::get(path2.substr(0, pos2))); + string s1 = toUpper(CI18N::get(path1.substr(0, pos1))); + string s2 = toUpper(CI18N::get(path2.substr(0, pos2))); sint result = s1.compare(s2); if (result != 0) @@ -3195,14 +3195,14 @@ struct CEmoteEntry } }; -static bool translateEmote(const std::string &id, ucstring &translatedName, std::string &commandName, std::string &commandNameAlt) +static bool translateEmote(const std::string &id, std::string &translatedName, std::string &commandName, std::string &commandNameAlt) { if (CI18N::hasTranslation(id)) { translatedName = CI18N::get(id); // convert command to utf8 since emote translation can have strange chars - commandName = toLower(translatedName).toUtf8(); + commandName = toLower(translatedName); // replace all spaces by _ while (strFindReplace(commandName, " ", "_")); @@ -3301,7 +3301,7 @@ void CInterfaceManager::initEmotes() CGroupSubMenu *pMenu = pRootMenu->getRootMenu(); nlassert(pMenu); - ucstring sTranslatedName; + std::string sTranslatedName; std::string sCommandName; std::string sCommandNameAlt; @@ -3345,7 +3345,7 @@ void CInterfaceManager::initEmotes() translateEmote(sTmp, sTranslatedName, sCommandName, sCommandNameAlt); // Create a line - pMenu->addLine (sTranslatedName.toUtf8() + " (/" + sCommandName + ")", "emote", + pMenu->addLine (sTranslatedName + " (/" + sCommandName + ")", "emote", "nb="+toString(nEmoteNb)+"|behav="+toString(nBehav), sTmp); } } diff --git a/ryzom/client/src/interface_v3/interface_manager.h b/ryzom/client/src/interface_v3/interface_manager.h index 91178677d..5206e0513 100644 --- a/ryzom/client/src/interface_v3/interface_manager.h +++ b/ryzom/client/src/interface_v3/interface_manager.h @@ -241,7 +241,7 @@ public: // Log system (all chat/tell void setLogState(bool state) { _LogState = state; } bool getLogState() const { return _LogState; } - void log(const ucstring &str, const std::string &cat = ""); + void log(const std::string &str, const std::string &cat = ""); /// Text from here and from server @@ -305,7 +305,7 @@ public: /** Open a MessageBox. this is a simple ModalWindow with a Ok button * ui:interface:message_box must be defined in xml, with a "text" ViewText son */ - void messageBox(const ucstring &text, const std::string &masterGroup="ui:interface", TCaseMode caseMode = CaseFirstSentenceLetterUp); + void messageBox(const std::string &text, const std::string &masterGroup="ui:interface", TCaseMode caseMode = CaseFirstSentenceLetterUp); /** Open a MessageBox. this is a simple ModalWindow with a Ok and a HELP button. * The help button with open a browser on ryzom.com faq * ui:interface:message_box_with_help must be defined in xml, with a "text" ViewText son @@ -321,7 +321,7 @@ public: * \param ahOnCancel => the action handler to call if cancel is pressed. NB: you don't have to call leave_modal in this ah (auto done). * \param paramsOnCancel => params passed to ahOnCancel. */ - void validMessageBox(TValidMessageIcon icon, const ucstring &text, const std::string &ahOnOk, const std::string ¶msOnOk= std::string(), + void validMessageBox(TValidMessageIcon icon, const std::string &text, const std::string &ahOnOk, const std::string ¶msOnOk= std::string(), const std::string &ahOnCancel= std::string(), const std::string ¶msOnCancel= std::string(), const std::string &masterGroup="ui:interface"); /** Get the current running validMessageBox OnOk action. empty if no validMessageBox currently opened @@ -446,7 +446,7 @@ public: */ static char* getTimestampHuman(const char* format = "[%H:%M:%S] "); - /** Parses any tokens in the ucstring like $t$ or $g()$ + /** Parses any tokens in the utf-8 string like $t$ or $g()$ */ static bool parseTokens(std::string& ucstr); @@ -672,7 +672,7 @@ private: CServerToLocalAutoCopy ServerToLocalAutoCopyDMGift; // Pop a new message box. If the message box was found, returns a pointer on it - void messageBoxInternal(const std::string &msgBoxGroup, const ucstring &text, const std::string &masterGroup, TCaseMode caseMode); + void messageBoxInternal(const std::string &msgBoxGroup, const std::string &text, const std::string &masterGroup, TCaseMode caseMode); CInterfaceLink::CInterfaceLinkUpdater *interfaceLinkUpdater; }; diff --git a/ryzom/client/src/interface_v3/item_special_effect.cpp b/ryzom/client/src/interface_v3/item_special_effect.cpp index fdb53a0ec..84dbdf785 100644 --- a/ryzom/client/src/interface_v3/item_special_effect.cpp +++ b/ryzom/client/src/interface_v3/item_special_effect.cpp @@ -66,7 +66,7 @@ void CItemSpecialEffectHelper::registerItemSpecialEffect(const string &name) { string tmp = "%"; tmp += s[0]; - if (s.size() >=2 && isdigit(s[1])) + if (s.size() >=2 && (uint8)s[1] < (uint8)'\x80' && isdigit(s[1])) tmp += s[1]; params.push_back(tmp); } diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 0e97c73f7..bd2377bcb 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -825,7 +825,7 @@ int CLuaIHMRyzom::validMessageBox(CLuaState &ls) CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 6, LUA_TSTRING); CInterfaceManager *im = CInterfaceManager::getInstance(); - im->validMessageBox(CInterfaceManager::QuestionIconMsg, msg, ls.toString(2), ls.toString(3), ls.toString(4), ls.toString(5), ls.toString(6)); + im->validMessageBox(CInterfaceManager::QuestionIconMsg, msg.toUtf8(), ls.toString(2), ls.toString(3), ls.toString(4), ls.toString(5), ls.toString(6)); return 0; } @@ -2889,7 +2889,7 @@ void CLuaIHMRyzom::messageBox(const ucstring &text) { //H_AUTO(Lua_CLuaIHM_messageBox) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->messageBox(text); + pIM->messageBox(text.toUtf8()); } // *************************************************************************** @@ -2897,7 +2897,7 @@ void CLuaIHMRyzom::messageBox(const ucstring &text, const std::string &masterGr { //H_AUTO(Lua_CLuaIHM_messageBox) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->messageBox(text, masterGroup); + pIM->messageBox(text.toUtf8(), masterGroup); } // *************************************************************************** @@ -2910,7 +2910,7 @@ void CLuaIHMRyzom::messageBox(const ucstring &text, const std::string &masterGr //H_AUTO(Lua_CLuaIHM_messageBox) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->messageBox(text, masterGroup, (TCaseMode) caseMode); + pIM->messageBox(text.toUtf8(), masterGroup, (TCaseMode) caseMode); } // *************************************************************************** @@ -3652,7 +3652,7 @@ void CLuaIHMRyzom::tell(const ucstring &player, const ucstring &msg) CInterfaceManager *im = CInterfaceManager::getInstance(); w->setKeyboardFocus(); w->enableBlink(1); - w->setCommand(ucstring("tell ") + CEntityCL::removeTitleFromName(player.toUtf8()) + ucstring(" "), false); + w->setCommand("tell " + CEntityCL::removeTitleFromName(player.toUtf8()) + " ", false); CGroupEditBox *eb = w->getEditBox(); if (eb != NULL) diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index 98432cdb8..d1c43d897 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -3201,7 +3201,7 @@ NLMISC_COMMAND(party_chat, "Create a new party chat", "") return true; } CPeopleInterraction &pi = PeopleInterraction; - ucstring title = args[0]; + string title = args[0]; if (!pi.testValidPartyChatName(title)) { @@ -3221,16 +3221,16 @@ NLMISC_COMMAND(remove_party_chat, "Remove a party chat", "") displayVisibleSystemMsg(CI18N::get("uiRemovePartyChatCmd")); return true; } - ucstring title = ucstring(args[0]); + string title = ucstring(args[0]); CChatWindow *chat = getChatWndMgr().getChatWindow(title); if (!chat) { - displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiBadPartyChatName")); + displayVisibleSystemMsg(title + " : " + CI18N::get("uiBadPartyChatName")); return true; } if (!PeopleInterraction.removePartyChat(chat)) { - displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiCantRemovePartyChat")); + displayVisibleSystemMsg(title + " : " + CI18N::get("uiCantRemovePartyChat")); return true; } return true; diff --git a/ryzom/client/src/interface_v3/sbrick_manager.cpp b/ryzom/client/src/interface_v3/sbrick_manager.cpp index a2cecf2d4..780b1301c 100644 --- a/ryzom/client/src/interface_v3/sbrick_manager.cpp +++ b/ryzom/client/src/interface_v3/sbrick_manager.cpp @@ -486,7 +486,7 @@ void CSBrickManager::compileBrickProperties() k++; } // Param Id modifier? (ie read not the 0th value, but the 1th etc... up to 9) - else if(k 0) { int currChar = (int) baseName[lastIndex]; - if (!isdigit(currChar) && + if (((uint8)currChar >= (uint8)'\x80' || !isdigit(currChar)) && currChar != ' ' && currChar != '\t') { @@ -4289,7 +4289,7 @@ ucstring CEditor::genInstanceName(const ucstring &baseName) while (lastIndex > 0) { int currChar = (int) strippedName[lastIndex]; - if (!isdigit(currChar) && + if (((uint8)currChar >= (uint8)'\x80' || !isdigit(currChar)) && currChar != ' ' && currChar != '\t') { diff --git a/ryzom/client/src/zone_util.cpp b/ryzom/client/src/zone_util.cpp index d7da6810c..0f2a84636 100644 --- a/ryzom/client/src/zone_util.cpp +++ b/ryzom/client/src/zone_util.cpp @@ -44,7 +44,7 @@ bool getPosFromZoneName(const std::string &name,NLMISC::CVector2f &dest) uint32 i = 0; while (zoneName[i] != '_') { - if (!::isdigit(zoneName[i])) return false; + if ((uint8)zoneName[i] >= (uint8)'\x80' || !::isdigit(zoneName[i])) return false; yStr += zoneName[i]; ++i; if (i == zoneName.size()) return false; @@ -52,7 +52,7 @@ bool getPosFromZoneName(const std::string &name,NLMISC::CVector2f &dest) ++i; while (i < zoneName.size()) { - if (!::isalpha(zoneName[i])) return false; + if ((uint8)zoneName[i] >= (uint8)'\x80' || !::isalpha(zoneName[i])) return false; xStr += (char) NLMISC::toUpper(zoneName[i]); ++i; } if (xStr.size() != 2) return false; @@ -80,7 +80,7 @@ bool getZonePosFromZoneName(const std::string &name, sint &x, sint &y) uint32 i = 0; while (zoneName[i] != '_') { - if (!::isdigit(zoneName[i])) return false; + if ((uint8)zoneName[i] >= (uint8)'\x80' || !::isdigit(zoneName[i])) return false; yStr += zoneName[i]; ++i; if (i == zoneName.size()) return false; @@ -88,7 +88,7 @@ bool getZonePosFromZoneName(const std::string &name, sint &x, sint &y) ++i; while (i < zoneName.size()) { - if (!::isalpha(zoneName[i])) return false; + if ((uint8)zoneName[i] >= (uint8)'\x80' || !::isalpha(zoneName[i])) return false; xStr += (char) NLMISC::toUpper(zoneName[i]); ++i; } if (xStr.size() != 2) return false; diff --git a/ryzom/common/src/game_share/character_title.h b/ryzom/common/src/game_share/character_title.h index 5ad8c3c10..bae0c2a4b 100644 --- a/ryzom/common/src/game_share/character_title.h +++ b/ryzom/common/src/game_share/character_title.h @@ -301,9 +301,9 @@ inline ECharacterTitle getGMTitleFromPriv (const std::string& priv) //---------------------------------------------------------------------- -inline bool isCsrTitle(const ucstring& title) +inline bool isCsrTitle(const std::string& title) { - ECharacterTitle titleEnum = toCharacterTitle( title.toUtf8() ); + ECharacterTitle titleEnum = toCharacterTitle( title ); bool bIsCsrTitle = (titleEnum >= SGM && titleEnum <= CM); return bIsCsrTitle; diff --git a/ryzom/common/src/game_share/utils.h b/ryzom/common/src/game_share/utils.h index cb22574a4..eb527162f 100644 --- a/ryzom/common/src/game_share/utils.h +++ b/ryzom/common/src/game_share/utils.h @@ -44,7 +44,11 @@ inline std::string capitalize(const std::string & s) if ( s.empty() ) return s; - return NLMISC::toUpper( s.substr(0,1) ) + NLMISC::toLower( s.substr(1,std::string::npos) ); + std::string res; + res.reserve(4); + ptrdiff_t i = 0; + NLMISC::appendToUpper(res, s, i); + return res + NLMISC::toLower(s.substr(i)); } inline ucstring capitalize(const ucstring & s) @@ -52,7 +56,8 @@ inline ucstring capitalize(const ucstring & s) if ( s.empty() ) return s; - return NLMISC::toUpper( s.substr(0,1) ) + NLMISC::toLower( s.substr(1,std::string::npos) ); + // return NLMISC::toUpper( s.substr(0,1) ) + NLMISC::toLower( s.substr(1,std::string::npos) ); + return ucstring::makeFromUtf8(capitalize(s.toUtf8())); } From ffa6179b827e506d2d7ebd480a4bbcf287dd1b43 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 2 Nov 2020 12:59:09 +0800 Subject: [PATCH 137/205] Alternative 7-bit upper- and lowercase --- nel/include/nel/misc/common.h | 12 +++++ nel/src/misc/common.cpp | 91 ++++++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 1 deletion(-) diff --git a/nel/include/nel/misc/common.h b/nel/include/nel/misc/common.h index 1e99b5e70..12ad31ceb 100644 --- a/nel/include/nel/misc/common.h +++ b/nel/include/nel/misc/common.h @@ -267,6 +267,18 @@ void toLowerAscii(char *str, char replacement); std::string toUpperAscii(const std::string &str, char replacement); void toUpperAscii(char *str, char replacement); +/** ASCII to lowercase. Useful for internal identifiers. +* Characters outside of the 7-bit ASCII space are not affected. +*/ +std::string toLowerAscii(const std::string &str); +void toLowerAscii(char *str); + +/** ASCII to uppercase. Useful for internal identifiers. +* Characters outside of the 7-bit ASCII space are not affected. +*/ +std::string toUpperAscii(const std::string &str); +void toUpperAscii(char *str); + /** * Convert to an hexadecimal std::string */ diff --git a/nel/src/misc/common.cpp b/nel/src/misc/common.cpp index fce6af69c..2cdec50c8 100644 --- a/nel/src/misc/common.cpp +++ b/nel/src/misc/common.cpp @@ -577,7 +577,6 @@ uint32 fromHumanReadable (const std::string &str) return 0; } - NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human readable time", "") { nlunreferenced(rawCommandString); @@ -594,6 +593,50 @@ NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human rea return true; } +NLMISC_CATEGORISED_COMMAND(nel, toLower, "Convert a string to lowercase", "") +{ + nlunreferenced(args); + nlunreferenced(quiet); + nlunreferenced(human); + + log.displayNL("%s", toLower(rawCommandString).c_str()); + + return true; +} + +NLMISC_CATEGORISED_COMMAND(nel, toUpper, "Convert a string to uppercase", "") +{ + nlunreferenced(args); + nlunreferenced(quiet); + nlunreferenced(human); + + log.displayNL("%s", toUpper(rawCommandString).c_str()); + + return true; +} + +NLMISC_CATEGORISED_COMMAND(nel, toLowerAscii, "Convert a string's ascii-characters to lowercase", "") +{ + nlunreferenced(args); + nlunreferenced(quiet); + nlunreferenced(human); + + log.displayNL("%s", toLowerAscii(rawCommandString).c_str()); + + return true; +} + +NLMISC_CATEGORISED_COMMAND(nel, toUpperAscii, "Convert a string's ascii-characters to uppercase", "") +{ + nlunreferenced(args); + nlunreferenced(quiet); + nlunreferenced(human); + + log.displayNL("%s", toUpperAscii(rawCommandString).c_str()); + + return true; +} + #if 0 std::string toLower(const char *str) @@ -739,6 +782,52 @@ void toUpperAscii(char *str, char replacement) } } +std::string toLowerAscii(const std::string &str) +{ + std::string res; + res.reserve(str.size()); + for (std::string::const_iterator it(str.begin()), end(str.end()); it != end; ++it) + { + char c = *it; + if (c >= 'A' && c <= 'Z') res += c + ('a' - 'A'); + else res += c; + } + return res; +} + +void toLowerAscii(char *str) +{ + for (ptrdiff_t i = 0; str[i]; ++i) + { + char c = str[i]; + if (c >= 'A' && c <= 'Z') str[i] = c + ('a' - 'A'); + else str[i] = c; + } +} + +std::string toUpperAscii(const std::string &str) +{ + std::string res; + res.reserve(str.size()); + for (std::string::const_iterator it(str.begin()), end(str.end()); it != end; ++it) + { + char c = *it; + if (c >= 'a' && c <= 'z') res += c - ('a' - 'A'); + else res += c; + } + return res; +} + +void toUpperAscii(char *str) +{ + for (ptrdiff_t i = 0; str[i]; ++i) + { + char c = str[i]; + if (c >= 'a' && c <= 'z') str[i] = c - ('a' - 'A'); + else str[i] = c; + } +} + std::string toHexa(const uint8 &b) { return toString("%02hhx", b); From 281630c28080e0087ad178eca5d87cc8854e4c30 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 2 Nov 2020 13:44:44 +0800 Subject: [PATCH 138/205] Use the simplified toLower for identifiers and filenames --- nel/include/nel/georges/form_elm.h | 2 +- nel/src/3d/animation_set.cpp | 2 +- nel/src/3d/async_texture_manager.cpp | 2 +- nel/src/3d/coarse_mesh_build.cpp | 4 +- nel/src/3d/driver.cpp | 4 +- nel/src/3d/driver/opengl/driver_opengl.cpp | 2 +- nel/src/3d/hls_texture_bank.cpp | 2 +- nel/src/3d/hls_texture_manager.cpp | 2 +- nel/src/3d/instance_lighter.cpp | 2 +- nel/src/3d/landscapeig_manager.cpp | 2 +- nel/src/3d/packed_zone.cpp | 2 +- nel/src/3d/scene.cpp | 4 +- nel/src/3d/scene_group.cpp | 6 +-- nel/src/3d/shape_bank.cpp | 22 +++++------ nel/src/3d/shape_info.cpp | 2 +- nel/src/3d/texture_file.cpp | 2 +- nel/src/3d/tile_bank.cpp | 4 +- nel/src/georges/form.cpp | 2 +- nel/src/georges/form_dfn.cpp | 4 +- nel/src/georges/form_loader.cpp | 6 +-- nel/src/gui/action_handler.cpp | 6 +-- nel/src/gui/css_parser.cpp | 10 ++--- nel/src/gui/css_selector.cpp | 8 ++-- nel/src/gui/css_style.cpp | 28 +++++++------- nel/src/gui/ctrl_base.cpp | 2 +- nel/src/gui/ctrl_base_button.cpp | 6 +-- nel/src/gui/ctrl_button.cpp | 6 +-- nel/src/gui/ctrl_col_pick.cpp | 4 +- nel/src/gui/ctrl_scroll.cpp | 6 +-- nel/src/gui/ctrl_text_button.cpp | 6 +-- nel/src/gui/dbgroup_combo_box.cpp | 3 +- nel/src/gui/group_editbox.cpp | 2 +- nel/src/gui/group_html.cpp | 28 +++++++------- nel/src/gui/html_parser.cpp | 10 ++--- nel/src/gui/http_hsts.cpp | 2 +- nel/src/gui/interface_anim.cpp | 2 +- nel/src/gui/interface_group.cpp | 2 +- nel/src/gui/interface_options.cpp | 4 +- nel/src/gui/interface_parser.cpp | 16 ++++---- nel/src/gui/libwww.cpp | 4 +- nel/src/gui/url_parser.cpp | 2 +- nel/src/gui/view_pointer.cpp | 26 ++++++------- nel/src/gui/view_renderer.cpp | 16 ++++---- nel/src/ligo/primitive_class.cpp | 8 ++-- nel/src/ligo/primitive_configuration.cpp | 6 +-- nel/src/misc/big_file.cpp | 10 ++--- nel/src/misc/command.cpp | 8 ++-- nel/src/misc/common.cpp | 4 +- nel/src/misc/i18n.cpp | 8 ++-- nel/src/misc/i_xml.cpp | 2 +- nel/src/misc/path.cpp | 34 ++++++++--------- nel/src/misc/sheet_id.cpp | 10 ++--- nel/src/misc/streamed_package.cpp | 2 +- nel/src/misc/streamed_package_manager.cpp | 2 +- nel/src/misc/string_common.cpp | 2 +- nel/src/misc/system_info.cpp | 4 +- nel/src/net/email.cpp | 2 +- nel/src/net/service.cpp | 2 +- nel/src/sound/audio_decoder.cpp | 4 +- nel/src/sound/audio_mixer_user.cpp | 2 +- nel/src/sound/group_controller_root.cpp | 2 +- ryzom/client/src/animation_fx.cpp | 2 +- ryzom/client/src/auto_anim.cpp | 2 +- ryzom/client/src/character_cl.cpp | 22 +++++------ ryzom/client/src/client.cpp | 2 +- ryzom/client/src/client_cfg.cpp | 4 +- .../client_sheets/automaton_list_sheet.cpp | 6 +-- .../src/client_sheets/character_sheet.cpp | 10 ++--- ryzom/client/src/client_sheets/item_sheet.cpp | 20 +++++----- .../client_sheets/outpost_building_sheet.cpp | 8 ++-- .../client/src/client_sheets/player_sheet.cpp | 4 +- .../client/src/client_sheets/sbrick_sheet.cpp | 14 +++---- ryzom/client/src/commands.cpp | 8 ++-- ryzom/client/src/connection.cpp | 6 +-- ryzom/client/src/continent.cpp | 6 +-- ryzom/client/src/continent_manager.cpp | 4 +- ryzom/client/src/door_manager.cpp | 8 ++-- ryzom/client/src/entity_animation_manager.cpp | 2 +- ryzom/client/src/ground_fx_manager.cpp | 2 +- ryzom/client/src/hair_set.cpp | 2 +- ryzom/client/src/ig_callback.cpp | 2 +- ryzom/client/src/init.cpp | 6 +-- .../src/interface_v3/bot_chat_page_trade.cpp | 2 +- .../client/src/interface_v3/character_3d.cpp | 2 +- .../src/interface_v3/chat_text_manager.cpp | 4 +- .../client/src/interface_v3/dbctrl_sheet.cpp | 37 ++++++++++--------- .../interface_v3/dbgroup_list_sheet_trade.cpp | 2 +- .../client/src/interface_v3/group_compas.cpp | 4 +- ryzom/client/src/interface_v3/group_map.cpp | 8 ++-- .../client/src/interface_v3/guild_manager.cpp | 4 +- .../src/interface_v3/interface_3d_scene.cpp | 12 +++--- .../src/interface_v3/interface_manager.cpp | 4 +- .../src/interface_v3/inventory_manager.cpp | 2 +- .../interface_v3/item_consumable_effect.cpp | 16 ++++---- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 2 +- .../client/src/interface_v3/music_player.cpp | 4 +- .../src/interface_v3/people_interraction.cpp | 2 +- ryzom/client/src/interface_v3/people_list.cpp | 4 +- .../src/interface_v3/sbrick_manager.cpp | 4 +- .../src/interface_v3/view_bitmap_faber_mp.cpp | 2 +- ryzom/client/src/interface_v3/view_radar.cpp | 4 +- ryzom/client/src/login_patch.cpp | 2 +- ryzom/client/src/mesh_camera_col_manager.cpp | 2 +- ryzom/client/src/net_manager.cpp | 4 +- ryzom/client/src/outpost.cpp | 2 +- ryzom/client/src/pacs_client.cpp | 4 +- ryzom/client/src/player_cl.cpp | 2 +- ryzom/client/src/sky.cpp | 2 +- ryzom/client/src/streamable_ig.cpp | 10 ++--- ryzom/client/src/string_manager_client.cpp | 10 ++--- ryzom/client/src/teleport.cpp | 2 +- ryzom/common/src/game_share/ecosystem.cpp | 16 ++++---- ryzom/common/src/game_share/fame.cpp | 8 ++-- ryzom/common/src/game_share/guild_grade.cpp | 2 +- .../src/game_share/guild_grade_inline.h | 2 +- ryzom/common/src/game_share/people_pd.cpp | 4 +- .../common/src/game_share/people_pd_inline.h | 4 +- ryzom/common/src/game_share/pvp_clan.cpp | 4 +- ryzom/common/src/game_share/season.cpp | 2 +- ryzom/common/src/game_share/season_inline.h | 2 +- .../src/game_share/server_edition_module.cpp | 6 +-- ryzom/common/src/game_share/sp_type.cpp | 2 +- ryzom/common/src/game_share/sp_type_inline.h | 2 +- .../time_weather_season/weather_manager.cpp | 4 +- .../weather_setup_sheet_base.cpp | 6 +-- ryzom/tools/client/client_patcher/main.cpp | 2 +- 126 files changed, 376 insertions(+), 378 deletions(-) diff --git a/nel/include/nel/georges/form_elm.h b/nel/include/nel/georges/form_elm.h index bf9b3ef62..6795ad328 100644 --- a/nel/include/nel/georges/form_elm.h +++ b/nel/include/nel/georges/form_elm.h @@ -631,7 +631,7 @@ inline bool CFormElm::convertValue (bool &result, const std::string &value) cons } else { - std::string temp = NLMISC::toLower(value); + std::string temp = NLMISC::toLowerAscii(value); if (strcmp (temp.c_str (), "true") == 0) { result = true; diff --git a/nel/src/3d/animation_set.cpp b/nel/src/3d/animation_set.cpp index 0b4c096c0..462587b09 100644 --- a/nel/src/3d/animation_set.cpp +++ b/nel/src/3d/animation_set.cpp @@ -289,7 +289,7 @@ void CAnimationSet::preloadSSSShapes(IDriver &drv, CShapeBank &shapeBank) std::set::iterator it; for(it=_SSSShapes.begin();it!=_SSSShapes.end();it++) { - string fileName= toLower(*it); + string fileName= toLowerAscii(*it); // link the shape to the shapeCache shapeBank.linkShapeToShapeCache(fileName, shapeCacheName); diff --git a/nel/src/3d/async_texture_manager.cpp b/nel/src/3d/async_texture_manager.cpp index a962c9991..22c4969ea 100644 --- a/nel/src/3d/async_texture_manager.cpp +++ b/nel/src/3d/async_texture_manager.cpp @@ -151,7 +151,7 @@ uint CAsyncTextureManager::addTextureRef(const string &textNameNotLwr, CMeshBa uint ret; // lower case name - string textName = toLower(textNameNotLwr); + string textName = toLowerAscii(textNameNotLwr); // find the texture in map ItTextureEntryMap it; diff --git a/nel/src/3d/coarse_mesh_build.cpp b/nel/src/3d/coarse_mesh_build.cpp index 966f389b4..e89c8da8d 100644 --- a/nel/src/3d/coarse_mesh_build.cpp +++ b/nel/src/3d/coarse_mesh_build.cpp @@ -117,7 +117,7 @@ bool CCoarseMeshBuild::buildBitmap (const std::vector& coarseMe if (texture->supportSharing()) { // Get sharing name - name+=toLower(texture->getShareName()); + name+=toLowerAscii(texture->getShareName()); } else { @@ -477,7 +477,7 @@ void CCoarseMeshBuild::remapCoordinates (const std::vector& coa if (texture->supportSharing()) { // Get sharing name - name+=toLower(texture->getShareName()); + name+=toLowerAscii(texture->getShareName()); } else { diff --git a/nel/src/3d/driver.cpp b/nel/src/3d/driver.cpp index 32cd19a89..71600d3c9 100644 --- a/nel/src/3d/driver.cpp +++ b/nel/src/3d/driver.cpp @@ -291,7 +291,7 @@ bool IDriver::invalidateShareTexture (ITexture &texture) void IDriver::getTextureShareName (const ITexture& tex, string &output) { // Create the shared Name. - output= toLower(tex.getShareName()); + output= toLowerAscii(tex.getShareName()); // append format Id of the texture. static char fmt[256]; @@ -372,7 +372,7 @@ void IDriver::profileTextureUsage(std::vector &result) // get the shareName string shareName; if(text->supportSharing()) - shareName= toLower(text->getShareName()); + shareName= toLowerAscii(text->getShareName()); else shareName= "Not Shared"; diff --git a/nel/src/3d/driver/opengl/driver_opengl.cpp b/nel/src/3d/driver/opengl/driver_opengl.cpp index 90b17958f..6fe9ae7c4 100644 --- a/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -2583,7 +2583,7 @@ void CDriverGL::retrieveATIDriverVersion() result = RegQueryValueExA(subKey, "DriverDesc", NULL, &valueType, (unsigned char *) driverDesc, &driverDescBufSize); if (result == ERROR_SUCCESS && valueType == REG_SZ) { - toLower(driverDesc); + toLowerAscii(driverDesc); if (strstr(driverDesc, "radeon")) // is it a radeon card ? { char driverVersion[256]; diff --git a/nel/src/3d/hls_texture_bank.cpp b/nel/src/3d/hls_texture_bank.cpp index b741ec387..9077f1638 100644 --- a/nel/src/3d/hls_texture_bank.cpp +++ b/nel/src/3d/hls_texture_bank.cpp @@ -59,7 +59,7 @@ uint32 CHLSTextureBank::addColorTexture(const CHLSColorTexture &tex) // *************************************************************************** void CHLSTextureBank::addTextureInstance(const std::string &name, uint32 colorTextureId, const vector &cols) { - string nameLwr= toLower(name); + string nameLwr= toLowerAscii(name); // checks nlassert(colorTextureId<_ColorTextures.size()); diff --git a/nel/src/3d/hls_texture_manager.cpp b/nel/src/3d/hls_texture_manager.cpp index 586ec53ce..3f585eb6b 100644 --- a/nel/src/3d/hls_texture_manager.cpp +++ b/nel/src/3d/hls_texture_manager.cpp @@ -76,7 +76,7 @@ sint CHLSTextureManager::findTexture(const std::string &name) const return -1; // Build a valid key. - string nameLwr= toLower(name); + string nameLwr= toLowerAscii(name); CHLSTextureBank::CTextureInstance textKey; CHLSTextureBank::CTextureInstanceHandle textKeyHandle; textKey.buildAsKey(nameLwr.c_str()); diff --git a/nel/src/3d/instance_lighter.cpp b/nel/src/3d/instance_lighter.cpp index 87e0deb45..a08a0a38f 100644 --- a/nel/src/3d/instance_lighter.cpp +++ b/nel/src/3d/instance_lighter.cpp @@ -415,7 +415,7 @@ void CInstanceLighter::light (const CInstanceGroup &igIn, CInstanceGroup &igOut, string name= _Instances[i].Name; bool shapeFound= true; - if (toLower (CFile::getExtension (name)) == "pacs_prim") + if (toLowerAscii (CFile::getExtension (name)) == "pacs_prim") { nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", name.c_str()); continue; diff --git a/nel/src/3d/landscapeig_manager.cpp b/nel/src/3d/landscapeig_manager.cpp index 10eab0f60..d2b276f8a 100644 --- a/nel/src/3d/landscapeig_manager.cpp +++ b/nel/src/3d/landscapeig_manager.cpp @@ -129,7 +129,7 @@ void CLandscapeIGManager::initIG(UScene *scene, const std::string &igDesc, UDriv _ig.getShapeName(i, shapeName); if (!shapeName.empty ()) { - if (toLower(CFile::getExtension(shapeName)) != "pacs_prim") + if (toLowerAscii(CFile::getExtension(shapeName)) != "pacs_prim") { // Insert a new shape ? if (_ShapeAdded.find(shapeName) == _ShapeAdded.end()) diff --git a/nel/src/3d/packed_zone.cpp b/nel/src/3d/packed_zone.cpp index f1cb7426b..fc8fa9a8a 100644 --- a/nel/src/3d/packed_zone.cpp +++ b/nel/src/3d/packed_zone.cpp @@ -665,7 +665,7 @@ void CPackedZone32::build(std::vector &leaves, { CMatrix instanceMatrix; igs[k]->getInstanceMatrix(l, instanceMatrix); - if (NLMISC::toLower(NLMISC::CFile::getExtension(igs[k]->getShapeName(l))) == "pacs_prim") continue; + if (NLMISC::toLowerAscii(NLMISC::CFile::getExtension(igs[k]->getShapeName(l))) == "pacs_prim") continue; std::string stdShapeName = standardizeShapeName(igs[k]->getShapeName(l)); TShapeCache::const_iterator it = shapeCache.find(stdShapeName); if (it != shapeCache.end()) diff --git a/nel/src/3d/scene.cpp b/nel/src/3d/scene.cpp index 15173d7d9..651837e2c 100644 --- a/nel/src/3d/scene.cpp +++ b/nel/src/3d/scene.cpp @@ -793,7 +793,7 @@ CTransformShape *CScene::createInstance(const string &shapeName) if (pMB->getAutoAnim()) { - std::string animName = toLower(CFile::getFilenameWithoutExtension(shapeName)); + std::string animName = toLowerAscii(CFile::getFilenameWithoutExtension(shapeName)); uint animID = _AutomaticAnimationSet->getAnimationIdByName(animName); if (animID != CAnimationSet::NotFound) { @@ -833,7 +833,7 @@ void CScene::createInstanceAsync(const string &shapeName, CTransformShape **pIns if (_ShapeBank->getPresentState( shapeName ) != CShapeBank::Present) { // Load it from file asynchronously - _ShapeBank->loadAsync( toLower(shapeName), getDriver(), position, NULL, selectedTexture); + _ShapeBank->loadAsync( toLowerAscii(shapeName), getDriver(), position, NULL, selectedTexture); } } diff --git a/nel/src/3d/scene_group.cpp b/nel/src/3d/scene_group.cpp index dc5dd9f73..131f5feaf 100644 --- a/nel/src/3d/scene_group.cpp +++ b/nel/src/3d/scene_group.cpp @@ -607,7 +607,7 @@ void CInstanceGroup::getShapeName (uint instanceIndex, std::string &shapeName) c shapeName = _TransformName->transformName (instanceIndex, rInstanceInfo.InstanceName, rInstanceInfo.Name); } - toLower(shapeName); + toLowerAscii(shapeName); if (!shapeName.empty() && shapeName.find('.') == std::string::npos) shapeName += ".shape"; } @@ -860,7 +860,7 @@ bool CInstanceGroup::addToSceneAsync (CScene& scene, IDriver *driver, uint selec shapeName = _TransformName->transformName (i, rInstanceInfo.InstanceName, rInstanceInfo.Name); } - toLower(shapeName); + toLowerAscii(shapeName); if (!shapeName.empty() && shapeName.find('.') == std::string::npos) shapeName += ".shape"; @@ -920,7 +920,7 @@ void CInstanceGroup::stopAddToSceneAsync () shapeName = rInstanceInfo.Name; } - toLower(shapeName); + toLowerAscii(shapeName); _AddToSceneTempScene->getShapeBank()->cancelLoadAsync (shapeName); } } diff --git a/nel/src/3d/shape_bank.cpp b/nel/src/3d/shape_bank.cpp index 71bdb79e2..cb6ea8c21 100644 --- a/nel/src/3d/shape_bank.cpp +++ b/nel/src/3d/shape_bank.cpp @@ -56,7 +56,7 @@ CShapeBank::~CShapeBank() IShape*CShapeBank::addRef(const string &shapeNameNotLwr) { - string shapeName= toLower(shapeNameNotLwr); + string shapeName= toLowerAscii(shapeNameNotLwr); // get the shape info (must succeed) TShapeInfoMap::iterator scfpmIt = ShapePtrToShapeInfo.find( getShapePtrFromShapeName( shapeName ) ); @@ -434,7 +434,7 @@ bool CShapeBank::processWSUploadTexture (CWaitingShape &rWS, uint32 &nTotalUploa CShapeBank::TShapeState CShapeBank::getPresentState (const string &shapeNameNotLwr) { - string shapeName= toLower(shapeNameNotLwr); + string shapeName= toLowerAscii(shapeNameNotLwr); // Is the shape is found in the shape map so return Present TShapeMap::iterator smIt = ShapeMap.find (shapeName); @@ -450,7 +450,7 @@ CShapeBank::TShapeState CShapeBank::getPresentState (const string &shapeNameNotL // *************************************************************************** IShape *CShapeBank::getShape (const std::string &shapeNameNotLwr) { - string shapeName= toLower(shapeNameNotLwr); + string shapeName= toLowerAscii(shapeNameNotLwr); // Is the shape is found in the shape map so return Present TShapeMap::iterator smIt = ShapeMap.find (shapeName); @@ -464,7 +464,7 @@ IShape *CShapeBank::getShape (const std::string &shapeNameNotLwr) void CShapeBank::load (const string &shapeNameNotLwr) { - string shapeName= toLower(shapeNameNotLwr); + string shapeName= toLowerAscii(shapeNameNotLwr); TShapeMap::iterator smIt = ShapeMap.find(shapeName); if( smIt == ShapeMap.end() ) @@ -498,7 +498,7 @@ void CShapeBank::load (const string &shapeNameNotLwr) void CShapeBank::loadAsync (const std::string &shapeNameNotLwr, IDriver *pDriver, const CVector &position, bool *bSignal, uint selectedTexture) { - string shapeName= toLower(shapeNameNotLwr); + string shapeName= toLowerAscii(shapeNameNotLwr); TShapeMap::iterator smIt = ShapeMap.find(shapeName); if (smIt != ShapeMap.end()) @@ -530,7 +530,7 @@ void CShapeBank::loadAsync (const std::string &shapeNameNotLwr, IDriver *pDriver void CShapeBank::cancelLoadAsync (const std::string &shapeNameNotLwr) { - string shapeName= toLower(shapeNameNotLwr); + string shapeName= toLowerAscii(shapeNameNotLwr); TWaitingShapesMap::iterator wsmmIt = WaitingShapes.find(shapeName); if (wsmmIt != WaitingShapes.end()) @@ -600,7 +600,7 @@ bool CShapeBank::isShapeWaiting () void CShapeBank::add (const string &shapeNameNotLwr, IShape* pShp) { nlassert(pShp); - string shapeName= toLower(shapeNameNotLwr); + string shapeName= toLowerAscii(shapeNameNotLwr); // request a system mem geometry copy? if(pShp && _ShapeNeedingSystemGeometryCopy.find(shapeName)!=_ShapeNeedingSystemGeometryCopy.end()) @@ -724,7 +724,7 @@ sint CShapeBank::getShapeCacheFreeSpace(const std::string &shapeCacheName) const void CShapeBank::linkShapeToShapeCache(const string &shapeNameNotLwr, const string &shapeCacheName) { - string shapeName= toLower(shapeNameNotLwr); + string shapeName= toLowerAscii(shapeNameNotLwr); for(;;) { @@ -857,7 +857,7 @@ void CShapeBank::preLoadShapes(const std::string &shapeCacheName, return; // lower case - string wildCard= toLower(wildCardNotLwr); + string wildCard= toLowerAscii(wildCardNotLwr); // For all files for(uint i=0;iprogress ((float)i/(float)listFile.size ()); - string fileName= toLower(CFile::getFilename(listFile[i])); + string fileName= toLowerAscii(CFile::getFilename(listFile[i])); // if the file is ok for the wildCard, process it if( testWildCard(fileName.c_str(), wildCard.c_str()) ) { @@ -908,7 +908,7 @@ void CShapeBank::preLoadShapes(const std::string &shapeCacheName, // *************************************************************************** void CShapeBank::buildSystemGeometryForshape(const std::string &shapeName) { - _ShapeNeedingSystemGeometryCopy.insert(toLower(shapeName)); + _ShapeNeedingSystemGeometryCopy.insert(toLowerAscii(shapeName)); } diff --git a/nel/src/3d/shape_info.cpp b/nel/src/3d/shape_info.cpp index d3a8a4df3..4385b044e 100644 --- a/nel/src/3d/shape_info.cpp +++ b/nel/src/3d/shape_info.cpp @@ -229,7 +229,7 @@ void CShapeInfo::build(const CMeshBase &meshBase, const CMeshMRMGeom &meshGeom) // *************************************************************************** std::string standardizeShapeName(const std::string &name) { - std::string result = NLMISC::toLower(name); + std::string result = NLMISC::toLowerAscii(name); if (CFile::getExtension(result).empty()) { result += ".shape"; diff --git a/nel/src/3d/texture_file.cpp b/nel/src/3d/texture_file.cpp index 0e343ec8e..58f2f333f 100644 --- a/nel/src/3d/texture_file.cpp +++ b/nel/src/3d/texture_file.cpp @@ -311,7 +311,7 @@ void CTextureFile::setMipMapSkipAtLoad(uint8 level) // *************************************************************************** std::string CTextureFile::getShareName() const { - return toLower(_FileName); + return toLowerAscii(_FileName); } diff --git a/nel/src/3d/tile_bank.cpp b/nel/src/3d/tile_bank.cpp index a22a797f4..9ba3ca756 100644 --- a/nel/src/3d/tile_bank.cpp +++ b/nel/src/3d/tile_bank.cpp @@ -275,7 +275,7 @@ sint CTileBank::getNumBitmap (CTile::TBitmap bitmap) const { std::vector vect (str.length()+1); memcpy (&*vect.begin(), str.c_str(), str.length()+1); - toLower(&*vect.begin()); + toLowerAscii(&*vect.begin()); setString.insert (std::string (&*vect.begin())); } } @@ -600,7 +600,7 @@ void CTileBank::removeDisplacementMap (uint mapId) uint CTileBank::getDisplacementMap (const string &fileName) { // Lower string - string lower=toLower(fileName); + string lower=toLowerAscii(fileName); // Look for this texture filename uint noiseTile; diff --git a/nel/src/georges/form.cpp b/nel/src/georges/form.cpp index 40f374b8d..2f9ecf9b1 100644 --- a/nel/src/georges/form.cpp +++ b/nel/src/georges/form.cpp @@ -371,7 +371,7 @@ void CForm::warning (bool exception, const std::string &function, const char *fo void CForm::getDependencies (std::set &dependencies) const { // Add me - if (dependencies.insert (toLower(CFile::getFilename (_Filename))).second) + if (dependencies.insert (toLowerAscii(CFile::getFilename (_Filename))).second) { // Add parents uint i; diff --git a/nel/src/georges/form_dfn.cpp b/nel/src/georges/form_dfn.cpp index d9c52c1b4..628077579 100644 --- a/nel/src/georges/form_dfn.cpp +++ b/nel/src/georges/form_dfn.cpp @@ -882,7 +882,7 @@ void CFormDfn::warning (bool exception, const std::string &function, const char void CFormDfn::getDependencies (std::set &dependencies) const { // Scan only if not already inserted - if (dependencies.insert (toLower(CFile::getFilename (_Filename))).second) + if (dependencies.insert (toLowerAscii(CFile::getFilename (_Filename))).second) { // Add parents uint i; @@ -898,7 +898,7 @@ void CFormDfn::getDependencies (std::set &dependencies) const Entries[i].getDfnPtr ()->getDependencies (dependencies); if (Entries[i].getTypePtr ()) { - dependencies.insert (toLower(CFile::getFilename (Entries[i].getFilename()))); + dependencies.insert (toLowerAscii(CFile::getFilename (Entries[i].getFilename()))); } } } diff --git a/nel/src/georges/form_loader.cpp b/nel/src/georges/form_loader.cpp index 877c587ed..dd3d50ed5 100644 --- a/nel/src/georges/form_loader.cpp +++ b/nel/src/georges/form_loader.cpp @@ -67,7 +67,7 @@ CFormLoader::~CFormLoader() CType *CFormLoader::loadType (const std::string &filename) { // Lower string filename - string lowerStr = toLower(filename); + string lowerStr = toLowerAscii(filename); lowerStr = CFile::getFilename (lowerStr); // Already in the map ? @@ -137,7 +137,7 @@ CType *CFormLoader::loadType (const std::string &filename) CFormDfn *CFormLoader::loadFormDfn (const std::string &filename, bool forceLoad) { // Lower string filename - string lowerStr = toLower(filename); + string lowerStr = toLowerAscii(filename); lowerStr = CFile::getFilename (lowerStr); // Already in the map ? @@ -203,7 +203,7 @@ CFormDfn *CFormLoader::loadFormDfn (const std::string &filename, bool forceLoad) UForm *CFormLoader::loadForm (const std::string &filename) { // Lower string filename - string lowerStr = toLower((string)filename); + string lowerStr = toLowerAscii((string)filename); lowerStr = CFile::getFilename (lowerStr); // Already in the map ? diff --git a/nel/src/gui/action_handler.cpp b/nel/src/gui/action_handler.cpp index a10513ebb..f7a5f2cee 100644 --- a/nel/src/gui/action_handler.cpp +++ b/nel/src/gui/action_handler.cpp @@ -73,13 +73,13 @@ namespace NLGUI { string allparam = Params; skipBlankAtStart (allparam); - string param = toLower (ParamName); + string param = toLowerAscii (ParamName); while (!allparam.empty()) { std::string::size_type e = allparam.find('='); if (e == std::string::npos || e == 0) break; std::string::size_type p = allparam.find('|'); - string tmp = NLMISC::toLower(allparam.substr(0,e)); + string tmp = NLMISC::toLowerAscii(allparam.substr(0,e)); skipBlankAtEnd(tmp); if (tmp == param) { @@ -105,7 +105,7 @@ namespace NLGUI std::string::size_type e = allparam.find('='); if (e == std::string::npos || e == 0) break; std::string::size_type p = allparam.find('|'); - string tmp = NLMISC::toLower(allparam.substr(0,e)); + string tmp = NLMISC::toLowerAscii(allparam.substr(0,e)); skipBlankAtEnd(tmp); string tmp2 = allparam.substr(e+1,p-e-1); diff --git a/nel/src/gui/css_parser.cpp b/nel/src/gui/css_parser.cpp index d43189fca..ab9f6edb7 100644 --- a/nel/src/gui/css_parser.cpp +++ b/nel/src/gui/css_parser.cpp @@ -50,7 +50,7 @@ namespace NLGUI pos = elements[i].find_first_of(':'); if (pos != std::string::npos) { - std::string key = trim(toLower(elements[i].substr(0, pos))); + std::string key = trim(toLowerAscii(elements[i].substr(0, pos))); std::string value = trim(elements[i].substr(pos+1)); styles.push_back(TStylePair(key, value)); } @@ -361,7 +361,7 @@ namespace NLGUI while(pos < sel.size() && is_nmchar(sel[pos])) pos++; - current.Element = toLower(sel.substr(start, pos - start)); + current.Element = toLowerAscii(sel.substr(start, pos - start)); start = pos; continue; } @@ -374,7 +374,7 @@ namespace NLGUI while(pos < sel.size() && is_nmchar(sel[pos])) pos++; - current.Id = toLower(sel.substr(start, pos - start)); + current.Id = toLowerAscii(sel.substr(start, pos - start)); start = pos; } else if (sel[pos] == '.') @@ -386,7 +386,7 @@ namespace NLGUI while(pos < sel.size() && (is_nmchar(sel[pos]) || sel[pos] == '.')) pos++; - current.setClass(toLower(sel.substr(start, pos - start))); + current.setClass(toLowerAscii(sel.substr(start, pos - start))); start = pos; } else if (sel[pos] == '[') @@ -552,7 +552,7 @@ namespace NLGUI } } - std::string key = toLower(sel.substr(start, pos - start)); + std::string key = toLowerAscii(sel.substr(start, pos - start)); if (key.empty()) { failed = true; diff --git a/nel/src/gui/css_selector.cpp b/nel/src/gui/css_selector.cpp index 2c9d94559..18d0375b0 100644 --- a/nel/src/gui/css_selector.cpp +++ b/nel/src/gui/css_selector.cpp @@ -59,7 +59,7 @@ namespace NLGUI void CCssSelector::setClass(const std::string &cls) { std::vector parts; - NLMISC::splitString(toLower(cls), ".", parts); + NLMISC::splitString(toLowerAscii(cls), ".", parts); for(uint i = 0; i< parts.size(); i++) { @@ -80,7 +80,7 @@ namespace NLGUI } else { - Attr.push_back(SAttribute(key, toLower(val), op, cs)); + Attr.push_back(SAttribute(key, toLowerAscii(val), op, cs)); } } @@ -146,7 +146,7 @@ namespace NLGUI // case-insensitive compare, Attr.value is already lowercased if (!Attr[i].caseSensitive) { - value = toLower(value); + value = toLowerAscii(value); } switch(Attr[i].op) @@ -255,7 +255,7 @@ namespace NLGUI if (start == std::string::npos) return; - std::string expr = toLower(pseudo.substr(start, end - start)); + std::string expr = toLowerAscii(pseudo.substr(start, end - start)); if (expr.empty()) return; diff --git a/nel/src/gui/css_style.cpp b/nel/src/gui/css_style.cpp index 396bff062..ac36da726 100644 --- a/nel/src/gui/css_style.cpp +++ b/nel/src/gui/css_style.cpp @@ -676,7 +676,7 @@ namespace NLGUI else if (it->first == "text-decoration" || it->first == "text-decoration-line") { - std::string prop(toLower(it->second)); + std::string prop(toLowerAscii(it->second)); style.Underlined = (prop.find("underline") != std::string::npos); style.StrikeThrough = (prop.find("line-through") != std::string::npos); } @@ -924,7 +924,7 @@ namespace NLGUI { // normalize std::string image = trim(it->second); - if (toLower(image.substr(0, 4)) == "url(") + if (toLowerAscii(image.substr(0, 4)) == "url(") { image = image.substr(4, image.size()-5); } @@ -934,7 +934,7 @@ namespace NLGUI if (it->first == "background-repeat") { // normalize - std::string val = toLower(trim(it->second)); + std::string val = toLowerAscii(trim(it->second)); std::vector parts; splitParams(val, ' ', parts); // check for "repeat repeat" @@ -947,7 +947,7 @@ namespace NLGUI if (it->first == "background-size") { // normalize - std::string val = toLower(trim(it->second)); + std::string val = toLowerAscii(trim(it->second)); std::vector parts; splitParams(val, ' ', parts); if (parts.size() == 2 && parts[0] == parts[1]) @@ -999,7 +999,7 @@ namespace NLGUI uint index = 0; while(!failed && index < parts.size()) { - std::string val = toLower(parts[index]); + std::string val = toLowerAscii(parts[index]); bool matches = false; for(uint i = 0; i < nbProps; i++) { @@ -1028,7 +1028,7 @@ namespace NLGUI // second loop -> false && break loop = !loop; - val = toLower(parts[next]); + val = toLowerAscii(parts[next]); if (val == "center") { if (bgPositionX.empty()) bgPositionX = "center"; @@ -1082,7 +1082,7 @@ namespace NLGUI uint next = index + 1; if (next < parts.size()) { - val = toLower(parts[next]); + val = toLowerAscii(parts[next]); if (val == "cover" || val == "contain") { matches = true; @@ -1106,7 +1106,7 @@ namespace NLGUI next++; if (next < parts.size()) { - val = toLower(parts[next]); + val = toLowerAscii(parts[next]); if (val == "auto") v = "auto"; else if (getCssLength(fval, unit, val)) @@ -1160,7 +1160,7 @@ namespace NLGUI uint next = index + 1; if (next < parts.size()) { - val = toLower(parts[next]); + val = toLowerAscii(parts[next]); if (val == "repeat" || val == "space" || val == "round" || val == "no-repeat") { vert = val; @@ -1334,7 +1334,7 @@ namespace NLGUI bool CCssStyle::tryBorderWidthShorthand(const std::string &prop, const std::string &value, TStyle &style) const { std::vector parts; - splitParams(toLower(value), ' ', parts); + splitParams(toLowerAscii(value), ' ', parts); float tmpf; std::string unit; @@ -1371,7 +1371,7 @@ namespace NLGUI bool CCssStyle::tryBorderStyleShorthand(const std::string &prop, const std::string &value, TStyle &style) const { std::vector parts; - splitParams(toLower(value), ' ', parts); + splitParams(toLowerAscii(value), ' ', parts); // verify that parts are valid uint8 maxSize = (prop == "border" || prop == "border-style") ? 4 : 1; @@ -1420,7 +1420,7 @@ namespace NLGUI bool CCssStyle::tryBorderColorShorthand(const std::string &prop, const std::string &value, TStyle &style) const { std::vector parts; - splitParams(toLower(value), ' ', parts); + splitParams(toLowerAscii(value), ' ', parts); CRGBA color; // verify that parts are valid @@ -1465,7 +1465,7 @@ namespace NLGUI TStyle borderStyle; std::vector parts; - splitParams(toLower(value), ' ', parts); + splitParams(toLowerAscii(value), ' ', parts); for(uint index = 0; index < parts.size(); ++index) { @@ -1530,7 +1530,7 @@ namespace NLGUI void CCssStyle::expandPaddingShorthand(const std::string &value, TStyle &style) const { std::vector parts; - splitParams(toLower(value), ' ', parts); + splitParams(toLowerAscii(value), ' ', parts); uint8 t, r, b, l; if (!getShorthandIndices(parts.size(), t, r, b, l)) diff --git a/nel/src/gui/ctrl_base.cpp b/nel/src/gui/ctrl_base.cpp index 2e95c50dd..e120c5d4e 100644 --- a/nel/src/gui/ctrl_base.cpp +++ b/nel/src/gui/ctrl_base.cpp @@ -100,7 +100,7 @@ namespace NLGUI CCtrlBase::TToolTipParentType CCtrlBase::stringToToolTipParent( const std::string &str ) { - std::string s = toLower( str ); + std::string s = toLowerAscii( str ); if( s == "mouse" ) return TTMouse; diff --git a/nel/src/gui/ctrl_base_button.cpp b/nel/src/gui/ctrl_base_button.cpp index dec715048..68aa19f15 100644 --- a/nel/src/gui/ctrl_base_button.cpp +++ b/nel/src/gui/ctrl_base_button.cpp @@ -584,18 +584,18 @@ namespace NLGUI prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_l" ); if (prop) { - _ListMenuLeft = NLMISC::toLower(std::string((const char *) prop)); + _ListMenuLeft = NLMISC::toLowerAscii(std::string((const char *) prop)); } prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r" ); if (prop) { - _ListMenuRight = NLMISC::toLower(std::string((const char *) prop)); + _ListMenuRight = NLMISC::toLowerAscii(std::string((const char *) prop)); } // list menu on both clicks prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_b" ); if (prop) { - setListMenuBoth(NLMISC::toLower(std::string((const char *) prop))); + setListMenuBoth(NLMISC::toLowerAscii(std::string((const char *) prop))); } prop= (char*) xmlGetProp (cur, (xmlChar*)"frozen"); diff --git a/nel/src/gui/ctrl_button.cpp b/nel/src/gui/ctrl_button.cpp index e27d8cfbd..cc38e50e4 100644 --- a/nel/src/gui/ctrl_button.cpp +++ b/nel/src/gui/ctrl_button.cpp @@ -210,21 +210,21 @@ namespace NLGUI prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_normal" ); if (prop) { - string TxName = NLMISC::toLower((const char *) prop); + string TxName = NLMISC::toLowerAscii((const char *) prop); _TextureIdNormal.setTexture(TxName.c_str()); } prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_pushed" ); if (prop) { - string TxName = NLMISC::toLower((const char *) prop); + string TxName = NLMISC::toLowerAscii((const char *) prop); _TextureIdPushed.setTexture(TxName.c_str()); } prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_over" ); if (prop) { - string TxName = NLMISC::toLower((const char *) prop); + string TxName = NLMISC::toLowerAscii((const char *) prop); _TextureIdOver.setTexture(TxName.c_str()); } diff --git a/nel/src/gui/ctrl_col_pick.cpp b/nel/src/gui/ctrl_col_pick.cpp index 411414de7..251c655c2 100644 --- a/nel/src/gui/ctrl_col_pick.cpp +++ b/nel/src/gui/ctrl_col_pick.cpp @@ -212,12 +212,12 @@ namespace NLGUI CViewRenderer &rVR = *CViewRenderer::getInstance(); if(prop) { - string sTmp = NLMISC::toLower((const char*)prop); + string sTmp = NLMISC::toLowerAscii((const char*)prop); _Texture = rVR.createTexture (sTmp, 0, 0, 256, 64, false, false); } prop = (char*) xmlGetProp( node, (xmlChar*)"onchange" ); - if (prop) _AHOnChange = NLMISC::toLower((const char*)prop); + if (prop) _AHOnChange = NLMISC::toLowerAscii((const char*)prop); prop = (char*) xmlGetProp( node, (xmlChar*)"onchange_params" ); if (prop) _AHOnChangeParams = string((const char*)prop); diff --git a/nel/src/gui/ctrl_scroll.cpp b/nel/src/gui/ctrl_scroll.cpp index d9191e770..00f089660 100644 --- a/nel/src/gui/ctrl_scroll.cpp +++ b/nel/src/gui/ctrl_scroll.cpp @@ -561,17 +561,17 @@ namespace NLGUI // Read Action handlers prop = (char*) xmlGetProp( node, (xmlChar*)"onscroll" ); - if (prop) _AHOnScroll = NLMISC::toLower(prop.str()); + if (prop) _AHOnScroll = NLMISC::toLowerAscii(prop.str()); prop = (char*) xmlGetProp( node, (xmlChar*)"params" ); if (prop) _AHOnScrollParams = string((const char*)prop); // prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollend" ); - if (prop) _AHOnScrollEnd = NLMISC::toLower(prop.str()); + if (prop) _AHOnScrollEnd = NLMISC::toLowerAscii(prop.str()); prop = (char*) xmlGetProp( node, (xmlChar*)"end_params" ); if (prop) _AHOnScrollEndParams = string((const char*)prop); // prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollcancel" ); - if (prop) _AHOnScrollCancel = NLMISC::toLower(prop.str()); + if (prop) _AHOnScrollCancel = NLMISC::toLowerAscii(prop.str()); prop = (char*) xmlGetProp( node, (xmlChar*)"cancel_params" ); if (prop) _AHOnScrollCancelParams = string((const char*)prop); diff --git a/nel/src/gui/ctrl_text_button.cpp b/nel/src/gui/ctrl_text_button.cpp index 3be6142e3..e7689704f 100644 --- a/nel/src/gui/ctrl_text_button.cpp +++ b/nel/src/gui/ctrl_text_button.cpp @@ -542,7 +542,7 @@ namespace NLGUI prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_normal" ); if (prop) { - string TxName = toLower(std::string((const char *) prop)); + string TxName = toLowerAscii(std::string((const char *) prop)); _TextureIdNormal[0].setTexture((TxName+"_l.tga").c_str()); _TextureIdNormal[1].setTexture((TxName+"_m.tga").c_str()); _TextureIdNormal[2].setTexture((TxName+"_r.tga").c_str()); @@ -551,7 +551,7 @@ namespace NLGUI prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_pushed" ); if (prop) { - string TxName = toLower(std::string((const char *) prop)); + string TxName = toLowerAscii(std::string((const char *) prop)); _TextureIdPushed[0].setTexture((TxName+"_l.tga").c_str()); _TextureIdPushed[1].setTexture((TxName+"_m.tga").c_str()); _TextureIdPushed[2].setTexture((TxName+"_r.tga").c_str()); @@ -560,7 +560,7 @@ namespace NLGUI prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_over" ); if (prop) { - string TxName = toLower(std::string((const char *) prop)); + string TxName = toLowerAscii(std::string((const char *) prop)); _TextureIdOver[0].setTexture((TxName+"_l.tga").c_str()); _TextureIdOver[1].setTexture((TxName+"_m.tga").c_str()); _TextureIdOver[2].setTexture((TxName+"_r.tga").c_str()); diff --git a/nel/src/gui/dbgroup_combo_box.cpp b/nel/src/gui/dbgroup_combo_box.cpp index 725019b72..1e5f18b4d 100644 --- a/nel/src/gui/dbgroup_combo_box.cpp +++ b/nel/src/gui/dbgroup_combo_box.cpp @@ -45,7 +45,8 @@ namespace NLGUI // Compare strings static inline bool lt_text(const std::pair &s1, const std::pair &s2) { - return toLower(s1.second) < toLower(s2.second); + // return toLower(s1.second) < toLower(s2.second); + return -NLMISC::compareCaseInsensitive(s1.second, s2.second); } std::string CDBGroupComboBox::measureMenu; diff --git a/nel/src/gui/group_editbox.cpp b/nel/src/gui/group_editbox.cpp index 27084dd1b..f90eb424f 100644 --- a/nel/src/gui/group_editbox.cpp +++ b/nel/src/gui/group_editbox.cpp @@ -629,7 +629,7 @@ namespace NLGUI } prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r" ); - if (prop) _ListMenuRight = toLower((const char *) prop); + if (prop) _ListMenuRight = toLowerAscii((const char *) prop); prop = (char*) xmlGetProp( cur, (xmlChar*)"max_historic" ); if (prop) fromString((const char*)prop, _MaxHistoric); diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 508d60361..04c083c20 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -89,7 +89,7 @@ namespace NLGUI // Return URL with https is host is in HSTS list static std::string upgradeInsecureUrl(const std::string &url) { - if (toLower(url.substr(0, 7)) != "http://") { + if (toLowerAscii(url.substr(0, 7)) != "http://") { return url; } @@ -136,7 +136,7 @@ namespace NLGUI if (pos == std::string::npos) return; - std::string key = toLower(header.substr(0, pos)); + std::string key = toLowerAscii(header.substr(0, pos)); if (pos != std::string::npos) { HeadersRecv[key] = header.substr(pos + 2); @@ -185,7 +185,7 @@ namespace NLGUI bool hasHSTSHeader() { // ignore header if not secure connection - if (toLower(Url.substr(0, 8)) != "https://") + if (toLowerAscii(Url.substr(0, 8)) != "https://") { return false; } @@ -552,7 +552,7 @@ namespace NLGUI LOG_DL("curl easy handle %p created for '%s'", curl, download.url.c_str()); // https:// - if (toLower(download.url.substr(0, 8)) == "https://") + if (toLowerAscii(download.url.substr(0, 8)) == "https://") { // if supported, use custom SSL context function to load certificates NLWEB::CCurlCertificates::useCertificates(curl); @@ -1266,7 +1266,7 @@ namespace NLGUI // TODO: 'content' should already be tokenized in css parser as it has all the functions for that std::string content = trim(_Style.getStyle("content")); - if (toLower(content) == "none" || toLower(content) == "normal") + if (toLowerAscii(content) == "none" || toLowerAscii(content) == "normal") { _Style.popStyle(); return; @@ -1297,7 +1297,7 @@ namespace NLGUI // skip closing quote pos++; } - else if (content[pos] == 'u' && pos < content.size() - 6 && toLower(content.substr(pos, 4)) == "url(") + else if (content[pos] == 'u' && pos < content.size() - 6 && toLowerAscii(content.substr(pos, 4)) == "url(") { // url(/path-to/image.jpg) / "Alt!" // url("/path to/image.jpg") / "Alt!" @@ -3440,7 +3440,7 @@ namespace NLGUI result = url; string tmp; - if (toLower(result).find("file:") == 0 && result.size() > 5) + if (toLowerAscii(result).find("file:") == 0 && result.size() > 5) { result = result.substr(5, result.size()-5); } @@ -3461,7 +3461,7 @@ namespace NLGUI { // Normalize the path if (isUrl) - //result = "file:"+toLower(CPath::standardizePath (CPath::getFullPath (CFile::getPath(result)))+CFile::getFilename(result));*/ + //result = "file:"+toLowerAscii(CPath::standardizePath (CPath::getFullPath (CFile::getPath(result)))+CFile::getFilename(result));*/ result = "file:/"+tmp; else result = tmp; @@ -3786,7 +3786,7 @@ namespace NLGUI updateRefreshButton(); std::string filename; - if (toLower(uri).find("file:/") == 0) + if (toLowerAscii(uri).find("file:/") == 0) { filename = uri.substr(6, uri.size() - 6); } @@ -3856,7 +3856,7 @@ namespace NLGUI } // https:// - if (toLower(url.substr(0, 8)) == "https://") + if (toLowerAscii(url.substr(0, 8)) == "https://") { // if supported, use custom SSL context function to load certificates NLWEB::CCurlCertificates::useCertificates(curl); @@ -5347,7 +5347,7 @@ namespace NLGUI if (_Style.hasStyle("text-align")) align = _Style.Current.TextAlign; else if (elm.hasNonEmptyAttribute("align")) - align = toLower(elm.getAttribute("align")); + align = toLowerAscii(elm.getAttribute("align")); if (align == "left") cellParams.Align = CGroupCell::Left; @@ -5362,7 +5362,7 @@ namespace NLGUI if (_Style.hasStyle("vertical-align")) valign = _Style.Current.VerticalAlign; else if (elm.hasNonEmptyAttribute("valign")) - valign = toLower(elm.getAttribute("valign")); + valign = toLowerAscii(elm.getAttribute("valign")); if (valign == "top") cellParams.VAlign = CGroupCell::Top; @@ -5859,7 +5859,7 @@ namespace NLGUI // Build the form CGroupHTML::CForm form; // id check is case sensitive and auto id's are uppercase - form.id = toLower(trim(elm.getAttribute("id"))); + form.id = toLowerAscii(trim(elm.getAttribute("id"))); if (form.id.empty()) { form.id = toString("FORM%d", _Forms.size()); @@ -6287,7 +6287,7 @@ namespace NLGUI { fromString(httpContent.substr(0, pos), _NextRefreshTime); - pos = toLower(httpContent).find("url="); + pos = toLowerAscii(httpContent).find("url="); if (pos != string::npos) _RefreshUrl = getAbsoluteUrl(httpContent.substr(pos + 4)); } diff --git a/nel/src/gui/html_parser.cpp b/nel/src/gui/html_parser.cpp index 3d7303706..de1a0e4d9 100644 --- a/nel/src/gui/html_parser.cpp +++ b/nel/src/gui/html_parser.cpp @@ -89,7 +89,7 @@ namespace NLGUI } } - parent.Children.push_back(CHtmlElement(CHtmlElement::ELEMENT_NODE, toLower((const char*)node->name))); + parent.Children.push_back(CHtmlElement(CHtmlElement::ELEMENT_NODE, toLowerAscii((const char*)node->name))); CHtmlElement &elm = parent.Children.back(); elm.ID = element_number; elm.parent = &parent; @@ -109,7 +109,7 @@ namespace NLGUI elm.Attributes.clear(); for (xmlAttr *cur_attr = node->properties; cur_attr; cur_attr = cur_attr->next) { - std::string key(toLower((const char *)(cur_attr->name))); + std::string key(toLowerAscii((const char *)(cur_attr->name))); std::string value; if (cur_attr->children) { @@ -124,7 +124,7 @@ namespace NLGUI NLMISC::splitString(elm.getAttribute("class"), " ", parts); for(uint i = 0; i for ingame browser @@ -154,7 +154,7 @@ namespace NLGUI bool useStyle = true; if (elm.hasAttribute("media")) { - std::string media = trim(toLower(elm.Attributes["media"])); + std::string media = trim(toLowerAscii(elm.Attributes["media"])); useStyle = media.empty() || media.find("all") != std::string::npos || media.find("screen") != std::string::npos; //