develop
kaetemi 4 years ago
parent ad0e970785
commit 72d9f8ea4f

@ -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 &param) : CViewText(param)

@ -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()); }
/**

@ -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")))

@ -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);
}
}
}

@ -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.

@ -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;
}

@ -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)

@ -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

@ -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)
{

@ -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));
}
}
};

@ -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;
}
}

@ -913,10 +913,10 @@ NLMISC_COMMAND(slsn, "Temp : set the name of the last sender.", "<name>")
}
// ***************************************************************************
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;

@ -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);
};

@ -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();

@ -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;

@ -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;

@ -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);

@ -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)

@ -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<CDialogEntityPositionState> 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;
}
}

@ -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;

@ -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())
{

@ -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))
{

@ -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);

@ -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;
}

@ -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<ucstring, SGuildMember> CachedGuildMembers;
static map<string, SGuildMember> CachedGuildMembers;
const string &onlineMessage = CI18N::get("uiPlayerOnline");
const string &offlineMessage = CI18N::get("uiPlayerOffline");
for (uint i = 0; i < _GuildMembers.size(); ++i)
{
map<ucstring, SGuildMember>::const_iterator it = CachedGuildMembers.find(_GuildMembers[i].Name);
map<string, SGuildMember>::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<string, CClientConfig::SSysInfoParam>::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<CViewText*>(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<CViewText*>(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<CViewText*>(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<CViewText*>(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

@ -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;
};

@ -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(" &&

@ -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);

@ -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;
}
// ***************************************************************************

@ -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<SGuildMember> 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;
}

@ -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;
// <missing:XXX>
group = group.substr(9, group.size()-10);
groupHtml = dynamic_cast<CGroupHTML*>(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<CViewText*>(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);

@ -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);

Loading…
Cancel
Save