develop
kaetemi 4 years ago
parent c27547c3a3
commit 0dfff69c6f

@ -147,6 +147,9 @@ public:
static void append(IStream &s, u32char c); static void append(IStream &s, u32char c);
static u32char get(IStream &s); static u32char get(IStream &s);
/// Get an UTF-8 string from an undefined ASCII-based codepage
static std::string fromAscii(std::string &str);
private: private:
typedef u32char (*TIterator)(const void **addr); typedef u32char (*TIterator)(const void **addr);
static u32char utf8Iterator(const void **addr); static u32char utf8Iterator(const void **addr);

@ -174,6 +174,21 @@ std::string CUtfStringView::toAscii() const
return res; 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 std::wstring CUtfStringView::toWide() const
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS

@ -804,7 +804,7 @@ std::string buildPlayerNameForSaveFile(const std::string &playerNameIn)
(c>='0' && c<='9') || (c>='0' && c<='9') ||
(c=='_') ) (c=='_') )
{ {
ret[i]= tolower(c); ret[i]= tolower(c); // TODO: toLowerAscii
} }
else else
ret[i]= '_'; ret[i]= '_';

@ -2419,14 +2419,8 @@ CEntityCL *CEntityManager::getEntityByKeywords (const std::vector<string> &keywo
//----------------------------------------------- //-----------------------------------------------
CEntityCL *CEntityManager::getEntityByName (const string &name, bool caseSensitive, bool complete) const CEntityCL *CEntityManager::getEntityByName (const string &name, bool caseSensitive, bool complete) const
{ {
string source = name; string source;
const uint size = (uint)source.size(); source = caseSensitive ? name : toLower(name); // TODO: toLowerInsensitive
if (!caseSensitive)
{
uint j;
for (j=0; j<size; j++)
source[j] = tolower (source[j]);
}
uint i; uint i;
const uint count = (uint)_Entities.size(); const uint count = (uint)_Entities.size();
@ -2437,16 +2431,9 @@ CEntityCL *CEntityManager::getEntityByName (const string &name, bool caseSensiti
{ {
if(_Entities[i]) if(_Entities[i])
{ {
string value = _Entities[i]->getDisplayName(); string value = caseSensitive ? _Entities[i]->getDisplayName() : toLower(_Entities[i]->getDisplayName()); // TODO: toLowerInsensitive
bool foundEntity = false; bool foundEntity = false;
uint j;
if (!caseSensitive)
{
for (j=0; j<value.size(); j++)
value[j] = tolower (value[j]);
}
// Complete test ? // Complete test ?
if (complete) if (complete)
{ {
@ -2455,12 +2442,9 @@ CEntityCL *CEntityManager::getEntityByName (const string &name, bool caseSensiti
} }
else else
{ {
if (value.size() >= size) if (NLMISC::startsWith(value, source))
{
if (std::operator==(source, value.substr (0, size)))
foundEntity = true; foundEntity = true;
} }
}
if (foundEntity) if (foundEntity)
{ {

@ -2355,7 +2355,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value)
if (pVT != NULL) pVT->setText(_Title); if (pVT != NULL) pVT->setText(_Title);
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:player")); CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:player"));
if (pGC != NULL) pGC->setUCTitle(_EntityName); if (pGC != NULL) pGC->setTitle(_EntityName);
CSkillManager *pSM = CSkillManager::getInstance(); CSkillManager *pSM = CSkillManager::getInstance();
pSM->setPlayerTitle(_TitleRaw); pSM->setPlayerTitle(_TitleRaw);

@ -973,12 +973,12 @@ class CHandlerBrowse : public IActionHandler
{ {
if(params[i]=='%' && i<params.size()-2) if(params[i]=='%' && i<params.size()-2)
{ {
if(isxdigit(params[i+1]) && isxdigit(params[i+2])) if(isxdigit(params[i+1]) && isxdigit(params[i+2])) // FIXME: Locale dependent
{ {
// read value from heax decimal // read value from heax decimal
uint8 val= 0; uint8 val= 0;
params[i+1]= tolower(params[i+1]); params[i+1]= tolower(params[i+1]); // FIXME: toLowerAscii
params[i+2]= tolower(params[i+2]); params[i+2]= tolower(params[i+2]); // FIXME: toLowerAscii
if(isdigit(params[i+1])) val= params[i+1]-'0'; if(isdigit(params[i+1])) val= params[i+1]-'0';
else val= 10+ params[i+1]-'a'; else val= 10+ params[i+1]-'a';
val*=16; val*=16;
@ -2508,7 +2508,7 @@ void refreshItemHelp(CSheetHelpSetup &setup)
CItemSheet *pIS = (CItemSheet*)pES; CItemSheet *pIS = (CItemSheet*)pES;
// ---- Common // ---- Common
string title = setup.SrcSheet->getItemActualName().toUtf8(); string title = setup.SrcSheet->getItemActualName();
setupHelpTitle(setup.HelpWindow, title ); setupHelpTitle(setup.HelpWindow, title );
getItemText (setup.SrcSheet, itemText, pIS); getItemText (setup.SrcSheet, itemText, pIS);

@ -836,7 +836,7 @@ class CAHReplyTeller : public IActionHandler
{ {
w->setKeyboardFocus(); w->setKeyboardFocus();
w->enableBlink(1); w->enableBlink(1);
PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName.toUtf8())); PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName));
CGroupEditBox *eb = w->getEditBox(); CGroupEditBox *eb = w->getEditBox();
if (eb != NULL) if (eb != NULL)
{ {
@ -863,7 +863,7 @@ class CAHReplyTellerOnce : public IActionHandler
{ {
w->setKeyboardFocus(); w->setKeyboardFocus();
w->enableBlink(1); 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(); CGroupEditBox *eb = w->getEditBox();
if (eb != NULL) if (eb != NULL)
{ {
@ -908,7 +908,7 @@ REGISTER_ACTION_HANDLER (CAHCycleTell, "cycle_tell")
NLMISC_COMMAND(slsn, "Temp : set the name of the last sender.", "<name>") NLMISC_COMMAND(slsn, "Temp : set the name of the last sender.", "<name>")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
PeopleInterraction.LastSenderName = ucstring(args[0]); PeopleInterraction.LastSenderName = args[0];
return true; return true;
} }

@ -279,9 +279,9 @@ void launchPhraseComposition(bool creation)
// Set the Text of the Window // Set the Text of the Window
if(creation) if(creation)
window->setUCTitle(CI18N::get("uiPhraseCreate")); window->setTitle(CI18N::get("uiPhraseCreate"));
else else
window->setUCTitle(CI18N::get("uiPhraseEdit")); window->setTitle(CI18N::get("uiPhraseEdit"));
// clear the sentence for a New Phrase creation. // clear the sentence for a New Phrase creation.
buildSentenceTarget->clearBuildingPhrase(); buildSentenceTarget->clearBuildingPhrase();

@ -188,8 +188,8 @@ void CActionPhraseFaber::launchFaberCastWindow(sint32 memoryLine, uint memoryIn
window->setActive(true); window->setActive(true);
// Setup the Title with a default text // Setup the Title with a default text
ucstring title= CI18N::get("uiPhraseFaberExecuteNoPlan"); string title= CI18N::get("uiPhraseFaberExecuteNoPlan");
window->setUCTitle (title); window->setTitle (title);
} }
// **** setup DB observer! // **** setup DB observer!
@ -570,9 +570,9 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick
if(window) if(window)
{ {
// Setup the Title with the item built // 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) ); strFindReplace(title, "%item", STRING_MANAGER::CStringManagerClient::getItemLocalizedName(_ExecuteFromItemPlanBrick->FaberPlan.ItemBuilt) );
window->setUCTitle (title); window->setTitle (title);
} }

@ -250,7 +250,7 @@ void CBotChatPageTrade::begin()
if (gc) if (gc)
{ {
// set the title // set the title
gc->setUCTitle(_Title); gc->setTitle(_Title);
// show the buy mean // show the buy mean
CInterfaceGroup *money = dynamic_cast<CInterfaceGroup *>(gc->getGroup("money")); CInterfaceGroup *money = dynamic_cast<CInterfaceGroup *>(gc->getGroup("money"));
if (money) money->setActive((_BuyMean == Money) || (_BuyMean == MoneyFactionPoints)); if (money) money->setActive((_BuyMean == Money) || (_BuyMean == MoneyFactionPoints));

@ -72,7 +72,7 @@ public:
// set the buy mean (must be called before 'begin' is called) // set the buy mean (must be called before 'begin' is called)
void setBuyMean(TBuyMean buyMean) { _BuyMean = buyMean; } void setBuyMean(TBuyMean buyMean) { _BuyMean = buyMean; }
// set the title of the window (actually applied when 'begin' is called) // 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) // update the 'buy' dialog window for the given sphrase sheet (the player has changed an equipped weapon => action stats change)
void updateSPhraseBuyDialog(); void updateSPhraseBuyDialog();
// invalidate window coords // invalidate window coords
@ -134,7 +134,7 @@ private:
uint32 _CurrItemInventory; uint32 _CurrItemInventory;
bool _BuyOnly; bool _BuyOnly;
TBuyMean _BuyMean; TBuyMean _BuyMean;
ucstring _Title; std::string _Title;
bool _ResaleEdit; bool _ResaleEdit;
bool _QuantityEdit; bool _QuantityEdit;
sint32 _QuantityCheck; sint32 _QuantityCheck;

@ -363,8 +363,7 @@ void CChatTargetFilter::setTargetGroup(CChatGroup::TGroupType groupType, uint32
if (_Chat) if (_Chat)
{ {
// set the prompt // set the prompt
const ucstring prompt(""); _Chat->setPrompt(">");
_Chat->setPrompt(prompt + (ucchar) '>');
// set the color // set the color
string entry="UI:SAVE:CHAT:COLORS:"; string entry="UI:SAVE:CHAT:COLORS:";

@ -135,10 +135,7 @@ bool CChatWindow::create(const CChatWindowDesc &desc, const std::string &chatId)
return false; return false;
} }
_Chat->setLocalize (desc.Localize); _Chat->setLocalize (desc.Localize);
if (desc.Localize) _Chat->setTitle(desc.Title);
_Chat->setTitle(desc.Title.toString());
else
_Chat->setUCTitle(desc.Title);
_Chat->setSavable(desc.Savable); _Chat->setSavable(desc.Savable);
// groups like system info don't have edit box. // 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; if (!_Chat) return;
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(_Chat->getGroup("eb")); CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(_Chat->getGroup("eb"));
if (!eb) return; if (!eb) return;
eb->setPrompt(prompt.toUtf8()); eb->setPrompt(prompt);
} }
void CChatWindow::setPromptColor(NLMISC::CRGBA col) 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); 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; if (!_EB) return;
_EB->setInputStringAsUtf16(entry); _EB->setInputString(entry);
} }
//================================================================================= //=================================================================================
ucstring CChatWindow::getTitle() const string CChatWindow::getTitle() const
{ {
if (!_Chat) if (!_Chat)
{ {
return ucstring(""); return string();
} }
else 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; string finalMsg;
CInterfaceProperty prop; CInterfaceProperty prop;
@ -483,10 +480,10 @@ void CChatWindow::displayLocalPlayerTell(const ucstring &receiver, const ucstrin
finalMsg += csr + CI18N::get("youTell") + ": "; finalMsg += csr + CI18N::get("youTell") + ": ";
prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," ");
encodeColorTag(prop.getRGBA(), finalMsg, true); encodeColorTag(prop.getRGBA(), finalMsg, true);
finalMsg += msg.toUtf8(); finalMsg += msg;
string s = CI18N::get("youTellPlayer"); string s = CI18N::get("youTellPlayer");
strFindReplace(s, "%name", receiver.toUtf8()); strFindReplace(s, "%name", receiver);
strFindReplace(finalMsg, CI18N::get("youTell"), s); strFindReplace(finalMsg, CI18N::get("youTell"), s);
displayMessage(finalMsg, prop.getRGBA(), CChatGroup::tell, 0, numBlinks); displayMessage(finalMsg, prop.getRGBA(), CChatGroup::tell, 0, numBlinks);
CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); 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)') // 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 // remove shard name if necessary
ucstring winName= CEntityCL::removeShardFromName(winNameFull); string winName= CEntityCL::removeShardFromName(winNameFull);
// get the color // get the color
string sWinColor = winColor; string sWinColor = winColor;
@ -745,12 +742,12 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c
// Look if the free teller do not already exists // Look if the free teller do not already exists
uint32 i; uint32 i;
string sWinName = winName.toString(); string sWinName = winName;
sWinName = toLower(sWinName); sWinName = toLower(sWinName);
for (i = 0; i < _FreeTellers.size(); ++i) for (i = 0; i < _FreeTellers.size(); ++i)
{ {
CGroupContainer *pGC = _FreeTellers[i]; CGroupContainer *pGC = _FreeTellers[i];
if (toLower(pGC->getUCTitle().toString()) == sWinName) if (toLower(pGC->getTitle()) == sWinName)
break; break;
} }
// Create container if not present // Create container if not present
@ -772,11 +769,11 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c
if (!pGC) if (!pGC)
{ {
delete pIG; delete pIG;
nlwarning("<CChatGroupWindow::createFreeTeller> group is not a container.(%s)", winName.toString().c_str()); nlwarning("<CChatGroupWindow::createFreeTeller> group is not a container.(%s)", winName.c_str());
return NULL; return NULL;
} }
// set title from the name // set title from the name
pGC->setUCTitle(winName); pGC->setTitle(winName);
// //
pGC->setSavable(true); pGC->setSavable(true);
pGC->setEscapable(true); pGC->setEscapable(true);
@ -834,7 +831,7 @@ void CChatGroupWindow::updateAllFreeTellerHeaders()
//================================================================================= //=================================================================================
void CChatGroupWindow::updateFreeTellerHeader(CGroupContainer &ft) void CChatGroupWindow::updateFreeTellerHeader(CGroupContainer &ft)
{ {
ucstring name = ft.getUCTitle(); string name = ft.getTitle();
CCtrlBaseButton *newFriendBut = dynamic_cast<CCtrlBaseButton *>(ft.getCtrl("new_friend")); CCtrlBaseButton *newFriendBut = dynamic_cast<CCtrlBaseButton *>(ft.getCtrl("new_friend"));
CCtrlBaseButton *ignoreBut = dynamic_cast<CCtrlBaseButton *>(ft.getCtrl("ignore")); CCtrlBaseButton *ignoreBut = dynamic_cast<CCtrlBaseButton *>(ft.getCtrl("ignore"));
CCtrlBaseButton *inviteBut = dynamic_cast<CCtrlBaseButton *>(ft.getCtrl("invite")); CCtrlBaseButton *inviteBut = dynamic_cast<CCtrlBaseButton *>(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); CGroupContainer *pGC = createFreeTeller(winName);
if (pGC != NULL) 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); TChatWindowMap::iterator it = _ChatWindowMap.find(title);
if (it == _ChatWindowMap.end()) 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); TChatWindowMap::iterator it = _ChatWindowMap.find(title);
if (it == _ChatWindowMap.end()) if (it == _ChatWindowMap.end())
{ {
nlwarning("Unknown chat window '%s'", title.toUtf8().c_str()); nlwarning("Unknown chat window '%s'", title.c_str());
return; return;
} }
it->second->deleteContainer(); it->second->deleteContainer();
@ -1213,11 +1210,11 @@ CChatWindow *CChatWindowManager::getChatWindowFromCaller(CCtrlBase *caller)
} }
if (!father) return NULL; 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; // if (oldName == newName) return true;
CChatWindow *newWin = getChatWindow(newName); CChatWindow *newWin = getChatWindow(newName);
@ -1225,8 +1222,8 @@ bool CChatWindowManager::rename(const ucstring &oldName, const ucstring &newName
TChatWindowMap::iterator it = _ChatWindowMap.find(oldName); TChatWindowMap::iterator it = _ChatWindowMap.find(oldName);
if (it == _ChatWindowMap.end()) return false; if (it == _ChatWindowMap.end()) return false;
_ChatWindowMap[newName] = it->second; _ChatWindowMap[newName] = it->second;
it->second->getContainer()->setLocalize(false); it->second->getContainer()->setLocalize(newNameLocalize);
it->second->getContainer()->setTitle(newName.toUtf8()); it->second->getContainer()->setTitle(newName);
_ChatWindowMap.erase(it); _ChatWindowMap.erase(it);
return true; return true;
} }

@ -23,7 +23,7 @@
#ifndef CL_CHAT_WINDOW_H #ifndef CL_CHAT_WINDOW_H
#define 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 "nel/misc/smart_ptr.h"
#include "game_share/chat_group.h" #include "game_share/chat_group.h"
@ -57,7 +57,7 @@ struct CChatWindowDesc
{ {
typedef std::vector<std::pair<std::string,std::string> > TTemplateParams; typedef std::vector<std::pair<std::string,std::string> > 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 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 std::string ChatTemplate; // Template for the chat interface, or "" to use the default one
TTemplateParams ChatTemplateParams; // optional template parameters TTemplateParams ChatTemplateParams; // optional template parameters
@ -94,7 +94,7 @@ public:
// called by a CChatWindow when it is deleted // called by a CChatWindow when it is deleted
virtual void chatWindowRemoved(CChatWindow * /* cw */) {} virtual void chatWindowRemoved(CChatWindow * /* cw */) {}
// called by a CChatWindow when a msg has been displayed in it ('displayMessage' has been called) // 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: public:
// display a message in this chat box with the given color // 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 // 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); void setCommand(const std::string &command, bool execute);
// set a command to be displayed and eventually executed in this chat window // 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) // 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 // Set listener to react to a chat entry
void setListener(IChatWindowListener *listener) { _Listener = listener; } void setListener(IChatWindowListener *listener) { _Listener = listener; }
IChatWindowListener *getListener() const { return _Listener; } IChatWindowListener *getListener() const { return _Listener; }
// Set the menu for the chat // Set the menu for the chat
void setMenu(const std::string &menuName); void setMenu(const std::string &menuName);
// Set a new prompt for the chat window // 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 // Set the color for the chat window
void setPromptColor(NLMISC::CRGBA col); void setPromptColor(NLMISC::CRGBA col);
/** Get the container associated with this chat window /** Get the container associated with this chat window
@ -131,7 +131,7 @@ public:
/** try to rename the chat window /** try to rename the chat window
* \return true if success * \return true if success
*/ */
bool rename(const ucstring &newName, bool newNameLocalize); bool rename(const std::string &newName, bool newNameLocalize);
/** delete the container /** delete the container
* Don't do it in the dtor, because done automatically at the end of the app by the interface manager. * 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 * Useful only if querried by the user
@ -140,7 +140,7 @@ public:
// get the last chat window from which a command has been called // get the last chat window from which a command has been called
static CChatWindow *getChatWindowLaunchingCommand() { return _ChatWindowLaunchingCommand; } static CChatWindow *getChatWindowLaunchingCommand() { return _ChatWindowLaunchingCommand; }
// get the title of this chat window // get the title of this chat window
ucstring getTitle() const; std::string getTitle() const;
// observers // observers
void addObserver(IObserver *obs); void addObserver(IObserver *obs);
void removeObserver(IObserver *obs); void removeObserver(IObserver *obs);
@ -154,7 +154,7 @@ public:
void setAHOnCloseButtonParams(const std::string &n); void setAHOnCloseButtonParams(const std::string &n);
void setHeaderColor(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 /// 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); static void encodeColorTag(const NLMISC::CRGBA &color, std::string &text, bool append=true);
@ -196,8 +196,8 @@ public:
void setTabIndex(sint32 n); void setTabIndex(sint32 n);
// Free Teller // Free Teller
NLGUI::CGroupContainer *createFreeTeller(const ucstring &winName, const std::string &winColor=""); NLGUI::CGroupContainer *createFreeTeller(const std::string &winName, const std::string &winColor="");
void setActiveFreeTeller(const ucstring &winName, bool bActive=true); void setActiveFreeTeller(const std::string &winName, bool bActive=true);
std::string getFreeTellerName(const std::string &containerID); std::string getFreeTellerName(const std::string &containerID);
bool removeFreeTeller(const std::string &containerID); // Return true if free teller found bool removeFreeTeller(const std::string &containerID); // Return true if free teller found
void removeAllFreeTellers(); void removeAllFreeTellers();
@ -245,9 +245,9 @@ public:
CChatWindow *createChatGroupWindow(const CChatWindowDesc &desc); CChatWindow *createChatGroupWindow(const CChatWindowDesc &desc);
// Get a chat window by its title // 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 /// 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 // Remove a chat window by its pointer
void removeChatWindow(CChatWindow *cw); void removeChatWindow(CChatWindow *cw);
/// from a ctrl of a chat box that triggered a menu, or an event, retrieve the associated chat box /// 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 // Singleton pattern applied to the chat window manager
static CChatWindowManager &getInstance(); static CChatWindowManager &getInstance();
// try to rename a window // 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 // warning : this is slow
uint getNumChatWindow() const { return (uint)_ChatWindowMap.size(); } uint getNumChatWindow() const { return (uint)_ChatWindowMap.size(); }
// warning : this is slow : for debug only // warning : this is slow : for debug only
CChatWindow *getChatWindowByIndex(uint index); CChatWindow *getChatWindowByIndex(uint index);
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
private: private:
typedef std::map<ucstring, NLMISC::CRefPtr<CChatWindow> > TChatWindowMap; typedef std::map<std::string, NLMISC::CRefPtr<CChatWindow> > TChatWindowMap;
private: private:
// //
TChatWindowMap _ChatWindowMap; TChatWindowMap _ChatWindowMap;

@ -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()) if (CtrlSheet && !LuaMethodName.empty())
{ {
// delegate setup of context he help ( & window ) to lua // 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 // call lua function to update tooltip window
_ItemInfoWaiter.sendRequest(); _ItemInfoWaiter.sendRequest();
help = _ItemInfoWaiter.infoValidated().toUtf8(); help = _ItemInfoWaiter.infoValidated();
// its expected to get at least item name back // its expected to get at least item name back
if (help.empty()) if (help.empty())
help = getItemActualName().toUtf8(); help = getItemActualName();
} }
else if (!_ContextHelp.empty()) else if (!_ContextHelp.empty())
{ {
@ -3454,7 +3454,7 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const
} }
else else
{ {
help = getItemActualName().toUtf8();; help = getItemActualName();;
} }
} }
else else
@ -3575,7 +3575,7 @@ void CDBCtrlSheet::getContextHelpToolTip(std::string &help) const
if (useItemInfoForFamily(item->Family)) if (useItemInfoForFamily(item->Family))
{ {
_ItemInfoWaiter.sendRequest(); _ItemInfoWaiter.sendRequest();
help = _ItemInfoWaiter.infoValidated().toUtf8(); help = _ItemInfoWaiter.infoValidated();
return; return;
} }
} }
@ -4563,11 +4563,11 @@ void CDBCtrlSheet::initArmourColors()
// *************************************************************************** // ***************************************************************************
ucstring CDBCtrlSheet::getItemActualName() const string CDBCtrlSheet::getItemActualName() const
{ {
const CItemSheet *pIS= asItemSheet(); const CItemSheet *pIS= asItemSheet();
if(!pIS) if(!pIS)
return ucstring(); return string();
else else
{ {
string ret; string ret;
@ -4587,7 +4587,7 @@ ucstring CDBCtrlSheet::getItemActualName() const
if (pIS->Family == ITEMFAMILY::SCROLL_R2) if (pIS->Family == ITEMFAMILY::SCROLL_R2)
{ {
const R2::TMissionItem *mi = R2::getEditor().getPlotItemInfos(getSheetId()); 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 // if item is not a mp, append faber_quality & faber_stat_type
// Don't append quality and stat type for Named Items!!! // Don't append quality and stat type for Named Items!!!

@ -73,7 +73,7 @@ public:
: IItemInfoWaiter(), Requesting(false) : IItemInfoWaiter(), Requesting(false)
{ } { }
public: public:
ucstring infoValidated() const; std::string infoValidated() const;
void sendRequest(); void sendRequest();
virtual void infoReceived(); virtual void infoReceived();
}; };
@ -582,7 +582,7 @@ public:
void setItemColor(sint32 val) {if(_UserColor) _UserColor->setValue32(val);} void setItemColor(sint32 val) {if(_UserColor) _UserColor->setValue32(val);}
// Get the Actual item name. Localized version of SheetId, or given by server through NAMEID. // 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. /// true if support drag copy (with CTRL). action handler has to check control.
bool canDragCopy() const {return _DragCopy;} bool canDragCopy() const {return _DragCopy;}

@ -63,13 +63,13 @@ bool CGroupCareer::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
if (Career >= ROLES::NB_ROLES) if (Career >= ROLES::NB_ROLES)
Career = ROLES::fighter; Career = ROLES::fighter;
ucstring sTmp = ROLES::roleToUCString(Career); string sTmp = ROLES::roleToUCString(Career);
for (uint32 i= 0; i < sTmp.size(); ++i) for (uint32 i= 0; i < sTmp.size(); ++i)
if (sTmp[i] < 128) if (sTmp[i] < 128)
if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') ) if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') )
sTmp[i] = sTmp[i] - 'a' + 'A'; sTmp[i] = sTmp[i] - 'a' + 'A';
setUCTitle (sTmp); setTitle (sTmp);
return true; return true;
} }
@ -133,7 +133,7 @@ bool CGroupJob::parse (xmlNodePtr /* cur */, CInterfaceGroup * /* parentGroup */
// if (sTmp[i] < 128) // if (sTmp[i] < 128)
// if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') ) // if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') )
// sTmp[i] = sTmp[i] - 'a' + 'A'; // sTmp[i] = sTmp[i] - 'a' + 'A';
// setUCTitle (sTmp); // seUCTitle (sTmp);
// //
// return true; // return true;
} }

@ -626,11 +626,11 @@ static DECLARE_INTERFACE_USER_FCT(getChatWin)
CChatWindowManager &rCWM = CChatWindowManager::getInstance(); CChatWindowManager &rCWM = CChatWindowManager::getInstance();
ucstring title = CI18N::get(args[0].getString()); string title = CI18N::get(args[0].getString());
CChatWindow *window = rCWM.getChatWindow(title); CChatWindow *window = rCWM.getChatWindow(title);
if (!window) 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; return false;
} }
string sTmp = window->getContainer()->getId(); string sTmp = window->getContainer()->getId();

@ -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 from ctrlSheet, then take the correct ACTUAL name (ie from NAMEID if not 0)
if(ctrlSheet) if(ctrlSheet)
{ {
result.setString(ctrlSheet->getItemActualName().toUtf8()); result.setString(ctrlSheet->getItemActualName());
return true; return true;
} }
// Standard (but less accurate) way // Standard (but less accurate) way

@ -982,7 +982,7 @@ void CInterfaceManager::initInGame()
// flush system msg buffer // flush system msg buffer
for( uint i=0; i<PeopleInterraction.SystemMessageBuffer.size(); ++i ) for( uint i=0; i<PeopleInterraction.SystemMessageBuffer.size(); ++i )
{ {
displaySystemInfo(PeopleInterraction.SystemMessageBuffer[i].Str.toUtf8(), PeopleInterraction.SystemMessageBuffer[i].Cat); displaySystemInfo(PeopleInterraction.SystemMessageBuffer[i].Str, PeopleInterraction.SystemMessageBuffer[i].Cat);
} }
PeopleInterraction.SystemMessageBuffer.clear(); PeopleInterraction.SystemMessageBuffer.clear();

@ -2021,11 +2021,11 @@ void CTempInvManager::updateForageQQ( uint whichOne )
break; break;
default:; default:;
} }
ucstring title = CI18N::get( WIN_TEMPINV_TITLE_FORAGING ); string title = CI18N::get( WIN_TEMPINV_TITLE_FORAGING );
strFindReplace( title, "%qt", toString( "%.1f", qt ) ); strFindReplace( title, "%qt", toString( "%.1f", qt ) );
strFindReplace( title, "%ql", toString( "%.1f", ql ) ); strFindReplace( title, "%ql", toString( "%.1f", ql ) );
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId(WIN_TEMPINV)); CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId(WIN_TEMPINV));
pGC->setUCTitle( title ); pGC->setTitle( title );
} }
isInUpdateForageQQ = false; 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; SearchQualityMin = 0;
SearchQualityMax = 999; SearchQualityMax = 999;
@ -2208,13 +2208,13 @@ void SBagOptions::setSearchFilter(const ucstring &s)
if (!s.empty()) if (!s.empty())
{ {
std::vector<ucstring> words; std::vector<string> words;
splitUCString(toLower(s), ucstring(" "), words); splitString(toLower(s), string(" "), words);
size_t pos; size_t pos;
for(int i = 0; i<words.size(); ++i) for(int i = 0; i<words.size(); ++i)
{ {
std::string kw = words[i].toUtf8(); std::string kw = words[i];
pos = kw.find("-"); pos = kw.find("-");
if (pos != std::string::npos) if (pos != std::string::npos)
@ -2318,17 +2318,17 @@ bool SBagOptions::canDisplay(CDBCtrlSheet *pCS) const
if (SearchFilter.size() > 0) if (SearchFilter.size() > 0)
{ {
bool match = true; bool match = true;
ucstring lcName = toLower(pCS->getItemActualName()); string lcName = toLower(pCS->getItemActualName());
// add item quality as a keyword to match // add item quality as a keyword to match
if (pCS->getQuality() > 1) if (pCS->getQuality() > 1)
{ {
lcName += ucstring(" " + toString(pCS->getQuality())); lcName += string(" " + toString(pCS->getQuality()));
} }
for (uint i = 0; i< SearchFilter.size(); ++i) for (uint i = 0; i< SearchFilter.size(); ++i)
{ {
if (lcName.find(SearchFilter[i]) == ucstring::npos) if (lcName.find(SearchFilter[i]) == string::npos)
{ {
return false; return false;
} }
@ -2741,7 +2741,7 @@ class CHandlerInvSearchButton : public IActionHandler
return; return;
} }
ucstring filter; string filter;
std::string id = btn->getParent()->getId() + ":" + sParams + ":eb"; std::string id = btn->getParent()->getId() + ":" + sParams + ":eb";
CGroupEditBox *eb = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(id)); CGroupEditBox *eb = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(id));
if (!eb) if (!eb)
@ -2755,7 +2755,7 @@ class CHandlerInvSearchButton : public IActionHandler
{ {
CWidgetManager::getInstance()->setCaptureKeyboard(eb); CWidgetManager::getInstance()->setCaptureKeyboard(eb);
eb->setSelectionAll(); eb->setSelectionAll();
filter = eb->getInputStringAsUtf16(); filter = eb->getInputString();
} }
CDBGroupListSheetBag *pList = dynamic_cast<CDBGroupListSheetBag*>(CWidgetManager::getInstance()->getElementFromId(btn->getParent()->getId() + ":bag_list")); CDBGroupListSheetBag *pList = dynamic_cast<CDBGroupListSheetBag*>(CWidgetManager::getInstance()->getElementFromId(btn->getParent()->getId() + ":bag_list"));
@ -2805,10 +2805,10 @@ class CHandlerInvSetSearch : public IActionHandler
std::string id = pCaller->getParent()->getParent()->getId(); std::string id = pCaller->getParent()->getParent()->getId();
CDBGroupListSheetBag *pList = dynamic_cast<CDBGroupListSheetBag*>(CWidgetManager::getInstance()->getElementFromId(id + ":bag_list")); CDBGroupListSheetBag *pList = dynamic_cast<CDBGroupListSheetBag*>(CWidgetManager::getInstance()->getElementFromId(id + ":bag_list"));
if (pList != NULL) pList->setSearchFilter(eb->getInputStringAsUtf16()); if (pList != NULL) pList->setSearchFilter(eb->getInputString());
CDBGroupIconListBag *pIcons = dynamic_cast<CDBGroupIconListBag*>(CWidgetManager::getInstance()->getElementFromId(id + ":bag_icons")); CDBGroupIconListBag *pIcons = dynamic_cast<CDBGroupIconListBag*>(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" ); REGISTER_ACTION_HANDLER( CHandlerInvSetSearch, "inv_set_search" );

@ -520,7 +520,7 @@ struct SSortStruct
{ {
CDBGroupListSheetText::CSheetChild *SheetText; CDBGroupListSheetText::CSheetChild *SheetText;
CDBGroupListSheet::CSheetChild *SheetIcon; CDBGroupListSheet::CSheetChild *SheetIcon;
ucstring Pos; std::string Pos;
bool operator < (const SSortStruct &o) const { return Pos < o.Pos; } bool operator < (const SSortStruct &o) const { return Pos < o.Pos; }
}; };
@ -558,7 +558,7 @@ struct SBagOptions
bool SearchFilterChanged; bool SearchFilterChanged;
uint16 SearchQualityMin; uint16 SearchQualityMin;
uint16 SearchQualityMax; uint16 SearchQualityMax;
std::vector<ucstring> SearchFilter; std::vector<std::string> SearchFilter;
// ----------------------- // -----------------------
SBagOptions() SBagOptions()
@ -576,7 +576,7 @@ struct SBagOptions
bool isSomethingChanged(); // From last call ? bool isSomethingChanged(); // From last call ?
bool isSearchFilterChanged() const { return SearchFilterChanged; } bool isSearchFilterChanged() const { return SearchFilterChanged; }
void setSearchFilter(const ucstring &s); void setSearchFilter(const std::string &s);
bool getFilterArmor() const bool getFilterArmor() const
{ {
@ -674,7 +674,7 @@ public:
// Return true if the sheet can be displayed due to filters // Return true if the sheet can be displayed due to filters
bool canDisplay(CDBCtrlSheet *pCS) { return _BO.canDisplay(pCS); } 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: private:
@ -707,7 +707,7 @@ public:
// Return true if the sheet can be displayed due to filters // Return true if the sheet can be displayed due to filters
bool canDisplay(CDBCtrlSheet *pCS) const { return _BO.canDisplay(pCS); } 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); }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

@ -51,8 +51,8 @@ void CItemSpecialEffectHelper::registerItemSpecialEffect(const string &name)
vector<string> params; vector<string> params;
// get ui string // get ui string
ucstring ucs = CI18N::get("uiItemFX_" + name); string ucs = CI18N::get("uiItemFX_" + name);
CSString p, s = ucs.toString(); CSString p, s = ucs;
// locate and store parameters // locate and store parameters
// %p : percent // %p : percent

@ -87,7 +87,7 @@ using namespace NLMISC;
// *************************************************************************** // ***************************************************************************
// Add the template key to the parent // 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(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CMacroCmdManager *pMCM = CMacroCmdManager::getInstance(); CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();
@ -104,14 +104,14 @@ void addKeyLine (CGroupList *pParent, const ucstring &keyName, const ucstring &s
CViewText *pViewKeyName = dynamic_cast<CViewText*>(pKeysLine->getView(TEMPLATE_KEYS_KEY_NAME)); CViewText *pViewKeyName = dynamic_cast<CViewText*>(pKeysLine->getView(TEMPLATE_KEYS_KEY_NAME));
if (pViewKeyName != NULL) if (pViewKeyName != NULL)
{ {
pViewKeyName->setText (keyName.toUtf8()); pViewKeyName->setText (keyName);
pViewKeyName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); pViewKeyName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White);
} }
CViewText *pViewShortcutName = dynamic_cast<CViewText*>(pKeysLine->getView(TEMPLATE_KEYS_SHORTCUT_NAME)); CViewText *pViewShortcutName = dynamic_cast<CViewText*>(pKeysLine->getView(TEMPLATE_KEYS_SHORTCUT_NAME));
if (pViewShortcutName != NULL) if (pViewShortcutName != NULL)
{ {
pViewShortcutName->setText (shortcutName.toUtf8()); pViewShortcutName->setText (shortcutName);
pViewShortcutName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); pViewShortcutName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White);
} }

@ -586,9 +586,17 @@ static void addFromPlaylist(const std::string &playlist, const std::vector<std::
if (!useUtf8) if (!useUtf8)
{ {
lineStr = ucstring(line).toUtf8(); lineStr = NLMISC::mbcsToUtf8(line); // Attempt local codepage first
if (lineStr.empty())
lineStr = CUtfStringView::fromAscii(std::string(line));
lineStr = trim(lineStr); lineStr = trim(lineStr);
} }
else
{
lineStr = trim(std::string(line + 3));
}
lineStr = CUtfStringView(lineStr).toUtf8(true); // Re-encode external string
// Not a comment line // Not a comment line
if (lineStr[0] != '#') if (lineStr[0] != '#')

@ -355,7 +355,7 @@ void CPeopleInterraction::release()
uint numCW = cwm.getNumChatWindow(); uint numCW = cwm.getNumChatWindow();
for(uint k = 0; k < numCW; ++k) for(uint k = 0; k < numCW; ++k)
{ {
nlwarning("Window %d : %s", (int) k, (cwm.getChatWindowByIndex(k)->getTitle().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) if (pl == &FriendList)
list = 0; list = 0;
ucstring temp = contactName; // TODO: UTF-8 serial ucstring temp = ucstring::makeFromUtf8(contactName); // TODO: UTF-8 (serial)
out.serial(temp); out.serial(temp);
out.serial(list); out.serial(list);
NetMngr.push(out); NetMngr.push(out);
@ -1192,7 +1192,7 @@ void CPeopleInterraction::askMoveContact(uint peopleIndexInSrc, CPeopleList *plS
// Fake Local simulation // Fake Local simulation
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
ucstring peopleName= plSRC->getName(peopleIndexInSrc); string peopleName= plSRC->getName(peopleIndexInSrc);
plSRC->removePeople(peopleIndexInSrc); plSRC->removePeople(peopleIndexInSrc);
sint dstIndex = plDST->addPeople(peopleName); sint dstIndex = plDST->addPeople(peopleName);
plDST->setOnline(dstIndex, ccs_online); plDST->setOnline(dstIndex, ccs_online);
@ -1252,7 +1252,7 @@ void CPeopleInterraction::askRemoveContact(uint peopleIndex, CPeopleList *pl)
//================================================================================================================= //=================================================================================================================
void CPeopleInterraction::initContactLists( const std::vector<uint32> &vFriendListName, void CPeopleInterraction::initContactLists( const std::vector<uint32> &vFriendListName,
const std::vector<TCharConnectionState> &vFriendListOnline, const std::vector<TCharConnectionState> &vFriendListOnline,
const std::vector<ucstring> &vIgnoreListName ) const std::vector<ucstring> &vIgnoreListName ) // TODO: UTF-8 (serial)
{ {
// clear the current lists if any // clear the current lists if any
@ -1264,18 +1264,18 @@ void CPeopleInterraction::initContactLists( const std::vector<uint32> &vFriendLi
for (uint i = 0; i < vFriendListName.size(); ++i) for (uint i = 0; i < vFriendListName.size(); ++i)
addContactInList(contactIdPool++, vFriendListName[i], vFriendListOnline[i], 0); addContactInList(contactIdPool++, vFriendListName[i], vFriendListOnline[i], 0);
for (uint i = 0; i < vIgnoreListName.size(); ++i) for (uint i = 0; i < vIgnoreListName.size(); ++i)
addContactInList(contactIdPool++, vIgnoreListName[i], ccs_offline, 1); addContactInList(contactIdPool++, vIgnoreListName[i].toUtf8(), ccs_offline, 1);
updateAllFreeTellerHeaders(); 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 // select correct people list
CPeopleList &pl= nList==0?FriendList:IgnoreList; CPeopleList &pl= nList==0?FriendList:IgnoreList;
// remove the shard name if possible // remove the shard name if possible
string name= CEntityCL::removeShardFromName(nameIn.toUtf8()); string name= CEntityCL::removeShardFromName(nameIn);
// add the contact to this list // add the contact to this list
sint index = pl.getIndexFromName(name); 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 // select correct people list
const CPeopleList &pl= nList==0?FriendList:IgnoreList; const CPeopleList &pl= nList==0?FriendList:IgnoreList;
// remove the shard name if possible // remove the shard name if possible
string name= CEntityCL::removeShardFromName(nameIn.toUtf8()); string name= CEntityCL::removeShardFromName(nameIn);
return pl.getIndexFromName(name) != -1; 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; if (title.empty()) return false;
// shouldn't begin like 'user chat 1-5' // shouldn't begin like 'user chat 1-5'
ucstring userChatStr = CI18N::get("uiUserChat"); const string &userChatStr = CI18N::get("uiUserChat");
if (title.substr(0, userChatStr.length()) == userChatStr) return false; 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 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; 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 (GuildChat && title == GuildChat->getTitle()) return false;
if (TeamChat && title == TeamChat->getTitle()) return false; if (TeamChat && title == TeamChat->getTitle()) return false;
sint index; sint index;
index = FriendList.getIndexFromName(title.toUtf8()); index = FriendList.getIndexFromName(title);
if (index != -1) return false; if (index != -1) return false;
index = IgnoreList.getIndexFromName(title.toUtf8()); index = IgnoreList.getIndexFromName(title);
if (index != -1) return false; if (index != -1) return false;
// TODO_GAMEDEV server test for the name (not only local), & modify callers of this function // 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 // 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 // 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; return;
} }
CChatWindowDesc chatDesc; CChatWindowDesc chatDesc;
ucstring userChatStr = CI18N::get("uiUserChat"); string userChatStr = CI18N::get("uiUserChat");
userChatStr += ucchar(' ') + ucstring(toString(index + 1)); userChatStr += ' ' + toString(index + 1);
//chatDesc.FatherContainer = "ui:interface:communication"; //chatDesc.FatherContainer = "ui:interface:communication";
chatDesc.FatherContainer = "ui:interface:contact_list"; chatDesc.FatherContainer = "ui:interface:contact_list";
chatDesc.Title = userChatStr; chatDesc.Title = userChatStr;
@ -2592,7 +2594,7 @@ public:
{ {
for(uint l = 0; l < pl.PartyChats.size(); ++l) 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; ++ insertionIndex;
} }
} }
@ -2939,7 +2941,7 @@ class CHandlerSelectChatSource : public IActionHandler
{ {
if (pc[l].Filter != NULL) 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))); menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, toString(pc[l].ID), pc[l].Filter->isListeningWindow(cw)));
++ insertionIndex; ++ insertionIndex;
} }

@ -156,12 +156,12 @@ public:
CFilteredChat UserChat[MaxNumUserChats]; CFilteredChat UserChat[MaxNumUserChats];
CFilteredChat TheUserChat; CFilteredChat TheUserChat;
// Id of last people who talked // Id of last people who talked
ucstring LastSenderName; std::string LastSenderName;
// system message // system message
struct CSysMsg struct CSysMsg
{ {
ucstring Str; std::string Str;
std::string Cat; std::string Cat;
}; };
// system message buffer // system message buffer
@ -195,13 +195,13 @@ public:
*/ */
CFilteredChat *getFilteredChatFromChatWindow(CChatWindow *cw); CFilteredChat *getFilteredChatFromChatWindow(CChatWindow *cw);
bool testValidPartyChatName(const ucstring &name); bool testValidPartyChatName(const std::string &name);
bool removePartyChat(CChatWindow *window); bool removePartyChat(CChatWindow *window);
void removeAllPartyChat(); void removeAllPartyChat();
/** /**
* create a named party chat. * create a named party chat.
*/ */
bool createNewPartyChat(const ucstring &title); bool createNewPartyChat(const std::string &title);
static void assignPartyChatMenu(CChatWindow *partyChat); static void assignPartyChatMenu(CChatWindow *partyChat);
@ -215,11 +215,11 @@ public:
// init contact list (from server typically) // init contact list (from server typically)
void initContactLists( const std::vector<uint32> &vFriendListName, void initContactLists( const std::vector<uint32> &vFriendListName,
const std::vector<TCharConnectionState> &vFriendListOnline, const std::vector<TCharConnectionState> &vFriendListOnline,
const std::vector<ucstring> &vIgnoreListName ); const std::vector<ucstring> &vIgnoreListName ); // TODO: UTF-8 (serial)
// Friend list == 0 // Ignore list == 1 // Friend list == 0 // Ignore list == 1
void addContactInList(uint32 contactId, uint32 nameID, TCharConnectionState Online, uint8 nList); void addContactInList(uint32 contactId, uint32 nameID, TCharConnectionState Online, uint8 nList);
void addContactInList(uint32 contactId, const ucstring &name, TCharConnectionState Online, uint8 nList); void addContactInList(uint32 contactId, const std::string &name, TCharConnectionState Online, uint8 nList);
bool isContactInList(const ucstring &name, uint8 nList) const; bool isContactInList(const std::string &name, uint8 nList) const;
// Called each frame to receive name from IOS // Called each frame to receive name from IOS
void updateWaitingContacts(); void updateWaitingContacts();
// server decide to remove a contact (if it does not exists anymore) // server decide to remove a contact (if it does not exists anymore)

@ -127,10 +127,7 @@ bool CPeopleList::create(const CPeopleListDesc &desc, const CChatWindowDesc *cha
_BaseContainer->setSavable(desc.Savable); _BaseContainer->setSavable(desc.Savable);
_BaseContainer->setLocalize(desc.Localize); _BaseContainer->setLocalize(desc.Localize);
if (desc.Localize) _BaseContainer->setTitle(desc.PeopleListTitle);
_BaseContainer->setTitle(desc.PeopleListTitle.toString());
else
_BaseContainer->setUCTitle(desc.PeopleListTitle);
//_BaseContainer->setId("ui:interface:" + desc.Id); //_BaseContainer->setId("ui:interface:" + desc.Id);
// create the chat window if there's one // create the chat window if there's one
@ -162,7 +159,7 @@ sint CPeopleList::getIndexFromName(const string &name) const
string sNameIn = toLower(name); string sNameIn = toLower(name);
for(uint k = 0; k < _Peoples.size(); ++k) 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; if (sPeopleName == sNameIn) return k;
} }
return -1; return -1;
@ -198,8 +195,8 @@ bool CPeopleList::sortExByContactId(const CPeople& a, const CPeople& b)
//================================================================== //==================================================================
bool CPeopleList::sortExByName(const CPeople& a, const CPeople& b) bool CPeopleList::sortExByName(const CPeople& a, const CPeople& b)
{ {
ucstring name_a = toUpper(a.getName()); string name_a = toUpper(a.getName());
ucstring name_b = toUpper(b.getName()); string name_b = toUpper(b.getName());
return (name_a < name_b); 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) bool CPeopleList::sortExByOnline(const CPeople& a, const CPeople& b)
{ {
ucstring name_a = toUpper(a.getName()); string name_a = toUpper(a.getName());
ucstring name_b = toUpper(b.getName()); string name_b = toUpper(b.getName());
// We want order: online/alpha, offworld/alpha, offline/alpha // We want order: online/alpha, offworld/alpha, offline/alpha
if (a.Online == b.Online) 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; if (!_BaseContainer) return - 1;
// check if not already inserted // check if not already inserted
if (getIndexFromName(name.toUtf8()) != -1) if (getIndexFromName(name) != -1)
{ {
nlwarning("<CPeopleList::addPeople> people %s inserted twice.", name.toString().c_str()); nlwarning("<CPeopleList::addPeople> people %s inserted twice.", name.c_str());
} }
vector<pair<string ,string> > properties; vector<pair<string ,string> > properties;
@ -371,11 +368,11 @@ sint CPeopleList::addPeople(const ucstring &name, uint teamMateIndex /*= 0*/)
if (!gc) if (!gc)
{ {
delete group; delete group;
nlwarning("<CPeopleList::addPeople> group is not a container.", name.toString().c_str()); nlwarning("<CPeopleList::addPeople> group is not a container.", name.c_str());
return -1; return -1;
} }
// set title from the name // set title from the name
gc->setUCTitle(name); gc->setTitle(name);
// People inside list are not savable ! // People inside list are not savable !
gc->setSavable(false); gc->setSavable(false);
// //
@ -694,7 +691,7 @@ std::string CPeopleList::getName(uint index) const
nlwarning("bad index"); nlwarning("bad index");
return "BAD INDEX!"; return "BAD INDEX!";
} }
return _Peoples[index].getName().toUtf8(); return _Peoples[index].getName();
} }
//================================================================== //==================================================================

@ -28,7 +28,6 @@
#include "chat_window.h" #include "chat_window.h"
#include "interface_pointer.h" #include "interface_pointer.h"
// NeL // NeL
#include "nel/misc/ucstring.h"
#include "nel/misc/rgba.h" #include "nel/misc/rgba.h"
@ -40,7 +39,7 @@
struct CPeopleListDesc struct CPeopleListDesc
{ {
enum TContactType { Team, Contact, Ignore, Unknown }; enum TContactType { Team, Contact, Ignore, Unknown };
ucstring PeopleListTitle; // title of the people list std::string PeopleListTitle; // title of the people list
TContactType ContactType; TContactType ContactType;
std::string FatherContainer; // name of the father container std::string FatherContainer; // name of the father container
std::string BaseContainerTemplateName; // name of the template for the base 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 /** 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 * 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 // swap people position between the 2 given indexs
void swapPeople(uint index1, uint index2); void swapPeople(uint index1, uint index2);
// Remove the people at the given index // Remove the people at the given index
@ -159,7 +158,7 @@ private:
bool Blocked; bool Blocked;
uint32 ContactId; uint32 ContactId;
bool operator < (const CPeople &other) const { return getName() < other.getName(); } 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<CPeople> TPeopleVect; typedef std::vector<CPeople> TPeopleVect;
private: private:

@ -588,8 +588,8 @@ void CSkillManager::checkTitleUnblocked(CHARACTER_TITLE::ECharacterTitle i, bool
// This is a new title, send a message // This is a new title, send a message
string titleStr = CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)i); string titleStr = CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)i);
bool womenTitle = (UserEntity && UserEntity->getGender() == GSGENDER::female); bool womenTitle = (UserEntity && UserEntity->getGender() == GSGENDER::female);
const ucstring newtitle(CStringManagerClient::getTitleLocalizedName(titleStr, womenTitle)); const char *newtitle(CStringManagerClient::getTitleLocalizedName(titleStr, womenTitle));
CAHManager::getInstance()->runActionHandler("message_popup", NULL, "text1="+newtitle.toUtf8()+"|text0="+CI18N::get("uiNewTitleBold")); CAHManager::getInstance()->runActionHandler("message_popup", NULL, string("text1=") + newtitle + "|text0=" + CI18N::get("uiNewTitleBold"));
} }
else else
{ {
@ -1097,8 +1097,8 @@ public:
{ {
string titleStr = CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)i); string titleStr = CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)i);
bool womenTitle = (UserEntity && UserEntity->getGender() == GSGENDER::female); bool womenTitle = (UserEntity && UserEntity->getGender() == GSGENDER::female);
const ucstring s(CStringManagerClient::getTitleLocalizedName(titleStr,womenTitle)); const char *s = CStringManagerClient::getTitleLocalizedName(titleStr, womenTitle);
pCB->addText(s.toUtf8()); pCB->addText(s);
pSM->_UIUnblockedTitles.push_back((CHARACTER_TITLE::ECharacterTitle)i); pSM->_UIUnblockedTitles.push_back((CHARACTER_TITLE::ECharacterTitle)i);
} }
} }

@ -3632,7 +3632,7 @@ public:
bool Castable; bool Castable;
uint32 Type; uint32 Type;
uint32 Icon; uint32 Icon;
ucstring Text; string Text;
bool operator<(const CPhraseSortEntry &pse) const bool operator<(const CPhraseSortEntry &pse) const
{ {
@ -3840,9 +3840,9 @@ void CSPhraseManager::computePhraseProgression()
// replace each number with 001 format. toLower // replace each number with 001 format. toLower
for(uint k=0;k<pse.Text.size();k++) for(uint k=0;k<pse.Text.size();k++)
{ {
if(pse.Text[k] < 256 && isalpha(pse.Text[k])) if((unsigned char)pse.Text[k] < 0x80 && isalpha(pse.Text[k]))
pse.Text[k]= tolower(pse.Text[k]); pse.Text[k]= tolower(pse.Text[k]); // FIXME: toLowerAscii
else if(pse.Text[k] < 256 && isdigit(pse.Text[k])) else if((unsigned char)pse.Text[k] < 0x80 && isdigit(pse.Text[k]))
{ {
uint32 number= 0; uint32 number= 0;
uint32 start= k; uint32 start= k;
@ -3853,7 +3853,7 @@ void CSPhraseManager::computePhraseProgression()
number+= pse.Text[k] - '0'; number+= pse.Text[k] - '0';
} }
// format, and replace in string // format, and replace in string
ucstring newNumber= toString("%3d", number); string newNumber= toString("%3d", number);
pse.Text.replace(start, k-start, newNumber); pse.Text.replace(start, k-start, newNumber);
// and skip this number // and skip this number
k= start + (uint)newNumber.size(); k= start + (uint)newNumber.size();
@ -4688,7 +4688,8 @@ int CSPhraseComAdpater::luaGetDesc(CLuaState &ls)
if (phraseSheetID != 0) if (phraseSheetID != 0)
{ {
// is it a built-in phrase? // is it a built-in phrase?
ucstring desc(STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId(phraseSheetID))); ucstring desc; // FIXME: UTF-8 Lua
desc.fromUtf8(STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId(phraseSheetID)));
if (!desc.empty()) if (!desc.empty())
{ {
CLuaIHM::push(ls, desc); CLuaIHM::push(ls, desc);

@ -110,13 +110,13 @@ void CViewBitmapFaberMp::draw ()
///\todo nico : draw icon ///\todo nico : draw icon
/*xOffset+=_XReal; /*xOffset+=_XReal;
yOffset+=_YReal; yOffset+=_YReal;
_SheetText->setText(ucstring(toString(_SheetId.getSInt32()))); _SheetText->setText(toString(_SheetId.getSInt32()));
_SheetText->draw(xOffset,yOffset+20); _SheetText->draw(xOffset,yOffset+20);
_QuantityText->setText(ucstring(toString(_Quantity.getSInt32()))); _QuantityText->setText(toString(_Quantity.getSInt32()));
_QuantityText->draw(xOffset,yOffset+10); _QuantityText->draw(xOffset,yOffset+10);
_QualityText->setText(ucstring(toString(_Quality.getSInt32()))); _QualityText->setText(toString(_Quality.getSInt32()));
_QualityText->draw(xOffset,yOffset); _QualityText->draw(xOffset,yOffset);
*/ */

@ -885,7 +885,7 @@ NLMISC::CRGBA interpClientCfgColor(const string &src, string &dest)
colorCode.resize(nextPos - 1); colorCode.resize(nextPos - 1);
for(uint k = 0; k < nextPos - 1; ++k) 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<std::string, CClientConfig::SSysInfoParam>::const_iterator it = ClientCfg.SystemInfoParams.find(colorCode); std::map<std::string, CClientConfig::SSysInfoParam>::const_iterator it = ClientCfg.SystemInfoParams.find(colorCode);
if (it != ClientCfg.SystemInfoParams.end()) if (it != ClientCfg.SystemInfoParams.end())
@ -953,7 +953,7 @@ std::string getStringCategoryIfAny(const string &src, string &dest)
colorCode.resize( codeSize ); colorCode.resize( codeSize );
for(ptrdiff_t k = 0; k < (ptrdiff_t)codeSize; ++k) 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; string destTmp;
if ( startPos != 0 ) if ( startPos != 0 )

@ -2494,7 +2494,7 @@ void impulseRemoteAdmin (NLMISC::CBitMemStream &impulse)
impulse.serial (cmd); impulse.serial (cmd);
// remove the 2 first rc character if exists, only there to say to the EGS that is a remote command // 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); cmd = cmd.substr(2);
mdDisplayVars.clear (); mdDisplayVars.clear ();

@ -53,7 +53,7 @@ bool getPosFromZoneName(const std::string &name,NLMISC::CVector2f &dest)
while (i < zoneName.size()) while (i < zoneName.size())
{ {
if (!::isalpha(zoneName[i])) return false; 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; if (xStr.size() != 2) return false;
dest.x = 160.f * ((xStr[0] - 'A') * 26 + (xStr[1] - 'A')); 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()) while (i < zoneName.size())
{ {
if (!::isalpha(zoneName[i])) return false; 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; if (xStr.size() != 2) return false;
x = (xStr[0] - 'A') * 26 + (xStr[1] - 'A'); x = (xStr[0] - 'A') * 26 + (xStr[1] - 'A');

Loading…
Cancel
Save