develop
kaetemi 4 years ago
parent 11b453baaa
commit 73b8ba9e4e

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

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

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

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

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

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

@ -510,7 +510,7 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick
CViewText *viewText= dynamic_cast<CViewText*>(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<CViewText*>(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);
}

@ -71,10 +71,10 @@ class CHandlerGuildCreate : public IActionHandler
CGroupEditBox *pDesc = dynamic_cast<CGroupEditBox*>(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());

@ -1011,9 +1011,9 @@ void CBotChatPageTrade::startSellDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCal
CViewText *itemNameView = dynamic_cast<CViewText *>(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<CViewText*>(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<CViewText*>(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

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

@ -30,7 +30,6 @@ namespace NLGUI
class CInterfaceGroup;
}
class ucstring;
namespace NLMISC{
class CCDBNodeLeaf;
}

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

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

@ -1665,7 +1665,7 @@ void CDBCtrlSheet::setupSBrick ()
}
// ***************************************************************************
void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector<NLMISC::CSheetId> &bricks, const ucstring &phraseName)
void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector<NLMISC::CSheetId> &bricks, const string &phraseName)
{
CSBrickManager *pBM = CSBrickManager::getInstance();
@ -1718,7 +1718,7 @@ void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector<NLMISC::CSheetId> &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<CSPhraseSheet*>(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;
}
}
*/

@ -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<NLMISC::CSheetId> &bricks, const ucstring &phraseName);
void setupDisplayAsPhrase(const std::vector<NLMISC::CSheetId> &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);

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

@ -136,13 +136,13 @@ void CDBGroupListSheetIconPhrase::setSectionGroupId(CInterfaceGroup *pIG, uin
CViewText *name = dynamic_cast<CViewText*>(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);
}
}

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

@ -110,9 +110,9 @@ 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] != ' ')
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);
}

@ -168,13 +168,13 @@ void CDBGroupListSheetTextPhrase::setSectionGroupId(CInterfaceGroup *pIG, uin
CViewText *name = dynamic_cast<CViewText*>(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);
}
}

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

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

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

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

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

@ -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<CViewBitmap*>(leftGroup->getView ("rp_logo_1"));
if (bitmap)
bitmap->setTexture(entityTag1.toString());
bitmap->setTexture(entityTag1);
bitmap = dynamic_cast<CViewBitmap*>(leftGroup->getView ("rp_logo_2"));
if (bitmap)
bitmap->setTexture(entityTag2.toString());
bitmap->setTexture(entityTag2);
}
bitmap = dynamic_cast<CViewBitmap*>(leftGroup->getView ("rp_logo_3"));
if (bitmap)
bitmap->setTexture(entityTag3.toString());
bitmap->setTexture(entityTag3);
bitmap = dynamic_cast<CViewBitmap*>(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)

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

@ -191,9 +191,9 @@ void CGroupPhraseSkillFilter::rebuild()
uint nCounter = 0;
// local variable (avoid realloc in loop)
vector< pair<string, string> > tempVec(2);
ucstring sSkillName;
string sDBNameSkillValue;
// vector< pair<string, string> > tempVec(2);
// string sSkillName;
// string sDBNameSkillValue;
// Build the hierarchy
while ((!bQuit) && (nCounter < 32)) // Counter is used to not infinitly loop

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

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

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

@ -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<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather"));
if (pVT != NULL)
pVT->setText(str.toUtf8());
pVT->setText(str);
CCtrlBase *pTooltip= dynamic_cast<CCtrlBase*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather_tt"));
if (pTooltip != NULL)
@ -1571,7 +1571,7 @@ void CInterfaceManager::updateFrameEvents()
pVT = dynamic_cast<CViewText*>(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<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(masterGroup+":" + msgBoxGroup));
CViewText *viewText= dynamic_cast<CViewText*>(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 &paramsOnOk, const std::string &ahOnCancel, const std::string &paramsOnCancel, const string &masterGroup)
{
CInterfaceGroup *group= dynamic_cast<CInterfaceGroup*>(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);
}
}

@ -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 &paramsOnOk= std::string(),
void validMessageBox(TValidMessageIcon icon, const std::string &text, const std::string &ahOnOk, const std::string &paramsOnOk= std::string(),
const std::string &ahOnCancel= std::string(), const std::string &paramsOnCancel= 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;
};

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

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

@ -3201,7 +3201,7 @@ NLMISC_COMMAND(party_chat, "Create a new party chat", "<party_chat_name>")
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", "<party_chat_name>")
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;

@ -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<textSize && isdigit(text[k]))
else if(k<textSize && (uint8)text[k] < (uint8)'\x80' && isdigit(text[k]))
{
char tp[2];
tp[0]= (char)text[k];

@ -3840,14 +3840,14 @@ void CSPhraseManager::computePhraseProgression()
// replace each number with 001 format. toLower
for(uint k=0;k<pse.Text.size();k++)
{
if((unsigned char)pse.Text[k] < 0x80 && isalpha(pse.Text[k]))
if((uint8)pse.Text[k] < (uint8)'\x80' && isalpha(pse.Text[k]))
pse.Text[k]= tolower(pse.Text[k]); // FIXME: toLowerAscii
else if((unsigned char)pse.Text[k] < 0x80 && isdigit(pse.Text[k]))
else if((uint8)pse.Text[k] < (uint8)'\x80' && isdigit(pse.Text[k]))
{
uint32 number= 0;
uint32 start= k;
// get the whole number
for(;k<pse.Text.size() && isdigit(pse.Text[k]);k++)
for(;k<pse.Text.size() && (uint8)pse.Text[k] < (uint8)'\x80' && isdigit(pse.Text[k]);k++)
{
number*=10;
number+= pse.Text[k] - '0';

@ -4244,7 +4244,7 @@ sint CEditor::getGeneratedNameIndex(const std::string &nameUtf8, const std::stri
{
++ strIt;
const char *numberStart = &*strIt;
for (; strIt != endStrIt && isdigit(*strIt); ++strIt) {}
for (; strIt != endStrIt && (uint8)(*strIt) < (uint8)'\x80' && isdigit(*strIt); ++strIt) {}
if (strIt == endStrIt)
{
sint ret;
@ -4266,7 +4266,7 @@ bool CEditor::isPostFixedByNumber(const ucstring &baseName)
while (lastIndex > 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')
{

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

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

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

Loading…
Cancel
Save