Merge branch 'develop' into ryzomclassic-develop

ryzomclassic-develop
kaetemi 4 years ago
commit 9cc899a3a6

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

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

@ -4177,7 +4177,8 @@ namespace NLGUI
}
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 );
char bufTmp[256], tgaName[256];
tgaName[0] = 0;
string sTGAname;
float uvMinU, uvMinV, uvMaxU, uvMaxV;
while (!iFile.eof())

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -310,12 +310,12 @@ public:
class CStringManagerTextProvider : public CViewTextID::IViewTextProvider
{
bool getString( uint32 stringId, ucstring &result )
bool getString( uint32 stringId, string &result )
{
return STRING_MANAGER::CStringManagerClient::instance()->getString( stringId, result );
}
bool getDynString( uint32 dynStringId, ucstring &result )
bool getDynString( uint32 dynStringId, string &result )
{
return STRING_MANAGER::CStringManagerClient::instance()->getDynString( dynStringId, result );
}
@ -400,7 +400,7 @@ public:
}
}
// get the title translated
ucstring sTitleTranslated = botName; // FIXME: UTF-8
string sTitleTranslated = botName; // FIXME: UTF-8
CStringPostProcessRemoveName spprn;
spprn.Woman = womanTitle;
spprn.cbIDStringReceived(sTitleTranslated);
@ -412,14 +412,14 @@ public:
{
// But if there is no name, display only the title
if (botName.empty())
botName = sTitleTranslated.toUtf8();
botName = sTitleTranslated;
}
else
{
// Else we want the title !
if (!botName.empty())
botName += " ";
botName += sTitleTranslated.toUtf8();
botName += sTitleTranslated;
}
formatedResult += botName;
@ -984,7 +984,7 @@ void CInterfaceManager::initInGame()
// flush system msg buffer
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();
@ -2349,7 +2349,7 @@ void CInterfaceManager::processServerIDString()
for (uint32 i = 0; i < _IDStringWaiters.size(); ++i)
{
bool bAffect = false;
ucstring ucstrToAffect;
string ucstrToAffect;
SIDStringWaiter *pISW = _IDStringWaiters[i];
if (pISW->IdOrString == true) // ID !
{
@ -2375,7 +2375,7 @@ void CInterfaceManager::processServerIDString()
if (bValid)
{
val.setString (ucstrToAffect.toUtf8());
val.setString (ucstrToAffect);
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)
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;
CRGBA color = CRGBA::White;
@ -3062,7 +3062,7 @@ NLMISC_COMMAND( localCounter, "Get value of local counter", "" )
{
if (args.size() != 0) return false;
CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo(ucstring(toString(im->getLocalSyncActionCounter())));
im->displaySystemInfo(toString(im->getLocalSyncActionCounter()));
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
if (name.empty())
{
name = pTokenSubjectEntity->getTitle().toUtf8();
name = pTokenSubjectEntity->getTitle();
}
token_replacement = name.empty() ? token_replacement : name;
}
else if (token_param == "title")
{
string title = pTokenSubjectEntity->getTitle().toUtf8();
string title = pTokenSubjectEntity->getTitle();
token_replacement = title.empty() ? token_replacement : title;
}
else if (token_param == "race")
@ -4244,10 +4244,10 @@ bool CInterfaceManager::parseTokens(string& ucstr)
else if (token_param == "guild")
{
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
ucstring ucGuildName;
string ucGuildName;
if (pSMC->getString(pTokenSubjectEntity->getGuildNameID(), ucGuildName))
{
token_replacement = ucGuildName.empty() ? token_replacement : ucGuildName.toUtf8();
token_replacement = ucGuildName.empty() ? token_replacement : ucGuildName;
}
}
else if (token_param.substr(0, 3) == "gs(" &&

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

@ -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 (!getInventory().isSpaceInAllBagsForItem(pCSDst))
{
ucstring msg = CI18N::get("msgCantPutItemInBag");
string msg = CI18N::get("msgCantPutItemInBag");
string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat);
return;
@ -3274,7 +3274,7 @@ class CHandlerInvTempAll : public IActionHandler
if (!bPlaceFound)
{
ucstring msg = CI18N::get("msgCantPutItemInBag");
string msg = CI18N::get("msgCantPutItemInBag");
string cat = getStringCategory(msg, msg);
CInterfaceManager::getInstance()->displaySystemInfo(msg, cat);
return;

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

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

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

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

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

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

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

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

@ -871,14 +871,14 @@ bool setVect(CVector &vectToChange, const CVector &vect, bool compute, bool chec
return true;
}// setVect //
NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest)
NLMISC::CRGBA interpClientCfgColor(const string &src, string &dest)
{
CRGBA color = CRGBA::White;
if (src.size() >= 3)
{
if (src[0] == (ucchar) '&')
if (src[0] == '&')
{
ucstring::size_type nextPos = src.find((ucchar) '&', 1);
string::size_type nextPos = src.find('&', 1);
if (nextPos != ucstring::npos)
{
std::string colorCode;
@ -911,7 +911,7 @@ NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest)
return color;
}
std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAddSysByDefault)
std::string getStringCategory(const string &src, string &dest, bool alwaysAddSysByDefault)
{
std::string str = getStringCategoryIfAny(src, dest);
if (alwaysAddSysByDefault)
@ -921,41 +921,41 @@ std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAd
}
std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest)
std::string getStringCategoryIfAny(const string &src, string &dest)
{
std::string colorCode;
if (src.size() >= 3)
{
uint startPos = 0;
size_t startPos = 0;
// Skip <NEW> or <CHG> if present at beginning
ucstring preTag;
const uint PreTagSize = 5;
const ucstring newTag("<NEW>");
string preTag;
const size_t PreTagSize = 5;
static const string newTag = "<NEW>";
if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == newTag) )
{
startPos = PreTagSize;
preTag = newTag;
}
const ucstring chgTag("<CHG>");
static const string chgTag = "<CHG>";
if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == chgTag) )
{
startPos = PreTagSize;
preTag = chgTag;
}
if (src[startPos] == (ucchar) '&')
if (src[startPos] == '&')
{
ucstring::size_type nextPos = src.find((ucchar) '&', startPos+1);
if (nextPos != ucstring::npos)
string::size_type nextPos = src.find('&', startPos+1);
if (nextPos != string::npos)
{
uint codeSize = (uint)nextPos - startPos - 1;
size_t codeSize = nextPos - startPos - 1;
colorCode.resize( codeSize );
for(uint k = 0; k < codeSize; ++k)
for(ptrdiff_t k = 0; k < (ptrdiff_t)codeSize; ++k)
{
colorCode[k] = tolower((char) src[k + startPos + 1]);
}
ucstring destTmp;
string destTmp;
if ( startPos != 0 )
destTmp = preTag; // leave <NEW> or <CHG> in the dest string
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
NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest);
NLMISC::CRGBA interpClientCfgColor(const std::string &src, std::string &dest);
// Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return "SYS"
std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAddSysByDefault = true);
std::string getStringCategory(const std::string &src, std::string &dest, bool alwaysAddSysByDefault = true);
// Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return ""
std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest);
std::string getStringCategoryIfAny(const std::string &src, std::string &dest);
bool getRelativeFloatFromString(const std::string src, float &dst);
void updateVector(const std::string part, NLMISC::CVector &dst, float value, bool add = false);

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

@ -702,7 +702,7 @@ void CPlayerCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle *
}
// update title when gender changed
const string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw.toUtf8(), _Gender == GSGENDER::female);
const string replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, _Gender == GSGENDER::female);
if (!replacement.empty() || !ClientCfg.DebugStringManager)
{
// Get extended name
@ -713,7 +713,7 @@ void CPlayerCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle *
if (_Slot == 0)
{
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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save