Merge branch 'develop' into ryzomclassic-develop

ryzomclassic-develop
kaetemi 4 years ago
commit 9cc899a3a6

@ -59,10 +59,8 @@ namespace NLGUI
{ {
public: public:
virtual ~IViewTextProvider(){} virtual ~IViewTextProvider(){}
bool getString(uint32 stringId, std::string &result) { ucstring temp; bool res = getString(stringId, temp); result = temp.toUtf8(); return res; } virtual bool getString(uint32 stringId, std::string &result) = 0;
bool getDynString(uint32 dynStringId, std::string &result) { ucstring temp; bool res = getDynString(dynStringId, temp); result = temp.toUtf8(); return res; } virtual bool getDynString(uint32 dynStringId, std::string &result) = 0;
virtual bool getString( uint32 stringId, ucstring &result ) = 0; // TODO: UTF-8
virtual bool getDynString( uint32 dynStringId, ucstring &result ) = 0; // TODO: UTF-8
}; };
CViewTextID(const TCtorParam &param) : CViewText(param) CViewTextID(const TCtorParam &param) : CViewText(param)

@ -253,6 +253,7 @@ void appendToUpper(std::string &res, const std::string &str, ptrdiff_t &i);
/** UTF-8 case insensitive compare */ /** UTF-8 case insensitive compare */
int compareCaseInsensitive(const char *a, const char *b); int compareCaseInsensitive(const char *a, const char *b);
int compareCaseInsensitive(const char *a, size_t lenA, const char *b, size_t lenB); int compareCaseInsensitive(const char *a, size_t lenA, const char *b, size_t lenB);
inline int compareCaseInsensitive(const std::string &a, const std::string &b) { return compareCaseInsensitive(&a[0], a.size(), &b[0], b.size()); }
/** /**

@ -4177,7 +4177,8 @@ namespace NLGUI
} }
else else
{ {
renderHtmlString(content); // Sanitize downloaded HTML UTF-8 encoding, and render
renderHtmlString(CUtfStringView(content).toUtf8(true));
} }
} }

@ -883,6 +883,7 @@ namespace NLGUI
driver->setCursorScale( CViewRenderer::hwCursorScale ); driver->setCursorScale( CViewRenderer::hwCursorScale );
char bufTmp[256], tgaName[256]; char bufTmp[256], tgaName[256];
tgaName[0] = 0;
string sTGAname; string sTGAname;
float uvMinU, uvMinV, uvMaxU, uvMaxV; float uvMinU, uvMinV, uvMaxU, uvMaxV;
while (!iFile.eof()) while (!iFile.eof())

@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#if 0
#ifndef CL_CANDIDATE_H #ifndef CL_CANDIDATE_H
#define CL_CANDIDATE_H #define CL_CANDIDATE_H
@ -39,3 +39,4 @@ struct Candidate
#endif // CL_CANDIDATE_H #endif // CL_CANDIDATE_H
#endif

@ -809,9 +809,9 @@ bool CCharacterCL::build(const CEntitySheet *sheet) // virtual
if (Type == Fauna) if (Type == Fauna)
{ {
// Get the fauna name in the sheet // Get the fauna name in the sheet
const ucstring creatureName(STRING_MANAGER::CStringManagerClient::getCreatureLocalizedName(_Sheet->Id)); const char *creatureName = STRING_MANAGER::CStringManagerClient::getCreatureLocalizedName(_Sheet->Id);
if (creatureName.find(ucstring("<NotExist:")) != 0) if (!FINAL_VERSION || !NLMISC::startsWith(creatureName, "<NotExist:"))
_EntityName = creatureName.toUtf8(); _EntityName = creatureName;
} }
else else
{ {
@ -7589,7 +7589,7 @@ void CCharacterCL::displayName()
//--------------------------------------------------- //---------------------------------------------------
void CCharacterCL::drawName(const NLMISC::CMatrix &mat) // virtual void CCharacterCL::drawName(const NLMISC::CMatrix &mat) // virtual
{ {
const ucstring &ucname = getEntityName(); const string &ucname = getEntityName();
if(!getEntityName().empty()) if(!getEntityName().empty())
{ {
// If there is no extended name, just display the name // If there is no extended name, just display the name
@ -7616,8 +7616,8 @@ void CCharacterCL::drawName(const NLMISC::CMatrix &mat) // virtual
{ {
if(_Sheet != 0) if(_Sheet != 0)
{ {
const ucstring name(STRING_MANAGER::CStringManagerClient::getCreatureLocalizedName(_Sheet->Id)); const char *name = STRING_MANAGER::CStringManagerClient::getCreatureLocalizedName(_Sheet->Id);
if (name.find(ucstring("<NotExist:")) != 0) if (!FINAL_VERSION || !NLMISC::startsWith(name, "<NotExist:"))
TextContext->render3D(mat, name); TextContext->render3D(mat, name);
} }
} }
@ -7674,9 +7674,9 @@ void CCharacterCL::displayModifiers() // virtual
} }
else if (TimeInSec >= mod.Time) else if (TimeInSec >= mod.Time)
{ {
ucstring hpModifier; string hpModifier;
if (mod.Text.empty()) if (mod.Text.empty())
hpModifier = ucstring(toString("%d", mod.Value)); hpModifier = toString("%d", mod.Value);
else else
hpModifier = mod.Text; hpModifier = mod.Text;
double t = TimeInSec-mod.Time; double t = TimeInSec-mod.Time;
@ -10324,7 +10324,7 @@ NLMISC_COMMAND(pvpMode, "modify pvp mode", "[<pvp mode> <state>]")
str+="in_safe_zone "; str+="in_safe_zone ";
if( pvpMode&PVP_MODE::PvpSafe) if( pvpMode&PVP_MODE::PvpSafe)
str+="safe "; str+="safe ";
IM->displaySystemInfo(ucstring(str)); IM->displaySystemInfo(str);
nlinfo("<pvpMode> %s",str.c_str()); nlinfo("<pvpMode> %s",str.c_str());
} }
else else

@ -2275,14 +2275,13 @@ string CClientConfig::getHtmlLanguageCode() const
} }
// *************************************************************************** // ***************************************************************************
ucstring CClientConfig::buildLoadingString( const ucstring& ucstr ) const string CClientConfig::buildLoadingString( const string& ucstr ) const
{ {
if( LoadingStringCount > 0 ) if( LoadingStringCount > 0 )
{ {
uint index = rand()%LoadingStringCount; uint index = rand()%LoadingStringCount;
string tipId = "uiLoadingString"+toString(index); string tipId = "uiLoadingString" + toString(index);
ucstring randomUCStr = CI18N::get(tipId); return CI18N::get(tipId);
return randomUCStr;
} }
else else
return ucstr; return ucstr;

@ -895,10 +895,10 @@ public:
float getActualLandscapeThreshold() const; float getActualLandscapeThreshold() const;
// Return LanguageCode but if "wk", then return "en" // Return LanguageCode but if "wk", then return "en"
string getHtmlLanguageCode() const; std::string getHtmlLanguageCode() const;
// return a random loading tip or, if there are not, return the string in argument // return a random loading tip or, if there are not, return the string in argument
ucstring buildLoadingString( const ucstring& ucstr ) const; std::string buildLoadingString(const std::string &ucstr) const;
/// get the path to client_default.cfg including the filename itself. /// get the path to client_default.cfg including the filename itself.
bool getDefaultConfigLocation(std::string& fileLocation) const; bool getDefaultConfigLocation(std::string& fileLocation) const;

@ -241,7 +241,7 @@ CClientChatManager::CClientChatManager()
} }
//------------------------------------------------------- //-------------------------------------------------------
const ucstring *CClientChatManager::cycleLastTell() const string *CClientChatManager::cycleLastTell()
{ {
if (_TellPeople.empty()) return NULL; if (_TellPeople.empty()) return NULL;
_TellPeople.push_front(_TellPeople.back()); _TellPeople.push_front(_TellPeople.back());
@ -282,14 +282,14 @@ void CClientChatManager::init( const string& /* staticDBFileName */ )
// chat // chat
// //
//----------------------------------------------- //-----------------------------------------------
void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam ) void CClientChatManager::chat( const string& strIn, bool isChatTeam )
{ {
// Truncate to 255 chars max (because of server restriction) // Truncate to 255 chars max (because of server restriction)
ucstring str= strIn.substr(0,255); ucstring str= ucstring(strIn).substr(0,255); // FIXME: UTF-8 (serial)
// send str to IOS // send str to IOS
CBitMemStream bms; CBitMemStream bms;
string msgType; const char *msgType;
if (isChatTeam) if (isChatTeam)
{ {
@ -303,13 +303,13 @@ void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam )
if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) )
{ {
bms.serial( str ); bms.serial( str ); // FIXME: UTF-8 (serial)
NetMngr.push( bms ); NetMngr.push( bms );
//nlinfo("impulseCallBack : %s %s sent", msgType.c_str(), str.toString().c_str()); //nlinfo("impulseCallBack : %s %s sent", msgType.c_str(), str.toString().c_str());
} }
else else
{ {
nlwarning("<CClientChatManager::chat> unknown message name : %s", msgType.c_str()); nlwarning("<CClientChatManager::chat> unknown message name : %s", msgType);
} }
if (UserEntity != NULL) UserEntity->setAFK(false); if (UserEntity != NULL) UserEntity->setAFK(false);
@ -321,11 +321,11 @@ void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam )
// tell // tell
// //
//----------------------------------------------- //-----------------------------------------------
void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn ) void CClientChatManager::tell( const string& receiverIn, const string& strIn )
{ {
// Truncate to 255 chars max (because of server restriction) // Truncate to 255 chars max (because of server restriction)
string receiver= receiverIn.substr(0,255); string receiver= receiverIn.substr(0,255); // FIXME: UTF-8 (serial)
ucstring str= strIn.substr(0,255); ucstring str= ucstring(strIn).substr(0,255); // FIXME: UTF-8 (serial)
// *** send str // *** send str
CBitMemStream bms; CBitMemStream bms;
@ -333,7 +333,7 @@ void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn )
if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) )
{ {
bms.serial( receiver ); bms.serial( receiver );
bms.serial( str ); bms.serial( str ); // FIXME: UTF-8
NetMngr.push( bms ); NetMngr.push( bms );
//nlinfo("impulseCallBack : %s %s %s sent", msgType.c_str(), receiver.c_str(), str.toString().c_str()); //nlinfo("impulseCallBack : %s %s %s sent", msgType.c_str(), receiver.c_str(), str.toString().c_str());
} }
@ -345,10 +345,10 @@ void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn )
// *** manage list of last telled people // *** manage list of last telled people
// remove the telled people from list (if present) // remove the telled people from list (if present)
std::list<ucstring>::iterator it = _TellPeople.begin(); std::list<string>::iterator it = _TellPeople.begin();
while(it != _TellPeople.end()) while(it != _TellPeople.end())
{ {
if (*it == ucstring(receiver)) if (*it == receiver)
{ {
it = _TellPeople.erase(it); it = _TellPeople.erase(it);
nlassert(_NumTellPeople != 0); nlassert(_NumTellPeople != 0);
@ -454,14 +454,14 @@ void CClientChatManager::processTellString(NLMISC::CBitMemStream& bms, IChatDisp
// Serial. For tell message, there is no chat mode, coz we know we are in tell mode ! // Serial. For tell message, there is no chat mode, coz we know we are in tell mode !
bms.serial (chatMsg.CompressedIndex); bms.serial (chatMsg.CompressedIndex);
bms.serial (chatMsg.SenderNameId); bms.serial (chatMsg.SenderNameId);
bms.serial (chatMsg.Content); bms.serial (chatMsg.Content); // FIXME: UTF-8 (serial)
if (PermanentlyBanned) return; if (PermanentlyBanned) return;
chatMsg.ChatMode = (uint8) CChatGroup::tell; chatMsg.ChatMode = (uint8) CChatGroup::tell;
// If !complete, wait // If !complete, wait
ucstring senderStr; string senderStr;
bool complete = true; bool complete = true;
complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr);
if (!complete) if (!complete)
@ -472,8 +472,8 @@ void CClientChatManager::processTellString(NLMISC::CBitMemStream& bms, IChatDisp
} }
// display // display
ucstring ucstr; string ucstr;
buildTellSentence(senderStr, chatMsg.Content, ucstr); buildTellSentence(senderStr, chatMsg.Content.toUtf8(), ucstr);
chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr); chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr);
} }
@ -488,9 +488,9 @@ void CClientChatManager::processFarTellString(NLMISC::CBitMemStream& bms, IChatD
if (PermanentlyBanned) return; if (PermanentlyBanned) return;
// display // display
ucstring ucstr; string ucstr;
buildTellSentence(farTellMsg.SenderName, farTellMsg.Text, ucstr); buildTellSentence(farTellMsg.SenderName.toUtf8(), farTellMsg.Text.toUtf8(), ucstr);
chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, farTellMsg.SenderName); chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, farTellMsg.SenderName.toUtf8());
} }
@ -505,7 +505,7 @@ void CClientChatManager::processChatString( NLMISC::CBitMemStream& bms, IChatDis
CChatMsg chatMsg; CChatMsg chatMsg;
bms.serial( chatMsg ); bms.serial( chatMsg );
CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(chatMsg.ChatMode); CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(chatMsg.ChatMode);
ucstring senderStr; string senderStr;
bool complete = true; bool complete = true;
complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr);
@ -528,9 +528,9 @@ void CClientChatManager::processChatString( NLMISC::CBitMemStream& bms, IChatDis
} }
// display // display
ucstring ucstr; string ucstr;
buildChatSentence(chatMsg.CompressedIndex, senderStr, chatMsg.Content, type, ucstr); buildChatSentence(chatMsg.CompressedIndex, senderStr, chatMsg.Content.toUtf8(), type, ucstr);
chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, chatMsg.Content, type, chatMsg.DynChatChanID, senderStr); chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, chatMsg.Content.toUtf8(), type, chatMsg.DynChatChanID, senderStr);
} }
@ -545,8 +545,8 @@ void CClientChatManager::processTellString2(NLMISC::CBitMemStream& bms, IChatDis
bms.serial(chatMsg.PhraseId); bms.serial(chatMsg.PhraseId);
// if !complete, wait // if !complete, wait
ucstring senderStr; string senderStr;
ucstring rawMessage; string rawMessage;
bool complete = true; bool complete = true;
complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr);
complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, rawMessage); complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, rawMessage);
@ -558,7 +558,7 @@ void CClientChatManager::processTellString2(NLMISC::CBitMemStream& bms, IChatDis
} }
// display // display
ucstring ucstr; string ucstr;
buildTellSentence(senderStr, rawMessage, ucstr); buildTellSentence(senderStr, rawMessage, ucstr);
chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr); chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr);
} }
@ -571,8 +571,8 @@ void CClientChatManager::processChatString2(NLMISC::CBitMemStream& bms, IChatDis
bms.serial( chatMsg ); bms.serial( chatMsg );
if (PermanentlyBanned) return; if (PermanentlyBanned) return;
CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(chatMsg.ChatMode); CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(chatMsg.ChatMode);
ucstring senderStr; string senderStr;
ucstring rawMessage; string rawMessage;
// here, the type cannot be dyn_chat (no DynChatId in the message) => discard // here, the type cannot be dyn_chat (no DynChatId in the message) => discard
if(type==CChatGroup::dyn_chat) if(type==CChatGroup::dyn_chat)
@ -592,11 +592,11 @@ void CClientChatManager::processChatString2(NLMISC::CBitMemStream& bms, IChatDis
return; return;
} }
rawMessage += ucstring(" "); rawMessage += " ";
rawMessage += chatMsg.CustomTxt; rawMessage += chatMsg.CustomTxt.toUtf8();
// display // display
ucstring ucstr; string ucstr;
buildChatSentence(chatMsg.CompressedIndex, senderStr, rawMessage, type, ucstr); buildChatSentence(chatMsg.CompressedIndex, senderStr, rawMessage, type, ucstr);
chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, rawMessage, type, CEntityId::Unknown, senderStr); chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, rawMessage, type, CEntityId::Unknown, senderStr);
} }
@ -615,7 +615,7 @@ void CClientChatManager::processChatStringWithNoSender( NLMISC::CBitMemStream& b
chatMsg.SenderNameId = 0; chatMsg.SenderNameId = 0;
chatMsg.ChatMode = type; chatMsg.ChatMode = type;
chatMsg.PhraseId = phraseID; chatMsg.PhraseId = phraseID;
ucstring ucstr; string ucstr;
// if !complete, wait // if !complete, wait
bool complete = STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, ucstr); bool complete = STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, ucstr);
@ -627,7 +627,7 @@ void CClientChatManager::processChatStringWithNoSender( NLMISC::CBitMemStream& b
} }
// diplay // diplay
ucstring senderName(""); string senderName;
chatDisplayer.displayChat(INVALID_DATASET_INDEX, ucstr, ucstr, type, CEntityId::Unknown, senderName); chatDisplayer.displayChat(INVALID_DATASET_INDEX, ucstr, ucstr, type, CEntityId::Unknown, senderName);
} }
@ -643,7 +643,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer)
for( itMsg = _ChatBuffer.begin(); itMsg != _ChatBuffer.end(); ) for( itMsg = _ChatBuffer.begin(); itMsg != _ChatBuffer.end(); )
{ {
CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(itMsg->ChatMode); CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(itMsg->ChatMode);
ucstring sender, content; string sender, content;
// all strings received? // all strings received?
bool complete = true; bool complete = true;
@ -652,7 +652,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer)
if(itMsg->UsePhraseId) if(itMsg->UsePhraseId)
complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(itMsg->PhraseId, content); complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(itMsg->PhraseId, content);
else else
content= itMsg->Content; content= itMsg->Content.toUtf8();
if (type == CChatGroup::dyn_chat) if (type == CChatGroup::dyn_chat)
{ {
@ -666,7 +666,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer)
// if complete, process // if complete, process
if (complete) if (complete)
{ {
ucstring ucstr; string ucstr;
if (itMsg->SenderNameId == 0) if (itMsg->SenderNameId == 0)
{ {
ucstr = content; ucstr = content;
@ -703,7 +703,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer)
// getString // getString
// //
//----------------------------------------------- //-----------------------------------------------
ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) string CClientChatManager::getString( CBitMemStream& bms, string& ucstr )
{ {
// deal with parameters // deal with parameters
@ -714,11 +714,11 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
// search if a parameter exists in the string // search if a parameter exists in the string
sprintf(chTmp,"$%d",dynParamIdx); sprintf(chTmp,"$%d",dynParamIdx);
ucstring ucstrTmp( chTmp ); string ucstrTmp( chTmp );
ucstring::size_type idx = ucstr.find(ucstrTmp); string::size_type idx = ucstr.find(ucstrTmp);
// if there's a parameter in the string // if there's a parameter in the string
if( idx != ucstring::npos ) if( idx != string::npos )
{ {
char c = (char)ucstr[idx+ucstrTmp.size()]; char c = (char)ucstr[idx+ucstrTmp.size()];
switch( c ) switch( c )
@ -728,7 +728,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
bool huff; bool huff;
bms.serialBit(huff); bms.serialBit(huff);
const ucstring dynStr("???"); const string dynStr("???");
if( huff ) if( huff )
{ {
nldebug("<CClientChatManager::getString> receiving huffman dynamic parameter in static string"); nldebug("<CClientChatManager::getString> receiving huffman dynamic parameter in static string");
@ -756,8 +756,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
string dynStr; string dynStr;
bms.serial( dynStr ); bms.serial( dynStr );
ucstring ucDynStr(dynStr); ucstr.replace( idx, ucstrTmp.size()+1, dynStr );
ucstr.replace( idx, ucstrTmp.size()+1, ucDynStr );
} }
break; break;
@ -766,7 +765,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
uint32 nb; uint32 nb;
bms.serial( nb ); bms.serial( nb );
ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) );
} }
break; break;
/* /*
@ -794,7 +793,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
sint32 nb; sint32 nb;
bms.serial( nb ); bms.serial( nb );
ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) );
} }
break; break;
/* /*
@ -823,7 +822,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
float nb; float nb;
bms.serial( nb ); bms.serial( nb );
ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) );
} }
break; break;
@ -849,7 +848,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
// getString // getString
// //
//----------------------------------------------- //-----------------------------------------------
bool CClientChatManager::getString( ucstring &result, std::vector<uint64>& args, const ucstring &ucstrbase ) bool CClientChatManager::getString( string &result, std::vector<uint64>& args, const string &ucstrbase )
{ {
result = ucstrbase; result = ucstrbase;
@ -863,17 +862,17 @@ bool CClientChatManager::getString( ucstring &result, std::vector<uint64>& args,
{ {
// search if a parameter exists in the string // search if a parameter exists in the string
sprintf(chTmp,"$%d",dynParamIdx); sprintf(chTmp,"$%d",dynParamIdx);
ucstring ucstrTmp( chTmp ); string ucstrTmp( chTmp );
ucstring::size_type idx = result.find(ucstrTmp); string::size_type idx = result.find(ucstrTmp);
// if there's a parameter in the string // if there's a parameter in the string
if( idx != ucstring::npos ) if( idx != string::npos )
{ {
ucstring rep; string rep;
rep = "???"; rep = "???";
if (dynParamIdx >= args.size()) if (dynParamIdx >= args.size())
{ {
nlwarning ("Missing args for string '%s', only %d args, need arg %d", ucstrbase.toString().c_str(), args.size(), dynParamIdx); nlwarning ("Missing args for string '%s', only %d args, need arg %d", ucstrbase.c_str(), args.size(), dynParamIdx);
} }
else else
{ {
@ -948,15 +947,15 @@ bool CClientChatManager::getString( ucstring &result, std::vector<uint64>& args,
} // getString // } // getString //
// *************************************************************************** // ***************************************************************************
void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstring &msg, ucstring &result) void CClientChatManager::buildTellSentence(const string &sender, const string &msg, string &result)
{ {
// If no sender name was provided, show only the msg // If no sender name was provided, show only the msg
if ( sender.empty() ) if ( sender.empty() )
result = msg; result = msg;
else else
{ {
ucstring name = CEntityCL::removeTitleAndShardFromName(sender.toUtf8()); string name = CEntityCL::removeTitleAndShardFromName(sender);
ucstring csr; string csr;
// special case where there is only a title, very rare case for some NPC // special case where there is only a title, very rare case for some NPC
if (name.empty()) if (name.empty())
@ -965,29 +964,29 @@ void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstrin
CCharacterCL *entity = dynamic_cast<CCharacterCL*>(EntitiesMngr.getEntityByName(sender, true, true)); CCharacterCL *entity = dynamic_cast<CCharacterCL*>(EntitiesMngr.getEntityByName(sender, true, true));
bool bWoman = entity && entity->getGender() == GSGENDER::female; bool bWoman = entity && entity->getGender() == GSGENDER::female;
name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman); name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman);
{ {
// Sometimes translation contains another title // Sometimes translation contains another title
ucstring::size_type pos = name.find('$'); string::size_type pos = name.find('$');
if (pos != ucstring::npos) if (pos != string::npos)
{ {
name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name.toUtf8()), bWoman); name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name), bWoman);
} }
} }
} }
else else
{ {
// Does the char have a CSR title? // Does the char have a CSR title?
csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring(""); csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? "(CSR) " : "";
} }
result = csr + name + ucstring(" ") + CI18N::get("tellsYou") + ucstring(": ") + msg; result = csr + name + " " + CI18N::get("tellsYou") + ": " + msg;
} }
} }
// *************************************************************************** // ***************************************************************************
void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderIndex */, const ucstring &sender, const ucstring &msg, CChatGroup::TGroupType type, ucstring &result) void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderIndex */, const string &sender, const string &msg, CChatGroup::TGroupType type, string &result)
{ {
// if its a tell, then use buildTellSentence // if its a tell, then use buildTellSentence
if(type==CChatGroup::tell) if(type==CChatGroup::tell)
@ -1005,35 +1004,35 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde
// get the category if any. Note, in some case (chat from other player), there is not categories // get the category if any. Note, in some case (chat from other player), there is not categories
// and we do not want getStringCategory to return 'SYS' category. // and we do not want getStringCategory to return 'SYS' category.
ucstring finalMsg; string finalMsg;
string catStr = getStringCategory(msg, finalMsg, false); string catStr = getStringCategory(msg, finalMsg, false);
ucstring cat; string cat;
if (!catStr.empty()) if (!catStr.empty())
cat = string("&")+catStr+"&"; cat = "&" + catStr + "&";
if ( ! cat.empty()) if (!cat.empty())
{ {
result = msg; result = msg;
return; return;
} }
// Format the sentence with the provided sender name // Format the sentence with the provided sender name
ucstring senderName = CEntityCL::removeTitleAndShardFromName(sender.toUtf8()); string senderName = CEntityCL::removeTitleAndShardFromName(sender);
ucstring csr; string csr;
// Does the char have a CSR title? // Does the char have a CSR title?
csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring(""); csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? "(CSR) " : "";
if (UserEntity && senderName.toUtf8() == UserEntity->getDisplayName()) if (UserEntity && senderName == UserEntity->getDisplayName())
{ {
// The player talks // The player talks
switch(type) switch(type)
{ {
case CChatGroup::shout: case CChatGroup::shout:
result = cat + csr + CI18N::get("youShout") + ucstring(": ") + finalMsg; result = cat + csr + CI18N::get("youShout") + ": " + finalMsg;
break; break;
default: default:
result = cat + csr + CI18N::get("youSay") + ucstring(": ") + finalMsg; result = cat + csr + CI18N::get("youSay") + ": " + finalMsg;
break; break;
} }
} }
@ -1046,13 +1045,13 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde
// We need the gender to display the correct title // We need the gender to display the correct title
bool bWoman = entity && entity->getGender() == GSGENDER::female; bool bWoman = entity && entity->getGender() == GSGENDER::female;
senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman); senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman);
{ {
// Sometimes translation contains another title // Sometimes translation contains another title
ucstring::size_type pos = senderName.find('$'); string::size_type pos = senderName.find('$');
if (pos != ucstring::npos) if (pos != string::npos)
{ {
senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName.toUtf8()), bWoman); senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName), bWoman);
} }
} }
} }
@ -1060,10 +1059,10 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde
switch(type) switch(type)
{ {
case CChatGroup::shout: case CChatGroup::shout:
result = cat + csr + senderName + ucstring(" ") + CI18N::get("heShout") + ucstring(": ") + finalMsg; result = cat + csr + senderName + " " + CI18N::get("heShout") + ": " + finalMsg;
break; break;
default: default:
result = cat + csr + senderName + ucstring(" ") + CI18N::get("heSays") + ucstring(": ") + finalMsg; result = cat + csr + senderName + " " + CI18N::get("heSays") + ": " + finalMsg;
break; break;
} }
} }
@ -1173,7 +1172,7 @@ void CClientChatManager::updateDynamicChatChannels(IChatDisplayer &chatDisplayer
class CHandlerTell : public IActionHandler class CHandlerTell : public IActionHandler
{ {
void execute (CCtrlBase *pCaller, const std::string &sParams) void execute (CCtrlBase *pCaller, const string &sParams)
{ {
string receiver = getParam (sParams, "player"); string receiver = getParam (sParams, "player");
string message; string message;
@ -1218,7 +1217,7 @@ REGISTER_ACTION_HANDLER( CHandlerTell, "tell");
class CHandlerEnterTell : public IActionHandler class CHandlerEnterTell : public IActionHandler
{ {
void execute (CCtrlBase * /* pCaller */, const std::string &sParams) void execute (CCtrlBase * /* pCaller */, const string &sParams)
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
string receiver = getParam (sParams, "player"); string receiver = getParam (sParams, "player");
@ -1294,7 +1293,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne
case CChatGroup::guild: if (guildActive) pUserBut->setHardText("uiFilterGuild"); break; case CChatGroup::guild: if (guildActive) pUserBut->setHardText("uiFilterGuild"); break;
case CChatGroup::dyn_chat: case CChatGroup::dyn_chat:
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChannelDbIndex); uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChannelDbIndex);
ucstring title; string title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
if (title.empty()) if (title.empty())
{ {
@ -1304,7 +1303,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne
} }
else else
{ {
pUserBut->setHardText(title.toUtf8()); pUserBut->setHardText(title);
} }
break; break;
} }
@ -1336,7 +1335,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne
class CHandlerTalk : public IActionHandler class CHandlerTalk : public IActionHandler
{ {
void execute (CCtrlBase * /* pCaller */, const std::string &sParams) void execute (CCtrlBase * /* pCaller */, const string &sParams)
{ {
// Param // Param
uint mode; uint mode;
@ -1375,7 +1374,7 @@ class CHandlerTalk : public IActionHandler
else else
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo (ucstring::makeFromUtf8(cmd) + ": " + CI18N::get ("uiCommandNotExists")); im->displaySystemInfo (cmd + ": " + CI18N::get ("uiCommandNotExists"));
} }
} }
else else
@ -1408,7 +1407,7 @@ REGISTER_ACTION_HANDLER( CHandlerTalk, "talk");
class CHandlerEnterTalk : public IActionHandler class CHandlerEnterTalk : public IActionHandler
{ {
void execute (CCtrlBase * /* pCaller */, const std::string &sParams) void execute (CCtrlBase * /* pCaller */, const string &sParams)
{ {
// Param // Param
uint mode; uint mode;
@ -1435,10 +1434,10 @@ REGISTER_ACTION_HANDLER( CHandlerEnterTalk, "enter_talk");
class CHandlerTalkMessage : public IActionHandler class CHandlerTalkMessage : public IActionHandler
{ {
void execute (CCtrlBase * /* pCaller */, const std::string &sParams) void execute (CCtrlBase * /* pCaller */, const string &sParams)
{ {
// Param // Param
ucstring text = CI18N::get ("uiTalkMemMsg"+sParams); string text = CI18N::get ("uiTalkMemMsg"+sParams);
// Find the base group // Find the base group
if (!text.empty()) if (!text.empty())
@ -1454,7 +1453,7 @@ REGISTER_ACTION_HANDLER( CHandlerTalkMessage, "talk_message");
class CHandlerSwapChatMode : public IActionHandler class CHandlerSwapChatMode : public IActionHandler
{ {
void execute (CCtrlBase * /* pCaller */, const std::string &sParams) void execute (CCtrlBase * /* pCaller */, const string &sParams)
{ {
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
bool updateCapture= getParam(sParams, "update_capture")=="1"; bool updateCapture= getParam(sParams, "update_capture")=="1";

@ -137,11 +137,11 @@ public:
* \param mode in which channel should this message goes * \param mode in which channel should this message goes
* \param dynChatId is valid only if mode==dyn_chat. This the Id of channel (not the index in DB!) * \param dynChatId is valid only if mode==dyn_chat. This the Id of channel (not the index in DB!)
*/ */
virtual void displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer=0) =0; virtual void displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer=0) =0;
/** /**
* display a player tell message * display a player tell message
*/ */
virtual void displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName) =0; virtual void displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName) =0;
/** /**
* Clear a channel. * Clear a channel.
* \param dynChatDbIndex is valid only if mode==dyn_chat. Contrary to displayChat, this is the Db Index (0..MaxDynChanPerPlayer) * \param dynChatDbIndex is valid only if mode==dyn_chat. Contrary to displayChat, this is the Db Index (0..MaxDynChanPerPlayer)
@ -177,18 +177,18 @@ public :
* \param str is the chat content (truncated to 255 char max) * \param str is the chat content (truncated to 255 char max)
* \param isChatTeam special case for Chat TEAM * \param isChatTeam special case for Chat TEAM
*/ */
void chat( const ucstring& str, bool isChatTeam = false ); void chat( const std::string& str, bool isChatTeam = false );
/** /**
* Transmit a chat message to the receiver * Transmit a chat message to the receiver
* \param receiver is the name of the listening char (truncated to 255 char max) * \param receiver is the name of the listening char (truncated to 255 char max)
* \param str is the chat content (truncated to 255 char max) * \param str is the chat content (truncated to 255 char max)
*/ */
void tell( const std::string& receiver, const ucstring& str ); void tell( const std::string& receiver, const std::string& str );
/** Get the last name of the people with which a 'tell' has been done, then move that name at the start of the list /** Get the last name of the people with which a 'tell' has been done, then move that name at the start of the list
*/ */
const ucstring *cycleLastTell(); const std::string *cycleLastTell();
/** Set the max number of name in the tell list /** Set the max number of name in the tell list
*/ */
@ -263,12 +263,12 @@ public :
* \param result decoded string * \param result decoded string
* \return true if the string is finalize, false if some param are missing from network * \return true if the string is finalize, false if some param are missing from network
*/ */
bool getString( ucstring &result, std::vector<uint64>& args, const ucstring& strbase ); bool getString( std::string &result, std::vector<uint64>& args, const std::string& strbase );
// build a sentence to be displayed in the chat (e.g add "you say", "you shout", "[user name] says" or "[user name] shout") // build a sentence to be displayed in the chat (e.g add "you say", "you shout", "[user name] says" or "[user name] shout")
static void buildChatSentence(TDataSetIndex compressedSenderIndex, const ucstring &sender, const ucstring &msg, CChatGroup::TGroupType type, ucstring &result); static void buildChatSentence(TDataSetIndex compressedSenderIndex, const std::string &sender, const std::string &msg, CChatGroup::TGroupType type, std::string &result);
// build a sentence to be displayed in the tell // build a sentence to be displayed in the tell
static void buildTellSentence(const ucstring &sender, const ucstring &msg, ucstring &result); static void buildTellSentence(const std::string &sender, const std::string &msg, std::string &result);
/// \name Dynamic Chat channel mgt /// \name Dynamic Chat channel mgt
@ -304,7 +304,7 @@ private :
uint8 ChatMode; uint8 ChatMode;
NLMISC::CEntityId DynChatChanID; NLMISC::CEntityId DynChatChanID;
// For Chat and Tell messages // For Chat and Tell messages
ucstring Content; ucstring Content; // FIXME: UTF-8 (serial)
// For Chat2 and Tell2 messages // For Chat2 and Tell2 messages
uint32 PhraseId; uint32 PhraseId;
// Use PhraseId or Content? // Use PhraseId or Content?
@ -338,7 +338,7 @@ private :
std::list<CChatMsgNode> _ChatBuffer; std::list<CChatMsgNode> _ChatBuffer;
// peoples // peoples
std::list<ucstring> _TellPeople; // the last people on which tells ha been done std::list<std::string> _TellPeople; // the last people on which tells ha been done
uint _NumTellPeople; uint _NumTellPeople;
uint _MaxNumTellPeople; uint _MaxNumTellPeople;
@ -361,7 +361,7 @@ private :
* \param str string with parameter values at end (str will change after) * \param str string with parameter values at end (str will change after)
* \return decoded string (str) * \return decoded string (str)
*/ */
ucstring getString( NLMISC::CBitMemStream& bms, ucstring& str ); std::string getString( NLMISC::CBitMemStream& bms, std::string& str );
}; };

@ -240,20 +240,18 @@ NLMISC_COMMAND(equipGroup, "equip group <name>", "name")
} }
if(CItemGroupManager::getInstance()->equipGroup(args[0])) if(CItemGroupManager::getInstance()->equipGroup(args[0]))
{ {
ucstring msg = CI18N::get("cmdEquipGroupSuccess"); string msg = CI18N::get("cmdEquipGroupSuccess");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return true; return true;
} }
else else
{ {
ucstring msg = CI18N::get("cmdEquipGroupError"); string msg = CI18N::get("cmdEquipGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return false; return false;
@ -274,10 +272,9 @@ NLMISC_COMMAND(moveGroup, "move group <name> to <dst>", "name dst")
if(CItemGroupManager::getInstance()->moveGroup(args[0], INVENTORIES::toInventory(args[1]))) if(CItemGroupManager::getInstance()->moveGroup(args[0], INVENTORIES::toInventory(args[1])))
{ {
ucstring msg = CI18N::get("cmdMoveGroupSuccess"); string msg = CI18N::get("cmdMoveGroupSuccess");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
strFindReplace(msg, "%inventory", args[1]); strFindReplace(msg, "%inventory", args[1]);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
@ -285,10 +282,9 @@ NLMISC_COMMAND(moveGroup, "move group <name> to <dst>", "name dst")
} }
else else
{ {
ucstring msg = CI18N::get("cmdMoveGroupError"); string msg = CI18N::get("cmdMoveGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
strFindReplace(msg, "%inventory", args[1]); strFindReplace(msg, "%inventory", args[1]);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
@ -312,24 +308,22 @@ NLMISC_COMMAND(createGroup, "create group <name> [true](create a <remove> for ev
removeUnequiped = !args[1].empty(); removeUnequiped = !args[1].empty();
if(CItemGroupManager::getInstance()->createGroup(args[0], removeUnequiped)) if(CItemGroupManager::getInstance()->createGroup(args[0], removeUnequiped))
{ {
ucstring msg; string msg;
if(removeUnequiped) if(removeUnequiped)
msg = CI18N::get("cmdCreateGroupSuccess2"); msg = CI18N::get("cmdCreateGroupSuccess2");
else else
msg = CI18N::get("cmdCreateGroupSuccess1"); msg = CI18N::get("cmdCreateGroupSuccess1");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return true; return true;
} }
else else
{ {
ucstring msg = CI18N::get("cmdCreateGroupError"); string msg = CI18N::get("cmdCreateGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return false; return false;
@ -350,20 +344,18 @@ NLMISC_COMMAND(deleteGroup, "delete group <name>", "name")
} }
if(CItemGroupManager::getInstance()->deleteGroup(args[0])) if(CItemGroupManager::getInstance()->deleteGroup(args[0]))
{ {
ucstring msg = CI18N::get("cmdDeleteGroupSuccess"); string msg = CI18N::get("cmdDeleteGroupSuccess");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return true; return true;
} }
else else
{ {
ucstring msg = CI18N::get("cmdDeleteGroupError"); string msg = CI18N::get("cmdDeleteGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return false; return false;
@ -494,7 +486,7 @@ NLMISC_COMMAND(random, "Roll a dice and say the result around","[<min>] <max> [h
if (!randomFromString(args[0], max)) if (!randomFromString(args[0], max))
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring msg = CI18N::get("uiRandomBadParameter"); string msg = CI18N::get("uiRandomBadParameter");
strFindReplace(msg, "%s", args[0] ); strFindReplace(msg, "%s", args[0] );
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return false; return false;
@ -504,7 +496,7 @@ NLMISC_COMMAND(random, "Roll a dice and say the result around","[<min>] <max> [h
if (!randomFromString(args[1], min)) if (!randomFromString(args[1], min))
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring msg = CI18N::get("uiRandomBadParameter"); string msg = CI18N::get("uiRandomBadParameter");
strFindReplace(msg, "%s", args[1] ); strFindReplace(msg, "%s", args[1] );
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return false; return false;
@ -544,7 +536,7 @@ NLMISC_COMMAND(dumpShapePos, "Dump Last Added Shape Pos.", "")
CInterfaceManager *IM = CInterfaceManager::getInstance(); CInterfaceManager *IM = CInterfaceManager::getInstance();
CVector pos = ShapeAddedByCommand.back().getPos(); CVector pos = ShapeAddedByCommand.back().getPos();
IM->displaySystemInfo(ucstring(toString("Shape Pos = %f, %f, %f", pos.x, pos.y, pos.z))); IM->displaySystemInfo(toString("Shape Pos = %f, %f, %f", pos.x, pos.y, pos.z));
return true; return true;
} }
//----------------------------------------------- //-----------------------------------------------
@ -932,9 +924,7 @@ NLMISC_COMMAND(a, "Execute an admin command on you","<cmd> <arg>")
cmd = args[0]; cmd = args[0];
for (uint i = 1; i < args.size(); i++) for (uint i = 1; i < args.size(); i++)
{ {
// temporary fix for utf-8 std::string tmp = args[i];
// servers commands are not decoded so convert them to ansi
std::string tmp = ucstring::makeFromUtf8(args[i]).toString();
if (!arg.empty()) if (!arg.empty())
arg += ' '; arg += ' ';
@ -976,9 +966,7 @@ NLMISC_COMMAND(b, "Execute an admin command on your target","<cmd> <arg>")
cmd = args[0]; cmd = args[0];
for (uint i = 1; i < args.size(); i++) for (uint i = 1; i < args.size(); i++)
{ {
// temporary fix for utf-8 std::string tmp = args[i];
// servers commands are not decoded so convert them to ansi
std::string tmp = ucstring::makeFromUtf8(args[i]).toString();
if (!arg.empty()) if (!arg.empty())
arg += ' '; arg += ' ';
@ -1023,9 +1011,7 @@ NLMISC_COMMAND(c, "Execute an admin command on character name","<Character Name>
cmd = args[1]; cmd = args[1];
for (uint i = 2; i < args.size(); i++) for (uint i = 2; i < args.size(); i++)
{ {
// temporary fix for utf-8 std::string tmp = args[i];
// servers commands are not decoded so convert them to ansi
std::string tmp = ucstring::makeFromUtf8(args[i]).toString();
if (!arg.empty()) if (!arg.empty())
arg += ' '; arg += ' ';
@ -1096,11 +1082,11 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic"
{ {
// Help // Help
CInterfaceManager *IM = CInterfaceManager::getInstance(); CInterfaceManager *IM = CInterfaceManager::getInstance();
IM->displaySystemInfo(ucstring("This command need 1 parameter :")); IM->displaySystemInfo("This command need 1 parameter :");
IM->displaySystemInfo(ucstring("<string> :")); IM->displaySystemInfo("<string> :");
IM->displaySystemInfo(ucstring("- none(to remove all verboses)")); IM->displaySystemInfo("- none(to remove all verboses)");
IM->displaySystemInfo(ucstring("- magic(to add debug infos about magic)")); IM->displaySystemInfo("- magic(to add debug infos about magic)");
IM->displaySystemInfo(ucstring("- anim (to add debug infos about animation)")); IM->displaySystemInfo("- anim (to add debug infos about animation)");
} }
else else
{ {
@ -1114,11 +1100,11 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic"
else else
{ {
CInterfaceManager *IM = CInterfaceManager::getInstance(); CInterfaceManager *IM = CInterfaceManager::getInstance();
IM->displaySystemInfo(ucstring("This command need 1 parameter :")); IM->displaySystemInfo("This command need 1 parameter :");
IM->displaySystemInfo(ucstring("<string> :")); IM->displaySystemInfo("<string> :");
IM->displaySystemInfo(ucstring("- none(to remove all verboses)")); IM->displaySystemInfo("- none(to remove all verboses)");
IM->displaySystemInfo(ucstring("- magic(to add debug infos about magic)")); IM->displaySystemInfo("- magic(to add debug infos about magic)");
IM->displaySystemInfo(ucstring("- anim (to add debug infos about animation)")); IM->displaySystemInfo("- anim (to add debug infos about animation)");
} }
} }
return true; return true;
@ -1323,7 +1309,7 @@ NLMISC_COMMAND(execScript, "Execute a script file (.cmd)","<FileName>")
} }
else else
{ {
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("Cannot open file")); CInterfaceManager::getInstance()->displaySystemInfo("Cannot open file");
} }
return true; return true;
@ -1368,7 +1354,7 @@ NLMISC_COMMAND(db, "Modify Database","<Property> <Value>")
{ {
sint64 prop = node->getValue64(); sint64 prop = node->getValue64();
string str = toString(prop); string str = toString(prop);
pIM->displaySystemInfo(ucstring(str)); pIM->displaySystemInfo(str);
nlinfo("%s", str.c_str()); nlinfo("%s", str.c_str());
} }
else else
@ -1722,7 +1708,7 @@ NLMISC_COMMAND(getSheetId, "get_sheet_id","<sheet file name>")
return false; return false;
CSheetId id(args[0]); CSheetId id(args[0]);
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(toString(id.asInt()))); CInterfaceManager::getInstance()->displaySystemInfo(toString(id.asInt()));
return true; return true;
} }
@ -1737,7 +1723,7 @@ NLMISC_COMMAND(getSheetName, "get_sheet_name","<Sheet Id>")
string name = id.toString(); string name = id.toString();
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(name)); CInterfaceManager::getInstance()->displaySystemInfo(name);
return true; return true;
} }
@ -2388,7 +2374,7 @@ NLMISC_COMMAND(sheet2idx, "Return the index of a sheet", "<sheet name> <visual s
else else
result = NLMISC::toString("sheet '%s' not valid", args[0].c_str()); result = NLMISC::toString("sheet '%s' not valid", args[0].c_str());
IM->displaySystemInfo(ucstring(result)); IM->displaySystemInfo(result);
nlinfo("'sheet2idx': %s", result.c_str()); nlinfo("'sheet2idx': %s", result.c_str());
return true; return true;
} }
@ -2411,7 +2397,7 @@ NLMISC_COMMAND(dynstr, "display a dyn string value", "<dyn string_id>")
uint dynId; uint dynId;
fromString(args[0], dynId); fromString(args[0], dynId);
ucstring result; string result;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynId, result); STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynId, result);
CInterfaceManager::getInstance()->displaySystemInfo(result); CInterfaceManager::getInstance()->displaySystemInfo(result);
@ -2426,7 +2412,7 @@ NLMISC_COMMAND(serverstr, "display a server string value", "<serverstr string_id
uint dynId; uint dynId;
fromString(args[0], dynId); fromString(args[0], dynId);
ucstring result; string result;
STRING_MANAGER::CStringManagerClient::instance()->getString(dynId, result); STRING_MANAGER::CStringManagerClient::instance()->getString(dynId, result);
CInterfaceManager::getInstance()->displaySystemInfo(result); CInterfaceManager::getInstance()->displaySystemInfo(result);
@ -2510,11 +2496,11 @@ NLMISC_COMMAND(mode, "Change the mode for an entity in a slot", "<Slot> <Mode> [
if(args.size() < 2) if(args.size() < 2)
{ {
// Help // Help
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 paramters :")); CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 paramters :");
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" <Slot> : the slot number of the entity to change")); CInterfaceManager::getInstance()->displaySystemInfo(" <Slot> : the slot number of the entity to change");
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" <Mode> : the mode wanted for the entity, one of the following number :")); CInterfaceManager::getInstance()->displaySystemInfo(" <Mode> : the mode wanted for the entity, one of the following number :");
for(uint i = 0; i<MBEHAV::NUMBER_OF_MODES; ++i) for(uint i = 0; i<MBEHAV::NUMBER_OF_MODES; ++i)
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::modeToString((MBEHAV::EMode)i).c_str()))); CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::modeToString((MBEHAV::EMode)i).c_str()));
} }
// Right parameters number // Right parameters number
else else
@ -2544,7 +2530,7 @@ NLMISC_COMMAND(mode, "Change the mode for an entity in a slot", "<Slot> <Mode> [
} }
// Invalid slot. // Invalid slot.
else else
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot");
} }
// Command well done. // Command well done.
@ -2557,12 +2543,12 @@ NLMISC_COMMAND(behaviour, "Change the behaviour for an entity in a slot", "<Slot
if(args.size() < 2 || args.size() > 6) if(args.size() < 2 || args.size() > 6)
{ {
// Help // Help
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 to 6 paramters :")); CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 to 6 paramters :");
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" <Slot> : the slot number of the entity to change")); CInterfaceManager::getInstance()->displaySystemInfo(" <Slot> : the slot number of the entity to change");
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" <Behaviour> : the behaviour to play for the entity, one of the following number :")); CInterfaceManager::getInstance()->displaySystemInfo(" <Behaviour> : the behaviour to play for the entity, one of the following number :");
for(uint i = 0; i<MBEHAV::EMOTE_BEGIN; ++i) for(uint i = 0; i<MBEHAV::EMOTE_BEGIN; ++i)
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i).c_str()))); CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i).c_str()));
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END))); CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END));
} }
else else
{ {
@ -2633,7 +2619,7 @@ NLMISC_COMMAND(behaviour, "Change the behaviour for an entity in a slot", "<Slot
entity->updateVisualProperty(NetMngr.getCurrentServerTick()+dt, CLFECOMMON::PROPERTY_BEHAVIOUR); entity->updateVisualProperty(NetMngr.getCurrentServerTick()+dt, CLFECOMMON::PROPERTY_BEHAVIOUR);
} }
else else
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot");
} }
// Command well done. // Command well done.
@ -2782,7 +2768,7 @@ NLMISC_COMMAND(spell, "Cast a spell", "\n"
entity->updateVisualProperty(NetMngr.getCurrentServerTick()+50, CLFECOMMON::PROPERTY_BEHAVIOUR); entity->updateVisualProperty(NetMngr.getCurrentServerTick()+50, CLFECOMMON::PROPERTY_BEHAVIOUR);
} }
else else
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot");
} }
// Command well done. // Command well done.
@ -3871,7 +3857,7 @@ NLMISC_COMMAND(testLongBubble, "To display a bubble with a long text", "<entity>
fromString(args[0], entityId); fromString(args[0], entityId);
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring text("test\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\n"); string text("test\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\n");
uint duration = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutBubbles).getValSInt32(); uint duration = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutBubbles).getValSInt32();
CEntityCL *entity = EntitiesMngr.entity(entityId); CEntityCL *entity = EntitiesMngr.entity(entityId);
@ -4005,7 +3991,7 @@ NLMISC_COMMAND(displayInventoryCounter, "display the Inventory counter to compar
srvVal&= pIM->getLocalSyncActionCounterMask(); srvVal&= pIM->getLocalSyncActionCounterMask();
locVal&= pIM->getLocalSyncActionCounterMask(); locVal&= pIM->getLocalSyncActionCounterMask();
pIM->displaySystemInfo(ucstring( "ServerCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); pIM->displaySystemInfo("ServerCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal));
// Well done. // Well done.
return true; return true;
@ -4023,7 +4009,7 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "")
srvVal&= PHRASE_EXECUTE_COUNTER_MASK; srvVal&= PHRASE_EXECUTE_COUNTER_MASK;
locVal&= PHRASE_EXECUTE_COUNTER_MASK; locVal&= PHRASE_EXECUTE_COUNTER_MASK;
pIM->displaySystemInfo(ucstring( "NextCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); pIM->displaySystemInfo("NextCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal));
// cycle // cycle
srvVal= NLGUI::CDBManager::getInstance()->getDbProp(PHRASE_DB_COUNTER_CYCLE)->getValue32(); srvVal= NLGUI::CDBManager::getInstance()->getDbProp(PHRASE_DB_COUNTER_CYCLE)->getValue32();
@ -4031,7 +4017,7 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "")
srvVal&= PHRASE_EXECUTE_COUNTER_MASK; srvVal&= PHRASE_EXECUTE_COUNTER_MASK;
locVal&= PHRASE_EXECUTE_COUNTER_MASK; locVal&= PHRASE_EXECUTE_COUNTER_MASK;
pIM->displaySystemInfo(ucstring( "CycleCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); pIM->displaySystemInfo("CycleCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal));
return true; return true;
} }
@ -4114,7 +4100,7 @@ NLMISC_COMMAND(skillToInt, "Convert a skill to an int", "")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo(ucstring(toString((uint) SKILLS::toSkill(args[0])))); im->displaySystemInfo(toString((uint) SKILLS::toSkill(args[0])));
return true; return true;
} }
@ -4520,7 +4506,7 @@ NLMISC_COMMAND(getSkillValue, "get a skill value by its name", "skill_name")
CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:SKILL", skillId), false); CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:SKILL", skillId), false);
if(node) if(node)
{ {
pIM->displaySystemInfo(ucstring(toString(node->getValue32()))); pIM->displaySystemInfo(toString(node->getValue32()));
} }
return true; return true;
@ -4550,7 +4536,7 @@ NLMISC_COMMAND(getBaseSkillValue, "get a baseskill value by its name", "skill_na
CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:BaseSKILL", skillId), false); CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:BaseSKILL", skillId), false);
if(node) if(node)
{ {
pIM->displaySystemInfo(ucstring(toString(node->getValue32()))); pIM->displaySystemInfo(toString(node->getValue32()));
} }
return true; return true;
@ -4812,7 +4798,7 @@ NLMISC_COMMAND(stick_log, "", "<slot>")
skel->getStickedObjects(sticks); skel->getStickedObjects(sticks);
nlinfo("StickedModels: %d", sticks.size()); nlinfo("StickedModels: %d", sticks.size());
pIM->displaySystemInfo(ucstring(toString("StickedModels: %d", sticks.size()))); pIM->displaySystemInfo(toString("StickedModels: %d", sticks.size()));
for(uint i=0;i<sticks.size();i++) for(uint i=0;i<sticks.size();i++)
{ {
@ -5377,7 +5363,7 @@ bool CUserCommand::execute(const std::string &/* rawCommandString */, const std:
if ((uint)index >= args.size()) if ((uint)index >= args.size())
{ {
// Not enough arguments // Not enough arguments
pIM->displaySystemInfo (ucstring(CommandName+" : ")+CI18N::get ("uiCommandWrongArgumentCount")); pIM->displaySystemInfo (CommandName+" : "+CI18N::get ("uiCommandWrongArgumentCount"));
return false; return false;
} }
else else
@ -5414,7 +5400,7 @@ bool CUserCommand::execute(const std::string &/* rawCommandString */, const std:
else else
{ {
// Not enough argument // Not enough argument
pIM->displaySystemInfo (ucstring(CommandName+" : ")+CI18N::get ("uiCommandWrongArgumentCount")); pIM->displaySystemInfo (CommandName+" : "+CI18N::get ("uiCommandWrongArgumentCount"));
return false; return false;
} }
return true; return true;
@ -5658,7 +5644,7 @@ NLMISC_COMMAND(tickToDate, "convert a tick value into a readable ryzom time", ""
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
float ryTime = rt.getRyzomTime(); float ryTime = rt.getRyzomTime();
std::string readableDate = toString("Day = %d, hour = %d:%d", rt.getRyzomDay(), (int) floorf(ryTime), (int) floorf(60.f * fmodf(ryTime, 1.f))); std::string readableDate = toString("Day = %d, hour = %d:%d", rt.getRyzomDay(), (int) floorf(ryTime), (int) floorf(60.f * fmodf(ryTime, 1.f)));
im->displaySystemInfo(ucstring(readableDate)); im->displaySystemInfo(readableDate);
return true; return true;
} }
@ -5930,7 +5916,7 @@ NLMISC_COMMAND(time, "Shows information about the current time", "")
tm = gmtime(&date); tm = gmtime(&date);
strftime(cs_utc, size, "%X", tm); strftime(cs_utc, size, "%X", tm);
ucstring msg = CI18N::get("uiCurrentLocalAndUtcTime"); string msg = CI18N::get("uiCurrentLocalAndUtcTime");
strFindReplace(msg, "%local", cs_local); strFindReplace(msg, "%local", cs_local);
strFindReplace(msg, "%utc", cs_utc); strFindReplace(msg, "%utc", cs_utc);
CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND");
@ -5939,7 +5925,7 @@ NLMISC_COMMAND(time, "Shows information about the current time", "")
NLMISC_COMMAND(playedTime, "Display character played time", "") NLMISC_COMMAND(playedTime, "Display character played time", "")
{ {
ucstring msg = CI18N::get("uiPlayedTime"); string msg = CI18N::get("uiPlayedTime");
strFindReplace(msg, "%time", NLMISC::secondsToHumanReadable(CharPlayedTime)); strFindReplace(msg, "%time", NLMISC::secondsToHumanReadable(CharPlayedTime));
CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND");
return true; return true;
@ -5947,7 +5933,7 @@ NLMISC_COMMAND(playedTime, "Display character played time", "")
NLMISC_COMMAND(version, "Display client version", "") NLMISC_COMMAND(version, "Display client version", "")
{ {
ucstring msg = getDebugVersion(); string msg = getDebugVersion();
CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND");
return true; return true;
} }

@ -360,7 +360,7 @@ bool connection (const string &cookie, const string &fsaddr)
// Preload continents // Preload continents
{ {
const ucstring nmsg("Loading continents..."); const string nmsg("Loading continents...");
ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) );
ContinentMngr.preloadSheets(); ContinentMngr.preloadSheets();
@ -398,7 +398,7 @@ bool connection (const string &cookie, const string &fsaddr)
// Init out game // Init out game
setOutGameFullScreen(); setOutGameFullScreen();
ucstring nmsg("Initializing outgame..."); string nmsg("Initializing outgame...");
ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) );
pIM->initOutGame(); pIM->initOutGame();
@ -541,7 +541,7 @@ bool reconnection()
// Preload continents // Preload continents
{ {
const ucstring nmsg ("Loading continents..."); const string nmsg ("Loading continents...");
ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) );
ContinentMngr.preloadSheets(); ContinentMngr.preloadSheets();
} }
@ -3343,10 +3343,10 @@ class CAHLoadScenario : public IActionHandler
if(val!=0) if(val!=0)
{ {
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
ucstring res; string res;
if (pSMC->getString(val,res)) if (pSMC->getString(val,res))
{ {
string charName = CEntityCL::removeTitleAndShardFromName(res.toUtf8()); string charName = CEntityCL::removeTitleAndShardFromName(res);
sessionBrowser.inviteCharacterByName(sessionBrowser._LastScheduleSessionCharId, charName); sessionBrowser.inviteCharacterByName(sessionBrowser._LastScheduleSessionCharId, charName);
if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_invokeResult"))) if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_invokeResult")))

@ -130,7 +130,7 @@ void CContextualCursor::del(const std::string &contextName)
// context : // context :
// Select a nex context. // Select a nex context.
//----------------------------------------------- //-----------------------------------------------
bool CContextualCursor::context(const std::string &contextName, float dist, const ucstring &cursName) bool CContextualCursor::context(const std::string &contextName, float dist, const std::string &cursName)
{ {
// Delete the context. // Delete the context.
TContext::iterator it = _Contexts.find(contextName); TContext::iterator it = _Contexts.find(contextName);
@ -163,7 +163,7 @@ bool CContextualCursor::context(const std::string &contextName, float dist, cons
if(cursName.empty()) if(cursName.empty())
cursor->setString(CI18N::get(functions.cursor)); cursor->setString(CI18N::get(functions.cursor));
else else
cursor->setString(cursName.toUtf8()); cursor->setString(cursName);
} }
} }
} }

@ -68,7 +68,7 @@ public:
void del(const std::string &contextName); void del(const std::string &contextName);
// Select a nex context. // Select a nex context.
bool context(const std::string &contextName, float dist = 0, const ucstring &cursName = ucstring("")); bool context(const std::string &contextName, float dist = 0, const std::string &cursName = std::string());
inline const std::string &context() const {return _Context;} inline const std::string &context() const {return _Context;}
// Check if there is an entity under the cursor. // Check if there is an entity under the cursor.

@ -109,7 +109,7 @@ public:
}; };
NLMISC::CVector2f Pos; // Pos in local map NLMISC::CVector2f Pos; // Pos in local map
ucstring Title; ucstring Title; // FIXME: UTF-8 (serial)
uint8 Type; uint8 Type;
//User LandMarks Colors //User LandMarks Colors

@ -195,7 +195,7 @@ static bool testMissionOption(sint32 priorityWanted)
// Get the Text for the cursor // Get the Text for the cursor
if(textID) if(textID)
{ {
ucstring result; string result;
bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, result); bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, result);
if (!res) if (!res)
result = NLMISC::CI18N::get("uiMissionOptionNotReceived"); result = NLMISC::CI18N::get("uiMissionOptionNotReceived");
@ -222,7 +222,7 @@ static bool testMissionRing()
uint32 textID = pNL->getValue32(); uint32 textID = pNL->getValue32();
// if the string is not received display a temp string // if the string is not received display a temp string
ucstring missionRingText; string missionRingText;
if(!STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, missionRingText)) if(!STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, missionRingText))
missionRingText = NLMISC::CI18N::get("uiMissionRingNameNotReceived"); missionRingText = NLMISC::CI18N::get("uiMissionRingNameNotReceived");
@ -443,7 +443,7 @@ void checkUnderCursor()
uint32 textID = pNL->getValue32(); uint32 textID = pNL->getValue32();
// if the string is not received display a temp string // if the string is not received display a temp string
ucstring webPageText; string webPageText;
if(!STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, webPageText)) if(!STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, webPageText))
webPageText = NLMISC::CI18N::get("uiWebPageNameNotReceived"); webPageText = NLMISC::CI18N::get("uiWebPageNameNotReceived");
@ -461,8 +461,8 @@ void checkUnderCursor()
{ {
// get the outpost name // get the outpost name
CSheetId outpostSheet(pNL->getValue32()); CSheetId outpostSheet(pNL->getValue32());
ucstring outpostName; string outpostName;
outpostName= ucstring(STRING_MANAGER::CStringManagerClient::getOutpostLocalizedName(outpostSheet)); outpostName= STRING_MANAGER::CStringManagerClient::getOutpostLocalizedName(outpostSheet);
// display the cursor // display the cursor
if(ContextCur.context("OUTPOST", 0.f, outpostName)) if(ContextCur.context("OUTPOST", 0.f, outpostName))
@ -566,8 +566,7 @@ void checkUnderCursor()
else else
{ {
cursor->setCursor("curs_pick.tga"); cursor->setCursor("curs_pick.tga");
ucstring contextText; string contextText = instref.ContextText;
contextText.fromUtf8(instref.ContextText);
if (ContextCur.context("WEBIG", 0.f, contextText)) if (ContextCur.context("WEBIG", 0.f, contextText))
return; return;
} }

@ -178,7 +178,7 @@ public :
CCompassTarget ct = pGC->getTarget(); CCompassTarget ct = pGC->getTarget();
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
ucstring oldName; string oldName;
if (!pSMC->getDynString(leaf->getOldValue32(), oldName)) if (!pSMC->getDynString(leaf->getOldValue32(), oldName))
{ {
nlwarning("Can't get compass target name"); nlwarning("Can't get compass target name");
@ -201,7 +201,7 @@ public :
{ {
// TODO : maybe the following code could be include in CGroupMap::checkCoords, but it is not called when the map is not visible... // TODO : maybe the following code could be include in CGroupMap::checkCoords, but it is not called when the map is not visible...
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
ucstring name; string name;
if (pSMC->getDynString((*tmpIt)->getValue32(), name)) if (pSMC->getDynString((*tmpIt)->getValue32(), name))
{ {
// if (_AlreadyReceived.count(name) == 0) // if (_AlreadyReceived.count(name) == 0)
@ -2245,7 +2245,7 @@ void CEntityManager::dumpXML(class NLMISC::IStream &f)
f.xmlPushBegin("Name"); f.xmlPushBegin("Name");
// Set a property name // Set a property name
f.xmlSetAttrib ("string"); f.xmlSetAttrib ("string");
ucstring n = _Entities[i]->getEntityName(); string n = _Entities[i]->getEntityName();
f.serial(n); f.serial(n);
// Close the new node header // Close the new node header
f.xmlPushEnd(); f.xmlPushEnd();
@ -2338,11 +2338,11 @@ CEntityCL *CEntityManager::getEntityByName (uint32 stringId) const
} }
//----------------------------------------------- //-----------------------------------------------
CEntityCL *CEntityManager::getEntityByKeywords (const std::vector<ucstring> &keywords, bool onlySelectable) const CEntityCL *CEntityManager::getEntityByKeywords (const std::vector<string> &keywords, bool onlySelectable) const
{ {
if (keywords.empty()) return NULL; if (keywords.empty()) return NULL;
std::vector<ucstring> lcKeywords; std::vector<string> lcKeywords;
lcKeywords.resize(keywords.size()); lcKeywords.resize(keywords.size());
for(uint k = 0; k < keywords.size(); k++) for(uint k = 0; k < keywords.size(); k++)
{ {
@ -2359,14 +2359,13 @@ CEntityCL *CEntityManager::getEntityByKeywords (const std::vector<ucstring> &key
if (onlySelectable && !_Entities[i]->properties().selectable()) continue; if (onlySelectable && !_Entities[i]->properties().selectable()) continue;
ucstring lcName; string lcName = toLower(_Entities[i]->getDisplayName());
lcName = toLower(_Entities[i]->getDisplayName());
if (lcName.empty()) continue; if (lcName.empty()) continue;
bool match = true; bool match = true;
for (uint k = 0; k < lcKeywords.size(); ++k) for (uint k = 0; k < lcKeywords.size(); ++k)
{ {
if (lcName.find(lcKeywords[k]) == ucstring::npos) if (lcName.find(lcKeywords[k]) == string::npos)
{ {
match = false; match = false;
break; break;
@ -2395,9 +2394,9 @@ CEntityCL *CEntityManager::getEntityByKeywords (const std::vector<ucstring> &key
} }
//----------------------------------------------- //-----------------------------------------------
CEntityCL *CEntityManager::getEntityByName (const ucstring &name, bool caseSensitive, bool complete) const CEntityCL *CEntityManager::getEntityByName (const string &name, bool caseSensitive, bool complete) const
{ {
ucstring source = name; string source = name;
const uint size = (uint)source.size(); const uint size = (uint)source.size();
if (!caseSensitive) if (!caseSensitive)
{ {
@ -2415,7 +2414,7 @@ CEntityCL *CEntityManager::getEntityByName (const ucstring &name, bool caseSensi
{ {
if(_Entities[i]) if(_Entities[i])
{ {
ucstring value = _Entities[i]->getDisplayName(); string value = _Entities[i]->getDisplayName();
bool foundEntity = false; bool foundEntity = false;
uint j; uint j;

@ -304,13 +304,13 @@ public:
* \param caseSensitive type of test to perform * \param caseSensitive type of test to perform
* \param complete : if true, the name must match the full name of the entity. * \param complete : if true, the name must match the full name of the entity.
*/ */
CEntityCL *getEntityByName (const ucstring &name, bool caseSensitive, bool complete) const; CEntityCL *getEntityByName (const std::string &name, bool caseSensitive, bool complete) const;
/** /**
* Case insensitive match against entity name. All listed keywords must match. * Case insensitive match against entity name. All listed keywords must match.
* \param keywords to match * \param keywords to match
* \param onlySelectable : if true, match only entity that can be selected * \param onlySelectable : if true, match only entity that can be selected
*/ */
CEntityCL *getEntityByKeywords (const std::vector<ucstring> &keywords, bool onlySelectable) const; CEntityCL *getEntityByKeywords (const std::vector<std::string> &keywords, bool onlySelectable) const;
CEntityCL *getEntityBySheetName (const std::string &sheet) const; CEntityCL *getEntityBySheetName (const std::string &sheet) const;
/// Get an entity by dataset index. Returns NULL if the entity is not found. /// Get an entity by dataset index. Returns NULL if the entity is not found.
CEntityCL *getEntityByCompressedIndex(TDataSetIndex compressedIndex) const; CEntityCL *getEntityByCompressedIndex(TDataSetIndex compressedIndex) const;

@ -2276,11 +2276,11 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value)
// check if there is any replacement tag in the string // check if there is any replacement tag in the string
string::size_type p1 = _EntityName.find('$'); string::size_type p1 = _EntityName.find('$');
if (p1 != ucstring::npos) if (p1 != string::npos)
{ {
// we found a replacement point begin tag // we found a replacement point begin tag
string::size_type p2 = _EntityName.find('$', p1+1); string::size_type p2 = _EntityName.find('$', p1+1);
if (p2 != ucstring::npos) if (p2 != string::npos)
{ {
// ok, we have the second replacement point! // ok, we have the second replacement point!
// extract the replacement id // extract the replacement id
@ -2295,21 +2295,21 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value)
womanTitle = ( c->getGender() == GSGENDER::female ); womanTitle = ( c->getGender() == GSGENDER::female );
} }
string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(), womanTitle); string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle);
// Sometimes translation contains another title // Sometimes translation contains another title
{ {
string::size_type pos = replacement.find('$'); string::size_type pos = replacement.find('$');
if (pos != ucstring::npos) if (pos != string::npos)
{ {
_EntityName = replacement.substr(0, pos); _EntityName = replacement.substr(0, pos);
string::size_type pos2 = replacement.find('$', pos + 1); string::size_type pos2 = replacement.find('$', pos + 1);
_TitleRaw = replacement.substr(pos+1, pos2 - pos - 1); _TitleRaw = replacement.substr(pos+1, pos2 - pos - 1);
replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(), womanTitle); replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle);
} }
} }
_Tags = STRING_MANAGER::CStringManagerClient::getTitleInfos(_TitleRaw.toUtf8(), womanTitle); _Tags = STRING_MANAGER::CStringManagerClient::getTitleInfos(_TitleRaw, womanTitle);
if (!replacement.empty() || !ClientCfg.DebugStringManager) if (!replacement.empty() || !ClientCfg.DebugStringManager)
{ {
@ -2318,9 +2318,9 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value)
_EntityName = _EntityName.substr(0, p1); // + _Name.substr(p2+1) _EntityName = _EntityName.substr(0, p1); // + _Name.substr(p2+1)
// Get extended name // Get extended name
_NameEx = replacement; _NameEx = replacement;
newtitle = _NameEx.toUtf8(); newtitle = _NameEx;
} }
CHARACTER_TITLE::ECharacterTitle titleEnum = CHARACTER_TITLE::toCharacterTitle( _TitleRaw.toUtf8() ); CHARACTER_TITLE::ECharacterTitle titleEnum = CHARACTER_TITLE::toCharacterTitle( _TitleRaw );
if ( titleEnum >= CHARACTER_TITLE::BeginGmTitle && titleEnum <= CHARACTER_TITLE::EndGmTitle ) if ( titleEnum >= CHARACTER_TITLE::BeginGmTitle && titleEnum <= CHARACTER_TITLE::EndGmTitle )
{ {
_GMTitle = titleEnum - CHARACTER_TITLE::BeginGmTitle; _GMTitle = titleEnum - CHARACTER_TITLE::BeginGmTitle;
@ -2348,13 +2348,13 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:player:header_opened:player_title")); CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:player:header_opened:player_title"));
if (pVT != NULL) pVT->setText(_Title.toUtf8()); if (pVT != NULL) pVT->setText(_Title);
CGroupContainer *pGC = dynamic_cast<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->setUCTitle(_EntityName);
CSkillManager *pSM = CSkillManager::getInstance(); CSkillManager *pSM = CSkillManager::getInstance();
pSM->setPlayerTitle(_TitleRaw.toUtf8()); pSM->setPlayerTitle(_TitleRaw);
} }
// Must rebuild the in scene interface 'cause name has changed // Must rebuild the in scene interface 'cause name has changed
@ -2368,7 +2368,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const std::string &value)
std::string CEntityCL::getTitleFromName(const std::string &name) std::string CEntityCL::getTitleFromName(const std::string &name)
{ {
std::string::size_type p1 = name.find('$'); std::string::size_type p1 = name.find('$');
if (p1 != ucstring::npos) if (p1 != string::npos)
{ {
std::string::size_type p2 = name.find('$', p1 + 1); std::string::size_type p2 = name.find('$', p1 + 1);
if (p2 != std::string::npos) if (p2 != std::string::npos)
@ -2384,14 +2384,14 @@ std::string CEntityCL::getTitleFromName(const std::string &name)
std::string CEntityCL::removeTitleFromName(const std::string &name) std::string CEntityCL::removeTitleFromName(const std::string &name)
{ {
std::string::size_type p1 = name.find('$'); std::string::size_type p1 = name.find('$');
if (p1 == ucstring::npos) if (p1 == string::npos)
{ {
return name; return name;
} }
else else
{ {
std::string::size_type p2 = name.find('$', p1 + 1); std::string::size_type p2 = name.find('$', p1 + 1);
if (p2 != ucstring::npos) if (p2 != string::npos)
{ {
return name.substr(0, p1) + name.substr(p2 + 1); return name.substr(0, p1) + name.substr(p2 + 1);
} }

@ -638,7 +638,7 @@ public:
// Add hit points gain/lost by this entity. // Add hit points gain/lost by this entity.
void addHPOutput(sint16 hp, NLMISC::CRGBA color, float dt=0.0f) { if(_HPModifiers.size()<20) _HPModifiers.push_back(CHPModifier(hp,color,dt));} void addHPOutput(sint16 hp, NLMISC::CRGBA color, float dt=0.0f) { if(_HPModifiers.size()<20) _HPModifiers.push_back(CHPModifier(hp,color,dt));}
void addHPOutput(const ucstring &text, NLMISC::CRGBA color, float dt=0.0f) { if(_HPModifiers.size()<20 && !text.empty()) _HPModifiers.push_back(CHPModifier(text,color,dt));} void addHPOutput(const std::string &text, NLMISC::CRGBA color, float dt=0.0f) { if(_HPModifiers.size()<20 && !text.empty()) _HPModifiers.push_back(CHPModifier(text,color,dt));}
/// Return the entity sheet scale. (return 1.0 if there is any problem). /// Return the entity sheet scale. (return 1.0 if there is any problem).
virtual float getSheetScale() const {return 1.0f;} virtual float getSheetScale() const {return 1.0f;}
@ -769,25 +769,25 @@ public:
bool isAnOutpostAlly() const; bool isAnOutpostAlly() const;
/// Return the entity title /// Return the entity title
const ucstring &getTitle() const const std::string &getTitle() const
{ {
return _Title; return _Title;
} }
/// Return the entity tags /// Return the entity tags
const ucstring &getTag(uint8 id) const const std::string &getTag(uint8 id) const
{ {
if (_Tags.size() > id) { if (_Tags.size() > id) {
return _Tags[id]; return _Tags[id];
} }
static ucstring empty; static const std::string empty;
return empty; return empty;
} }
/// Return the raw unparsed entity title /// Return the raw unparsed entity title
const ucstring getTitleRaw() const const std::string &getTitleRaw() const
{ {
return ucstring(_TitleRaw); return _TitleRaw;
} }
/// Return true if this entity has a reserved title /// Return true if this entity has a reserved title
@ -933,18 +933,18 @@ protected:
// Current Name for the entity // Current Name for the entity
std::string _EntityName; std::string _EntityName;
// Current entity title // Current entity title
ucstring _Title; std::string _Title;
// Current entity tags // Current entity tags
std::vector<std::string> _Tags; std::vector<std::string> _Tags;
// Current entity title string id // Current entity title string id
ucstring _TitleRaw; std::string _TitleRaw;
// Current permanent content symbol for the entity // Current permanent content symbol for the entity
std::string _PermanentStatutIcon; std::string _PermanentStatutIcon;
// Has reserved title? // Has reserved title?
bool _HasReservedTitle; bool _HasReservedTitle;
// Extended Name // Extended Name
ucstring _NameEx; std::string _NameEx;
// String ID // String ID
uint32 _NameId; uint32 _NameId;
// Primitive used for the collision in PACS // Primitive used for the collision in PACS
@ -995,10 +995,10 @@ protected:
CHPModifier() {} CHPModifier() {}
virtual ~CHPModifier() {} virtual ~CHPModifier() {}
CHPModifier (sint16 value, NLMISC::CRGBA color, float dt) : Value(value), Color(color), DeltaT(dt) {} CHPModifier (sint16 value, NLMISC::CRGBA color, float dt) : Value(value), Color(color), DeltaT(dt) {}
CHPModifier (const ucstring &text, NLMISC::CRGBA color, float dt) : Text(text), Color(color), DeltaT(dt) {} CHPModifier (const std::string &text, NLMISC::CRGBA color, float dt) : Text(text), Color(color), DeltaT(dt) {}
sint16 Value; // If Text.empty(), take the Value sint16 Value; // If Text.empty(), take the Value
ucstring Text; std::string Text;
NLMISC::CRGBA Color; NLMISC::CRGBA Color;
float DeltaT; float DeltaT;
}; };

@ -927,7 +927,7 @@ retryJoinEdit:
} }
} }
pIM->messageBoxWithHelp( pIM->messageBoxWithHelp(
CI18N::get(requestRetToMainland ? "uiSessionVanishedFarTP" : "uiSessionUnreachable") + ucstring(errorMsg), CI18N::get(requestRetToMainland ? "uiSessionVanishedFarTP" : "uiSessionUnreachable") + errorMsg,
letReturnToCharSelect ? "ui:outgame:charsel" : "ui:interface"); letReturnToCharSelect ? "ui:outgame:charsel" : "ui:interface");
// Info in the log // Info in the log
@ -1117,7 +1117,7 @@ void CFarTP::disconnectFromPreviousShard()
// Start progress bar and display background // Start progress bar and display background
ProgressBar.reset (BAR_STEP_TP); ProgressBar.reset (BAR_STEP_TP);
ucstring nmsg("Loading..."); string nmsg("Loading...");
ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) );
ProgressBar.progress(0); ProgressBar.progress(0);

@ -623,7 +623,7 @@ void CForageSourceCL::displayModifiers()
{ {
uint16 qttyDelta = ((uint16)mod.Value) & 0xFF; uint16 qttyDelta = ((uint16)mod.Value) & 0xFF;
uint16 qlty = ((uint16)mod.Value) >> 8; uint16 qlty = ((uint16)mod.Value) >> 8;
ucstring hpModifier = ucstring(toString("%u ", qttyDelta) + CI18N::get("uittQualityAbbrev") + toString(" %u", qlty)); string hpModifier = toString("%u ", qttyDelta) + CI18N::get("uittQualityAbbrev") + toString(" %u", qlty);
double t = TimeInSec-mod.Time; double t = TimeInSec-mod.Time;
// Compute the position for the Modifier. // Compute the position for the Modifier.
CVector pos= namePos + CVector(0.0f, 0.0f, 0.3f+(float)t*1.0f/totalDuration); CVector pos= namePos + CVector(0.0f, 0.0f, 0.3f+(float)t*1.0f/totalDuration);

@ -707,13 +707,13 @@ void CGameContextMenu::updateContextMenuMissionsOptions( bool forceHide )
uint32 textID = (uint32) _MissionOption[k]->getValue32(); uint32 textID = (uint32) _MissionOption[k]->getValue32();
if (textID) if (textID)
{ {
ucstring result; string result;
bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, result); bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, result);
if (!res) if (!res)
{ {
result = NLMISC::CI18N::get("uiMissionOptionNotReceived"); result = NLMISC::CI18N::get("uiMissionOptionNotReceived");
} }
pVTM->setText(result.toUtf8()); pVTM->setText(result);
pVTM->setActive(true); pVTM->setActive(true);
} }
else else
@ -748,13 +748,13 @@ void CGameContextMenu::updateContextMenuWebPage(uint options)
uint32 textID = (uint32) _WebPageTitle->getValue32(); uint32 textID = (uint32) _WebPageTitle->getValue32();
if (textID) if (textID)
{ {
ucstring result; string result;
bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, result); bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textID, result);
if (!res) if (!res)
{ {
result = NLMISC::CI18N::get("uiWebPageNameNotReceived"); result = NLMISC::CI18N::get("uiWebPageNameNotReceived");
} }
pVTM->setText(result.toUtf8()); pVTM->setText(result);
} }
else else
{ {
@ -828,13 +828,13 @@ void CGameContextMenu::updateContextMenuMissionRing()
// if the textId is ok and Flag is set. // if the textId is ok and Flag is set.
if ( textId ) if ( textId )
{ {
ucstring result; string result;
bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, result); bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, result);
if (!res) if (!res)
{ {
result = NLMISC::CI18N::get("uiMissionRingNameNotReceived"); result = NLMISC::CI18N::get("uiMissionRingNameNotReceived");
} }
pVTM->setText(result.toUtf8()); pVTM->setText(result);
pVTM->setActive(true); pVTM->setActive(true);
} }
else else

@ -262,7 +262,7 @@ char *XmlStrdup4NeL (const char *str)
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
static ucstring CurrentErrorMessage; static std::wstring CurrentErrorMessage;
static INT_PTR CALLBACK ExitClientErrorDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM /* lParam */) static INT_PTR CALLBACK ExitClientErrorDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM /* lParam */)
{ {
@ -338,7 +338,7 @@ void ExitClientError (const char *format, ...)
} }
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
CurrentErrorMessage.fromUtf8(str); CurrentErrorMessage = NLMISC::utf8ToWide(str);
DialogBox(HInstance, MAKEINTRESOURCE(IDD_ERROR_HELP_MESSAGE_BOX), NULL, ExitClientErrorDialogProc); DialogBox(HInstance, MAKEINTRESOURCE(IDD_ERROR_HELP_MESSAGE_BOX), NULL, ExitClientErrorDialogProc);
/* /*
ucstring ucstr; ucstring ucstr;
@ -937,7 +937,7 @@ void prelogInit()
initDebugMemory(); initDebugMemory();
// Load the application configuration. // Load the application configuration.
ucstring nmsg("Loading config file..."); string nmsg("Loading config file...");
ProgressBar.newMessage (nmsg); ProgressBar.newMessage (nmsg);
ClientCfg.init(ConfigFileName); ClientCfg.init(ConfigFileName);
@ -1533,7 +1533,7 @@ void postlogInit()
Driver->clearBuffers(CRGBA::Black); Driver->clearBuffers(CRGBA::Black);
Driver->swapBuffers(); Driver->swapBuffers();
CNiceInputAuto niceInputs; CNiceInputAuto niceInputs;
ucstring nmsg; string nmsg;
try try
{ {

@ -481,7 +481,7 @@ void initMainLoop()
// Progress bar for init_main_loop() // Progress bar for init_main_loop()
ProgressBar.reset (BAR_STEP_INIT_MAIN_LOOP); ProgressBar.reset (BAR_STEP_INIT_MAIN_LOOP);
ucstring nmsg; string nmsg;
FPU_CHECKER_ONCE FPU_CHECKER_ONCE
@ -1029,7 +1029,7 @@ void initMainLoop()
// PreLoad Fauna and Characters // PreLoad Fauna and Characters
if (!ClientCfg.Light && ClientCfg.PreCacheShapes) if (!ClientCfg.Light && ClientCfg.PreCacheShapes)
{ {
ucstring nmsg("Loading character shapes ..."); string nmsg("Loading character shapes ...");
ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) );

@ -647,7 +647,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
if (!im->isInGame()) return; if (!im->isInGame()) return;
// there was no / at the start of the line so try to cycle through the last people on which a tell was done // there was no / at the start of the line so try to cycle through the last people on which a tell was done
const ucstring *lastTellPeople = ChatMngr.cycleLastTell(); const string *lastTellPeople = ChatMngr.cycleLastTell();
if (!lastTellPeople) return; if (!lastTellPeople) return;
// Get chat box from ist edit box // Get chat box from ist edit box
// If it isn't a user chat or the main chat, just display 'tell' with the name. Otherwise, change the target of the window // If it isn't a user chat or the main chat, just display 'tell' with the name. Otherwise, change the target of the window
@ -661,7 +661,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit
else else
{ {
// it is not a filtered chat, display 'tell' (must be ingame) // it is not a filtered chat, display 'tell' (must be ingame)
_GroupEdit->setCommand("tell " + (*lastTellPeople).toUtf8() + ' ', false); _GroupEdit->setCommand("tell " + (*lastTellPeople) + ' ', false);
} }
} }
}; };

@ -192,9 +192,9 @@ public:
CEntityCL *selection = EntitiesMngr.entity(UserEntity->selection()); CEntityCL *selection = EntitiesMngr.entity(UserEntity->selection());
if (selection && selection->Type == CEntityCL::Player) if (selection && selection->Type == CEntityCL::Player)
{ {
ucstring name = CEntityCL::removeTitleAndShardFromName(selection->getEntityName()); string name = CEntityCL::removeTitleAndShardFromName(selection->getEntityName());
if (name.empty()) return; if (name.empty()) return;
CAHManager::getInstance()->runActionHandler("enter_tell", pCaller, "player=" + name.toString()); CAHManager::getInstance()->runActionHandler("enter_tell", pCaller, "player=" + name);
} }
} }
protected: protected:
@ -1358,19 +1358,19 @@ class CSelectItemSheet : public IActionHandler
// display msg in the system infos // display msg in the system infos
if (!canUse) if (!canUse)
{ {
ucstring msg = CI18N::get("msgCantUseItem"); string msg = CI18N::get("msgCantUseItem");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
im->displaySystemInfo(msg, cat); im->displaySystemInfo(msg, cat);
} }
if (!canBuild) if (!canBuild)
{ {
ucstring msg = CI18N::get("msgCantBuild"); string msg = CI18N::get("msgCantBuild");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
im->displaySystemInfo(msg, cat); im->displaySystemInfo(msg, cat);
} }
if (!canUseBuiltItem) if (!canUseBuiltItem)
{ {
ucstring msg = CI18N::get("msgCantUseBuiltItem"); string msg = CI18N::get("msgCantUseBuiltItem");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
im->displaySystemInfo(msg, cat); im->displaySystemInfo(msg, cat);
} }
@ -1941,13 +1941,13 @@ public:
sint32 Slot; sint32 Slot;
bool cbIDStringReceived(ucstring &inout) bool cbIDStringReceived(string &inout)
{ {
if (UserEntity != NULL) if (UserEntity != NULL)
{ {
if (UserEntity->selection() == Slot) if (UserEntity->selection() == Slot)
{ {
ucstring copyInout = inout; string copyInout = inout;
CStringPostProcessRemoveTitle::cbIDStringReceived(inout); CStringPostProcessRemoveTitle::cbIDStringReceived(inout);
if (inout.empty()) if (inout.empty())
{ {
@ -1957,13 +1957,13 @@ public:
if (pChar != NULL) if (pChar != NULL)
womanTitle = pChar->getGender() == GSGENDER::female; womanTitle = pChar->getGender() == GSGENDER::female;
STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout.toUtf8()), womanTitle); copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle);
// Sometimes translation contains another title // Sometimes translation contains another title
ucstring::size_type pos = copyInout.find('$'); string::size_type pos = copyInout.find('$');
if (pos != ucstring::npos) if (pos != string::npos)
{ {
copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout.toUtf8()), womanTitle); copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle);
} }
CStringPostProcessRemoveTitle::cbIDStringReceived(copyInout); CStringPostProcessRemoveTitle::cbIDStringReceived(copyInout);
@ -1985,7 +1985,7 @@ public:
sint32 Slot; sint32 Slot;
bool cbIDStringReceived(ucstring &inout) bool cbIDStringReceived(string &inout)
{ {
if (UserEntity != NULL) if (UserEntity != NULL)
{ {
@ -2036,8 +2036,8 @@ class CActionHandlerSetTargetName : public IActionHandler
{ {
sint32 nSlot = (sint32)evValue.getInteger(); sint32 nSlot = (sint32)evValue.getInteger();
ucstring TargetName; string TargetName;
ucstring TargetTitle; string TargetTitle;
// Get from nSlot // Get from nSlot
if (nSlot > -1) if (nSlot > -1)
@ -2071,9 +2071,9 @@ class CActionHandlerSetTargetName : public IActionHandler
} }
// Set to target // Set to target
CInterfaceExprValue evUCStr; CInterfaceExprValue evUCStr;
evUCStr.setString(TargetName.toUtf8()); evUCStr.setString(TargetName);
CInterfaceLink::setTargetProperty(sNameTarget, evUCStr); CInterfaceLink::setTargetProperty(sNameTarget, evUCStr);
evUCStr.setString(TargetTitle.toUtf8()); evUCStr.setString(TargetTitle);
CInterfaceLink::setTargetProperty(sTitleTarget, evUCStr); CInterfaceLink::setTargetProperty(sTitleTarget, evUCStr);
} }
} }
@ -2421,28 +2421,27 @@ class CAHTarget : public IActionHandler
{ {
virtual void execute (CCtrlBase * /* pCaller */, const string &Params) virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
{ {
ucstring entityName; string entityName = getParam(Params, "entity");
entityName.fromUtf8(getParam(Params, "entity"));
if (entityName.empty()) return; if (entityName.empty()) return;
string completeMatch = getParam(Params, "prefer_complete_match"); string completeMatch = getParam(Params, "prefer_complete_match");
bool quiet = (getParam (Params, "quiet") == "true"); bool quiet = (getParam (Params, "quiet") == "true");
vector<ucstring> keywords; vector<string> keywords;
NLMISC::splitUCString(entityName, ucstring(" "), keywords); NLMISC::splitString(entityName, " ", keywords);
if (!keywords.empty() && keywords[0].size() > 0 && keywords[0][0] == (ucchar)'"') if (!keywords.empty() && keywords[0].size() > 0 && keywords[0][0] == '"')
{ {
// entity name is in quotes, do old style match with 'starts with' filter // entity name is in quotes, do old style match with 'starts with' filter
// search for optional second parameter from old command for prefer_complete_match param // search for optional second parameter from old command for prefer_complete_match param
keywords.clear(); keywords.clear();
ucstring::size_type lastOf = entityName.rfind(ucstring("\"")); string::size_type lastOf = entityName.rfind("\"");
if (lastOf == 0) if (lastOf == 0)
lastOf = ucstring::npos; lastOf = string::npos;
// override the value only when there is no 'prefer_complete_match' parameter set // override the value only when there is no 'prefer_complete_match' parameter set
if (completeMatch.empty() && lastOf < entityName.size()) if (completeMatch.empty() && lastOf < entityName.size())
completeMatch = trim(entityName.substr(lastOf+1).toUtf8()); completeMatch = trim(entityName.substr(lastOf+1));
entityName = entityName.substr(1, lastOf-1); entityName = entityName.substr(1, lastOf-1);
} }
@ -2471,7 +2470,7 @@ class CAHTarget : public IActionHandler
if (entity == NULL) if (entity == NULL)
{ {
//Get the entity with a sheetName //Get the entity with a sheetName
entity = EntitiesMngr.getEntityBySheetName(entityName.toUtf8()); entity = EntitiesMngr.getEntityBySheetName(entityName);
} }
if (entity && entity->properties().selectable() && !entity->getDisplayName().empty()) if (entity && entity->properties().selectable() && !entity->getDisplayName().empty())
@ -2755,8 +2754,7 @@ class CAHAssist : public IActionHandler
virtual void execute (CCtrlBase * /* pCaller */, const string &Params) virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
{ {
// Get the entity name to target // Get the entity name to target
ucstring entityName; string entityName = getParam (Params, "entity");
entityName.fromUtf8 (getParam (Params, "entity"));
if (!entityName.empty()) if (!entityName.empty())
{ {
// Get the entity // Get the entity
@ -3785,7 +3783,7 @@ class CHandlerSetInterfaceScale : public IActionHandler
} }
} }
ucstring help("/setuiscale "+toString("%.1f .. %.1f", ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max)); string help = "/setuiscale "+toString("%.1f .. %.1f", ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max);
CInterfaceManager::getInstance()->displaySystemInfo(help); CInterfaceManager::getInstance()->displaySystemInfo(help);
} }
}; };
@ -3969,7 +3967,7 @@ public:
// display parry mode msg // display parry mode msg
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgUserModeParry"); string msg = CI18N::get("msgUserModeParry");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
} }
@ -3986,7 +3984,7 @@ public:
// display dodge mode msg // display dodge mode msg
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgUserModeDodge"); string msg = CI18N::get("msgUserModeDodge");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
} }
@ -4014,7 +4012,7 @@ REGISTER_ACTION_HANDLER(CHandlerSelectProtectedSlot, "select_protected_slot");
// *************************************************************************** // ***************************************************************************
// Common code // Common code
//static void fillPlayerBarText(ucstring &str, const string &dbScore, const string &dbScoreMax, const string &ttFormat) //static void fillPlayerBarText(ucstring &str, const string &dbScore, const string &dbScoreMax, const string &ttFormat)
static void fillPlayerBarText(ucstring &str, const string &dbScore, SCORES::TScores score, const string &ttFormat) static void fillPlayerBarText(std::string &str, const string &dbScore, SCORES::TScores score, const string &ttFormat)
{ {
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
CCDBNodeLeaf *node; CCDBNodeLeaf *node;
@ -4044,10 +4042,10 @@ public:
{ {
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring str; string str;
fillPlayerBarText(str, "HP", SCORES::hit_points, "uittPlayerLifeFormat"); fillPlayerBarText(str, "HP", SCORES::hit_points, "uittPlayerLifeFormat");
CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); CWidgetManager::getInstance()->setContextHelpText(str);
} }
}; };
REGISTER_ACTION_HANDLER(CHandlerPlayerTTLife, "player_tt_life"); REGISTER_ACTION_HANDLER(CHandlerPlayerTTLife, "player_tt_life");
@ -4061,10 +4059,10 @@ public:
{ {
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring str; string str;
fillPlayerBarText(str, "STA", SCORES::stamina, "uittPlayerStaminaFormat"); fillPlayerBarText(str, "STA", SCORES::stamina, "uittPlayerStaminaFormat");
CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); CWidgetManager::getInstance()->setContextHelpText(str);
} }
}; };
REGISTER_ACTION_HANDLER(CHandlerPlayerTTStamina, "player_tt_stamina"); REGISTER_ACTION_HANDLER(CHandlerPlayerTTStamina, "player_tt_stamina");
@ -4078,10 +4076,10 @@ public:
{ {
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring str; string str;
fillPlayerBarText(str, "SAP", SCORES::sap, "uittPlayerSapFormat"); fillPlayerBarText(str, "SAP", SCORES::sap, "uittPlayerSapFormat");
CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); CWidgetManager::getInstance()->setContextHelpText(str);
} }
}; };
REGISTER_ACTION_HANDLER(CHandlerPlayerTTSap, "player_tt_sap"); REGISTER_ACTION_HANDLER(CHandlerPlayerTTSap, "player_tt_sap");
@ -4095,10 +4093,10 @@ public:
{ {
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring str; string str;
fillPlayerBarText(str, "FOCUS", SCORES::focus, "uittPlayerFocusFormat"); fillPlayerBarText(str, "FOCUS", SCORES::focus, "uittPlayerFocusFormat");
CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); CWidgetManager::getInstance()->setContextHelpText(str);
} }
}; };
REGISTER_ACTION_HANDLER(CHandlerPlayerTTFocus, "player_tt_focus"); REGISTER_ACTION_HANDLER(CHandlerPlayerTTFocus, "player_tt_focus");
@ -4125,10 +4123,10 @@ public:
maxVal= node->getValue32(); maxVal= node->getValue32();
// Replace in the formated text // Replace in the formated text
ucstring str= CI18N::get("uittBulkFormat"); string str= CI18N::get("uittBulkFormat");
strFindReplace(str, "%v", toString("%.2f", val) ); strFindReplace(str, "%v", toString("%.2f", val) );
strFindReplace(str, "%m", toString(maxVal) ); strFindReplace(str, "%m", toString(maxVal) );
CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); CWidgetManager::getInstance()->setContextHelpText(str);
} }
}; };
REGISTER_ACTION_HANDLER(CHandlerGetTTBulk, "get_tt_bulk"); REGISTER_ACTION_HANDLER(CHandlerGetTTBulk, "get_tt_bulk");
@ -4521,7 +4519,7 @@ public:
if( sCustomPhrase.empty() ) if( sCustomPhrase.empty() )
{ {
// Create the message and send. // Create the message and send.
const string msgName = "COMMAND:EMOTE"; static const string msgName = "COMMAND:EMOTE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4536,11 +4534,11 @@ public:
else else
{ {
// Create the message and send. // Create the message and send.
const string msgName = "COMMAND:CUSTOM_EMOTE"; static const string msgName = "COMMAND:CUSTOM_EMOTE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
ucstring ucstr; ucstring ucstr; // FIXME: UTF-8 (serial)
ucstr.fromUtf8(sCustomPhrase); ucstr.fromUtf8(sCustomPhrase);
if( sCustomPhrase == "none" ) if( sCustomPhrase == "none" )
@ -4549,7 +4547,7 @@ public:
{ {
// display "no animation for emote" // display "no animation for emote"
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgCustomizedEmoteNoAnim"); string msg = CI18N::get("msgCustomizedEmoteNoAnim");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
return; return;
@ -4561,7 +4559,7 @@ public:
} }
out.serialEnum(behavToSend); out.serialEnum(behavToSend);
out.serial(ucstr); out.serial(ucstr); // FIXME: UTF-8 (serial)
NetMngr.push(out); NetMngr.push(out);
//nlinfo("impulseCallBack : %s %d %s sent", msgName.c_str(), (uint32)behavToSend, sCustomPhrase.c_str()); //nlinfo("impulseCallBack : %s %d %s sent", msgName.c_str(), (uint32)behavToSend, sCustomPhrase.c_str());
} }

@ -3625,11 +3625,11 @@ public:
return; return;
} }
ucstring txt; string txt;
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:NAME", index)); CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:NAME", index));
if (node && CStringManagerClient::instance()->getDynString(node->getValue32(), txt)) if (node && CStringManagerClient::instance()->getDynString(node->getValue32(), txt))
{ {
CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt.toUtf8())); CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt));
} }
} }
}; };

@ -1718,10 +1718,11 @@ void CItemMenuInBagInfoWaiter::infoValidated(CDBCtrlSheet* ctrlSheet)
// get the CreatorTextID // get the CreatorTextID
bool isCraftedByUserEntity = false; bool isCraftedByUserEntity = false;
ucstring creatorNameString; string creatorNameString;
if( STRING_MANAGER::CStringManagerClient::instance()->getString ( itemInfo.CreatorName, creatorNameString) ) if( STRING_MANAGER::CStringManagerClient::instance()->getString ( itemInfo.CreatorName, creatorNameString) )
{ {
if ( toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString.toUtf8())) std::string userNameString = UserEntity->getEntityName() + PlayerSelectedHomeShardNameWithParenthesis;
if (NLMISC::compareCaseInsensitive(userNameString, creatorNameString) == 0)
isCraftedByUserEntity = true; isCraftedByUserEntity = true;
} }
@ -1824,10 +1825,11 @@ class CHandlerItemMenuCheck : public IActionHandler
if (getInventory().isItemInfoUpToDate(getInventory().getItemSlotId(pCS))) if (getInventory().isItemInfoUpToDate(getInventory().getItemSlotId(pCS)))
{ {
// get the CreatorTextID // get the CreatorTextID
ucstring creatorNameString; string creatorNameString;
if( STRING_MANAGER::CStringManagerClient::instance()->getString ( getInventory().getItemInfo(getInventory().getItemSlotId(pCS)).CreatorName, creatorNameString) ) if( STRING_MANAGER::CStringManagerClient::instance()->getString ( getInventory().getItemInfo(getInventory().getItemSlotId(pCS)).CreatorName, creatorNameString) )
{ {
if (toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString.toUtf8())) string userNameString = UserEntity->getEntityName() + PlayerSelectedHomeShardNameWithParenthesis;
if (NLMISC::compareCaseInsensitive(userNameString, creatorNameString) == 0)
isTextEditionActive = true; isTextEditionActive = true;
} }
} }

@ -598,7 +598,7 @@ void getBuffer (CBitmap &btm)
void displayScreenShotSavedInfo(const string &filename) void displayScreenShotSavedInfo(const string &filename)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring msg("'" + filename + "' " + CI18N::get("uiScreenshotSaved")); string msg = "'" + filename + "' " + CI18N::get("uiScreenshotSaved");
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
} }
@ -885,7 +885,7 @@ class CAHCycleTell : public IActionHandler
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
if (!im->isInGame()) return; if (!im->isInGame()) return;
const ucstring *lastTellPeople = ChatMngr.cycleLastTell(); const string *lastTellPeople = ChatMngr.cycleLastTell();
if (!lastTellPeople) return; if (!lastTellPeople) return;
// just popup the main chat // just popup the main chat
//CChatWindow *w = PeopleInterraction.MainChat.Window; //CChatWindow *w = PeopleInterraction.MainChat.Window;
@ -913,10 +913,10 @@ NLMISC_COMMAND(slsn, "Temp : set the name of the last sender.", "<name>")
} }
// *************************************************************************** // ***************************************************************************
bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut) bool CStringPostProcessRemoveName::cbIDStringReceived(string &inOut)
{ {
// extract the replacement id // extract the replacement id
string strNewTitle = CEntityCL::getTitleFromName(inOut.toUtf8()); string strNewTitle = CEntityCL::getTitleFromName(inOut);
// retrieve the translated string // retrieve the translated string
if (!strNewTitle.empty()) if (!strNewTitle.empty())
@ -927,7 +927,7 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut)
ucstring::size_type pos = inOut.find('$'); ucstring::size_type pos = inOut.find('$');
if (pos != ucstring::npos) if (pos != ucstring::npos)
{ {
inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(inOut.toUtf8()), Woman); inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(inOut), Woman);
} }
} }
} }
@ -938,16 +938,16 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut)
} }
// *************************************************************************** // ***************************************************************************
bool CStringPostProcessRemoveTitle::cbIDStringReceived(ucstring &inOut) bool CStringPostProcessRemoveTitle::cbIDStringReceived(string &inOut)
{ {
inOut = CEntityCL::removeTitleAndShardFromName(inOut.toUtf8()); inOut = CEntityCL::removeTitleAndShardFromName(inOut);
return true; return true;
} }
// *************************************************************************** // ***************************************************************************
bool CStringPostProcessNPCRemoveTitle::cbIDStringReceived(ucstring &inOut) bool CStringPostProcessNPCRemoveTitle::cbIDStringReceived(string &inOut)
{ {
ucstring sOut = CEntityCL::removeTitleAndShardFromName(inOut.toUtf8()); string sOut = CEntityCL::removeTitleAndShardFromName(inOut);
if (sOut.empty()) if (sOut.empty())
{ {
CStringPostProcessRemoveName SPPRM; CStringPostProcessRemoveName SPPRM;

@ -157,7 +157,7 @@ class CStringPostProcessRemoveName : public CInterfaceManager::IStringProcess
public: public:
CStringPostProcessRemoveName():Woman(false) {} CStringPostProcessRemoveName():Woman(false) {}
bool Woman; bool Woman;
bool cbIDStringReceived(ucstring &inOut); bool cbIDStringReceived(std::string &inOut);
}; };
// *************************************************************************** // ***************************************************************************
@ -165,7 +165,7 @@ public:
class CStringPostProcessRemoveTitle : public CInterfaceManager::IStringProcess class CStringPostProcessRemoveTitle : public CInterfaceManager::IStringProcess
{ {
public: public:
bool cbIDStringReceived(ucstring &inOut); bool cbIDStringReceived(std::string &inOut);
}; };
// *************************************************************************** // ***************************************************************************
@ -173,7 +173,7 @@ public:
class CStringPostProcessNPCRemoveTitle : public CInterfaceManager::IStringProcess class CStringPostProcessNPCRemoveTitle : public CInterfaceManager::IStringProcess
{ {
public: public:
bool cbIDStringReceived(ucstring &inOut); bool cbIDStringReceived(std::string &inOut);
}; };

@ -441,7 +441,7 @@ class CAHToggleDodgeParry : public IActionHandler
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring msg; string msg;
// 0 - dodge mode // 0 - dodge mode
// 1 - parry mode // 1 - parry mode
if (NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DEFENSE:DEFENSE_MODE")->getValue32() == 0) if (NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DEFENSE:DEFENSE_MODE")->getValue32() == 0)

@ -1173,7 +1173,7 @@ public:
{ {
// display "you can't cast while moving" // display "you can't cast while moving"
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgNoCastWhileMoving"); string msg = CI18N::get("msgNoCastWhileMoving");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
return; return;
@ -1417,7 +1417,7 @@ public:
else else
{ {
// debug: // debug:
pIM->displaySystemInfo( ucstring("PHRASE:CANCEL_ALL") ); pIM->displaySystemInfo("PHRASE:CANCEL_ALL");
} }
} }
}; };

@ -164,11 +164,11 @@ void CBotChatPageDynamicMission::update()
{ {
uint32 textID = (uint32) NLGUI::CDBManager::getInstance()->getDbProp(toString(DM_CHOICE "%d:%d:TEXT", (int) k, (int) l))->getValue32(); uint32 textID = (uint32) NLGUI::CDBManager::getInstance()->getDbProp(toString(DM_CHOICE "%d:%d:TEXT", (int) k, (int) l))->getValue32();
// see if text has been receive // see if text has been receive
ucstring result; string result;
bool received = CStringManagerClient::instance()->getDynString(textID, result); bool received = CStringManagerClient::instance()->getDynString(textID, result);
if (received) if (received)
{ {
_ChoiceCB[k]->setText(l, result.toUtf8()); _ChoiceCB[k]->setText(l, result);
_TextReceived[k][l] = true; _TextReceived[k][l] = true;
} }
} }
@ -180,11 +180,11 @@ void CBotChatPageDynamicMission::update()
uint32 textID = (uint32) NLGUI::CDBManager::getInstance()->getDbProp(toString(DM_CHOICE "%d:%d:TEXT", (int) k, (int) l))->getValue32(); uint32 textID = (uint32) NLGUI::CDBManager::getInstance()->getDbProp(toString(DM_CHOICE "%d:%d:TEXT", (int) k, (int) l))->getValue32();
if (textID == 0 && !ClientCfg.Local) break; if (textID == 0 && !ClientCfg.Local) break;
// see if text has been received // see if text has been received
ucstring result; string result;
bool received = CStringManagerClient::instance()->getDynString(textID, result); bool received = CStringManagerClient::instance()->getDynString(textID, result);
if (received) if (received)
{ {
_ChoiceCB[k]->addText(result.toUtf8()); _ChoiceCB[k]->addText(result);
_TextReceived[k][l] = true; _TextReceived[k][l] = true;
} }
else else
@ -207,7 +207,7 @@ void CBotChatPageDynamicMission::update()
uint32 textID = NLGUI::CDBManager::getInstance()->getDbProp(DM_TITLE_DB_PATH)->getValue32(); uint32 textID = NLGUI::CDBManager::getInstance()->getDbProp(DM_TITLE_DB_PATH)->getValue32();
if (textID != 0) if (textID != 0)
{ {
ucstring result; string result;
if (CStringManagerClient::instance()->getDynString(textID, result)) if (CStringManagerClient::instance()->getDynString(textID, result))
{ {
textID = NLGUI::CDBManager::getInstance()->getDbProp(DM_DESCRIPTION_DB_PATH)->getValue32(); textID = NLGUI::CDBManager::getInstance()->getDbProp(DM_DESCRIPTION_DB_PATH)->getValue32();

@ -97,7 +97,7 @@ public:
std::vector<SDispString> &rVal = acces.value (); std::vector<SDispString> &rVal = acces.value ();
for (uint i = 0; i < rVal.size(); ++i) for (uint i = 0; i < rVal.size(); ++i)
{ {
CInterfaceManager::getInstance()->displayDebugInfo(ucstring(rVal[i].Str), rVal[i].Mode); CInterfaceManager::getInstance()->displayDebugInfo(rVal[i].Str, rVal[i].Mode);
} }
rVal.clear(); rVal.clear();
} }

@ -170,7 +170,7 @@ void CChatInputFilter::chatWindowRemoved(CChatWindow *cw)
} }
//============================================================================================================= //=============================================================================================================
void CChatInputFilter::displayMessage(const ucstring &msg, NLMISC::CRGBA col, uint numBlinks /*=0*/, bool *windowVisible) void CChatInputFilter::displayMessage(const string &msg, NLMISC::CRGBA col, uint numBlinks /*=0*/, bool *windowVisible)
{ {
bool windowVisibleTmp = false; bool windowVisibleTmp = false;
std::vector<CChatWindow *>::iterator it; std::vector<CChatWindow *>::iterator it;
@ -187,10 +187,9 @@ void CChatInputFilter::displayMessage(const ucstring &msg, NLMISC::CRGBA col, ui
} }
//============================================================================================================= //=============================================================================================================
void CChatInputFilter::displayTellMessage(/*TDataSetIndex &receiverIndex, */const ucstring &msg, const ucstring &sender, NLMISC::CRGBA col, uint numBlinks /*=0*/,bool *windowVisible /*=NULL*/) void CChatInputFilter::displayTellMessage(/*TDataSetIndex &receiverIndex, */const string &msg, const string &sender, NLMISC::CRGBA col, uint numBlinks /*=0*/,bool *windowVisible /*=NULL*/)
{ {
ucstring senderLwr; string senderLwr = NLMISC::toLower(sender);
senderLwr.fromUtf8(NLMISC::toLower(sender.toUtf8()));
// look in people lists // look in people lists
std::vector<CPeopleList *>::iterator peopleListIt; std::vector<CPeopleList *>::iterator peopleListIt;
@ -290,7 +289,7 @@ void CChatTargetFilter::setChat(CChatWindow *w)
} }
//============================================================================================================= //=============================================================================================================
void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow) void CChatTargetFilter::msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
// Common Target case // Common Target case
if (ClientCfg.Local) if (ClientCfg.Local)
@ -307,9 +306,9 @@ void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow)
else if (!_TargetPlayer.empty()) else if (!_TargetPlayer.empty())
{ {
// the target must be a player, make a tell on him // the target must be a player, make a tell on him
ChatMngr.tell(_TargetPlayer.toString(), msg); ChatMngr.tell(_TargetPlayer, msg);
// direct output in the chat // direct output in the chat
chatWindow->displayLocalPlayerTell(_TargetPlayer.toString(), msg); chatWindow->displayLocalPlayerTell(_TargetPlayer, msg);
} }
else else
{ {
@ -334,7 +333,7 @@ void CChatTargetFilter::setTargetPartyChat(CChatWindow *w)
} }
//============================================================================================================= //=============================================================================================================
void CChatTargetFilter::setTargetPlayer(const ucstring &targetPlayer) void CChatTargetFilter::setTargetPlayer(const string &targetPlayer)
{ {
_TargetPlayer = targetPlayer; _TargetPlayer = targetPlayer;
if (_TargetPartyChat) if (_TargetPartyChat)
@ -345,7 +344,7 @@ void CChatTargetFilter::setTargetPlayer(const ucstring &targetPlayer)
// set the prompt // set the prompt
if (_Chat) if (_Chat)
{ {
_Chat->setPrompt(targetPlayer + (ucchar) '>'); _Chat->setPrompt(targetPlayer + '>');
} }
} }

@ -42,10 +42,10 @@ public:
* Listening windows will blick only if there isnt a single visible listening window, so that the player can know if there's a message * Listening windows will blick only if there isnt a single visible listening window, so that the player can know if there's a message
* \param windowVisible is not NULL, points a bool that will be filled with true if one of the window on the which the msg was displayed is visible. * \param windowVisible is not NULL, points a bool that will be filled with true if one of the window on the which the msg was displayed is visible.
*/ */
void displayMessage(const ucstring &msg, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); void displayMessage(const std::string &msg, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL);
/** The same as displayMessage, but with sender name, so that the msg will be displayed in attached people lists as well /** The same as displayMessage, but with sender name, so that the msg will be displayed in attached people lists as well
*/ */
void displayTellMessage(/*TDataSetIndex &senderIndex, */const ucstring &msg, const ucstring &sender, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); void displayTellMessage(/*TDataSetIndex &senderIndex, */const std::string &msg, const std::string &sender, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL);
/** Clear the messages in all registered chat windows /** Clear the messages in all registered chat windows
*/ */
void clearMessages(); void clearMessages();
@ -134,8 +134,8 @@ public:
/** Set a player as the target. This remove any previous window target /** Set a player as the target. This remove any previous window target
* NB : this replace any previous party chat or target group or player * NB : this replace any previous party chat or target group or player
*/ */
void setTargetPlayer(const ucstring &targetPlayer); void setTargetPlayer(const std::string &targetPlayer);
const ucstring &getTargetPlayer() const { return _TargetPlayer; } const std::string &getTargetPlayer() const { return _TargetPlayer; }
//@} //@}
private: private:
@ -148,14 +148,14 @@ private:
// @{ // @{
CChatWindow *_TargetPartyChat; // the target party chat CChatWindow *_TargetPartyChat; // the target party chat
CChatGroup::TGroupType _TargetGroup; CChatGroup::TGroupType _TargetGroup;
ucstring _TargetPlayer; std::string _TargetPlayer;
// relevant only if _TargetGroup==dyn_chat // relevant only if _TargetGroup==dyn_chat
uint32 _TargetDynamicChannelDbIndex; uint32 _TargetDynamicChannelDbIndex;
// @} // @}
private: private:
// from IChatWindowListener // from IChatWindowListener
void chatWindowRemoved(CChatWindow *cw); void chatWindowRemoved(CChatWindow *cw);
void msgEntered(const ucstring &msg, CChatWindow *chatWindow); void msgEntered(const std::string &msg, CChatWindow *chatWindow);
// copy not supported // copy not supported
CChatTargetFilter(const CChatTargetFilter &/* other */):NLMISC::CRefCount() { nlassert(0); } CChatTargetFilter(const CChatTargetFilter &/* other */):NLMISC::CRefCount() { nlassert(0); }
CChatTargetFilter& operator=(const CChatTargetFilter &/* other */) { nlassert(0); return *this; } CChatTargetFilter& operator=(const CChatTargetFilter &/* other */) { nlassert(0); return *this; }

@ -106,15 +106,13 @@ bool CChatTextManager::showTimestamps() const
} }
//================================================================================= //=================================================================================
static CInterfaceGroup *parseCommandTag(ucstring &line) static CInterfaceGroup *parseCommandTag(string &line)
{ {
string::size_type start = line.find(ucstring("/$$")); string::size_type start = line.find("/$$");
if (start == string::npos) return NULL; if (start == string::npos) return NULL;
string::size_type end = line.find(ucstring("$$/"), start + 3); string::size_type end = line.find("$$/", start + 3);
if (end == string::npos) return NULL; if (end == string::npos) return NULL;
std::string commandLine; std::string commandLine = line.substr(start + 3, end - start - 3);
ucstring ucCommandLine = line.substr(start + 3, end - start - 3);
ucCommandLine.toString(commandLine);
line = line.substr(0, start) + line.substr(end +3); line = line.substr(0, start) + line.substr(end +3);
vector<string> params; vector<string> params;
explode(commandLine, std::string("|"), params); explode(commandLine, std::string("|"), params);
@ -221,11 +219,11 @@ static inline bool isUrlTag(const ucstring &s, ucstring::size_type index, ucstri
// *************************************************************************** // ***************************************************************************
// isUrlTag must match // isUrlTag must match
static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucstring &url, ucstring &title) static inline void getUrlTag(const string &s, string::size_type &index, string &url, string &title)
{ {
bool isMarkdown = false; bool isMarkdown = false;
ucstring::size_type textSize = s.size(); string::size_type textSize = s.size();
ucstring::size_type pos; string::size_type pos;
// see if we have markdown format // see if we have markdown format
if (s[index] == '(') if (s[index] == '(')
@ -250,8 +248,8 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst
} }
} }
ucchar chOpen = ' '; char chOpen = ' ';
ucchar chClose = ' '; char chClose = ' ';
if (isMarkdown) if (isMarkdown)
{ {
chOpen = '['; chOpen = '[';
@ -272,7 +270,7 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst
pos = s.find_first_of(chClose, index); pos = s.find_first_of(chClose, index);
// handle common special case: 'text http://.../, text' // handle common special case: 'text http://.../, text'
if (pos != ucstring::npos && index > 0) if (pos != string::npos && index > 0)
{ {
if (s[index-1] == ' ' && (s[pos-1] == ',' || s[pos-1] == '.')) if (s[index-1] == ' ' && (s[pos-1] == ',' || s[pos-1] == '.'))
{ {
@ -308,7 +306,7 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst
} }
// fallback to full string length as we did match http:// already and url spans to the end probably // fallback to full string length as we did match http:// already and url spans to the end probably
if (pos == ucstring::npos) if (pos == string::npos)
{ {
pos = textSize; pos = textSize;
} }
@ -321,22 +319,22 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst
} }
//================================================================================= //=================================================================================
static void prependTimestamp(ucstring &msg) static void prependTimestamp(string &msg)
{ {
ucstring cur_time; string cur_time;
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_CLOCK_12H", false); CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_CLOCK_12H", false);
if (node && node->getValueBool()) if (node && node->getValueBool())
cur_time = CInterfaceManager::getTimestampHuman("[%I:%M:%S %p] "); cur_time = CInterfaceManager::getTimestampHuman("[%I:%M:%S %p] ");
else else
cur_time = CInterfaceManager::getTimestampHuman(); cur_time = CInterfaceManager::getTimestampHuman();
ucstring::size_type codePos = msg.find(ucstring("@{")); string::size_type codePos = msg.find("@{");
if (codePos != ucstring::npos) if (codePos != string::npos)
{ {
// Prepend the current time (do it after the color if the color at first position. // Prepend the current time (do it after the color if the color at first position.
if (codePos == 0) if (codePos == 0)
{ {
codePos = msg.find(ucstring("}")); codePos = msg.find(string("}"));
msg = msg.substr(0, codePos + 1) + cur_time + msg.substr(codePos + 1, msg.length() - codePos); msg = msg.substr(0, codePos + 1) + cur_time + msg.substr(codePos + 1, msg.length() - codePos);
} }
else else
@ -351,9 +349,9 @@ static void prependTimestamp(ucstring &msg)
} }
//================================================================================= //=================================================================================
CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA col, bool justified /*=false*/, bool plaintext /*=false*/) CViewBase *CChatTextManager::createMsgText(const string &cstMsg, NLMISC::CRGBA col, bool justified /*=false*/, bool plaintext /*=false*/)
{ {
ucstring msg = cstMsg; string msg = cstMsg;
CInterfaceGroup *commandGroup = parseCommandTag(msg); CInterfaceGroup *commandGroup = parseCommandTag(msg);
if (showTimestamps()) if (showTimestamps())
@ -365,7 +363,7 @@ CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA
} }
//================================================================================= //=================================================================================
CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CRGBA col, bool justified, CInterfaceGroup *commandGroup) CViewBase *CChatTextManager::createMsgTextSimple(const string &msg, NLMISC::CRGBA col, bool justified, CInterfaceGroup *commandGroup)
{ {
CViewText *vt = new CViewText(CViewText::TCtorParam()); CViewText *vt = new CViewText(CViewText::TCtorParam());
// get parameters from config.xml // get parameters from config.xml
@ -379,14 +377,14 @@ CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CR
// if text contain any color code, set the text formated and white, // if text contain any color code, set the text formated and white,
// otherwise, set text normal and apply global color // otherwise, set text normal and apply global color
if (msg.find(ucstring("@{")) != ucstring::npos) if (msg.find("@{") != string::npos)
{ {
vt->setTextFormatTaged(msg.toUtf8()); vt->setTextFormatTaged(msg);
vt->setColor(NLMISC::CRGBA::White); vt->setColor(NLMISC::CRGBA::White);
} }
else else
{ {
vt->setText(msg.toUtf8()); vt->setText(msg);
vt->setColor(col); vt->setColor(col);
} }
@ -401,9 +399,9 @@ CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CR
} }
//================================================================================= //=================================================================================
CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::CRGBA col, bool justified, bool plaintext, CInterfaceGroup *commandGroup) CViewBase *CChatTextManager::createMsgTextComplex(const string &msg, NLMISC::CRGBA col, bool justified, bool plaintext, CInterfaceGroup *commandGroup)
{ {
ucstring::size_type textSize = msg.size(); string::size_type textSize = msg.size();
CGroupParagraph *para = new CGroupParagraph(CViewBase::TCtorParam()); CGroupParagraph *para = new CGroupParagraph(CViewBase::TCtorParam());
para->setId("line"); para->setId("line");
@ -412,7 +410,7 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
// use right click because left click might be used to activate chat window // use right click because left click might be used to activate chat window
para->setRightClickHandler("copy_chat_popup"); para->setRightClickHandler("copy_chat_popup");
para->setRightClickHandlerParams(msg.toUtf8()); para->setRightClickHandlerParams(msg);
if (plaintext) if (plaintext)
{ {
@ -427,12 +425,12 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
// quickly check if text has links or not // quickly check if text has links or not
bool hasUrl; bool hasUrl;
{ {
ucstring s = toLower(msg); string s = toLower(msg);
hasUrl = (s.find(ucstring("http://")) || s.find(ucstring("https://"))); hasUrl = (s.find("http://") || s.find("https://"));
} }
ucstring::size_type pos = 0; string::size_type pos = 0;
for (ucstring::size_type i = 0; i< textSize;) for (string::size_type i = 0; i< textSize;)
{ {
if (hasUrl && isUrlTag(msg, i, textSize)) if (hasUrl && isUrlTag(msg, i, textSize))
{ {
@ -442,8 +440,8 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
para->addChild(vt); para->addChild(vt);
} }
ucstring url; string url;
ucstring title; string title;
getUrlTag(msg, i, url, title); getUrlTag(msg, i, url, title);
if (url.size() > 0) if (url.size() > 0)
{ {
@ -465,29 +463,29 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
if (title.size() > 0) if (title.size() > 0)
{ {
vt->LinkTitle = title.toUtf8(); vt->LinkTitle = title;
vt->setText(vt->LinkTitle); vt->setText(vt->LinkTitle);
} }
else else
{ {
vt->LinkTitle = url.toUtf8(); vt->LinkTitle = url;
vt->setText(vt->LinkTitle); vt->setText(vt->LinkTitle);
} }
if (url.find_first_of('\'') != string::npos) if (url.find_first_of('\'') != string::npos)
{ {
ucstring clean; string clean;
for(string::size_type i = 0; i< url.size(); ++i) for(string::size_type i = 0; i< url.size(); ++i)
{ {
if (url[i] == '\'') if (url[i] == '\'')
clean += ucstring("%27"); clean += "%27";
else else
clean += url[i]; clean += url[i];
} }
url = clean; url = clean;
} }
vt->setActionOnLeftClick("lua"); vt->setActionOnLeftClick("lua");
vt->setParamsOnLeftClick("game:chatUrl('" + url.toUtf8() + "')"); vt->setParamsOnLeftClick("game:chatUrl('" + url + "')");
para->addChildLink(vt); para->addChildLink(vt);

@ -55,7 +55,7 @@ public:
* \param justified Should be true for justified text (stretch spaces of line to fill the full width) * \param justified Should be true for justified text (stretch spaces of line to fill the full width)
* \param plaintext Text will not be parsed for uri markup links * \param plaintext Text will not be parsed for uri markup links
*/ */
NLGUI::CViewBase *createMsgText(const ucstring &msg, NLMISC::CRGBA col, bool justified = false, bool plaintext = false); NLGUI::CViewBase *createMsgText(const std::string &msg, NLMISC::CRGBA col, bool justified = false, bool plaintext = false);
// Singleton access // Singleton access
static CChatTextManager &getInstance(); static CChatTextManager &getInstance();
@ -79,8 +79,8 @@ private:
bool showTimestamps() const; bool showTimestamps() const;
NLGUI::CViewBase *createMsgTextSimple(const ucstring &msg, NLMISC::CRGBA col, bool justified, NLGUI::CInterfaceGroup *commandGroup); NLGUI::CViewBase *createMsgTextSimple(const std::string &msg, NLMISC::CRGBA col, bool justified, NLGUI::CInterfaceGroup *commandGroup);
NLGUI::CViewBase *createMsgTextComplex(const ucstring &msg, NLMISC::CRGBA col, bool justified, bool plaintext, NLGUI::CInterfaceGroup *commandGroup); NLGUI::CViewBase *createMsgTextComplex(const std::string &msg, NLMISC::CRGBA col, bool justified, bool plaintext, NLGUI::CInterfaceGroup *commandGroup);
}; };
// shortcut to get text manager instance // shortcut to get text manager instance

@ -204,11 +204,11 @@ bool CChatWindow::isVisible() const
} }
//================================================================================= //=================================================================================
void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/) void CChatWindow::displayMessage(const string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/)
{ {
if (!_Chat) if (!_Chat)
{ {
if (msg.toUtf8() != "WRN: <CChatWindow::displayMessage> There's no global chat") if (msg != "WRN: <CChatWindow::displayMessage> There's no global chat")
nlwarning("<CChatWindow::displayMessage> There's no global chat"); nlwarning("<CChatWindow::displayMessage> There's no global chat");
return; return;
} }
@ -538,11 +538,11 @@ void CChatWindow::clearMessages(CChatGroup::TGroupType /* gt */, uint32 /* dynam
// CChatGroupWindow // // CChatGroupWindow //
////////////////////// //////////////////////
void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks, bool *windowVisible) void CChatGroupWindow::displayMessage(const string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks, bool *windowVisible)
{ {
if (!_Chat) if (!_Chat)
{ {
if (msg.toUtf8() != "WRN: <CChatGroupWindow::displayMessage> There's no global chat") if (msg != "WRN: <CChatGroupWindow::displayMessage> There's no global chat")
nlwarning("<CChatGroupWindow::displayMessage> There's no global chat"); nlwarning("<CChatGroupWindow::displayMessage> There's no global chat");
return; return;
} }
@ -563,8 +563,8 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
CRGBA newMsgColor= CRGBA::stringToRGBA(CWidgetManager::getInstance()->getParser()->getDefine("chat_group_tab_color_newmsg").c_str()); CRGBA newMsgColor= CRGBA::stringToRGBA(CWidgetManager::getInstance()->getParser()->getDefine("chat_group_tab_color_newmsg").c_str());
ucstring newmsg = msg; string newmsg = msg;
ucstring prefix; string prefix;
if (gl != NULL) if (gl != NULL)
{ {
@ -599,20 +599,20 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
gl = gl2; gl = gl2;
// Add dyn chan number before string // Add dyn chan number before string
ucstring prefix("[" + NLMISC::toString(dynamicChatDbIndex) + "]"); string prefix = "[" + NLMISC::toString(dynamicChatDbIndex) + "]";
// Find position to put the new string // Find position to put the new string
// After timestamp? // After timestamp?
size_t pos = newmsg.find(ucstring("]")); size_t pos = newmsg.find("]");
size_t colonpos = newmsg.find(ucstring(": @{")); size_t colonpos = newmsg.find(": @{");
// If no ] found or if found but after the colon (so part of the user chat) // If no ] found or if found but after the colon (so part of the user chat)
if (pos == ucstring::npos || (colonpos < pos)) if (pos == string::npos || (colonpos < pos))
{ {
// No timestamp, so put it right after the color and add a space // No timestamp, so put it right after the color and add a space
pos = newmsg.find(ucstring("}")); pos = newmsg.find("}");
prefix += " "; prefix += " ";
} }
if (pos == ucstring::npos) if (pos == string::npos)
newmsg = prefix + newmsg; newmsg = prefix + newmsg;
else else
newmsg = newmsg.substr(0, pos + 1) + prefix + newmsg.substr(pos + 1); newmsg = newmsg.substr(0, pos + 1) + prefix + newmsg.substr(pos + 1);
@ -622,10 +622,10 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
if (node && node->getValueBool()) if (node && node->getValueBool())
{ {
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChatDbIndex); uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChatDbIndex);
ucstring title; string title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
prefix = title.empty() ? ucstring("") : ucstring(" ") + title; prefix = (title.empty() ? "" : " ") + title;
pos = newmsg.find(ucstring("] ")); pos = newmsg.find("] ");
if (pos == ucstring::npos) if (pos == ucstring::npos)
newmsg = prefix + newmsg; newmsg = prefix + newmsg;
@ -667,7 +667,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
} }
//================================================================================= //=================================================================================
void CChatGroupWindow::displayTellMessage(const ucstring &msg, NLMISC::CRGBA col, const ucstring &sender) void CChatGroupWindow::displayTellMessage(const string &msg, NLMISC::CRGBA col, const string &sender)
{ {
// If we are here with a tell message this is because the teller doesn't belong to any people list // If we are here with a tell message this is because the teller doesn't belong to any people list
CGroupContainer *gcChat = createFreeTeller(sender); CGroupContainer *gcChat = createFreeTeller(sender);
@ -876,7 +876,7 @@ void CChatGroupWindow::setActiveFreeTeller(const ucstring &winName, bool bActive
} }
//================================================================================= //=================================================================================
ucstring CChatGroupWindow::getFreeTellerName(const std::string &containerID) string CChatGroupWindow::getFreeTellerName(const std::string &containerID)
{ {
uint32 i; uint32 i;
for (i = 0; i < _FreeTellers.size(); ++i) for (i = 0; i < _FreeTellers.size(); ++i)
@ -886,8 +886,8 @@ ucstring CChatGroupWindow::getFreeTellerName(const std::string &containerID)
break; break;
} }
if (i == _FreeTellers.size()) if (i == _FreeTellers.size())
return ucstring(""); return string();
return _FreeTellers[i]->getUCTitle(); return _FreeTellers[i]->getTitle();
} }
//================================================================================= //=================================================================================
@ -1306,7 +1306,7 @@ public:
else else
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo (ucstring::makeFromUtf8(cmd) + ": " + CI18N::get ("uiCommandNotExists")); im->displaySystemInfo (cmd + ": " + CI18N::get ("uiCommandNotExists"));
} }
} }
else else
@ -1410,16 +1410,16 @@ class CHandlerInviteToRingSession : public IActionHandler
public: public:
void execute (CCtrlBase *pCaller, const std::string &/* sParams */) void execute (CCtrlBase *pCaller, const std::string &/* sParams */)
{ {
ucstring playerName = ::getFreeTellerName(pCaller); string playerName = ::getFreeTellerName(pCaller).toUtf8();
if (!playerName.empty()) if (!playerName.empty())
{ {
// ask the SBS to invite the character in the session // ask the SBS to invite the character in the session
CSessionBrowserImpl::getInstance().inviteCharacterByName(CSessionBrowserImpl::getInstance().getCharId(), playerName.toUtf8()); CSessionBrowserImpl::getInstance().inviteCharacterByName(CSessionBrowserImpl::getInstance().getCharId(), playerName);
// additionaly, send a tell to signal the player he has been invited to a ring session // additionaly, send a tell to signal the player he has been invited to a ring session
ChatMngr.tell(playerName.toUtf8(), CI18N::get("uiRingInviteNotification")); ChatMngr.tell(playerName, CI18N::get("uiRingInviteNotification"));
// //
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo(ucstring("@{6F6F}") + playerName +ucstring(" @{FFFF}") + CI18N::get("uiRingInvitationSent"), "BC"); im->displaySystemInfo("@{6F6F}" + playerName +" @{FFFF}" + CI18N::get("uiRingInvitationSent"), "BC");
// force a refresh of the ui // force a refresh of the ui
CLuaManager::getInstance().executeLuaScript("CharTracking:forceRefresh()"); CLuaManager::getInstance().executeLuaScript("CharTracking:forceRefresh()");
} }

@ -47,7 +47,7 @@ class CChatWindow;
struct IChatWindowListener struct IChatWindowListener
{ {
// the user entered a msg in the given chat box // the user entered a msg in the given chat box
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) = 0; virtual void msgEntered(const std::string &msg, CChatWindow *chatWindow) = 0;
}; };
@ -98,8 +98,8 @@ public:
}; };
public: public:
// display a message in this chat box with the given color // display a message in this chat box with the given color
virtual void displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); virtual void displayMessage(const std::string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL);
virtual void displayTellMessage(const ucstring &/* msg */, NLMISC::CRGBA /* col */, const ucstring &/* sender */) {} virtual void displayTellMessage(const std::string &/* msg */, NLMISC::CRGBA /* col */, const std::string &/* sender */) {}
virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex); virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex);
// Test if the window is visible // Test if the window is visible
bool isVisible() const; bool isVisible() const;
@ -189,8 +189,8 @@ class CChatGroupWindow : public CChatWindow
public: public:
CChatGroupWindow() {} CChatGroupWindow() {}
// display a message in this chat box with the given color (callback from chat input filter) // display a message in this chat box with the given color (callback from chat input filter)
virtual void displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); virtual void displayMessage(const std::string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL);
virtual void displayTellMessage(const ucstring &msg, NLMISC::CRGBA col, const ucstring &sender); virtual void displayTellMessage(const std::string &msg, NLMISC::CRGBA col, const std::string &sender);
virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex); virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex);
sint32 getTabIndex(); sint32 getTabIndex();
void setTabIndex(sint32 n); void setTabIndex(sint32 n);
@ -198,7 +198,7 @@ public:
// Free Teller // Free Teller
NLGUI::CGroupContainer *createFreeTeller(const ucstring &winName, const std::string &winColor=""); NLGUI::CGroupContainer *createFreeTeller(const ucstring &winName, const std::string &winColor="");
void setActiveFreeTeller(const ucstring &winName, bool bActive=true); void setActiveFreeTeller(const ucstring &winName, bool bActive=true);
ucstring getFreeTellerName(const std::string &containerID); std::string getFreeTellerName(const std::string &containerID);
bool removeFreeTeller(const std::string &containerID); // Return true if free teller found bool removeFreeTeller(const std::string &containerID); // Return true if free teller found
void removeAllFreeTellers(); void removeAllFreeTellers();
void saveFreeTeller(NLMISC::IStream &f); void saveFreeTeller(NLMISC::IStream &f);

@ -207,9 +207,9 @@ int CDBCtrlSheet::luaGetCreatorName(CLuaState &ls)
{ {
uint32 itemSlotId = getInventory().getItemSlotId(this); uint32 itemSlotId = getInventory().getItemSlotId(this);
CClientItemInfo itemInfo = getInventory().getItemInfo(itemSlotId); CClientItemInfo itemInfo = getInventory().getItemInfo(itemSlotId);
ucstring creatorName; string creatorName;
STRING_MANAGER::CStringManagerClient::instance()->getString(itemInfo.CreatorName, creatorName); STRING_MANAGER::CStringManagerClient::instance()->getString(itemInfo.CreatorName, creatorName);
CLuaIHM::push(ls, creatorName); CLuaIHM::push(ls, ucstring::makeFromUtf8(creatorName)); // FIXME: Lua UTF-8
return 1; return 1;
} }
@ -1454,7 +1454,7 @@ void CDBCtrlSheet::setupMission()
void CDBCtrlSheet::setupGuildFlag () void CDBCtrlSheet::setupGuildFlag ()
{ {
// Find the guild name // Find the guild name
ucstring usGuildName; string usGuildName;
sint32 nGuildName = _SheetId.getSInt32(); sint32 nGuildName = _SheetId.getSInt32();
if (_LastSheetId != nGuildName || _NeedSetup) if (_LastSheetId != nGuildName || _NeedSetup)
{ {
@ -4564,7 +4564,7 @@ ucstring CDBCtrlSheet::getItemActualName() const
return ucstring(); return ucstring();
else else
{ {
ucstring ret; string ret;
// If NameId not 0, get from StringManager // If NameId not 0, get from StringManager
uint32 nameId= getItemNameId(); uint32 nameId= getItemNameId();
if(nameId) if(nameId)
@ -4596,21 +4596,21 @@ ucstring CDBCtrlSheet::getItemActualName() const
{ {
// get description string for item format // get description string for item format
std::string formatID = getItemRMFaberStatType() != RM_FABER_STAT_TYPE::Unknown ? "uihelpItemFaberPrefixAndSuffix" : "uihelpItemFaberPrefix"; std::string formatID = getItemRMFaberStatType() != RM_FABER_STAT_TYPE::Unknown ? "uihelpItemFaberPrefixAndSuffix" : "uihelpItemFaberPrefix";
ucstring format; string format;
if (!CI18N::hasTranslation(formatID)) if (!CI18N::hasTranslation(formatID))
{ {
format = ucstring("%p %n %s"); // not found, uses default string format = "%p %n %s"; // not found, uses default string
} }
else else
{ {
format = CI18N::get(formatID); format = CI18N::get(formatID);
} }
// suffix // suffix
strFindReplace(format, ucstring("%p"), RM_CLASS_TYPE::toLocalString(getItemRMClassType())); strFindReplace(format, "%p", RM_CLASS_TYPE::toLocalString(getItemRMClassType()));
// name // name
strFindReplace(format, ucstring("%n"), ret); strFindReplace(format, "%n", ret);
// prefix // prefix
strFindReplace(format, ucstring("%s"), CI18N::get(toString("mpstatItemQualifier%d", (int) getItemRMFaberStatType()).c_str())); strFindReplace(format, "%s", CI18N::get(toString("mpstatItemQualifier%d", (int) getItemRMFaberStatType()).c_str()));
ret = format; ret = format;

@ -313,7 +313,7 @@ void CDBGroupListSheetText::updateCoords ()
else else
{ {
// if not received, must insert in list of pending dynstring to check each frame // if not received, must insert in list of pending dynstring to check each frame
ucstring result; string result;
if( !STRING_MANAGER::CStringManagerClient::instance()->getDynString ( curNameId, result) ) if( !STRING_MANAGER::CStringManagerClient::instance()->getDynString ( curNameId, result) )
_NameIdToUpdate.insert( _SheetChildren[i] ); _NameIdToUpdate.insert( _SheetChildren[i] );
} }
@ -492,7 +492,7 @@ void CDBGroupListSheetText::checkCoords ()
{ {
CSheetChild * cst = (*it); CSheetChild * cst = (*it);
// String result // String result
ucstring result; string result;
if( STRING_MANAGER::CStringManagerClient::instance()->getDynString ( cst->NameId, result) ) if( STRING_MANAGER::CStringManagerClient::instance()->getDynString ( cst->NameId, result) )
{ {
set< CSheetChild *>::iterator itTmp = it; set< CSheetChild *>::iterator itTmp = it;

@ -689,10 +689,10 @@ void CDBGroupListSheetTrade::checkCoords ()
{ {
CSheetChildTrade * cst = (*it); CSheetChildTrade * cst = (*it);
// String result // String result
ucstring result; string result;
if( pSMC->getString ( cst->LastVendorNameId, result) ) if( pSMC->getString ( cst->LastVendorNameId, result) )
{ {
cst->VendorNameString = CEntityCL::removeShardFromName(result.toUtf8()); cst->VendorNameString = CEntityCL::removeShardFromName(result);
set< CSheetChildTrade *>::iterator itTmp = it; set< CSheetChildTrade *>::iterator itTmp = it;
++it; ++it;
VendorNameIdToUpdate.erase(itTmp); VendorNameIdToUpdate.erase(itTmp);

@ -194,7 +194,7 @@ void CEncyclopediaManager::rebuildAlbumList()
nlassert(pTree != NULL); nlassert(pTree != NULL);
CGroupTree::SNode *pRoot = new CGroupTree::SNode; CGroupTree::SNode *pRoot = new CGroupTree::SNode;
ucstring res; string res;
// Add all albums // Add all albums
for (uint32 i = 0; i < _Albums.size(); ++i) for (uint32 i = 0; i < _Albums.size(); ++i)
@ -206,7 +206,7 @@ void CEncyclopediaManager::rebuildAlbumList()
if (_Albums[i].Name == _AlbumNameSelected) if (_Albums[i].Name == _AlbumNameSelected)
pAlb->Opened = true; pAlb->Opened = true;
if (pSMC->getDynString(_Albums[i].Name, res)) if (pSMC->getDynString(_Albums[i].Name, res))
pAlb->Text = res.toUtf8(); pAlb->Text = res;
else else
nlwarning("try to construct album without name"); nlwarning("try to construct album without name");
@ -218,7 +218,7 @@ void CEncyclopediaManager::rebuildAlbumList()
pThm->AHName = "ency_click_thema"; pThm->AHName = "ency_click_thema";
pThm->AHParams = toString(_Albums[i].Themas[j].Name); pThm->AHParams = toString(_Albums[i].Themas[j].Name);
if (pSMC->getDynString(_Albums[i].Themas[j].Name, res)) if (pSMC->getDynString(_Albums[i].Themas[j].Name, res))
pThm->Text = res.toUtf8(); pThm->Text = res;
else else
nlwarning("try to construct thema without name"); nlwarning("try to construct thema without name");
@ -426,7 +426,7 @@ bool CEncyclopediaManager::isStringWaiting()
for (uint32 i = 0; i < _Albums.size(); ++i) for (uint32 i = 0; i < _Albums.size(); ++i)
{ {
ucstring res; string res;
if (!pSMC->getDynString(_Albums[i].Name, res)) if (!pSMC->getDynString(_Albums[i].Name, res))
return true; return true;
for (uint32 j = 0; j < _Albums[i].Themas.size(); ++j) for (uint32 j = 0; j < _Albums[i].Themas.size(); ++j)

@ -121,7 +121,7 @@ void CFlyingTextManager::releaseInGame()
} }
// *************************************************************************** // ***************************************************************************
void CFlyingTextManager::addFlyingText(void *key, const ucstring &text, const NLMISC::CVector &pos, CRGBA color, float scale, sint offsetX) void CFlyingTextManager::addFlyingText(void *key, const string &text, const NLMISC::CVector &pos, CRGBA color, float scale, sint offsetX)
{ {
// key exist in the map? // key exist in the map?
TInSceneCurrentMap::iterator it= _InSceneCurrent.find(key); TInSceneCurrentMap::iterator it= _InSceneCurrent.find(key);
@ -144,7 +144,7 @@ void CFlyingTextManager::addFlyingText(void *key, const ucstring &text, const NL
gi.UsedThisFrame= true; gi.UsedThisFrame= true;
// update infos // update infos
gi.ViewText->setText(text.toUtf8()); gi.ViewText->setText(text);
gi.ViewText->setColor(color); gi.ViewText->setColor(color);
gi.GroupInScene->Position= pos; gi.GroupInScene->Position= pos;
gi.GroupInScene->Scale= scale; gi.GroupInScene->Scale= scale;

@ -49,7 +49,7 @@ public:
/** add a flying text at a position (called during entity display). NB: may fail if no more free groups /** add a flying text at a position (called during entity display). NB: may fail if no more free groups
* \param offsetx: screen offsetx of the group in scene * \param offsetx: screen offsetx of the group in scene
*/ */
void addFlyingText(void *key, const ucstring &text, const NLMISC::CVector &pos, NLMISC::CRGBA color, float scale, sint offsetX=0); void addFlyingText(void *key, const std::string &text, const NLMISC::CVector &pos, NLMISC::CRGBA color, float scale, sint offsetX=0);
/// release no more used flying text (called by CEntityManager at each draw) /// release no more used flying text (called by CEntityManager at each draw)
void releaseNotUsedFlyingText(); void releaseNotUsedFlyingText();

@ -394,18 +394,18 @@ void CGroupCompas::draw()
// The text // The text
char message[50]; char message[50];
ucstring distText; string distText;
if (displayedTarget.getType() != CCompassTarget::North) if (displayedTarget.getType() != CCompassTarget::North)
{ {
if (dist > 999.0f) if (dist > 999.0f)
{ {
smprintf (message, 50, "%.1f ", dist/1000.0f); smprintf (message, 50, "%.1f ", dist/1000.0f);
distText = ucstring (message) + CI18N::get("uiKilometerUnit"); distText = message + CI18N::get("uiKilometerUnit");
} }
else else
{ {
smprintf (message, 50, "%.0f ", dist); smprintf (message, 50, "%.0f ", dist);
distText = ucstring (message) + CI18N::get("uiMeterUnit"); distText = message + CI18N::get("uiMeterUnit");
} }
distText = distText + " - " + displayedTarget.Name; distText = distText + " - " + displayedTarget.Name;
} }
@ -415,7 +415,7 @@ void CGroupCompas::draw()
} }
if (_DistViewText != distText) if (_DistViewText != distText)
{ {
_DistView->setText(distText.toUtf8()); _DistView->setText(distText);
_DistViewText = distText; _DistViewText = distText;
} }
} }
@ -558,9 +558,9 @@ bool buildCompassTargetFromTeamMember(CCompassTarget &ct, uint teamMemberId)
ct.setPositionState(tracker); ct.setPositionState(tracker);
CStringManagerClient *pSMC = CStringManagerClient::instance(); CStringManagerClient *pSMC = CStringManagerClient::instance();
ucstring name; string name;
if (pSMC->getString(nameNode->getValue32(), name)) if (pSMC->getString(nameNode->getValue32(), name))
ct.Name = CEntityCL::removeTitleAndShardFromName(name.toUtf8()); // TODO : dynamic support for name ct.Name = CEntityCL::removeTitleAndShardFromName(name); // TODO : dynamic support for name
else else
ct.Name = CI18N::get("uiNotReceived"); ct.Name = CI18N::get("uiNotReceived");
return true; return true;
@ -711,7 +711,7 @@ void CGroupCompasMenu::setActive (bool state)
ct.setType(CCompassTarget::North); ct.setType(CCompassTarget::North);
ct.Name = CI18N::get("uiNorth"); ct.Name = CI18N::get("uiNorth");
Targets.push_back(ct); Targets.push_back(ct);
getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
// Home // Home
CCDBNodeLeaf *pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":HOME_POINT"); CCDBNodeLeaf *pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":HOME_POINT");
sint32 px = (sint32) (pos->getValue64() >> 32); sint32 px = (sint32) (pos->getValue64() >> 32);
@ -721,7 +721,7 @@ void CGroupCompasMenu::setActive (bool state)
ct.setType(CCompassTarget::Home); ct.setType(CCompassTarget::Home);
ct.Name = CI18N::get("uiHome"); ct.Name = CI18N::get("uiHome");
Targets.push_back(ct); Targets.push_back(ct);
getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
} }
// Respawn // Respawn
pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":BIND_POINT"); pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":BIND_POINT");
@ -732,7 +732,7 @@ void CGroupCompasMenu::setActive (bool state)
ct.setType(CCompassTarget::Respawn); ct.setType(CCompassTarget::Respawn);
ct.Name = CI18N::get("uiRespawn"); ct.Name = CI18N::get("uiRespawn");
Targets.push_back(ct); Targets.push_back(ct);
getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
} }
// As of 6/5/2007 : The option to point the selection is always proposed even if no slot is currently targeted // As of 6/5/2007 : The option to point the selection is always proposed even if no slot is currently targeted
@ -777,7 +777,7 @@ void CGroupCompasMenu::setActive (bool state)
CCDBNodeLeaf *textIDLeaf = NLGUI::CDBManager::getInstance()->getDbProp(baseDbPath + toString(":%d:TARGET%d:TITLE", (int) k, (int) l), false); CCDBNodeLeaf *textIDLeaf = NLGUI::CDBManager::getInstance()->getDbProp(baseDbPath + toString(":%d:TARGET%d:TITLE", (int) k, (int) l), false);
if (textIDLeaf) if (textIDLeaf)
{ {
ucstring name; string name;
if (CStringManagerClient::instance()->getDynString(textIDLeaf->getValue32(), name)) if (CStringManagerClient::instance()->getDynString(textIDLeaf->getValue32(), name))
{ {
CCDBNodeLeaf *leafPosX= NLGUI::CDBManager::getInstance()->getDbProp(baseDbPath + toString(":%d:TARGET%d:X", (int) k, (int) l), false); CCDBNodeLeaf *leafPosX= NLGUI::CDBManager::getInstance()->getDbProp(baseDbPath + toString(":%d:TARGET%d:X", (int) k, (int) l), false);
@ -790,7 +790,7 @@ void CGroupCompasMenu::setActive (bool state)
ct.setPositionState(tracker); ct.setPositionState(tracker);
ct.Name = name; ct.Name = name;
Targets.push_back(ct); Targets.push_back(ct);
missionSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); missionSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
} }
@ -847,7 +847,7 @@ void CGroupCompasMenu::setActive (bool state)
ct.Pos = currCont->ContLandMarks[k].Pos; ct.Pos = currCont->ContLandMarks[k].Pos;
ct.Name = CStringManagerClient::getPlaceLocalizedName(currCont->ContLandMarks[k].TitleTextID); ct.Name = CStringManagerClient::getPlaceLocalizedName(currCont->ContLandMarks[k].TitleTextID);
Targets.push_back(ct); Targets.push_back(ct);
landMarkSubMenu->addLineAtIndex(contLandMarkIndex++, ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); landMarkSubMenu->addLineAtIndex(contLandMarkIndex++, ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
// separator? // separator?
@ -868,9 +868,9 @@ void CGroupCompasMenu::setActive (bool state)
CCompassTarget ct; CCompassTarget ct;
ct.setType(CCompassTarget::UserLandMark); ct.setType(CCompassTarget::UserLandMark);
ct.Pos = sortedLandmarks[k].Pos; ct.Pos = sortedLandmarks[k].Pos;
ct.Name = sortedLandmarks[k].Title; ct.Name = sortedLandmarks[k].Title.toUtf8();
Targets.push_back(ct); Targets.push_back(ct);
landMarkSubMenus[sortedLandmarks[k].Type]->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); landMarkSubMenus[sortedLandmarks[k].Type]->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
} }
@ -901,7 +901,7 @@ void CGroupCompasMenu::setActive (bool state)
if (buildCompassTargetFromTeamMember(ct, k)) if (buildCompassTargetFromTeamMember(ct, k))
{ {
Targets.push_back(ct); Targets.push_back(ct);
teamSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); teamSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
} }
@ -924,7 +924,7 @@ void CGroupCompasMenu::setActive (bool state)
if (buildCompassTargetFromAnimalMember(ct, k)) if (buildCompassTargetFromAnimalMember(ct, k))
{ {
Targets.push_back(ct); Targets.push_back(ct);
animalSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); animalSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
} }
@ -952,7 +952,7 @@ void CGroupCompasMenu::setActive (bool state)
CSmartPtr<CDialogEntityPositionState> tracker = new CDialogEntityPositionState( i ); CSmartPtr<CDialogEntityPositionState> tracker = new CDialogEntityPositionState( i );
ct.setPositionState(tracker); ct.setPositionState(tracker);
Targets.push_back(ct); Targets.push_back(ct);
dialogsSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); dialogsSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
} }

@ -46,7 +46,7 @@ class CCompassTarget
public: public:
enum TType { North = 0, Selection, Home, Respawn, ContinentLandMark, UserLandMark, PosTracker, NumTypes }; enum TType { North = 0, Selection, Home, Respawn, ContinentLandMark, UserLandMark, PosTracker, NumTypes };
NLMISC::CVector2f Pos; // Used for static target (ie not the current selection, a team member ...) NLMISC::CVector2f Pos; // Used for static target (ie not the current selection, a team member ...)
ucstring Name; std::string Name;
CCompassTarget(); CCompassTarget();
TType getType() const { return _Type; } TType getType() const { return _Type; }
void setType(TType type) { if (type == _Type) return; setPositionState(NULL); _Type = type; } void setType(TType type) { if (type == _Type) return; setPositionState(NULL); _Type = type; }
@ -124,11 +124,11 @@ private:
bool _Blinking; bool _Blinking;
double _StartBlinkTime; double _StartBlinkTime;
ucstring _CurrTargetName; std::string _CurrTargetName;
// The dist text // The dist text
CViewText *_DistView; CViewText *_DistView;
ucstring _DistViewText; std::string _DistViewText;
CViewRadar *_RadarView; CViewRadar *_RadarView;
CViewText *_RadarRangeView; CViewText *_RadarRangeView;

@ -60,7 +60,7 @@ void CGroupHTMLForum::addHTTPGetParams (string &url, bool /*trustedDomain*/)
{ {
ucstring user_name = UserEntity->getLoginName (); ucstring user_name = UserEntity->getLoginName ();
const SGuild &guild = CGuildManager::getInstance()->getGuild(); const SGuild &guild = CGuildManager::getInstance()->getGuild();
string gname = guild.Name.toUtf8(); string gname = guild.Name;
if (!gname.empty()) if (!gname.empty())
{ {
@ -92,7 +92,7 @@ void CGroupHTMLForum::addHTTPPostParams (SFormFields &formfields, bool /*trusted
{ {
ucstring user_name = UserEntity->getLoginName (); ucstring user_name = UserEntity->getLoginName ();
const SGuild &guild = CGuildManager::getInstance()->getGuild(); const SGuild &guild = CGuildManager::getInstance()->getGuild();
string gname = guild.Name.toUtf8(); string gname = guild.Name;
if (!gname.empty()) if (!gname.empty())
{ {

@ -456,7 +456,7 @@ void CGroupInSceneBubbleManager::update ()
{ {
if (_DynBubbles[i].DescWaiting != 0) if (_DynBubbles[i].DescWaiting != 0)
{ {
ucstring res; string res;
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
if (pSMC->getDynString(_DynBubbles[i].DescWaiting,res)) if (pSMC->getDynString(_DynBubbles[i].DescWaiting,res))
{ {
@ -488,7 +488,7 @@ void CGroupInSceneBubbleManager::update ()
// *************************************************************************** // ***************************************************************************
CGroupInSceneBubble *CGroupInSceneBubbleManager::newBubble (const ucstring &text) CGroupInSceneBubble *CGroupInSceneBubbleManager::newBubble (const string &text)
{ {
if (!text.empty() && !_Bubbles.empty()) if (!text.empty() && !_Bubbles.empty())
{ {
@ -576,7 +576,7 @@ void CGroupInSceneBubbleManager::addSkillPopup (uint skillId, sint delta, uint t
// *************************************************************************** // ***************************************************************************
void CGroupInSceneBubbleManager::addMessagePopup (const ucstring &message, CRGBA color, uint time) void CGroupInSceneBubbleManager::addMessagePopup (const string &message, CRGBA color, uint time)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
@ -599,7 +599,7 @@ void CGroupInSceneBubbleManager::addMessagePopup (const ucstring &message, CRGBA
CViewText *pViewName = dynamic_cast<CViewText*>(group->getView("name")); CViewText *pViewName = dynamic_cast<CViewText*>(group->getView("name"));
if (pViewName != NULL) if (pViewName != NULL)
{ {
pViewName->setText (message.toUtf8()); pViewName->setText (message);
pViewName->setColor (color); pViewName->setColor (color);
} }
@ -625,7 +625,7 @@ void CGroupInSceneBubbleManager::addMessagePopup (const ucstring &message, CRGBA
// *************************************************************************** // ***************************************************************************
void CGroupInSceneBubbleManager::addMessagePopupCenter (const ucstring &message, CRGBA color, uint time) void CGroupInSceneBubbleManager::addMessagePopupCenter (const string &message, CRGBA color, uint time)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
@ -648,7 +648,7 @@ void CGroupInSceneBubbleManager::addMessagePopupCenter (const ucstring &message,
CViewText *pViewName = dynamic_cast<CViewText*>(group->getView("name")); CViewText *pViewName = dynamic_cast<CViewText*>(group->getView("name"));
if (pViewName != NULL) if (pViewName != NULL)
{ {
pViewName->setTextFormatTaged(message.toUtf8()); pViewName->setTextFormatTaged(message);
pViewName->setColor (color); pViewName->setColor (color);
} }
@ -757,9 +757,9 @@ CGroupInSceneBubbleManager::CPopupContext *CGroupInSceneBubbleManager::buildCont
// *************************************************************************** // ***************************************************************************
void CGroupInSceneBubbleManager::addContextHelp (const ucstring &message, const string &targetName, uint time) void CGroupInSceneBubbleManager::addContextHelp (const string &message, const string &targetName, uint time)
{ {
std::string finalMessage = message.toUtf8(); std::string finalMessage = message;
CInterfaceElement *target; CInterfaceElement *target;
CPopupContext *context = CGroupInSceneBubbleManager::buildContextHelp ("context_help_", targetName, target, time); CPopupContext *context = CGroupInSceneBubbleManager::buildContextHelp ("context_help_", targetName, target, time);
if (context) if (context)
@ -835,7 +835,7 @@ void CGroupInSceneBubbleManager::ignoreContextHelp (CInterfaceGroup *groupToRemo
// *************************************************************************** // ***************************************************************************
void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText, uint bubbleTimer) void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const std::string &ucsText, uint bubbleTimer)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
@ -1065,9 +1065,7 @@ void CGroupInSceneBubbleManager::webIgChatOpen (uint32 nBotUID, string text, con
// Update the bubble's texts // Update the bubble's texts
ucstring ucText; bubble->setText(text);
ucText.fromUtf8(text);
bubble->setText(ucText);
id = bubble->getId() + ":header_opened:window:"; id = bubble->getId() + ":header_opened:window:";
CViewText *pVT; CViewText *pVT;
CCtrlLink *pCL; CCtrlLink *pCL;
@ -1092,9 +1090,8 @@ void CGroupInSceneBubbleManager::webIgChatOpen (uint32 nBotUID, string text, con
if (pVT != NULL) if (pVT != NULL)
{ {
pVT->setActive(true); pVT->setActive(true);
ucstring optionText; string optionText = strs[j];
optionText.fromUtf8(strs[j]); pVT->setText(optionText);
pVT->setText(optionText.toUtf8());
pCL = dynamic_cast<CCtrlLink*>(bubble->getElement(id+"optb"+toString(j))); pCL = dynamic_cast<CCtrlLink*>(bubble->getElement(id+"optb"+toString(j)));
if (pCL != NULL) if (pCL != NULL)
{ {
@ -1317,14 +1314,14 @@ class CAHDynChatClickOption : public IActionHandler
if (isBGDownloadEnabled()) if (isBGDownloadEnabled())
{ {
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
ucstring result; string result;
if (!pSMC->getDynString(optStrId, result)) if (!pSMC->getDynString(optStrId, result))
{ {
return; // shouldn't happen since the button isn't visible as long as the text has not been received ... return; // shouldn't happen since the button isn't visible as long as the text has not been received ...
} }
static volatile bool forceWarning = false; // for debug static volatile bool forceWarning = false; // for debug
ucstring::size_type pos= result.find(ucstring("{ros_exit}")); string::size_type pos= result.find("{ros_exit}");
if(pos != ucstring::npos || forceWarning) if(pos != string::npos || forceWarning)
{ {
if (AvailablePatchs != 0) if (AvailablePatchs != 0)
{ {
@ -1334,7 +1331,7 @@ class CAHDynChatClickOption : public IActionHandler
} }
} }
const string sMsg = "BOTCHAT:DYNCHAT_SEND"; static const string sMsg = "BOTCHAT:DYNCHAT_SEND";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out))
{ {
@ -1425,19 +1422,19 @@ void CGroupInSceneBubble::unlink ()
// *************************************************************************** // ***************************************************************************
void CGroupInSceneBubble::setText (const ucstring &text) void CGroupInSceneBubble::setText (const string &text)
{ {
if (text.empty()) return; if (text.empty()) return;
_TextParts.clear(); _TextParts.clear();
// Look for "{break}" in the message // Look for "{break}" in the message
ucstring finalMsg = text; string finalMsg = text;
ucstring tmpMsg; string tmpMsg;
for(;;) for(;;)
{ {
ucstring::size_type index = finalMsg.find (ucstring("{break}")); string::size_type index = finalMsg.find ("{break}");
if (index == ucstring::npos) break; if (index == string::npos) break;
tmpMsg = finalMsg.substr (0, index); tmpMsg = finalMsg.substr (0, index);
if (!tmpMsg.empty()) if (!tmpMsg.empty())
_TextParts.push_back(tmpMsg); _TextParts.push_back(tmpMsg);
@ -1478,14 +1475,14 @@ void CGroupInSceneBubble::skip()
// *************************************************************************** // ***************************************************************************
void CGroupInSceneBubble::setRawText (const ucstring &text) void CGroupInSceneBubble::setRawText (const string &text)
{ {
_CanBeShown = !text.empty(); _CanBeShown = !text.empty();
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CInterfaceElement *pVTIE = CWidgetManager::getInstance()->getElementFromId(getId()+":header_opened:window:text"); CInterfaceElement *pVTIE = CWidgetManager::getInstance()->getElementFromId(getId()+":header_opened:window:text");
CViewText *pVT= dynamic_cast<CViewText*>(pVTIE); CViewText *pVT= dynamic_cast<CViewText*>(pVTIE);
if (pVT != NULL) if (pVT != NULL)
pVT->setText(text.toUtf8()); pVT->setText(text);
} }
// *************************************************************************** // ***************************************************************************
@ -1584,8 +1581,7 @@ class CHandlerCharacterBubble : public IActionHandler
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
uint entityId; uint entityId;
fromString(getParam (sParams, "entity"), entityId); fromString(getParam (sParams, "entity"), entityId);
ucstring text; string text = getParam (sParams, "text");
text.fromUtf8(getParam (sParams, "text"));
string sTime = getParam (sParams, "time"); string sTime = getParam (sParams, "time");
uint duration; uint duration;
if (sTime.empty()) if (sTime.empty())
@ -1633,10 +1629,8 @@ class CHandlerMessagePopup : public IActionHandler
void execute (CCtrlBase * /* pCaller */, const std::string &sParams) void execute (CCtrlBase * /* pCaller */, const std::string &sParams)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring text0; string text0 = getParam (sParams, "text0");
text0.fromUtf8(getParam (sParams, "text0").c_str()); string text1 = getParam (sParams, "text1");
ucstring text1;
text1.fromUtf8(getParam (sParams, "text1").c_str());
string sTime = getParam (sParams, "time"); string sTime = getParam (sParams, "time");
uint duration; uint duration;
if (sTime.empty()) if (sTime.empty())
@ -1660,8 +1654,7 @@ class CHandlerContextHelp : public IActionHandler
string targetName = getParam (sParams, "target"); string targetName = getParam (sParams, "target");
string text = getParam (sParams, "text"); string text = getParam (sParams, "text");
ucstring itext; string itext = getParam (sParams, "itext");
itext.fromUtf8 (getParam (sParams, "itext"));
if (itext.empty()) if (itext.empty())
itext = CI18N::get(text); itext = CI18N::get(text);

@ -39,19 +39,19 @@ public:
void update (); void update ();
// Get a CGroupBubble // Get a CGroupBubble
class CGroupInSceneBubble *newBubble (const ucstring &text); class CGroupInSceneBubble *newBubble (const std::string &text);
// Add a message popup. if 0, get the OptionTimeoutMessages // Add a message popup. if 0, get the OptionTimeoutMessages
void addMessagePopup (const ucstring &message, NLMISC::CRGBA col = CRGBA::White, uint time = 0); void addMessagePopup (const std::string &message, NLMISC::CRGBA col = CRGBA::White, uint time = 0);
// The same as previous but centered in the screen. if 0, get the OptionTimeoutMessages // The same as previous but centered in the screen. if 0, get the OptionTimeoutMessages
void addMessagePopupCenter (const ucstring &message, NLMISC::CRGBA col = CRGBA::White, uint time = 0); void addMessagePopupCenter (const std::string &message, NLMISC::CRGBA col = CRGBA::White, uint time = 0);
// Add a skill popup // Add a skill popup
void addSkillPopup (uint skillId, sint delta, uint time); void addSkillPopup (uint skillId, sint delta, uint time);
// Add a context help with a string // Add a context help with a string
void addContextHelp (const ucstring &message, const std::string &target, uint time); void addContextHelp (const std::string &message, const std::string &target, uint time);
// Add a context help // Add a context help
void addContextHelpHTML (const std::string &filename, const std::string &target, uint time); void addContextHelpHTML (const std::string &filename, const std::string &target, uint time);
@ -60,7 +60,7 @@ public:
void ignoreContextHelp (CInterfaceGroup *groupToRemove); void ignoreContextHelp (CInterfaceGroup *groupToRemove);
// Open a bubble chat (with next and skip button) // Open a bubble chat (with next and skip button)
void chatOpen (uint32 nUID, const ucstring &ucsText, uint bubbleTimer = 0); void chatOpen (uint32 nUID, const std::string &ucsText, uint bubbleTimer = 0);
// Dynamic Chat // Dynamic Chat
@ -199,7 +199,7 @@ public:
void unlink (); void unlink ();
// Set text // Set text
void setText (const ucstring &text); void setText (const std::string &text);
// Called from action handler // Called from action handler
void next(); void next();
@ -217,7 +217,7 @@ public:
private: private:
void setRawText (const ucstring &text); void setRawText (const std::string &text);
void displayNextAndSkip (bool show); void displayNextAndSkip (bool show);
private: private:
@ -233,7 +233,7 @@ private:
CCharacterCL *_Character; CCharacterCL *_Character;
// Multi part bubble // Multi part bubble
std::vector<ucstring> _TextParts; std::vector<std::string> _TextParts;
uint32 _CurrentPart; uint32 _CurrentPart;
}; };

@ -202,7 +202,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
const char *templateName; const char *templateName;
const char *theTribeName = ""; const char *theTribeName = "";
std::string entityName = entity->getDisplayName(); std::string entityName = entity->getDisplayName();
std::string entityTitle = entity->getTitle().toUtf8(); std::string entityTitle = entity->getTitle();
// For some NPC's the name is empty and only a title is given, // For some NPC's the name is empty and only a title is given,
// in that case, treat the title as the name. // in that case, treat the title as the name.
@ -992,9 +992,9 @@ void CGroupInSceneUserInfo::updateDynamicData ()
if (_GuildName) if (_GuildName)
{ {
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
ucstring ucsTmp; string ucsTmp;
if (pSMC->getString (_Entity->getGuildNameID(), ucsTmp)) if (pSMC->getString (_Entity->getGuildNameID(), ucsTmp))
_GuildName->setText(ucsTmp.toUtf8()); _GuildName->setText(ucsTmp);
// guildname color is the pvp color // guildname color is the pvp color
_GuildName->setColor(entityColor); _GuildName->setColor(entityColor);
@ -1018,9 +1018,9 @@ void CGroupInSceneUserInfo::updateDynamicData ()
if (_EventFaction) if (_EventFaction)
{ {
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
ucstring ucsTmp; string ucsTmp;
if (pSMC->getString (_Entity->getEventFactionID(), ucsTmp)) if (pSMC->getString(_Entity->getEventFactionID(), ucsTmp))
_EventFaction->setText(ucsTmp.toUtf8()); _EventFaction->setText(ucsTmp);
// guildname color depends of PVP faction or not // guildname color depends of PVP faction or not
_EventFaction->setColor(entityColor); _EventFaction->setColor(entityColor);

@ -1176,10 +1176,10 @@ void CGroupMap::checkCoords()
// update text if needed // update text if needed
if (!_MissionTargetTextReceived[k]) if (!_MissionTargetTextReceived[k])
{ {
ucstring result; string result;
if (STRING_MANAGER::CStringManagerClient::instance()->getDynString(_MissionTargetTextIDs[k], result)) if (STRING_MANAGER::CStringManagerClient::instance()->getDynString(_MissionTargetTextIDs[k], result))
{ {
_MissionLM[k]->setDefaultContextHelp(result.toUtf8()); _MissionLM[k]->setDefaultContextHelp(result);
_MissionTargetTextReceived[k] = true; _MissionTargetTextReceived[k] = true;
} }
} }
@ -1363,11 +1363,11 @@ void CGroupMap::checkCoords()
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
uint32 val = NLGUI::CDBManager::getInstance()->getDbProp(NLMISC::toString("SERVER:GROUP:%d:NAME",i))->getValue32(); uint32 val = NLGUI::CDBManager::getInstance()->getDbProp(NLMISC::toString("SERVER:GROUP:%d:NAME",i))->getValue32();
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
ucstring res; string res;
if (pSMC->getString(val,res)) if (pSMC->getString(val, res))
{ {
std::string res2 = CEntityCL::removeTitleAndShardFromName(res.toUtf8()); std::string res2 = CEntityCL::removeTitleAndShardFromName(res);
_TeammateLM[i]->setDefaultContextHelp(res2); _TeammateLM[i]->setDefaultContextHelp(res2);
} }
} }
@ -3067,7 +3067,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm)
if (it != _ContinentLM.end()) if (it != _ContinentLM.end())
{ {
ct.setType(CCompassTarget::ContinentLandMark); ct.setType(CCompassTarget::ContinentLandMark);
(*it)->getContextHelpAsUtf16(ct.Name); (*it)->getContextHelp(ct.Name);
mapToWorld(ct.Pos, (*it)->Pos); mapToWorld(ct.Pos, (*it)->Pos);
found = true; found = true;
} }
@ -3080,7 +3080,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm)
if (it != _MissionLM.end()) if (it != _MissionLM.end())
{ {
ct.setPositionState(_MissionPosStates[it - _MissionLM.begin()]); ct.setPositionState(_MissionPosStates[it - _MissionLM.begin()]);
(*it)->getContextHelpAsUtf16(ct.Name); (*it)->getContextHelp(ct.Name);
mapToWorld(ct.Pos, (*it)->Pos); mapToWorld(ct.Pos, (*it)->Pos);
found = true; found = true;
} }
@ -3094,7 +3094,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm)
if (it != _UserLM.end()) if (it != _UserLM.end())
{ {
ct.setType(CCompassTarget::UserLandMark); ct.setType(CCompassTarget::UserLandMark);
(*it)->getContextHelpAsUtf16(ct.Name); (*it)->getContextHelp(ct.Name);
mapToWorld(ct.Pos, (*it)->Pos); mapToWorld(ct.Pos, (*it)->Pos);
found = true; found = true;
} }
@ -3122,7 +3122,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm)
if (!isIsland()) if (!isIsland())
{ {
ct.setType(CCompassTarget::Respawn); ct.setType(CCompassTarget::Respawn);
(*it)->getContextHelpAsUtf16(ct.Name); (*it)->getContextHelp(ct.Name);
mapToWorld(ct.Pos, (*it)->Pos); mapToWorld(ct.Pos, (*it)->Pos);
found = true; found = true;
} }
@ -3168,7 +3168,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm)
{ {
if(_AnimalLM[i]==lm) if(_AnimalLM[i]==lm)
{ {
_AnimalLM[i]->getContextHelpAsUtf16(ct.Name); _AnimalLM[i]->getContextHelp(ct.Name);
// copy The Animal Pos retriever into the compass // copy The Animal Pos retriever into the compass
ct.setPositionState(_AnimalPosStates[i]); ct.setPositionState(_AnimalPosStates[i]);
found = true; found = true;
@ -3186,7 +3186,7 @@ void CGroupMap::targetLandmark(CCtrlButton *lm)
{ {
if(_TeammateLM[i]==lm) if(_TeammateLM[i]==lm)
{ {
_TeammateLM[i]->getContextHelpAsUtf16(ct.Name); _TeammateLM[i]->getContextHelp(ct.Name);
// copy The Animal Pos retriever into the compass // copy The Animal Pos retriever into the compass
ct.setPositionState(_TeammatePosStates[i]); ct.setPositionState(_TeammatePosStates[i]);
found = true; found = true;
@ -3216,7 +3216,7 @@ void CGroupMap::targetLandmarkResult(uint32 index)
CCompassTarget ct; CCompassTarget ct;
ct.Pos = _MatchedLandmarks[index].Pos; ct.Pos = _MatchedLandmarks[index].Pos;
ct.Name = _MatchedLandmarks[index].Title; ct.Name = _MatchedLandmarks[index].Title.toUtf8();
// type sets compass arrow color // type sets compass arrow color
ct.setType(CCompassTarget::UserLandMark); ct.setType(CCompassTarget::UserLandMark);
@ -3310,7 +3310,7 @@ bool CGroupMap::targetLandmarkByName(const ucstring &search, bool startsWith) co
{ {
ct.setType(CCompassTarget::UserLandMark); ct.setType(CCompassTarget::UserLandMark);
mapToWorld(ct.Pos, lm->Pos); mapToWorld(ct.Pos, lm->Pos);
lm->getContextHelpAsUtf16(ct.Name); lm->getContextHelp(ct.Name);
closest = dist; closest = dist;
found = true; found = true;
} }
@ -3323,7 +3323,7 @@ bool CGroupMap::targetLandmarkByName(const ucstring &search, bool startsWith) co
{ {
ct.setType(CCompassTarget::ContinentLandMark); ct.setType(CCompassTarget::ContinentLandMark);
mapToWorld(ct.Pos, lm->Pos); mapToWorld(ct.Pos, lm->Pos);
lm->getContextHelpAsUtf16(ct.Name); lm->getContextHelp(ct.Name);
closest = dist; closest = dist;
found = true; found = true;
} }
@ -3334,7 +3334,7 @@ bool CGroupMap::targetLandmarkByName(const ucstring &search, bool startsWith) co
{ {
ct.setType(CCompassTarget::ContinentLandMark); ct.setType(CCompassTarget::ContinentLandMark);
mapToWorld(ct.Pos, lmt->Pos); mapToWorld(ct.Pos, lmt->Pos);
ct.Name = CUtfStringView(lmt->getText()).toUtf16(); ct.Name = lmt->getText();
closest = dist; closest = dist;
found = true; found = true;
} }

@ -245,11 +245,11 @@ bool CGuildManager::isLeaderOfTheGuild()
} }
// *************************************************************************** // ***************************************************************************
ucstring CGuildManager::getGuildName() string CGuildManager::getGuildName()
{ {
if (_InGuild) if (_InGuild)
return _Guild.Name; return _Guild.Name;
return ucstring(""); return string();
} }
// *************************************************************************** // ***************************************************************************
@ -359,7 +359,7 @@ void CGuildManager::update()
for (uint i = 0; i < _GuildMembers.size(); ++i) for (uint i = 0; i < _GuildMembers.size(); ++i)
{ {
if (!pSMC->getString (_GuildMembers[i].NameID, _GuildMembers[i].Name)) bAllValid = false; if (!pSMC->getString (_GuildMembers[i].NameID, _GuildMembers[i].Name)) bAllValid = false;
else _GuildMembers[i].Name = CEntityCL::removeTitleAndShardFromName(_GuildMembers[i].Name.toUtf8()); else _GuildMembers[i].Name = CEntityCL::removeTitleAndShardFromName(_GuildMembers[i].Name);
} }
// If all is valid no more need update and if guild is opened update the interface // If all is valid no more need update and if guild is opened update the interface
@ -369,13 +369,13 @@ void CGuildManager::update()
if (node && node->getValueBool()) if (node && node->getValueBool())
{ {
// See if we need to show any online/offline messages // See if we need to show any online/offline messages
static map<ucstring, SGuildMember> CachedGuildMembers; static map<string, SGuildMember> CachedGuildMembers;
ucstring onlineMessage = CI18N::get("uiPlayerOnline"); const string &onlineMessage = CI18N::get("uiPlayerOnline");
ucstring offlineMessage = CI18N::get("uiPlayerOffline"); const string &offlineMessage = CI18N::get("uiPlayerOffline");
for (uint i = 0; i < _GuildMembers.size(); ++i) for (uint i = 0; i < _GuildMembers.size(); ++i)
{ {
map<ucstring, SGuildMember>::const_iterator it = CachedGuildMembers.find(_GuildMembers[i].Name); map<string, SGuildMember>::const_iterator it = CachedGuildMembers.find(_GuildMembers[i].Name);
if ( it != CachedGuildMembers.end() ) if ( it != CachedGuildMembers.end() )
{ {
if ( (*it).second.Online == _GuildMembers[i].Online) if ( (*it).second.Online == _GuildMembers[i].Online)
@ -390,7 +390,7 @@ void CGuildManager::update()
continue; continue;
} }
ucstring msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage; string msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage;
strFindReplace(msg, "%s", _GuildMembers[i].Name); strFindReplace(msg, "%s", _GuildMembers[i].Name);
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
map<string, CClientConfig::SSysInfoParam>::const_iterator it; map<string, CClientConfig::SSysInfoParam>::const_iterator it;
@ -418,7 +418,7 @@ void CGuildManager::update()
{ {
uint i; uint i;
_Grade = EGSPD::CGuildGrade::Member; _Grade = EGSPD::CGuildGrade::Member;
ucstring sUserName = toLower(UserEntity->getEntityName()); string sUserName = toLower(UserEntity->getEntityName());
for (i = 0; i < _GuildMembers.size(); ++i) for (i = 0; i < _GuildMembers.size(); ++i)
{ {
if (toLower(_GuildMembers[i].Name) == sUserName) if (toLower(_GuildMembers[i].Name) == sUserName)
@ -471,7 +471,7 @@ void CGuildManager::update()
{ {
CViewText *pJoinPropPhraseView = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(VIEW_JOIN_PROPOSAL_PHRASE)); CViewText *pJoinPropPhraseView = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(VIEW_JOIN_PROPOSAL_PHRASE));
if (pJoinPropPhraseView != NULL) if (pJoinPropPhraseView != NULL)
pJoinPropPhraseView->setText(_JoinPropPhrase.toUtf8()); pJoinPropPhraseView->setText(_JoinPropPhrase);
pJoinProp->setActive(true); pJoinProp->setActive(true);
CWidgetManager::getInstance()->setTopWindow(pJoinProp); CWidgetManager::getInstance()->setTopWindow(pJoinProp);
@ -722,10 +722,10 @@ bool CDBGroupListAscensor::CSheetChildAscensor::isInvalidated(CDBGroupListSheetT
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
uint32 nameID = NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:ASCENSOR:" + toString(Index) + ":NAME")->getValue32(); uint32 nameID = NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:ASCENSOR:" + toString(Index) + ":NAME")->getValue32();
ucstring name; string name;
if (nameID && pSMC->getDynString(nameID, name)) if (nameID && pSMC->getDynString(nameID, name))
{ {
Text->setText(name.toUtf8()); Text->setText(name);
uint64 icon = NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:ASCENSOR:" + toString(Index) + ":ICON")->getValue64(); uint64 icon = NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:ASCENSOR:" + toString(Index) + ":ICON")->getValue64();
@ -831,7 +831,7 @@ class CAHGuildSheetOpen : public IActionHandler
// Set name // Set name
CViewText *pViewName = dynamic_cast<CViewText*>(pLine->getView(TEMPLATE_GUILD_MEMBER_NAME)); CViewText *pViewName = dynamic_cast<CViewText*>(pLine->getView(TEMPLATE_GUILD_MEMBER_NAME));
if (pViewName != NULL) if (pViewName != NULL)
pViewName->setText (rGuildMembers[i].Name.toUtf8()); pViewName->setText (rGuildMembers[i].Name);
// Set Grade // Set Grade
CViewText *pViewGrade = dynamic_cast<CViewText*>(pLine->getView(TEMPLATE_GUILD_MEMBER_GRADE)); CViewText *pViewGrade = dynamic_cast<CViewText*>(pLine->getView(TEMPLATE_GUILD_MEMBER_GRADE));
@ -875,7 +875,7 @@ class CAHGuildSheetOpen : public IActionHandler
CCtrlBase *inviteButton = pLine->getCtrl("invite_button"); CCtrlBase *inviteButton = pLine->getCtrl("invite_button");
if (inviteButton != NULL) if (inviteButton != NULL)
inviteButton->setActive(rGuildMembers[i].Online != ccs_offline && rGuildMembers[i].Name.toUtf8() != UserEntity->getEntityName()); inviteButton->setActive(rGuildMembers[i].Online != ccs_offline && rGuildMembers[i].Name != UserEntity->getEntityName());
// Enter Date // Enter Date
CViewText *pViewEnterDate = dynamic_cast<CViewText*>(pLine->getView(TEMPLATE_GUILD_MEMBER_ENTER_DATE)); CViewText *pViewEnterDate = dynamic_cast<CViewText*>(pLine->getView(TEMPLATE_GUILD_MEMBER_ENTER_DATE));
@ -883,13 +883,13 @@ class CAHGuildSheetOpen : public IActionHandler
{ {
CRyzomTime rt; CRyzomTime rt;
rt.updateRyzomClock(rGuildMembers[i].EnterDate); rt.updateRyzomClock(rGuildMembers[i].EnterDate);
ucstring str = toString("%04d", rt.getRyzomYear()) + " "; string str = toString("%04d", rt.getRyzomYear()) + " ";
str += CI18N::get("uiJenaYear") + " : "; str += CI18N::get("uiJenaYear") + " : ";
str += CI18N::get("uiAtysianCycle") + " "; str += CI18N::get("uiAtysianCycle") + " ";
str += toString("%01d", rt.getRyzomCycle()+1) +", "; str += toString("%01d", rt.getRyzomCycle()+1) +", ";
str += CI18N::get("ui"+MONTH::toString( (MONTH::EMonth)rt.getRyzomMonthInCurrentCycle() )) + ", "; str += CI18N::get("ui"+MONTH::toString( (MONTH::EMonth)rt.getRyzomMonthInCurrentCycle() )) + ", ";
str += toString("%02d", rt.getRyzomDayOfMonth()+1); str += toString("%02d", rt.getRyzomDayOfMonth()+1);
pViewEnterDate->setText(str.toUtf8()); pViewEnterDate->setText(str);
} }
// Add to the list // Add to the list
@ -989,12 +989,12 @@ class CAHGuildSheetMenuOpen : public IActionHandler
public: public:
// Current selection // Current selection
static sint32 MemberIndexSelected; // Index of the member selected when right clicked static sint32 MemberIndexSelected; // Index of the member selected when right clicked
static ucstring MemberNameSelected; // Name of the member selected when right clicked (for extra check) static std::string MemberNameSelected; // Name of the member selected when right clicked (for extra check)
}; };
REGISTER_ACTION_HANDLER (CAHGuildSheetMenuOpen, "guild_member_menu_open"); REGISTER_ACTION_HANDLER (CAHGuildSheetMenuOpen, "guild_member_menu_open");
sint32 CAHGuildSheetMenuOpen::MemberIndexSelected= -1; sint32 CAHGuildSheetMenuOpen::MemberIndexSelected= -1;
ucstring CAHGuildSheetMenuOpen::MemberNameSelected; std::string CAHGuildSheetMenuOpen::MemberNameSelected;
// *************************************************************************** // ***************************************************************************
@ -1089,12 +1089,12 @@ public:
// Current selection // Current selection
static sint32 MemberIndexSelected; // Index of the member selected when left clicked static sint32 MemberIndexSelected; // Index of the member selected when left clicked
static ucstring MemberNameSelected; // Name of the member selected when lef clicked static std::string MemberNameSelected; // Name of the member selected when lef clicked
}; };
REGISTER_ACTION_HANDLER(CAHGuildSheetTellMember, "guild_tell_member"); REGISTER_ACTION_HANDLER(CAHGuildSheetTellMember, "guild_tell_member");
sint32 CAHGuildSheetTellMember::MemberIndexSelected= -1; sint32 CAHGuildSheetTellMember::MemberIndexSelected= -1;
ucstring CAHGuildSheetTellMember::MemberNameSelected; string CAHGuildSheetTellMember::MemberNameSelected;
// *************************************************************************** // ***************************************************************************
class CAHGuildSheetSetLeader : public IActionHandler class CAHGuildSheetSetLeader : public IActionHandler

@ -37,7 +37,7 @@ struct SGuildMember
{ {
uint32 Index; // Index in the DB uint32 Index; // Index in the DB
uint32 NameID; uint32 NameID;
ucstring Name; std::string Name;
EGSPD::CGuildGrade::TGuildGrade Grade; EGSPD::CGuildGrade::TGuildGrade Grade;
TCharConnectionState Online; TCharConnectionState Online;
uint32 EnterDate; uint32 EnterDate;
@ -54,7 +54,7 @@ struct SGuildMember
struct SGuild struct SGuild
{ {
uint32 NameID; uint32 NameID;
ucstring Name; std::string Name;
uint64 Icon; uint64 Icon;
bool QuitGuildAvailable; bool QuitGuildAvailable;
@ -131,7 +131,7 @@ public:
bool isLeaderOfTheGuild(); bool isLeaderOfTheGuild();
/// If the player is in a guild get the guild name else return empty /// If the player is in a guild get the guild name else return empty
ucstring getGuildName(); std::string getGuildName();
/// If the player is in a guild get the amount of money the guild owns else return zero /// If the player is in a guild get the amount of money the guild owns else return zero
uint64 getMoney(); uint64 getMoney();
@ -270,7 +270,7 @@ private:
// Join Proposal handling // Join Proposal handling
uint32 _JoinPropPhraseID; uint32 _JoinPropPhraseID;
ucstring _JoinPropPhrase; std::string _JoinPropPhrase;
bool _JoinPropUpdate; bool _JoinPropUpdate;
}; };

@ -310,12 +310,12 @@ public:
class CStringManagerTextProvider : public CViewTextID::IViewTextProvider class CStringManagerTextProvider : public CViewTextID::IViewTextProvider
{ {
bool getString( uint32 stringId, ucstring &result ) bool getString( uint32 stringId, string &result )
{ {
return STRING_MANAGER::CStringManagerClient::instance()->getString( stringId, result ); return STRING_MANAGER::CStringManagerClient::instance()->getString( stringId, result );
} }
bool getDynString( uint32 dynStringId, ucstring &result ) bool getDynString( uint32 dynStringId, string &result )
{ {
return STRING_MANAGER::CStringManagerClient::instance()->getDynString( dynStringId, result ); return STRING_MANAGER::CStringManagerClient::instance()->getDynString( dynStringId, result );
} }
@ -400,7 +400,7 @@ public:
} }
} }
// get the title translated // get the title translated
ucstring sTitleTranslated = botName; // FIXME: UTF-8 string sTitleTranslated = botName; // FIXME: UTF-8
CStringPostProcessRemoveName spprn; CStringPostProcessRemoveName spprn;
spprn.Woman = womanTitle; spprn.Woman = womanTitle;
spprn.cbIDStringReceived(sTitleTranslated); spprn.cbIDStringReceived(sTitleTranslated);
@ -412,14 +412,14 @@ public:
{ {
// But if there is no name, display only the title // But if there is no name, display only the title
if (botName.empty()) if (botName.empty())
botName = sTitleTranslated.toUtf8(); botName = sTitleTranslated;
} }
else else
{ {
// Else we want the title ! // Else we want the title !
if (!botName.empty()) if (!botName.empty())
botName += " "; botName += " ";
botName += sTitleTranslated.toUtf8(); botName += sTitleTranslated;
} }
formatedResult += botName; formatedResult += botName;
@ -984,7 +984,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, PeopleInterraction.SystemMessageBuffer[i].Cat); displaySystemInfo(PeopleInterraction.SystemMessageBuffer[i].Str.toUtf8(), PeopleInterraction.SystemMessageBuffer[i].Cat);
} }
PeopleInterraction.SystemMessageBuffer.clear(); PeopleInterraction.SystemMessageBuffer.clear();
@ -2349,7 +2349,7 @@ void CInterfaceManager::processServerIDString()
for (uint32 i = 0; i < _IDStringWaiters.size(); ++i) for (uint32 i = 0; i < _IDStringWaiters.size(); ++i)
{ {
bool bAffect = false; bool bAffect = false;
ucstring ucstrToAffect; string ucstrToAffect;
SIDStringWaiter *pISW = _IDStringWaiters[i]; SIDStringWaiter *pISW = _IDStringWaiters[i];
if (pISW->IdOrString == true) // ID ! if (pISW->IdOrString == true) // ID !
{ {
@ -2375,7 +2375,7 @@ void CInterfaceManager::processServerIDString()
if (bValid) if (bValid)
{ {
val.setString (ucstrToAffect.toUtf8()); val.setString (ucstrToAffect);
CInterfaceLink::setTargetProperty (pISW->Target, val); CInterfaceLink::setTargetProperty (pISW->Target, val);
} }
@ -2496,7 +2496,7 @@ bool CInterfaceManager::getCurrentValidMessageBoxOnOk(string &ahOnOk, const std:
// *************************************************************************** // ***************************************************************************
void CInterfaceManager::displayDebugInfo(const ucstring &str, TSystemInfoMode mode /*=InfoMsg*/) void CInterfaceManager::displayDebugInfo(const string &str, TSystemInfoMode mode /*=InfoMsg*/)
{ {
if (PeopleInterraction.DebugInfo) if (PeopleInterraction.DebugInfo)
PeopleInterraction.ChatInput.DebugInfo.displayMessage(str, getDebugInfoColor(mode), 2); PeopleInterraction.ChatInput.DebugInfo.displayMessage(str, getDebugInfoColor(mode), 2);
@ -2526,7 +2526,7 @@ NLMISC::CRGBA CInterfaceManager::getDebugInfoColor(TSystemInfoMode mode)
} }
// *************************************************************************** // ***************************************************************************
void CInterfaceManager::displaySystemInfo(const ucstring &str, const string &cat) void CInterfaceManager::displaySystemInfo(const string &str, const string &cat)
{ {
CClientConfig::SSysInfoParam::TMode mode = CClientConfig::SSysInfoParam::Normal; CClientConfig::SSysInfoParam::TMode mode = CClientConfig::SSysInfoParam::Normal;
CRGBA color = CRGBA::White; CRGBA color = CRGBA::White;
@ -3062,7 +3062,7 @@ NLMISC_COMMAND( localCounter, "Get value of local counter", "" )
{ {
if (args.size() != 0) return false; if (args.size() != 0) return false;
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo(ucstring(toString(im->getLocalSyncActionCounter()))); im->displaySystemInfo(toString(im->getLocalSyncActionCounter()));
return true; return true;
} }
@ -4219,13 +4219,13 @@ bool CInterfaceManager::parseTokens(string& ucstr)
// special case where there is only a title, very rare case for some NPC // special case where there is only a title, very rare case for some NPC
if (name.empty()) if (name.empty())
{ {
name = pTokenSubjectEntity->getTitle().toUtf8(); name = pTokenSubjectEntity->getTitle();
} }
token_replacement = name.empty() ? token_replacement : name; token_replacement = name.empty() ? token_replacement : name;
} }
else if (token_param == "title") else if (token_param == "title")
{ {
string title = pTokenSubjectEntity->getTitle().toUtf8(); string title = pTokenSubjectEntity->getTitle();
token_replacement = title.empty() ? token_replacement : title; token_replacement = title.empty() ? token_replacement : title;
} }
else if (token_param == "race") else if (token_param == "race")
@ -4244,10 +4244,10 @@ bool CInterfaceManager::parseTokens(string& ucstr)
else if (token_param == "guild") else if (token_param == "guild")
{ {
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
ucstring ucGuildName; string ucGuildName;
if (pSMC->getString(pTokenSubjectEntity->getGuildNameID(), ucGuildName)) if (pSMC->getString(pTokenSubjectEntity->getGuildNameID(), ucGuildName))
{ {
token_replacement = ucGuildName.empty() ? token_replacement : ucGuildName.toUtf8(); token_replacement = ucGuildName.empty() ? token_replacement : ucGuildName;
} }
} }
else if (token_param.substr(0, 3) == "gs(" && else if (token_param.substr(0, 3) == "gs(" &&

@ -249,7 +249,7 @@ public:
{ {
public: public:
virtual ~IStringProcess() { } virtual ~IStringProcess() { }
virtual bool cbIDStringReceived(ucstring &inOut) = 0; // called when string or id is received (return true if valid the change) virtual bool cbIDStringReceived(std::string &inOut) = 0; // called when string or id is received (return true if valid the change)
}; };
void addServerString (const std::string &sTarget, uint32 id, IStringProcess *cb = NULL); void addServerString (const std::string &sTarget, uint32 id, IStringProcess *cb = NULL);
@ -292,12 +292,12 @@ public:
void drawViews (NL3D::UCamera camera); void drawViews (NL3D::UCamera camera);
// display a debug info // display a debug info
void displayDebugInfo(const ucstring &str, TSystemInfoMode mode = InfoMsg); void displayDebugInfo(const std::string &str, TSystemInfoMode mode = InfoMsg);
// get the color associated with the given system info mode // get the color associated with the given system info mode
NLMISC::CRGBA getDebugInfoColor(TSystemInfoMode mode); NLMISC::CRGBA getDebugInfoColor(TSystemInfoMode mode);
// display a system info string // display a system info string
void displaySystemInfo(const ucstring &str, const std::string &Category = "SYS"); void displaySystemInfo(const std::string &str, const std::string &Category = "SYS");
NLMISC::CRGBA getSystemInfoColor(const std::string &Category = "SYS"); NLMISC::CRGBA getSystemInfoColor(const std::string &Category = "SYS");
void setupOptions(); void setupOptions();

@ -3194,7 +3194,7 @@ class CHandlerInvTempToBag : public IActionHandler
// If we cant find place display a message and dont send the request to the server // If we cant find place display a message and dont send the request to the server
if (!getInventory().isSpaceInAllBagsForItem(pCSDst)) if (!getInventory().isSpaceInAllBagsForItem(pCSDst))
{ {
ucstring msg = CI18N::get("msgCantPutItemInBag"); string msg = CI18N::get("msgCantPutItemInBag");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
return; return;
@ -3274,7 +3274,7 @@ class CHandlerInvTempAll : public IActionHandler
if (!bPlaceFound) if (!bPlaceFound)
{ {
ucstring msg = CI18N::get("msgCantPutItemInBag"); string msg = CI18N::get("msgCantPutItemInBag");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
CInterfaceManager::getInstance()->displaySystemInfo(msg, cat); CInterfaceManager::getInstance()->displaySystemInfo(msg, cat);
return; return;

@ -1353,7 +1353,7 @@ int CLuaIHMRyzom::getPlayerName(CLuaState &ls)
int CLuaIHMRyzom::getPlayerTitleRaw(CLuaState &ls) int CLuaIHMRyzom::getPlayerTitleRaw(CLuaState &ls)
{ {
CLuaIHM::checkArgCount(ls, "getPlayerTitleRaw", 0); CLuaIHM::checkArgCount(ls, "getPlayerTitleRaw", 0);
ls.push(UserEntity->getTitleRaw().toUtf8()); ls.push(UserEntity->getTitleRaw());
return 1; return 1;
} }
@ -1361,7 +1361,7 @@ int CLuaIHMRyzom::getPlayerTitleRaw(CLuaState &ls)
int CLuaIHMRyzom::getPlayerTitle(CLuaState &ls) int CLuaIHMRyzom::getPlayerTitle(CLuaState &ls)
{ {
CLuaIHM::checkArgCount(ls, "getPlayerTitle", 0); CLuaIHM::checkArgCount(ls, "getPlayerTitle", 0);
ls.push(UserEntity->getTitle().toUtf8()); ls.push(UserEntity->getTitle());
return 1; return 1;
} }
@ -1435,7 +1435,7 @@ int CLuaIHMRyzom::getTargetTitleRaw(CLuaState &ls)
if (!target) return 0; if (!target) return 0;
ls.push(target->getTitleRaw().toUtf8()); ls.push(target->getTitleRaw());
return 1; return 1;
} }
@ -1447,7 +1447,7 @@ int CLuaIHMRyzom::getTargetTitle(CLuaState &ls)
if (!target) return 0; if (!target) return 0;
ls.push(target->getTitle().toUtf8()); ls.push(target->getTitle());
return 1; return 1;
} }
@ -1667,7 +1667,7 @@ int CLuaIHMRyzom::displaySystemInfo(CLuaState &ls)
ucstring msg; ucstring msg;
nlverify(CLuaIHM::getUCStringOnStack(ls, 1, msg)); nlverify(CLuaIHM::getUCStringOnStack(ls, 1, msg));
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->displaySystemInfo(msg, ls.toString(2)); pIM->displaySystemInfo(msg.toUtf8(), ls.toString(2));
return 0; return 0;
} }
@ -3220,9 +3220,7 @@ void CLuaIHMRyzom::browseNpcWebPage(const std::string &htmlId, const std::string
{ {
userName = UserEntity->getDisplayName(); userName = UserEntity->getDisplayName();
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
ucstring ucsTmp; pSMC->getString(UserEntity->getGuildNameID(), guildName);
pSMC->getString(UserEntity->getGuildNameID(), ucsTmp);
guildName = ucsTmp.toString();
while (guildName.find(' ') != string::npos) while (guildName.find(' ') != string::npos)
{ {
@ -3273,16 +3271,16 @@ void CLuaIHMRyzom::clearHtmlUndoRedo(const std::string &htmlId)
ucstring CLuaIHMRyzom::getDynString(sint32 dynStringId) ucstring CLuaIHMRyzom::getDynString(sint32 dynStringId)
{ {
//H_AUTO(Lua_CLuaIHM_getDynString) //H_AUTO(Lua_CLuaIHM_getDynString)
ucstring result; string result;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynStringId, result); STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynStringId, result);
return result; return ucstring::makeFromUtf8(result); // TODO: Lua UTF-8
} }
// *************************************************************************** // ***************************************************************************
bool CLuaIHMRyzom::isDynStringAvailable(sint32 dynStringId) bool CLuaIHMRyzom::isDynStringAvailable(sint32 dynStringId)
{ {
//H_AUTO(Lua_CLuaIHM_isDynStringAvailable) //H_AUTO(Lua_CLuaIHM_isDynStringAvailable)
ucstring result; string result;
bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynStringId, result); bool res = STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynStringId, result);
return res; return res;
} }
@ -3426,7 +3424,7 @@ string CLuaIHMRyzom::getGuildMemberName(sint32 nMemberId)
if ((nMemberId < 0) || (nMemberId >= getNbGuildMembers())) if ((nMemberId < 0) || (nMemberId >= getNbGuildMembers()))
return ""; return "";
return CGuildManager::getInstance()->getGuildMembers()[nMemberId].Name.toString(); return CGuildManager::getInstance()->getGuildMembers()[nMemberId].Name;
} }
// *************************************************************************** // ***************************************************************************
@ -3947,27 +3945,27 @@ int CLuaIHMRyzom::displayChatMessage(CLuaState &ls)
if (input == "around") if (input == "around")
{ {
prop.readRGBA(std::string(dbPath + ":SAY").c_str(), " "); prop.readRGBA(std::string(dbPath + ":SAY").c_str(), " ");
ci.AroundMe.displayMessage(ucstring(msg), prop.getRGBA()); ci.AroundMe.displayMessage(msg, prop.getRGBA());
} }
else if (input == "region") else if (input == "region")
{ {
prop.readRGBA(std::string(dbPath + ":REGION").c_str(), " "); prop.readRGBA(std::string(dbPath + ":REGION").c_str(), " ");
ci.Region.displayMessage(ucstring(msg), prop.getRGBA()); ci.Region.displayMessage(msg, prop.getRGBA());
} }
else if (input == "universe") else if (input == "universe")
{ {
prop.readRGBA(std::string(dbPath + ":UNIVERSE_NEW").c_str(), " "); prop.readRGBA(std::string(dbPath + ":UNIVERSE_NEW").c_str(), " ");
ci.Universe.displayMessage(ucstring(msg), prop.getRGBA()); ci.Universe.displayMessage(msg, prop.getRGBA());
} }
else if (input == "guild") else if (input == "guild")
{ {
prop.readRGBA(std::string(dbPath + ":CLADE").c_str(), " "); prop.readRGBA(std::string(dbPath + ":CLADE").c_str(), " ");
ci.Guild.displayMessage(ucstring(msg), prop.getRGBA()); ci.Guild.displayMessage(msg, prop.getRGBA());
} }
else if (input == "team") else if (input == "team")
{ {
prop.readRGBA(std::string(dbPath + ":GROUP").c_str(), " "); prop.readRGBA(std::string(dbPath + ":GROUP").c_str(), " ");
ci.Team.displayMessage(ucstring(msg), prop.getRGBA()); ci.Team.displayMessage(msg, prop.getRGBA());
} }
} }
if (ls.type(2) == LUA_TNUMBER) if (ls.type(2) == LUA_TNUMBER)
@ -3975,7 +3973,7 @@ int CLuaIHMRyzom::displayChatMessage(CLuaState &ls)
sint64 id = ls.toInteger(2); sint64 id = ls.toInteger(2);
prop.readRGBA(toString("%s:DYN:%i", dbPath.c_str(), id).c_str(), " "); prop.readRGBA(toString("%s:DYN:%i", dbPath.c_str(), id).c_str(), " ");
if (id >= 0 && id < CChatGroup::MaxDynChanPerPlayer) if (id >= 0 && id < CChatGroup::MaxDynChanPerPlayer)
ci.DynamicChat[id].displayMessage(ucstring(msg), prop.getRGBA()); ci.DynamicChat[id].displayMessage(msg, prop.getRGBA());
} }
return 1; return 1;
} }

@ -623,9 +623,9 @@ void CMusicPlayer::createPlaylistFromMusic()
if (extensions.empty()) if (extensions.empty())
{ {
// in the very unlikely scenario // in the very unlikely scenario
const ucstring message("Sound driver has no support for music."); static const string message("Sound driver has no support for music.");
CInterfaceManager::getInstance()->displaySystemInfo(message, "SYS"); CInterfaceManager::getInstance()->displaySystemInfo(message, "SYS");
nlinfo("%s", message.toUtf8().c_str()); nlinfo("%s", message.c_str());
return; return;
} }
std::string newPath = CPath::makePathAbsolute(CPath::standardizePath(ClientCfg.MediaPlayerDirectory), CPath::getCurrentPath(), true); std::string newPath = CPath::makePathAbsolute(CPath::standardizePath(ClientCfg.MediaPlayerDirectory), CPath::getCurrentPath(), true);
@ -635,7 +635,7 @@ void CMusicPlayer::createPlaylistFromMusic()
std::string msg(CI18N::get("uiMk_system6")); std::string msg(CI18N::get("uiMk_system6"));
msg += ": " + newPath + " (" + extlist + ")"; msg += ": " + newPath + " (" + extlist + ")";
CInterfaceManager::getInstance()->displaySystemInfo(ucstring::makeFromUtf8(msg), "SYS"); CInterfaceManager::getInstance()->displaySystemInfo(msg, "SYS");
nlinfo("%s", msg.c_str()); nlinfo("%s", msg.c_str());
// Recursive scan for files from media directory // Recursive scan for files from media directory

@ -91,7 +91,7 @@ static const sint PARTY_CHAT_SPAWN_DELTA = 20; // to avoid that all party chat a
/** Display an error msg in the system info window, and also in the last window that triggered the command (so that the user is sure to see it) /** Display an error msg in the system info window, and also in the last window that triggered the command (so that the user is sure to see it)
*/ */
static void displayVisibleSystemMsg(const ucstring &msg, const string &cat = "CHK"); static void displayVisibleSystemMsg(const std::string &msg, const string &cat = "CHK");
////////////////////////////// //////////////////////////////
@ -102,7 +102,7 @@ static void displayVisibleSystemMsg(const ucstring &msg, const string &cat = "CH
struct CPartyChatEntryHandler : public IChatWindowListener struct CPartyChatEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -120,7 +120,7 @@ struct CPartyChatEntryHandler : public IChatWindowListener
// handler to manage user entry in 'around me' window // handler to manage user entry in 'around me' window
struct CAroundMeEntryHandler : public IChatWindowListener struct CAroundMeEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -138,7 +138,7 @@ struct CAroundMeEntryHandler : public IChatWindowListener
// handler to manage user entry in 'region' window // handler to manage user entry in 'region' window
struct CRegionEntryHandler : public IChatWindowListener struct CRegionEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -156,7 +156,7 @@ struct CRegionEntryHandler : public IChatWindowListener
// handler to manage user entry in 'universe' window // handler to manage user entry in 'universe' window
struct CUniverseEntryHandler : public IChatWindowListener struct CUniverseEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -174,7 +174,7 @@ struct CUniverseEntryHandler : public IChatWindowListener
// handler to manage user entry in 'guild chat' window // handler to manage user entry in 'guild chat' window
struct CGuildChatEntryHandler : public IChatWindowListener struct CGuildChatEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -191,7 +191,7 @@ struct CGuildChatEntryHandler : public IChatWindowListener
// handler to manage user entry in 'team chat' window // handler to manage user entry in 'team chat' window
struct CTeamChatEntryHandler : public IChatWindowListener struct CTeamChatEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -208,7 +208,7 @@ struct CTeamChatEntryHandler : public IChatWindowListener
// handler to manage user entry in a 'talk with friend' window // handler to manage user entry in a 'talk with friend' window
struct CFriendTalkEntryHandler : public IChatWindowListener struct CFriendTalkEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -225,10 +225,9 @@ struct CFriendTalkEntryHandler : public IChatWindowListener
// handler to manage user entry in a debug console window // handler to manage user entry in a debug console window
struct CDebugConsoleEntryHandler : public IChatWindowListener struct CDebugConsoleEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow * /* chatWindow */) virtual void msgEntered(const string &msg, CChatWindow * /* chatWindow */)
{ {
std::string str = msg.toString(); NLMISC::ICommand::execute( msg, g_log );
NLMISC::ICommand::execute( str, g_log );
} }
}; };
@ -242,7 +241,7 @@ public:
DbIndex= 0; DbIndex= 0;
} }
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -935,7 +934,7 @@ class CHandlerChatGroupFilter : public IActionHandler
case CChatGroup::dyn_chat: case CChatGroup::dyn_chat:
uint32 index = PeopleInterraction.TheUserChat.Filter.getTargetDynamicChannelDbIndex(); uint32 index = PeopleInterraction.TheUserChat.Filter.getTargetDynamicChannelDbIndex();
uint32 textId = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DYN_CHAT:CHANNEL"+toString(index)+":NAME")->getValue32(); uint32 textId = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DYN_CHAT:CHANNEL"+toString(index)+":NAME")->getValue32();
ucstring title; string title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
if (title.empty()) if (title.empty())
{ {
@ -945,7 +944,7 @@ class CHandlerChatGroupFilter : public IActionHandler
} }
else else
{ {
pUserBut->setHardText(title.toUtf8()); pUserBut->setHardText(title);
} }
break; break;
} }
@ -1298,7 +1297,7 @@ void CPeopleInterraction::addContactInList(uint32 contactId, const ucstring &nam
//================================================================================================================= //=================================================================================================================
void CPeopleInterraction::addContactInList(uint32 contactId, uint32 nameID, TCharConnectionState online, uint8 nList) void CPeopleInterraction::addContactInList(uint32 contactId, uint32 nameID, TCharConnectionState online, uint8 nList)
{ {
ucstring name; string name;
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
if (pSMC->getString(nameID, name)) if (pSMC->getString(nameID, name))
{ {
@ -1358,7 +1357,7 @@ void CPeopleInterraction::updateWaitingContacts()
for (uint32 i = 0; i < WaitingContacts.size();) for (uint32 i = 0; i < WaitingContacts.size();)
{ {
SWaitingContact &w = WaitingContacts[i]; SWaitingContact &w = WaitingContacts[i];
ucstring name; string name;
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
if (pSMC->getString(w.NameId, name)) if (pSMC->getString(w.NameId, name))
{ {
@ -1394,7 +1393,7 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS
// Only show the message if this player is not in my guild (because then the guild manager will show a message) // Only show the message if this player is not in my guild (because then the guild manager will show a message)
std::vector<SGuildMember> GuildMembers = CGuildManager::getInstance()->getGuildMembers(); std::vector<SGuildMember> GuildMembers = CGuildManager::getInstance()->getGuildMembers();
bool bOnlyFriend = true; bool bOnlyFriend = true;
ucstring name = toLower(FriendList.getName(index)); string name = toLower(FriendList.getName(index).toUtf8());
for (uint i = 0; i < GuildMembers.size(); ++i) for (uint i = 0; i < GuildMembers.size(); ++i)
{ {
if (toLower(GuildMembers[i].Name) == name) if (toLower(GuildMembers[i].Name) == name)
@ -1410,8 +1409,8 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS
// Player is not in my guild, and the status change is from offline to online/abroad online or vice versa. // Player is not in my guild, and the status change is from offline to online/abroad online or vice versa.
if (showMsg) if (showMsg)
{ {
ucstring msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline"); string msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline");
strFindReplace(msg, "%s", FriendList.getName(index)); strFindReplace(msg, "%s", FriendList.getName(index).toUtf8());
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
map<string, CClientConfig::SSysInfoParam>::const_iterator it; map<string, CClientConfig::SSysInfoParam>::const_iterator it;
NLMISC::CRGBA col = CRGBA::Yellow; NLMISC::CRGBA col = CRGBA::Yellow;
@ -1883,7 +1882,7 @@ void CPeopleInterraction::refreshActiveUserChats()
} }
//================================================================================================================= //=================================================================================================================
void CPeopleInterraction::talkInDynamicChannel(uint32 channelNb,ucstring sentence) void CPeopleInterraction::talkInDynamicChannel(uint32 channelNb,string sentence)
{ {
if(channelNb<CChatGroup::MaxDynChanPerPlayer) if(channelNb<CChatGroup::MaxDynChanPerPlayer)
{ {
@ -1892,7 +1891,7 @@ void CPeopleInterraction::talkInDynamicChannel(uint32 channelNb,ucstring sentenc
} }
//================================================================================================================= //=================================================================================================================
void CPeopleInterraction::displayTellInMainChat(const ucstring &playerName) void CPeopleInterraction::displayTellInMainChat(const string &playerName)
{ {
//CChatWindow *chat = PeopleInterraction.MainChat.Window; //CChatWindow *chat = PeopleInterraction.MainChat.Window;
CChatWindow *chat = PeopleInterraction.ChatGroup.Window; CChatWindow *chat = PeopleInterraction.ChatGroup.Window;
@ -2138,7 +2137,7 @@ public:
uint peopleIndex; uint peopleIndex;
if (PeopleInterraction.getPeopleFromCurrentMenu(list, peopleIndex)) if (PeopleInterraction.getPeopleFromCurrentMenu(list, peopleIndex))
{ {
CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex)); CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8());
} }
} }
}; };
@ -2160,7 +2159,7 @@ class CHandlerTellContact : public IActionHandler
uint peopleIndex; uint peopleIndex;
if (PeopleInterraction.getPeopleFromContainerID(gc->getId(), list, peopleIndex)) if (PeopleInterraction.getPeopleFromContainerID(gc->getId(), list, peopleIndex))
{ {
CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex)); CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8());
} }
} }
@ -2416,7 +2415,7 @@ class CHandlerValidatePartyChatName : public IActionHandler
if (!gc) return; if (!gc) return;
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(gc->getGroup("eb")); CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(gc->getGroup("eb"));
if (!eb) return; if (!eb) return;
ucstring title = eb->getInputStringAsUtf16(); string title = eb->getInputString();
// TODO GAMEDEV : create (or join ?) a new channel. Each channel (party chat) should have a unique name in the game // TODO GAMEDEV : create (or join ?) a new channel. Each channel (party chat) should have a unique name in the game
// moreover, it should not have the name of another available chat window (for example, it shouldn't be named 'Around Me') // moreover, it should not have the name of another available chat window (for example, it shouldn't be named 'Around Me')
@ -2425,7 +2424,7 @@ class CHandlerValidatePartyChatName : public IActionHandler
if (!PeopleInterraction.testValidPartyChatName(title)) if (!PeopleInterraction.testValidPartyChatName(title))
{ {
displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiInvalidPartyChatName")); displayVisibleSystemMsg(title + " : " + CI18N::get("uiInvalidPartyChatName"));
return; return;
} }
@ -2636,12 +2635,12 @@ public:
uint32 canWrite = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DYN_CHAT:CHANNEL"+s+":WRITE_RIGHT")->getValue32(); uint32 canWrite = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DYN_CHAT:CHANNEL"+s+":WRITE_RIGHT")->getValue32();
if (canWrite != 0) if (canWrite != 0)
{ {
ucstring title; string title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
// replace dynamic channel name and shortcut // replace dynamic channel name and shortcut
string res = CI18N::get("uiFilterMenuDynamic"); string res = CI18N::get("uiFilterMenuDynamic");
strFindReplace(res, "%channel", title.toUtf8()); strFindReplace(res, "%channel", title);
strFindReplace(res, "%shortcut", s); strFindReplace(res, "%shortcut", s);
pMenu->addLineAtIndex(5 + insertion_index, res, "chat_target_selected", "dyn"+s, "dyn"+s); pMenu->addLineAtIndex(5 + insertion_index, res, "chat_target_selected", "dyn"+s, "dyn"+s);
@ -2829,9 +2828,9 @@ class CHandlerSelectChatSource : public IActionHandler
pVTM->setActive(active); pVTM->setActive(active);
if (active) if (active)
{ {
ucstring title; string title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
pVTM->setText("["+s+"] " + title.toUtf8()); pVTM->setText("["+s+"] " + title);
} }
} }
} }
@ -2954,9 +2953,9 @@ class CHandlerSelectChatSource : public IActionHandler
bool active = (textId != 0); bool active = (textId != 0);
if (active) if (active)
{ {
ucstring title; string title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
menu->addLineAtIndex(insertionIndex, "["+s+"] " + title.toUtf8(), FILTER_TOGGLE, "dyn"+s); menu->addLineAtIndex(insertionIndex, "["+s+"] " + title, FILTER_TOGGLE, "dyn"+s);
menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, "dyn"+s, pi.ChatInput.DynamicChat[i].isListeningWindow(cw))); menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, "dyn"+s, pi.ChatInput.DynamicChat[i].isListeningWindow(cw)));
++insertionIndex; ++insertionIndex;
} }
@ -3315,7 +3314,7 @@ REGISTER_INTERFACE_USER_FCT("getNumUserChatLeft", getNumUserChatLeft)
// STATIC FUNCTIONS IMPLEMENTATIONS // // STATIC FUNCTIONS IMPLEMENTATIONS //
////////////////////////////////////// //////////////////////////////////////
static void displayVisibleSystemMsg(const ucstring &msg, const string &cat) static void displayVisibleSystemMsg(const string &msg, const string &cat)
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo(msg, cat); im->displaySystemInfo(msg, cat);
@ -3328,7 +3327,7 @@ static void displayVisibleSystemMsg(const ucstring &msg, const string &cat)
#if !FINAL_VERSION #if !FINAL_VERSION
NLMISC_COMMAND(testSI, "tmp", "tmp") NLMISC_COMMAND(testSI, "tmp", "tmp")
{ {
PeopleInterraction.ChatInput.DebugInfo.displayMessage(ucstring("test"), CRGBA::Red); PeopleInterraction.ChatInput.DebugInfo.displayMessage("test", CRGBA::Red);
return true; return true;
} }
#endif #endif

@ -250,14 +250,14 @@ public:
// Test if the given chat is a user chat (this includes the main chat) // Test if the given chat is a user chat (this includes the main chat)
bool isUserChat(CChatWindow *cw) const; bool isUserChat(CChatWindow *cw) const;
void talkInDynamicChannel(uint32 channelNb,ucstring sentence); void talkInDynamicChannel(uint32 channelNb,std::string sentence);
CChatGroupWindow *getChatGroupWindow() const; CChatGroupWindow *getChatGroupWindow() const;
void updateAllFreeTellerHeaders(); void updateAllFreeTellerHeaders();
void removeAllFreeTellers(); void removeAllFreeTellers();
static void displayTellInMainChat(const ucstring &playerName); static void displayTellInMainChat(const std::string &playerName);
private: private:
// create various chat & people lists // create various chat & people lists
void createTeamChat(); void createTeamChat();

@ -449,7 +449,7 @@ void CPeopleList::setContactId(uint index, uint32 contactId)
} }
//================================================================== //==================================================================
void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, const ucstring &msg,uint numBlinks /*=0*/) void CPeopleList::displayLocalPlayerTell(const string &receiver, uint index, const string &msg,uint numBlinks /*=0*/)
{ {
if (_ContactType == CPeopleListDesc::Ignore) if (_ContactType == CPeopleListDesc::Ignore)
{ {
@ -473,13 +473,13 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c
} }
string csr = CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""; string csr = CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : "";
string finalMsg = csr + CI18N::get("youTell") + ": " + msg.toUtf8(); string finalMsg = csr + CI18N::get("youTell") + ": " + msg;
// display msg with good color // display msg with good color
CInterfaceProperty prop; CInterfaceProperty prop;
prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," ");
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);
gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA())); gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA()));
CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell));
@ -497,7 +497,7 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c
//================================================================== //==================================================================
void CPeopleList::displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA col, uint /* numBlinks */ /*= 0*/) void CPeopleList::displayMessage(uint index, const string &msg, NLMISC::CRGBA col, uint /* numBlinks */ /*= 0*/)
{ {
if (_ContactType == CPeopleListDesc::Ignore) if (_ContactType == CPeopleListDesc::Ignore)
{ {
@ -951,7 +951,7 @@ class CHandlerContactEntry : public IActionHandler
pWin->displayTellMessage(final, prop.getRGBA(), pWin->getFreeTellerName(str)); pWin->displayTellMessage(final, prop.getRGBA(), pWin->getFreeTellerName(str));
string s = CI18N::get("youTellPlayer"); string s = CI18N::get("youTellPlayer");
strFindReplace(s, "%name", pWin->getFreeTellerName(str).toUtf8()); strFindReplace(s, "%name", pWin->getFreeTellerName(str));
strFindReplace(final, CI18N::get("youTell"), s); strFindReplace(final, CI18N::get("youTell"), s);
CInterfaceManager::getInstance()->log(final, CChatGroup::groupTypeToString(CChatGroup::tell)); CInterfaceManager::getInstance()->log(final, CChatGroup::groupTypeToString(CChatGroup::tell));
} }

@ -113,8 +113,8 @@ public:
/** Display a message for the given people /** Display a message for the given people
* If the window is closed, it causes it to blink (and also the parent window) * If the window is closed, it causes it to blink (and also the parent window)
*/ */
void displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA col, uint numBlinks = 0); void displayMessage(uint index, const std::string &msg, NLMISC::CRGBA col, uint numBlinks = 0);
void displayLocalPlayerTell(const ucstring &receiver, uint index, const ucstring &msg, uint numBlinks = 0); void displayLocalPlayerTell(const std::string &receiver, uint index, const std::string &msg, uint numBlinks = 0);
// Is the given people window visible ? // Is the given people window visible ?
bool isPeopleChatVisible(uint index) const; bool isPeopleChatVisible(uint index) const;
// reset remove everything from the interface // reset remove everything from the interface

@ -697,10 +697,9 @@ void CItemGroupManager::listGroup()
for(int i=0;i<_Groups.size();i++) for(int i=0;i<_Groups.size();i++)
{ {
CItemGroup group = _Groups[i]; CItemGroup group = _Groups[i];
ucstring msg = NLMISC::CI18N::get("cmdListGroupLine"); string msg = NLMISC::CI18N::get("cmdListGroupLine");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = group.name;
nameUC.fromUtf8(group.name);
NLMISC::strFindReplace(msg, "%name", nameUC); NLMISC::strFindReplace(msg, "%name", nameUC);
NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.Items.size())); NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.Items.size()));
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);

@ -1123,7 +1123,7 @@ bool mainLoop()
// //
#define BAR_STEP_TP 2 #define BAR_STEP_TP 2
ProgressBar.reset (BAR_STEP_TP); ProgressBar.reset (BAR_STEP_TP);
ucstring nmsg("Loading..."); string nmsg("Loading...");
ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) );
ProgressBar.progress(0); ProgressBar.progress(0);
ContinentMngr.select(UserEntity->pos(), ProgressBar); ContinentMngr.select(UserEntity->pos(), ProgressBar);
@ -1164,7 +1164,7 @@ bool mainLoop()
if (BanMsgCountdown < 0.f) if (BanMsgCountdown < 0.f)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgPermanentlyBanned"); string msg = CI18N::get("msgPermanentlyBanned");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
BanMsgCountdown = BanMsgRepeatTime; BanMsgCountdown = BanMsgRepeatTime;
@ -3441,11 +3441,11 @@ NLMISC_COMMAND(dumpFontTexture, "Write font texture to file", "")
{ {
std::string fname = CFile::findNewFile("font-texture.tga"); std::string fname = CFile::findNewFile("font-texture.tga");
TextContext->dumpCacheTexture(fname.c_str()); TextContext->dumpCacheTexture(fname.c_str());
im->displaySystemInfo(ucstring(fname + " created"), "SYS"); im->displaySystemInfo(fname + " created", "SYS");
} }
else else
{ {
im->displaySystemInfo(ucstring("Error: TextContext == NULL"), "SYS"); im->displaySystemInfo("Error: TextContext == NULL", "SYS");
} }
return true; return true;
} }

@ -871,14 +871,14 @@ bool setVect(CVector &vectToChange, const CVector &vect, bool compute, bool chec
return true; return true;
}// setVect // }// setVect //
NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest) NLMISC::CRGBA interpClientCfgColor(const string &src, string &dest)
{ {
CRGBA color = CRGBA::White; CRGBA color = CRGBA::White;
if (src.size() >= 3) if (src.size() >= 3)
{ {
if (src[0] == (ucchar) '&') if (src[0] == '&')
{ {
ucstring::size_type nextPos = src.find((ucchar) '&', 1); string::size_type nextPos = src.find('&', 1);
if (nextPos != ucstring::npos) if (nextPos != ucstring::npos)
{ {
std::string colorCode; std::string colorCode;
@ -911,7 +911,7 @@ NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest)
return color; return color;
} }
std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAddSysByDefault) std::string getStringCategory(const string &src, string &dest, bool alwaysAddSysByDefault)
{ {
std::string str = getStringCategoryIfAny(src, dest); std::string str = getStringCategoryIfAny(src, dest);
if (alwaysAddSysByDefault) if (alwaysAddSysByDefault)
@ -921,41 +921,41 @@ std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAd
} }
std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest) std::string getStringCategoryIfAny(const string &src, string &dest)
{ {
std::string colorCode; std::string colorCode;
if (src.size() >= 3) if (src.size() >= 3)
{ {
uint startPos = 0; size_t startPos = 0;
// Skip <NEW> or <CHG> if present at beginning // Skip <NEW> or <CHG> if present at beginning
ucstring preTag; string preTag;
const uint PreTagSize = 5; const size_t PreTagSize = 5;
const ucstring newTag("<NEW>"); static const string newTag = "<NEW>";
if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == newTag) ) if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == newTag) )
{ {
startPos = PreTagSize; startPos = PreTagSize;
preTag = newTag; preTag = newTag;
} }
const ucstring chgTag("<CHG>"); static const string chgTag = "<CHG>";
if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == chgTag) ) if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == chgTag) )
{ {
startPos = PreTagSize; startPos = PreTagSize;
preTag = chgTag; preTag = chgTag;
} }
if (src[startPos] == (ucchar) '&') if (src[startPos] == '&')
{ {
ucstring::size_type nextPos = src.find((ucchar) '&', startPos+1); string::size_type nextPos = src.find('&', startPos+1);
if (nextPos != ucstring::npos) if (nextPos != string::npos)
{ {
uint codeSize = (uint)nextPos - startPos - 1; size_t codeSize = nextPos - startPos - 1;
colorCode.resize( codeSize ); colorCode.resize( codeSize );
for(uint k = 0; k < codeSize; ++k) for(ptrdiff_t k = 0; k < (ptrdiff_t)codeSize; ++k)
{ {
colorCode[k] = tolower((char) src[k + startPos + 1]); colorCode[k] = tolower((char) src[k + startPos + 1]);
} }
ucstring destTmp; string destTmp;
if ( startPos != 0 ) if ( startPos != 0 )
destTmp = preTag; // leave <NEW> or <CHG> in the dest string destTmp = preTag; // leave <NEW> or <CHG> in the dest string
destTmp += src.substr(nextPos + 1); destTmp += src.substr(nextPos + 1);

@ -165,11 +165,11 @@ bool setVect(NLMISC::CVector &vectToChange, const NLMISC::CVector &vect, bool co
// read color from client cfg system info colors // read color from client cfg system info colors
NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest); NLMISC::CRGBA interpClientCfgColor(const std::string &src, std::string &dest);
// Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return "SYS" // Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return "SYS"
std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAddSysByDefault = true); std::string getStringCategory(const std::string &src, std::string &dest, bool alwaysAddSysByDefault = true);
// Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return "" // Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return ""
std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest); std::string getStringCategoryIfAny(const std::string &src, std::string &dest);
bool getRelativeFloatFromString(const std::string src, float &dst); bool getRelativeFloatFromString(const std::string src, float &dst);
void updateVector(const std::string part, NLMISC::CVector &dst, float value, bool add = false); void updateVector(const std::string part, NLMISC::CVector &dst, float value, bool add = false);

@ -600,21 +600,21 @@ void impulsePermanentUnban(NLMISC::CBitMemStream &impulse)
class CInterfaceChatDisplayer : public CClientChatManager::IChatDisplayer class CInterfaceChatDisplayer : public CClientChatManager::IChatDisplayer
{ {
public: public:
virtual void displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer=0); virtual void displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer=0);
virtual void displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName); virtual void displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName);
virtual void clearChannel(CChatGroup::TGroupType mode, uint32 dynChatDbIndex); virtual void clearChannel(CChatGroup::TGroupType mode, uint32 dynChatDbIndex);
private: private:
// Add colorization tag for sender name // Add colorization tag for sender name
void colorizeSender(ucstring &text, const ucstring &senderName, CRGBA baseColor); void colorizeSender(string &text, const string &senderName, CRGBA baseColor);
}; };
static CInterfaceChatDisplayer InterfaceChatDisplayer; static CInterfaceChatDisplayer InterfaceChatDisplayer;
void CInterfaceChatDisplayer::colorizeSender(ucstring &text, const ucstring &senderName, CRGBA baseColor) void CInterfaceChatDisplayer::colorizeSender(string &text, const string &senderName, CRGBA baseColor)
{ {
// find the sender/text separator to put color tags // find the sender/text separator to put color tags
ucstring::size_type pos = senderName.toUtf8().length() - 1; ucstring::size_type pos = senderName.length() - 1;
if (pos != ucstring::npos) if (pos != ucstring::npos)
{ {
string str; string str;
@ -624,36 +624,36 @@ void CInterfaceChatDisplayer::colorizeSender(ucstring &text, const ucstring &sen
CChatWindow::encodeColorTag(prop.getRGBA(), str, false); CChatWindow::encodeColorTag(prop.getRGBA(), str, false);
str += text.toUtf8().substr(0, pos+1); str += text.substr(0, pos+1);
CChatWindow::encodeColorTag(baseColor, str, true); CChatWindow::encodeColorTag(baseColor, str, true);
str += text.toUtf8().substr(pos+1); str += text.substr(pos+1);
text.fromUtf8(str); text = str;
} }
} }
// display a chat from network to interface // display a chat from network to interface
void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer) void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring finalString; string finalString;
string stringCategory = getStringCategory(ucstr, finalString); string stringCategory = getStringCategory(ucstr, finalString);
bool bubbleWanted = true; bool bubbleWanted = true;
// Subtract rawMessage from ucstr so that the 'sender' part remains. // Subtract rawMessage from ucstr so that the 'sender' part remains.
ucstring senderPart = ucstr.luabind_substr(0, ucstr.length() - rawMessage.length()); string senderPart = ucstr.substr(0, ucstr.length() - rawMessage.length());
// search a "{no_bubble}" tag // search a "{no_bubble}" tag
{ {
ucstring::size_type index = finalString.find(ucstring("{no_bubble}")); string::size_type index = finalString.find("{no_bubble}");
const size_t tokenSize= 11; // length of "{no_bubble}" const size_t tokenSize= 11; // length of "{no_bubble}"
if (index != ucstring::npos) if (index != string::npos)
{ {
bubbleWanted = false; bubbleWanted = false;
finalString = finalString.luabind_substr(0, index) + finalString.substr(index+tokenSize,finalString.size()); finalString = finalString.substr(0, index) + finalString.substr(index+tokenSize,finalString.size());
} }
} }
@ -665,9 +665,9 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// Remove all {break} // Remove all {break}
for(;;) for(;;)
{ {
ucstring::size_type index = finalString.find(ucstring("{break}")); string::size_type index = finalString.find("{break}");
if (index == ucstring::npos) break; if (index == ucstring::npos) break;
finalString = finalString.luabind_substr(0, index) + finalString.luabind_substr(index+7,finalString.size()); finalString = finalString.substr(0, index) + finalString.substr(index+7,finalString.size());
} }
// select DB // select DB
@ -716,10 +716,10 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// find the sender/text separator to put color tags // find the sender/text separator to put color tags
if (senderPart.empty() && stringCategory == "emt") if (senderPart.empty() && stringCategory == "emt")
{ {
size_t pos = finalString.find(ucstring(": "), 0); size_t pos = finalString.find(": ", 0);
if (pos != ucstring::npos) if (pos != string::npos)
{ {
senderPart = finalString.luabind_substr(0, pos + 2); senderPart = finalString.substr(0, pos + 2);
} }
} }
colorizeSender(finalString, senderPart, col); colorizeSender(finalString, senderPart, col);
@ -786,16 +786,16 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
if (pIM->getLogState()) if (pIM->getLogState())
{ {
// Add dyn chan number before string // Add dyn chan number before string
ucstring prefix("[" + NLMISC::toString(dbIndex) + "]"); string prefix = "[" + NLMISC::toString(dbIndex) + "]";
// Find position to put the new string // Find position to put the new string
// After timestamp? // After timestamp?
size_t pos = finalString.find(ucstring("]")); size_t pos = finalString.find("]");
size_t colonpos = finalString.find(ucstring(": @{")); size_t colonpos = finalString.find(": @{");
// If no ] found or if found but after the colon (so part of the user chat) // If no ] found or if found but after the colon (so part of the user chat)
if (pos == ucstring::npos || (colonpos < pos)) if (pos == string::npos || (colonpos < pos))
{ {
// No timestamp, so put it right after the color and add a space // No timestamp, so put it right after the color and add a space
pos = finalString.find(ucstring("}"));; pos = finalString.find("}");;
prefix += " "; prefix += " ";
} }
finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1); finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1);
@ -803,28 +803,28 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
if (node && node->getValueBool()) if (node && node->getValueBool())
{ {
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex); uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex);
ucstring title; string title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
prefix = title.empty() ? ucstring("") : ucstring(" ") + title; prefix = (title.empty() ? "" : " ") + title;
pos = finalString.find(ucstring("] ")); pos = finalString.find("] ");
finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos); finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos);
} }
} }
} }
else else
{ {
nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.toString().c_str()); nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.c_str());
} }
} }
else else
{ {
ucstring::size_type index = finalString.find(ucstring("<BPFX>")); string::size_type index = finalString.find("<BPFX>");
if (index != ucstring::npos) if (index != ucstring::npos)
{ {
bubbleWanted = false; bubbleWanted = false;
finalString = finalString.substr(index+6,finalString.size()); finalString = finalString.substr(index+6,finalString.size());
ucstring::size_type index2 = finalString.find(ucstring(" ")); string::size_type index2 = finalString.find(string(" "));
ucstring playerName; string playerName;
if (index2 < (finalString.size()-3)) if (index2 < (finalString.size()-3))
{ {
playerName = finalString.substr(0,index2); playerName = finalString.substr(0,index2);
@ -832,7 +832,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
} }
if (!senderName.empty()) if (!senderName.empty())
{ {
CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()), true, true); CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName), true, true);
if (senderEntity) if (senderEntity)
{ {
if (senderEntity->Type != CEntityCL::Player) if (senderEntity->Type != CEntityCL::Player)
@ -840,16 +840,16 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
if (playerName.empty()) if (playerName.empty())
{ {
senderEntity->removeStateFx(); senderEntity->removeStateFx();
senderEntity->setStateFx(finalString.toString()); senderEntity->setStateFx(finalString);
nlinfo("empty"); nlinfo("empty");
} }
else else
{ {
CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName.toUtf8()), false, true); CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName), false, true);
if (destEntity) if (destEntity)
{ {
destEntity->removeStateFx(); destEntity->removeStateFx();
destEntity->setStateFx(finalString.toString()); destEntity->setStateFx(finalString);
nlinfo("no empty"); nlinfo("no empty");
} }
} }
@ -866,7 +866,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// if tell, bkup sendername // if tell, bkup sendername
if (mode == CChatGroup::tell && windowVisible && !senderName.empty()) if (mode == CChatGroup::tell && windowVisible && !senderName.empty())
{ {
PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()); PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName);
} }
} }
@ -876,7 +876,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// **** Process chat entry for the bubbles // **** Process chat entry for the bubbles
// todo hulud : registering a chat callback would be better than calling this hardcoded action handler // todo hulud : registering a chat callback would be better than calling this hardcoded action handler
ucstring finalRawMessage; string finalRawMessage;
// remove color qualifier from raw string // remove color qualifier from raw string
getStringCategory(rawMessage, finalRawMessage); getStringCategory(rawMessage, finalRawMessage);
if (bubbleWanted) if (bubbleWanted)
@ -902,7 +902,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
channel = "#" + toString((uint32)mode); channel = "#" + toString((uint32)mode);
} }
} }
if (!stringCategory.empty() && NLMISC::toUpper(stringCategory) != "SYS") if (!stringCategory.empty() && NLMISC::compareCaseInsensitive(stringCategory.c_str(), "SYS")) // Not empty and not 'SYS'
{ {
channel = channel + "/" + stringCategory; channel = channel + "/" + stringCategory;
} }
@ -912,13 +912,13 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// display a tell from network to interface // display a tell from network to interface
void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName) void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName)
{ {
ucstring finalString = ucstr; string finalString = ucstr;
// for now, '&' are removed by server so use another format until a special msg is made // for now, '&' are removed by server so use another format until a special msg is made
if (strFindReplace(finalString, ucstring("<R2_INVITE>"), ucstring())) if (strFindReplace(finalString, "<R2_INVITE>", string()))
{ {
CLuaManager::getInstance().executeLuaScript("RingAccessPoint:forceRefresh()"); CLuaManager::getInstance().executeLuaScript("RingAccessPoint:forceRefresh()");
} }
@ -928,13 +928,13 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u
prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," ");
bool windowVisible; bool windowVisible;
ucstring goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()); string goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName);
// The sender part is up to and including the first ":" after the goodSenderName // The sender part is up to and including the first ":" after the goodSenderName
ucstring::size_type pos = finalString.find(goodSenderName); string::size_type pos = finalString.find(goodSenderName);
pos = finalString.find(':', pos); pos = finalString.find(':', pos);
pos = finalString.find(' ', pos); pos = finalString.find(' ', pos);
ucstring senderPart = finalString.substr(0, pos+1); string senderPart = finalString.substr(0, pos+1);
colorizeSender(finalString, senderPart, prop.getRGBA()); colorizeSender(finalString, senderPart, prop.getRGBA());
PeopleInterraction.ChatInput.Tell.displayTellMessage(/*senderIndex, */finalString, goodSenderName, prop.getRGBA(), 2, &windowVisible); PeopleInterraction.ChatInput.Tell.displayTellMessage(/*senderIndex, */finalString, goodSenderName, prop.getRGBA(), 2, &windowVisible);
@ -1527,7 +1527,7 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason)
// start progress bar and display background // start progress bar and display background
ProgressBar.reset (BAR_STEP_TP); ProgressBar.reset (BAR_STEP_TP);
ucstring nmsg("Loading..."); string nmsg("Loading...");
ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) );
@ -2125,7 +2125,7 @@ void impulseWhere(NLMISC::CBitMemStream &impulse)
sprintf(buf,"Your server position is : X= %g Y= %g Z= %g",xf,yf,zf); sprintf(buf,"Your server position is : X= %g Y= %g Z= %g",xf,yf,zf);
nlinfo(buf); nlinfo(buf);
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(buf)); CInterfaceManager::getInstance()->displaySystemInfo(buf);
}// impulseWhere // }// impulseWhere //
//----------------------------------------------- //-----------------------------------------------
@ -3265,8 +3265,8 @@ private:
STRING_MANAGER::CStringManagerClient *pSMC= STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC= STRING_MANAGER::CStringManagerClient::instance();
// get the content string (should have been received!) // get the content string (should have been received!)
ucstring contentStr; string contentStr;
ucstring titleStr; string titleStr;
if(!pSMC->getDynString(_TextId[ContentType], contentStr)) if(!pSMC->getDynString(_TextId[ContentType], contentStr))
return; return;
@ -3293,8 +3293,8 @@ private:
} }
if(i != digitMaxEnd) if(i != digitMaxEnd)
{ {
ucstring web_app = contentStr.substr(digitStart, i-digitStart); string web_app = contentStr.substr(digitStart, i-digitStart);
contentStr = ucstring(ClientCfg.WebIgMainDomain + "/") + web_app + ucstring("/index.php?") + contentStr.substr((size_t)i + 1); contentStr = string(ClientCfg.WebIgMainDomain + "/") + web_app + string("/index.php?") + contentStr.substr((size_t)i + 1);
} }
else else
{ {
@ -3328,7 +3328,7 @@ private:
if (is_webig) if (is_webig)
{ {
CGroupHTML *groupHtml; CGroupHTML *groupHtml;
string group = titleStr.toString(); string group = titleStr;
// <missing:XXX> // <missing:XXX>
group = group.substr(9, group.size()-10); group = group.substr(9, group.size()-10);
groupHtml = dynamic_cast<CGroupHTML*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:"+group+":content:html")); groupHtml = dynamic_cast<CGroupHTML*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:"+group+":content:html"));
@ -3351,7 +3351,7 @@ private:
{ {
if (group == "webig") if (group == "webig")
pGC->setActive(true); pGC->setActive(true);
string url = contentStr.toString(); string url = contentStr;
addWebIGParams(url, true); addWebIGParams(url, true);
groupHtml->browse(url.c_str()); groupHtml->browse(url.c_str());
CWidgetManager::getInstance()->setTopWindow(pGC); CWidgetManager::getInstance()->setTopWindow(pGC);
@ -3371,7 +3371,7 @@ private:
// must set the text by hand // must set the text by hand
CViewText *vt= dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("server_message_box_content_view_text"))); CViewText *vt= dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("server_message_box_content_view_text")));
if(vt) if(vt)
vt->setTextFormatTaged(contentStr.toUtf8()); vt->setTextFormatTaged(contentStr);
// open // open
CWidgetManager::getInstance()->setTopWindow(pGC); CWidgetManager::getInstance()->setTopWindow(pGC);
@ -3462,7 +3462,7 @@ void impulseCombatFlyingHpDelta(NLMISC::CBitMemStream &impulse)
CRGBA color((uint8)(rgba>>24&255), (uint8)(rgba>>16&255), (uint8)(rgba>>8&255), (uint8)(rgba&255)); CRGBA color((uint8)(rgba>>24&255), (uint8)(rgba>>16&255), (uint8)(rgba>>8&255), (uint8)(rgba&255));
CEntityCL *entity = EntitiesMngr.getEntityByCompressedIndex(entityID); CEntityCL *entity = EntitiesMngr.getEntityByCompressedIndex(entityID);
if (entity) if (entity)
entity->addHPOutput(ucstring(toString("%d", hpDelta)), color); entity->addHPOutput(toString("%d", hpDelta), color);
} }
void impulseCombatFlyingTextItemSpecialEffectProc(NLMISC::CBitMemStream &impulse) void impulseCombatFlyingTextItemSpecialEffectProc(NLMISC::CBitMemStream &impulse)
@ -3476,7 +3476,7 @@ void impulseCombatFlyingTextItemSpecialEffectProc(NLMISC::CBitMemStream &impulse
impulse.serial(effect); impulse.serial(effect);
impulse.serial(param); impulse.serial(param);
CRGBA color((uint8)(rgba>>24&255), (uint8)(rgba>>16&255), (uint8)(rgba>>8&255), (uint8)(rgba&255)); CRGBA color((uint8)(rgba>>24&255), (uint8)(rgba>>16&255), (uint8)(rgba>>8&255), (uint8)(rgba&255));
ucstring text = CI18N::get(toString("uiItemSpecialEffectFlyingText%s", ITEM_SPECIAL_EFFECT::toString((ITEM_SPECIAL_EFFECT::TItemSpecialEffect)effect).c_str())); string text = CI18N::get(toString("uiItemSpecialEffectFlyingText%s", ITEM_SPECIAL_EFFECT::toString((ITEM_SPECIAL_EFFECT::TItemSpecialEffect)effect).c_str()));
strFindReplace(text, "%param", toString("%d", param)); strFindReplace(text, "%param", toString("%d", param));
CEntityCL *entity = EntitiesMngr.getEntityByCompressedIndex(entityID); CEntityCL *entity = EntitiesMngr.getEntityByCompressedIndex(entityID);
if (entity) if (entity)
@ -3492,7 +3492,7 @@ void impulseCombatFlyingText(NLMISC::CBitMemStream &impulse)
COMBAT_FLYING_TEXT::TCombatFlyingText type = (COMBAT_FLYING_TEXT::TCombatFlyingText)tmp; COMBAT_FLYING_TEXT::TCombatFlyingText type = (COMBAT_FLYING_TEXT::TCombatFlyingText)tmp;
CRGBA color(255, 255, 255); CRGBA color(255, 255, 255);
ucstring text(""); string text("");
float dt = 0.0f; float dt = 0.0f;
switch (type) switch (type)
@ -4203,7 +4203,7 @@ std::string WebServer;
NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", "<people_name> <msg>") NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", "<people_name> <msg>")
{ {
if (args.empty()) return false; if (args.empty()) return false;
ucstring player = args[0]; string player = args[0];
std::string msg; std::string msg;
if (args.size() >= 2) if (args.size() >= 2)
{ {
@ -4214,7 +4214,7 @@ NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", "<people_n
} }
} }
TDataSetIndex dsi = INVALID_DATASET_INDEX; TDataSetIndex dsi = INVALID_DATASET_INDEX;
InterfaceChatDisplayer.displayChat(dsi, ucstring(msg), ucstring(msg), CChatGroup::team, NLMISC::CEntityId::Unknown, player); InterfaceChatDisplayer.displayChat(dsi, msg, msg, CChatGroup::team, NLMISC::CEntityId::Unknown, player);
return true; return true;
} }
@ -4222,7 +4222,7 @@ NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", "<people_n
NLMISC_COMMAND(localTell, "Temp : simulate a tell in local mode", "<people_name> <msg>") NLMISC_COMMAND(localTell, "Temp : simulate a tell in local mode", "<people_name> <msg>")
{ {
if (args.empty()) return false; if (args.empty()) return false;
ucstring player = args[0]; string player = args[0];
std::string msg; std::string msg;
if (args.size() >= 2) if (args.size() >= 2)
{ {
@ -4233,7 +4233,7 @@ NLMISC_COMMAND(localTell, "Temp : simulate a tell in local mode", "<people_name>
} }
} }
// TDataSetIndex dsi = INVALID_DATASET_ROW; // TDataSetIndex dsi = INVALID_DATASET_ROW;
InterfaceChatDisplayer.displayTell(/*dsi, */ucstring(msg), player); InterfaceChatDisplayer.displayTell(/*dsi, */msg, player);
return true; return true;
} }

@ -702,7 +702,7 @@ void CPlayerCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle *
} }
// update title when gender changed // update title when gender changed
const string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(), _Gender == GSGENDER::female); const string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, _Gender == GSGENDER::female);
if (!replacement.empty() || !ClientCfg.DebugStringManager) if (!replacement.empty() || !ClientCfg.DebugStringManager)
{ {
// Get extended name // Get extended name
@ -713,7 +713,7 @@ void CPlayerCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle *
if (_Slot == 0) if (_Slot == 0)
{ {
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:player:header_opened:player_title")); CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:player:header_opened:player_title"));
if (pVT != NULL) pVT->setText(_Title.toUtf8()); if (pVT != NULL) pVT->setText(_Title);
} }
// rebuild in scene interface // rebuild in scene interface

@ -446,7 +446,7 @@ void CPlayerR2CL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle
} }
// update title when gender changed // update title when gender changed
const string replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(),_Gender == GSGENDER::female)); const string replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw,_Gender == GSGENDER::female));
if (!replacement.empty()) if (!replacement.empty())
{ {
// Get extended name // Get extended name

@ -1868,7 +1868,7 @@ void CClientEditionModule::onTpPositionSimulated(NLNET::IModuleProxy * /* sender
beginLoading (LoadingBackground); beginLoading (LoadingBackground);
#define BAR_STEP_TP 2 // fixme : this define is duplicated.... #define BAR_STEP_TP 2 // fixme : this define is duplicated....
ProgressBar.reset (BAR_STEP_TP); ProgressBar.reset (BAR_STEP_TP);
ucstring nmsg("Loading..."); string nmsg("Loading...");
ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) );
ProgressBar.progress(0); ProgressBar.progress(0);
ContinentMngr.select(dest, ProgressBar); ContinentMngr.select(dest, ProgressBar);

@ -373,7 +373,7 @@ restartLoop4:
_WaitingStrings.insert(stringId); _WaitingStrings.insert(stringId);
// need to ask for this string. // need to ask for this string.
NLMISC::CBitMemStream bms; NLMISC::CBitMemStream bms;
const string msgType = "STRING_MANAGER:STRING_RQ"; static const string msgType = "STRING_MANAGER:STRING_RQ";
if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) )
{ {
bms.serial( stringId ); bms.serial( stringId );
@ -752,7 +752,7 @@ restartLoop:
// If the string contains a title, then remove it // If the string contains a title, then remove it
string::size_type pos = str.find('$'); string::size_type pos = str.find('$');
if ( ! str.empty() && pos != ucstring::npos) if ( ! str.empty() && pos != string::npos)
{ {
str = CEntityCL::removeTitleFromName(str); str = CEntityCL::removeTitleFromName(str);
} }
@ -1181,9 +1181,9 @@ bool CStringManagerClient::checkWordFileDates(vector<CFileCheck> &fileChecks, co
// *************************************************************************** // ***************************************************************************
void CStringManagerClient::initI18NSpecialWords(const string &languageCode) void CStringManagerClient::initI18NSpecialWords(const string &languageCode)
{ {
ucstring womenNameColIdent= string("women_name"); ucstring womenNameColIdent = "women_name";
ucstring descColIdent= string("description"); ucstring descColIdent = "description";
ucstring descColIdent2= string("description2"); ucstring descColIdent2 = "description2";
// List of words to append to the local CI18N system. // List of words to append to the local CI18N system.
static const char *specialWords[]= static const char *specialWords[]=
@ -1260,8 +1260,8 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode)
for(uint j=1;j<ws.size();j++) for(uint j=1;j<ws.size();j++)
{ {
// Get the key and name string. // Get the key and name string.
const string &key= ws.getData(j, keyColIndex).toUtf8(); string key= ws.getData(j, keyColIndex).toUtf8(); // FIXME: const string & when UTF-8
const string &name= ws.getData(j, nameColIndex).toUtf8(); string name= ws.getData(j, nameColIndex).toUtf8(); // FIXME: const string & when UTF-8
// Append to the I18N. // Append to the I18N.
// avoid case problems // avoid case problems
string keyStr = NLMISC::toLower(key); string keyStr = NLMISC::toLower(key);
@ -1442,8 +1442,7 @@ const char *CStringManagerClient::getSpecialWord(const string &label, bool women
{ {
if( UseFemaleTitles && women ) if( UseFemaleTitles && women )
{ {
ucstring ustr(it->WomenName); if( !it->WomenName[0] )
if( !ustr.empty() )
return it->WomenName; return it->WomenName;
} }
return it->Name; return it->Name;
@ -1637,8 +1636,6 @@ const char *CStringManagerClient::getTitleLocalizedName(const string &titleId, b
// *************************************************************************** // ***************************************************************************
vector<string> CStringManagerClient::getTitleInfos(const string &titleId, bool women) vector<string> CStringManagerClient::getTitleInfos(const string &titleId, bool women)
{ {
//ucstring infosUC;
//infosUC.fromUtf8(titleId);
vector<string> listInfos; vector<string> listInfos;
splitString(titleId, string("#"), listInfos); splitString(titleId, string("#"), listInfos);

@ -64,11 +64,9 @@ public:
void flushStringCache(); void flushStringCache();
bool getString(uint32 stringId, std::string &result); bool getString(uint32 stringId, std::string &result);
bool getString(uint32 stringId, ucstring &result) { std::string temp; bool res = getString(stringId, temp); result.fromUtf8(temp); return res; } // FIXME: UTF-8
void waitString(uint32 stringId, const IStringWaiterRemover *premover, std::string *result); void waitString(uint32 stringId, const IStringWaiterRemover *premover, std::string *result);
void waitString(uint32 stringId, IStringWaitCallback *pcallback); void waitString(uint32 stringId, IStringWaitCallback *pcallback);
bool getDynString(uint32 dynStringId, std::string &result); bool getDynString(uint32 dynStringId, std::string &result);
bool getDynString(uint32 dynStringId, ucstring &result) { std::string temp; bool res = getString(dynStringId, temp); result.fromUtf8(temp); return res; } // FIXME: UTF-8
void waitDynString(uint32 stringId, const IStringWaiterRemover *premover, std::string *result); void waitDynString(uint32 stringId, const IStringWaiterRemover *premover, std::string *result);
void waitDynString(uint32 stringId, IStringWaitCallback *pcallback); void waitDynString(uint32 stringId, IStringWaitCallback *pcallback);

@ -2948,7 +2948,7 @@ bool CUserEntity::sit(bool s)
// autowalk disabled // autowalk disabled
UserControls.autowalkState(false); UserControls.autowalkState(false);
const string msgName = "COMMAND:SIT"; static const string msgName = "COMMAND:SIT";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -2963,7 +2963,7 @@ bool CUserEntity::sit(bool s)
// display sit msg // display sit msg
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgUserIsSitting"); string msg = CI18N::get("msgUserIsSitting");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
} }
@ -2976,7 +2976,7 @@ bool CUserEntity::sit(bool s)
{ {
if(mode(MBEHAV::NORMAL)) if(mode(MBEHAV::NORMAL))
{ {
const string msgName = "COMMAND:SIT"; static const string msgName = "COMMAND:SIT";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -2991,7 +2991,7 @@ bool CUserEntity::sit(bool s)
// display stand msg // display stand msg
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgUserIsStanding"); string msg = CI18N::get("msgUserIsStanding");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
} }
@ -3067,7 +3067,7 @@ void CUserEntity::setAFK(bool b, string afkTxt)
} }
// send afk state // send afk state
string msgName = "COMMAND:AFK"; static const string msgName = "COMMAND:AFK";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -3081,15 +3081,15 @@ void CUserEntity::setAFK(bool b, string afkTxt)
ucstring ucstr; ucstring ucstr;
ucstr.fromUtf8( afkTxt ); ucstr.fromUtf8( afkTxt );
CBitMemStream outTxt; CBitMemStream outTxt;
msgName = "STRING:AFK_TXT"; static const string msgNameTxt = "STRING:AFK_TXT";
if( GenericMsgHeaderMngr.pushNameToStream(msgName,outTxt) ) if( GenericMsgHeaderMngr.pushNameToStream(msgNameTxt,outTxt) )
{ {
outTxt.serial( ucstr ); outTxt.serial( ucstr );
NetMngr.push( outTxt ); NetMngr.push( outTxt );
} }
else else
{ {
nlwarning("CUserEntity:setAFK: unknown message named '%s'.", msgName.c_str()); nlwarning("CUserEntity:setAFK: unknown message named '%s'.", msgNameTxt.c_str());
} }
@ -3111,7 +3111,7 @@ void CUserEntity::rollDice(sint16 min, sint16 max, bool local)
} }
sint16 roll = min + (sint16)dice->rand(max-min); sint16 roll = min + (sint16)dice->rand(max-min);
ucstring msg = CI18N::get("msgRollDiceLocal"); string msg = CI18N::get("msgRollDiceLocal");
strFindReplace(msg, "%min", toString(min)); strFindReplace(msg, "%min", toString(min));
strFindReplace(msg, "%max", toString(max)); strFindReplace(msg, "%max", toString(max));
strFindReplace(msg, "%roll", toString(roll)); strFindReplace(msg, "%roll", toString(roll));
@ -3143,7 +3143,7 @@ bool CUserEntity::canEngageCombat()
{ {
// display "you can't fight while sitting" message) // display "you can't fight while sitting" message)
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgCantFightSit"); string msg = CI18N::get("msgCantFightSit");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
@ -3154,7 +3154,7 @@ bool CUserEntity::canEngageCombat()
{ {
// display "you can't fight while swiming" message) // display "you can't fight while swiming" message)
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgCantFightSwim"); string msg = CI18N::get("msgCantFightSwim");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
@ -3165,7 +3165,7 @@ bool CUserEntity::canEngageCombat()
{ {
// display "you can't fight while swimming" message) // display "you can't fight while swimming" message)
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgCantFightRide"); string msg = CI18N::get("msgCantFightRide");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
@ -4140,7 +4140,7 @@ void CUserEntity::switchVelocity(bool userRequest)
// display message : your are running, you are walking // display message : your are running, you are walking
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg; string msg;
if( _Run ) if( _Run )
msg = CI18N::get("msgUserIsRunning"); msg = CI18N::get("msgUserIsRunning");
else else

@ -159,6 +159,16 @@ bool CGenericXmlMsgHeaderManager::pushNameToStream(const string &msgName, CBitMe
return res; return res;
} }
//
bool CGenericXmlMsgHeaderManager::pushNameToStream(const char *msgName, CBitMemStream &strm)
{
bool res = (_Root->select(msgName, strm) != NULL);
if (!res) nlwarning("pushNameToStream failed: Unknown message name '%s'", msgName);
return res;
}
// //
void CGenericXmlMsgHeaderManager::popNameFromStream(string &resultName, CBitMemStream &strm) void CGenericXmlMsgHeaderManager::popNameFromStream(string &resultName, CBitMemStream &strm)
{ {

@ -231,6 +231,14 @@ public:
*/ */
bool pushNameToStream(const std::string &msgName, NLMISC::CBitMemStream &strm); bool pushNameToStream(const std::string &msgName, NLMISC::CBitMemStream &strm);
/**
* Convert and write a Message Name into a stream.
* \param string msgName : Message Name to convert and write into the stream.
* \param CBitMemStream strm : the stream to receive the Message Name.
* \return bool : 'false' if the method cannot write the message Name into the stream (probably because de message name is wrong).
*/
bool pushNameToStream(const char *msgName, NLMISC::CBitMemStream &strm);
/** /**
* Convert and return the Message Name from a stream. * Convert and return the Message Name from a stream.
* \param string resultName: The result for the Message Name. * \param string resultName: The result for the Message Name.

@ -633,7 +633,7 @@ public:
uint8 ChatMode; uint8 ChatMode;
// uint32 DynChatChanID; // uint32 DynChatChanID;
NLMISC::CEntityId DynChatChanID; NLMISC::CEntityId DynChatChanID;
ucstring Content; ucstring Content; // FIXME: UTF-8 (serial)
CChatMsg() CChatMsg()
{ {
@ -650,7 +650,7 @@ public:
f.serial( ChatMode ); f.serial( ChatMode );
if(ChatMode==CChatGroup::dyn_chat) if(ChatMode==CChatGroup::dyn_chat)
f.serial(DynChatChanID); f.serial(DynChatChanID);
f.serial( Content ); f.serial( Content ); // FIXME: UTF-8 (serial)
} }
}; };
@ -669,7 +669,7 @@ public:
uint32 SenderNameId; uint32 SenderNameId;
uint8 ChatMode; uint8 ChatMode;
uint32 PhraseId; uint32 PhraseId;
ucstring CustomTxt; ucstring CustomTxt; // FIXME: UTF-8 (serial)
CChatMsg2() CChatMsg2()
{ {
@ -685,7 +685,7 @@ public:
f.serial( SenderNameId ); f.serial( SenderNameId );
f.serial( ChatMode ); f.serial( ChatMode );
f.serial( PhraseId ); f.serial( PhraseId );
f.serial( CustomTxt ); f.serial( CustomTxt ); // FIXME: UTF-8 (serial)
} }
}; };
@ -700,8 +700,8 @@ public:
class CFarTellMsg class CFarTellMsg
{ {
public: public:
ucstring SenderName; ucstring SenderName; // FIXME: UTF-8 (serial)
ucstring Text; ucstring Text; // FIXME: UTF-8 (serial)
void serial(NLMISC::CBitMemStream &f) void serial(NLMISC::CBitMemStream &f)
{ {

Loading…
Cancel
Save