develop
kaetemi 4 years ago
parent 7e8f84462f
commit 246ea2f603

@ -250,6 +250,10 @@ void appendToLower(std::string &res, const std::string &str, ptrdiff_t &i);
void appendToUpper(std::string &res, const char *str, ptrdiff_t &i); void appendToUpper(std::string &res, const char *str, ptrdiff_t &i);
void appendToUpper(std::string &res, const std::string &str, ptrdiff_t &i); 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);
/** /**
* Convert to an hexadecimal std::string * Convert to an hexadecimal std::string

@ -4732,8 +4732,8 @@ static const char **s_UtfLowerToUpperMap[16] = {
NL_FORCE_INLINE void appendToLowerAsUtf8(std::string &res, const char *str, ptrdiff_t &i) NL_FORCE_INLINE void appendToLowerAsUtf8(std::string &res, const char *str, ptrdiff_t &i)
{ {
char c = str[i]; unsigned char c = str[i];
char d, e; unsigned char d, e;
if (c < 0x80) if (c < 0x80)
{ {
if (c >= 'A' && c <= 'Z') if (c >= 'A' && c <= 'Z')
@ -4824,8 +4824,8 @@ void appendToLower(std::string &res, const std::string &str, ptrdiff_t &i)
NL_FORCE_INLINE void appendToUpperAsUtf8(std::string &res, const char *str, ptrdiff_t &i) NL_FORCE_INLINE void appendToUpperAsUtf8(std::string &res, const char *str, ptrdiff_t &i)
{ {
char c = str[i]; unsigned char c = str[i];
char d, e; unsigned char d, e;
if (c < 0x80) if (c < 0x80)
{ {
if (c >= 'a' && c <= 'z') if (c >= 'a' && c <= 'z')
@ -4910,6 +4910,230 @@ void appendToUpper(std::string &res, const std::string &str, ptrdiff_t &i)
appendToUpperAsUtf8(res, &str[0], i); appendToUpperAsUtf8(res, &str[0], i);
} }
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
static const char s_UpperAscii[] = {
'A', 0, 'B', 0, 'C', 0, 'D', 0, 'E', 0, 'F', 0, 'G', 0,
'H', 0, 'I', 0, 'J', 0, 'K', 0, 'L', 0, 'M', 0, 'N', 0,
'O', 0, 'P', 0, 'Q', 0, 'R', 0, 'S', 0, 'T', 0, 'U', 0,
'V', 0, 'W', 0, 'X', 0, 'Y', 0, 'Z', 0, 0, 0, 0, 0
};
const char *fetchToUpperAsUtf8(const char **str)
{
unsigned char c = *(*str);
unsigned char d, e;
if (c < 0x80)
{
if (c >= 'a' && c <= 'z')
{
// 1-byte UTF-8
++(*str);
return &s_UpperAscii[(c - 'a') << 1];
}
}
else if ((c & 0xE0) == 0xC0 && ((d = (*str)[1]) & 0xC0) == 0x80)
{
// 2-byte UTF-8
const char *table = s_Utf8LowerToUpperTables[c & 0x1F];
if (table)
{
unsigned char idx = (d & 0x3F) << 2;
if (table[idx])
{
(*str) += 2;
return &table[idx];
}
}
}
else if ((c & 0xF0) == 0xE0 && ((d = (*str)[1]) & 0xC0) == 0x80 && ((e = (*str)[2]) & 0xC0) == 0x80)
{
// 3-byte UTF-8
const char **map = s_UtfLowerToUpperMap[c & 0x0F];
if (map)
{
const char *table = map[d & 0x3F];
if (table)
{
unsigned char idx = (d & 0x3F) << 2;
if (table[idx])
{
(*str) += 3;
return &table[idx];
}
}
}
}
return NULL;
}
int compareCaseInsensitive(const char *a, const char *b)
{
// while (*a != 0 && *b != 0)
for (; ;)
{
const char *ca = fetchToUpperAsUtf8(&a);
const char *cb = fetchToUpperAsUtf8(&b);
if (!ca && !cb)
{
// Easy case, ASCII compare or junk
if (*a != *b)
{
if (*a > * b) return 1;
else return -1;
}
else if (!*a) // Equal and NUL, ends both
{
return 0;
}
++a;
++b;
}
else if (!cb)
{
// String a changed lowercase, iterate ca until NUL alongside b
nlassert(*ca);
do
{
if (*ca != *b)
{
if (*ca > *b) return 1;
else return -1;
}
++ca;
++b;
} while (*ca);
}
else if (!ca)
{
// String b changed lowercase, iterate a alongside cb until NUL
nlassert(*cb);
do
{
if (*a != *cb)
{
if (*a > *cb) return 1;
else return -1;
}
++a;
++cb;
} while (*cb);
}
else
{
// Both strings changed lowercase
if (ca != cb) // Only check if it's a different result
{
do
{
if (*ca != *cb)
{
if (*ca > *cb) return 1;
else return -1;
}
++ca;
++cb;
} while (*ca && *cb);
}
}
}
// if (*a == *b) return 0;
// if (*a > *b) return 1;
// return -1;
}
int compareCaseInsensitive(const char *a, size_t lenA, const char *b, size_t lenB)
{
const char *ma = a + lenA;
const char *mb = b + lenB;
for (; ;)
{
if (a >= ma)
{
if (b >= mb)
{
return 0; // Both strings ended
}
else
{
return 1; // A is longer
}
}
if (b >= mb)
{
return -1; // B is longer
}
const char *ca = fetchToUpperAsUtf8(&a);
const char *cb = fetchToUpperAsUtf8(&b);
if (!ca && !cb)
{
// Easy case, ASCII compare or junk
if (*a != *b)
{
if (*a > * b) return 1;
else return -1;
}
/*
else if (!*a) // Equal and NUL, ends both
{
return 0;
}
*/
++a;
++b;
}
else if (!cb)
{
// String a changed lowercase, iterate ca until NUL alongside b
nlassert(*ca);
do
{
if (*ca != *b)
{
if (*ca > *b) return 1;
else return -1;
}
++ca;
++b;
} while (*ca);
}
else if (!ca)
{
// String b changed lowercase, iterate a alongside cb until NUL
nlassert(*cb);
do
{
if (*a != *cb)
{
if (*a > *cb) return 1;
else return -1;
}
++a;
++cb;
} while (*cb);
}
else
{
// Both strings changed lowercase
if (ca != cb) // Only check if it's a different result
{
do
{
if (*ca != *cb)
{
if (*ca > *cb) return 1;
else return -1;
}
++ca;
++cb;
} while (*ca && *cb);
}
}
}
}
// *************************************************************************** // ***************************************************************************
#else #else

@ -811,7 +811,7 @@ bool CCharacterCL::build(const CEntitySheet *sheet) // virtual
// Get the fauna name in the sheet // Get the fauna name in the sheet
const ucstring creatureName(STRING_MANAGER::CStringManagerClient::getCreatureLocalizedName(_Sheet->Id)); const ucstring creatureName(STRING_MANAGER::CStringManagerClient::getCreatureLocalizedName(_Sheet->Id));
if (creatureName.find(ucstring("<NotExist:")) != 0) if (creatureName.find(ucstring("<NotExist:")) != 0)
_EntityName = creatureName; _EntityName = creatureName.toUtf8();
} }
else else
{ {

@ -955,7 +955,7 @@ void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstrin
result = msg; result = msg;
else else
{ {
ucstring name = CEntityCL::removeTitleAndShardFromName(sender); ucstring name = CEntityCL::removeTitleAndShardFromName(sender.toUtf8());
ucstring csr; ucstring csr;
// special case where there is only a title, very rare case for some NPC // special case where there is only a title, very rare case for some NPC
@ -965,20 +965,20 @@ void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstrin
CCharacterCL *entity = dynamic_cast<CCharacterCL*>(EntitiesMngr.getEntityByName(sender, true, true)); CCharacterCL *entity = dynamic_cast<CCharacterCL*>(EntitiesMngr.getEntityByName(sender, true, true));
bool bWoman = entity && entity->getGender() == GSGENDER::female; bool bWoman = entity && entity->getGender() == GSGENDER::female;
name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman);
{ {
// Sometimes translation contains another title // Sometimes translation contains another title
ucstring::size_type pos = name.find('$'); ucstring::size_type pos = name.find('$');
if (pos != ucstring::npos) if (pos != ucstring::npos)
{ {
name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name), bWoman); name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name.toUtf8()), bWoman);
} }
} }
} }
else else
{ {
// Does the char have a CSR title? // Does the char have a CSR title?
csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? ucstring("(CSR) ") : ucstring(""); csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring("");
} }
result = csr + name + ucstring(" ") + CI18N::get("tellsYou") + ucstring(": ") + msg; result = csr + name + ucstring(" ") + CI18N::get("tellsYou") + ucstring(": ") + msg;
@ -1018,13 +1018,13 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde
} }
// Format the sentence with the provided sender name // Format the sentence with the provided sender name
ucstring senderName = CEntityCL::removeTitleAndShardFromName(sender); ucstring senderName = CEntityCL::removeTitleAndShardFromName(sender.toUtf8());
ucstring csr; ucstring csr;
// Does the char have a CSR title? // Does the char have a CSR title?
csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? ucstring("(CSR) ") : ucstring(""); csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring("");
if (UserEntity && senderName == UserEntity->getDisplayName()) if (UserEntity && senderName.toUtf8() == UserEntity->getDisplayName())
{ {
// The player talks // The player talks
switch(type) switch(type)
@ -1046,13 +1046,13 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde
// We need the gender to display the correct title // We need the gender to display the correct title
bool bWoman = entity && entity->getGender() == GSGENDER::female; bool bWoman = entity && entity->getGender() == GSGENDER::female;
senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman);
{ {
// Sometimes translation contains another title // Sometimes translation contains another title
ucstring::size_type pos = senderName.find('$'); ucstring::size_type pos = senderName.find('$');
if (pos != ucstring::npos) if (pos != ucstring::npos)
{ {
senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName), bWoman); senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName.toUtf8()), bWoman);
} }
} }
} }

@ -145,8 +145,8 @@ string CharNameValidDBLink;
uint8 PlayerSelectedSlot = 0; uint8 PlayerSelectedSlot = 0;
string PlayerSelectedFileName; string PlayerSelectedFileName;
TSessionId PlayerSelectedMainland= (TSessionId)0; // This is the mainland selected at the SELECT perso!! TSessionId PlayerSelectedMainland= (TSessionId)0; // This is the mainland selected at the SELECT perso!!
ucstring PlayerSelectedHomeShardName; std::string PlayerSelectedHomeShardName;
ucstring PlayerSelectedHomeShardNameWithParenthesis; std::string PlayerSelectedHomeShardNameWithParenthesis;
extern std::string CurrentCookie; extern std::string CurrentCookie;
ucstring NewKeysCharNameWanted; // name of the character for which a new keyset must be created ucstring NewKeysCharNameWanted; // name of the character for which a new keyset must be created
@ -1441,7 +1441,7 @@ Deprecated {
ucstring::size_type pos = sValue.find('$'); ucstring::size_type pos = sValue.find('$');
if (pos != ucstring::npos) if (pos != ucstring::npos)
{ {
sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sValue), womanTitle); sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sValue.toUtf8()), womanTitle);
} }
} }
setTarget (pCaller, sTarget, sValue); setTarget (pCaller, sTarget, sValue);
@ -3348,7 +3348,7 @@ class CAHLoadScenario : public IActionHandler
ucstring res; ucstring res;
if (pSMC->getString(val,res)) if (pSMC->getString(val,res))
{ {
string charName = CEntityCL::removeTitleAndShardFromName(res).toString(); string charName = CEntityCL::removeTitleAndShardFromName(res.toUtf8());
sessionBrowser.inviteCharacterByName(sessionBrowser._LastScheduleSessionCharId, charName); sessionBrowser.inviteCharacterByName(sessionBrowser._LastScheduleSessionCharId, charName);
if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_invokeResult"))) if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_invokeResult")))

@ -30,8 +30,8 @@ extern std::vector<CMainlandSummary> Mainlands;
extern uint8 PlayerSelectedSlot; extern uint8 PlayerSelectedSlot;
extern std::string PlayerSelectedFileName; extern std::string PlayerSelectedFileName;
extern TSessionId PlayerSelectedMainland; // This is the mainland selected at the SELECT perso!! extern TSessionId PlayerSelectedMainland; // This is the mainland selected at the SELECT perso!!
extern ucstring PlayerSelectedHomeShardName; // The home shard name (aniro, leanon etc....) extern std::string PlayerSelectedHomeShardName; // The home shard name (aniro, leanon etc....)
extern ucstring PlayerSelectedHomeShardNameWithParenthesis; // Same with parenthesis extern std::string PlayerSelectedHomeShardNameWithParenthesis; // Same with parenthesis
extern std::vector<CCharacterSummary> CharacterSummaries; extern std::vector<CCharacterSummary> CharacterSummaries;
extern std::string UserPrivileges; extern std::string UserPrivileges;
extern sint LoginCharsel; extern sint LoginCharsel;

@ -514,7 +514,7 @@ string getDebugInformation()
if(UserEntity) if(UserEntity)
{ {
str += toString("Player Name: '%s'\n", UserEntity->getEntityName().toString().c_str()); str += toString("Player Name: '%s'\n", UserEntity->getEntityName().c_str());
str += toString("UserPosition: %.2f %.2f %.2f\n", UserEntity->pos().x, UserEntity->pos().y, UserEntity->pos().z); str += toString("UserPosition: %.2f %.2f %.2f\n", UserEntity->pos().x, UserEntity->pos().y, UserEntity->pos().z);
} }
else else

@ -2097,7 +2097,7 @@ bool CEntityCL::clipped (const std::vector<NLMISC::CPlane> &clippingPlanes, cons
// Set the name of the entity. Handle replacement tag if any // Set the name of the entity. Handle replacement tag if any
// to insert NPC task translated. // to insert NPC task translated.
//--------------------------------------------------- //---------------------------------------------------
void CEntityCL::setEntityName(const ucstring &name) void CEntityCL::setEntityName(const std::string &name)
{ {
_EntityName = name; _EntityName = name;
} }
@ -2264,7 +2264,7 @@ void CEntityCL::load() // virtual
//----------------------------------------------- //-----------------------------------------------
void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value)
{ {
_EntityName = value; _EntityName = value.toUtf8();
// remove the shard name if possible // remove the shard name if possible
_EntityName= removeShardFromName(_EntityName); _EntityName= removeShardFromName(_EntityName);
@ -2303,7 +2303,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value)
if (pos != ucstring::npos) if (pos != ucstring::npos)
{ {
ucstring sn = replacement; ucstring sn = replacement;
_EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(sn.substr(0, pos)); _EntityName = sn.substr(0, pos).toUtf8();
ucstring::size_type pos2 = sn.find('$', pos + 1); ucstring::size_type pos2 = sn.find('$', pos + 1);
_TitleRaw = sn.substr(pos+1, pos2 - pos - 1); _TitleRaw = sn.substr(pos+1, pos2 - pos - 1);
replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle); replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle);
@ -2370,32 +2370,32 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value)
//----------------------------------------------- //-----------------------------------------------
// getTitleFromName // getTitleFromName
//----------------------------------------------- //-----------------------------------------------
ucstring CEntityCL::getTitleFromName(const ucstring &name) std::string CEntityCL::getTitleFromName(const std::string &name)
{ {
ucstring::size_type p1 = name.find('$'); std::string::size_type p1 = name.find('$');
if (p1 != ucstring::npos) if (p1 != ucstring::npos)
{ {
ucstring::size_type p2 = name.find('$', p1 + 1); std::string::size_type p2 = name.find('$', p1 + 1);
if (p2 != ucstring::npos) if (p2 != std::string::npos)
return name.substr(p1+1, p2-p1-1); return name.substr(p1+1, p2-p1-1);
} }
return ucstring(""); return std::string();
}// getTitleFromName // }// getTitleFromName //
//----------------------------------------------- //-----------------------------------------------
// removeTitleFromName // removeTitleFromName
//----------------------------------------------- //-----------------------------------------------
ucstring CEntityCL::removeTitleFromName(const ucstring &name) std::string CEntityCL::removeTitleFromName(const std::string &name)
{ {
ucstring::size_type p1 = name.find('$'); std::string::size_type p1 = name.find('$');
if (p1 == ucstring::npos) if (p1 == ucstring::npos)
{ {
return name; return name;
} }
else else
{ {
ucstring::size_type p2 = name.find('$', p1 + 1); std::string::size_type p2 = name.find('$', p1 + 1);
if (p2 != ucstring::npos) if (p2 != ucstring::npos)
{ {
return name.substr(0, p1) + name.substr(p2 + 1); return name.substr(0, p1) + name.substr(p2 + 1);
@ -2410,16 +2410,16 @@ ucstring CEntityCL::removeTitleFromName(const ucstring &name)
//----------------------------------------------- //-----------------------------------------------
// removeShardFromName // removeShardFromName
//----------------------------------------------- //-----------------------------------------------
ucstring CEntityCL::removeShardFromName(const ucstring &name) std::string CEntityCL::removeShardFromName(const std::string &name)
{ {
// The string must contains a '(' and a ')' // The string must contains a '(' and a ')'
ucstring::size_type p0= name.find('('); std::string::size_type p0= name.find('(');
ucstring::size_type p1= name.find(')'); std::string::size_type p1= name.find(')');
if(p0==ucstring::npos || p1==ucstring::npos || p1<=p0) if(p0==std::string::npos || p1==std::string::npos || p1<=p0)
return name; return name;
// if it is the same as the shard name of the user, remove it // if it is the same as the shard name of the user, remove it
if(ucstrnicmp(name, (uint)p0+1, (uint)(p1-p0-1), PlayerSelectedHomeShardName)==0) if (!NLMISC::compareCaseInsensitive(name.c_str() + p0 + 1, p1-p0-1, PlayerSelectedHomeShardName.c_str(), PlayerSelectedHomeShardName.size()))
return name.substr(0,p0) + name.substr(p1+1); return name.substr(0,p0) + name.substr(p1+1);
// else don't modify // else don't modify
else else
@ -2429,7 +2429,7 @@ ucstring CEntityCL::removeShardFromName(const ucstring &name)
//----------------------------------------------- //-----------------------------------------------
// removeTitleAndShardFromName // removeTitleAndShardFromName
//----------------------------------------------- //-----------------------------------------------
ucstring CEntityCL::removeTitleAndShardFromName(const ucstring &name) std::string CEntityCL::removeTitleAndShardFromName(const std::string &name)
{ {
return removeTitleFromName(removeShardFromName(name)); return removeTitleFromName(removeShardFromName(name));
} }

@ -334,19 +334,19 @@ public:
*/ */
//@{ //@{
/// Return the Name of the entity. There may be a specification in it (guard, trader, etc ...). It is then surrounded by '$' /// Return the Name of the entity. There may be a specification in it (guard, trader, etc ...). It is then surrounded by '$'
const ucstring &getEntityName() const {return _EntityName;} const std::string &getEntityName() const {return _EntityName;}
/// Return the title from a name. The specification is surrounded by '$', and tells the title of the entity (guard, matis merchant, etc ..) /// Return the title from a name. The specification is surrounded by '$', and tells the title of the entity (guard, matis merchant, etc ..)
static ucstring getTitleFromName(const ucstring &name); static std::string getTitleFromName(const std::string &name);
/// Remove the specification from a name. The specification is surrounded by '$', and tells the title of the entity (guard, matis merchant, etc ..) /// Remove the specification from a name. The specification is surrounded by '$', and tells the title of the entity (guard, matis merchant, etc ..)
static ucstring removeTitleFromName(const ucstring &name); static std::string removeTitleFromName(const std::string &name);
/// Remove the shard from a name (if player from the same shard). The shard is surrounded by (), and tells the incoming shard of the entity (aniro, leanon etc...) /// Remove the shard from a name (if player from the same shard). The shard is surrounded by (), and tells the incoming shard of the entity (aniro, leanon etc...)
static ucstring removeShardFromName(const ucstring &name); static std::string removeShardFromName(const std::string &name);
/// Remove both title and shard from name /// Remove both title and shard from name
static ucstring removeTitleAndShardFromName(const ucstring &name); static std::string removeTitleAndShardFromName(const std::string &name);
/// Change the entity name. /// Change the entity name.
void setEntityName(const ucstring &name); void setEntityName(const std::string &name);
/// Return a displayable name /// Return a displayable name
ucstring getDisplayName() const std::string getDisplayName() const
{ {
return removeTitleAndShardFromName(_EntityName); return removeTitleAndShardFromName(_EntityName);
} }
@ -931,7 +931,7 @@ protected:
// Flags to know what is possible to do with the entity (selectable, liftable, etc.). // Flags to know what is possible to do with the entity (selectable, liftable, etc.).
CProperties _Properties; CProperties _Properties;
// Current Name for the entity // Current Name for the entity
ucstring _EntityName; std::string _EntityName;
// Current entity title // Current entity title
ucstring _Title; ucstring _Title;
// Current entity tags // Current entity tags

@ -508,9 +508,9 @@ void CForageSourceCL::updateVisualPropertyVisualFX(const NLMISC::TGameCycle &/*
CEntityCL *prospector = EntitiesMngr.entities()[_ProspectorSlot]; CEntityCL *prospector = EntitiesMngr.entities()[_ProspectorSlot];
if (prospector != NULL) if (prospector != NULL)
{ {
ucstring prospectorName = prospector->getDisplayName(); string prospectorName = prospector->getDisplayName();
if ( ! prospectorName.empty() ) if ( ! prospectorName.empty() )
_EntityName += ucstring(" [") + prospectorName + ucstring("]"); _EntityName += " [" + prospectorName + "]";
} }
} }
@ -539,15 +539,15 @@ void CForageSourceCL::updateVisualPropertyName(const NLMISC::TGameCycle &/* game
const ucchar *name = STRING_MANAGER::CStringManagerClient::getItemLocalizedName( rmSheetId ); const ucchar *name = STRING_MANAGER::CStringManagerClient::getItemLocalizedName( rmSheetId );
if ( name ) if ( name )
{ {
_EntityName = name; _EntityName = ucstring(name).toUtf8();
if ( _ProspectorSlot != 255 ) if ( _ProspectorSlot != 255 )
{ {
CEntityCL *prospector = EntitiesMngr.entities()[_ProspectorSlot]; CEntityCL *prospector = EntitiesMngr.entities()[_ProspectorSlot];
if (prospector != NULL) if (prospector != NULL)
{ {
ucstring prospectorName = prospector->getDisplayName(); std::string prospectorName = prospector->getDisplayName();
if ( ! prospectorName.empty() ) if ( ! prospectorName.empty() )
_EntityName += ucstring(" [") + prospectorName + ucstring("]"); _EntityName += " [" + prospectorName + "]";
} }
} }
// Rebuild inscene interface // Rebuild inscene interface
@ -568,9 +568,9 @@ void CForageSourceCL::updateVisualPropertyTarget(const NLMISC::TGameCycle &/* ga
CEntityCL *prospector = EntitiesMngr.entities()[_ProspectorSlot]; // NULL if entity not received CEntityCL *prospector = EntitiesMngr.entities()[_ProspectorSlot]; // NULL if entity not received
if (prospector != NULL) if (prospector != NULL)
{ {
ucstring prospectorName = prospector->getDisplayName(); std::string prospectorName = prospector->getDisplayName();
if ( ! prospectorName.empty() ) if ( ! prospectorName.empty() )
_EntityName = _EntityName + ucstring(" [") + prospectorName + ucstring("]"); _EntityName = _EntityName + " [" + prospectorName + "]";
} }
// Rebuild inscene interface // Rebuild inscene interface

@ -225,8 +225,8 @@ struct CStatThread : public NLMISC::IRunnable
string cookie() string cookie()
{ {
string name; string name;
if(UserEntity && !UserEntity->getEntityName().toString().empty()) if(UserEntity && !UserEntity->getEntityName().empty())
name = UserEntity->getEntityName().toString(); name = UserEntity->getEntityName();
std::string userid = toString("u%d", NetMngr.getUserId())+name; std::string userid = toString("u%d", NetMngr.getUserId())+name;
return toUpper(getMD5((const uint8 *)userid.c_str(), (uint32)userid.size()).toString()); return toUpper(getMD5((const uint8 *)userid.c_str(), (uint32)userid.size()).toString());
@ -236,7 +236,7 @@ struct CStatThread : public NLMISC::IRunnable
bool connect() bool connect()
{ {
//nlinfo("connect"); //nlinfo("connect");
if(!UserEntity || UserEntity->getEntityName().toString().empty()) if(!UserEntity || UserEntity->getEntityName().empty())
return false; return false;
referer = ContinentMngr.getCurrentContinentSelectName(); referer = ContinentMngr.getCurrentContinentSelectName();
@ -260,7 +260,7 @@ struct CStatThread : public NLMISC::IRunnable
timeinfo = localtime ( &rawtime ); timeinfo = localtime ( &rawtime );
strftime (buffer,80,"%H%%3A%M", timeinfo); strftime (buffer,80,"%H%%3A%M", timeinfo);
addParam(params, "localtime", buffer); addParam(params, "localtime", buffer);
addParam(params, "cv_name", UserEntity->getEntityName().toUtf8()); addParam(params, "cv_name", UserEntity->getEntityName());
//addParam(params, "cv_email", ""); //addParam(params, "cv_email", "");
//addParam(params, "cv_avatar", ""); //addParam(params, "cv_avatar", "");
addParam(params, "cv_Userid", toString(NetMngr.getUserId())); addParam(params, "cv_Userid", toString(NetMngr.getUserId()));

@ -1959,13 +1959,13 @@ public:
if (pChar != NULL) if (pChar != NULL)
womanTitle = pChar->getGender() == GSGENDER::female; womanTitle = pChar->getGender() == GSGENDER::female;
STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle); STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout.toUtf8()), womanTitle);
// Sometimes translation contains another title // Sometimes translation contains another title
ucstring::size_type pos = copyInout.find('$'); ucstring::size_type pos = copyInout.find('$');
if (pos != ucstring::npos) if (pos != ucstring::npos)
{ {
copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle); copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout.toUtf8()), womanTitle);
} }
CStringPostProcessRemoveTitle::cbIDStringReceived(copyInout); CStringPostProcessRemoveTitle::cbIDStringReceived(copyInout);

@ -670,7 +670,7 @@ class CHandlerOpenTitleHelp : public IActionHandler
if (selection == NULL) return; if (selection == NULL) return;
//if(selection->isNPC()) //if(selection->isNPC())
{ {
ucstring name = selection->getEntityName(); std::string name = selection->getEntityName();
if(name.empty()) if(name.empty())
{ {
// try to get the name from the string manager (for npc) // try to get the name from the string manager (for npc)
@ -679,7 +679,7 @@ class CHandlerOpenTitleHelp : public IActionHandler
{ {
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
pSMC->getString (nDBid, name); pSMC->getString (nDBid, name);
ucstring copyName = name; std::string copyName = name;
name = CEntityCL::removeTitleAndShardFromName(name); name = CEntityCL::removeTitleAndShardFromName(name);
if (name.empty()) if (name.empty())
{ {
@ -689,18 +689,18 @@ class CHandlerOpenTitleHelp : public IActionHandler
woman = pChar->getGender() == GSGENDER::female; woman = pChar->getGender() == GSGENDER::female;
// extract the replacement id // extract the replacement id
ucstring strNewTitle = CEntityCL::getTitleFromName(copyName); std::string strNewTitle = CEntityCL::getTitleFromName(copyName);
// retrieve the translated string // retrieve the translated string
if (!strNewTitle.empty()) if (!strNewTitle.empty())
name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(strNewTitle, woman); name = ucstring(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(ucstring::makeFromUtf8(strNewTitle), woman)).toUtf8();
else else
name.clear(); name.clear();
} }
} }
} }
if(!name.empty()) if(!name.empty())
CAHManager::getInstance()->runActionHandler("show_hide", pCaller, "profile|pname="+name.toUtf8()+"|ptype="+toString((int)selection->Type)); CAHManager::getInstance()->runActionHandler("show_hide", pCaller, "profile|pname="+name+"|ptype="+toString((int)selection->Type));
return; return;
} }
} }
@ -2762,7 +2762,7 @@ class CPlayerShardNameRemover : public IOnReceiveTextId
{ {
virtual void onReceiveTextId(ucstring &str) virtual void onReceiveTextId(ucstring &str)
{ {
str= CEntityCL::removeShardFromName(str); str= CEntityCL::removeShardFromName(str.toUtf8());
} }
}; };
static CPlayerShardNameRemover PlayerShardNameRemover; static CPlayerShardNameRemover PlayerShardNameRemover;
@ -3629,7 +3629,7 @@ public:
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:NAME", index)); CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:NAME", index));
if (node && CStringManagerClient::instance()->getDynString(node->getValue32(), txt)) if (node && CStringManagerClient::instance()->getDynString(node->getValue32(), txt))
{ {
CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt).toUtf8()); CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt.toUtf8()));
} }
} }
}; };

@ -1737,7 +1737,7 @@ void CItemMenuInBagInfoWaiter::infoValidated(CDBCtrlSheet* ctrlSheet)
ucstring creatorNameString; ucstring creatorNameString;
if( STRING_MANAGER::CStringManagerClient::instance()->getString ( itemInfo.CreatorName, creatorNameString) ) if( STRING_MANAGER::CStringManagerClient::instance()->getString ( itemInfo.CreatorName, creatorNameString) )
{ {
if (toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString)) if ( toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString.toUtf8()))
isCraftedByUserEntity = true; isCraftedByUserEntity = true;
} }
@ -1845,7 +1845,7 @@ class CHandlerItemMenuCheck : public IActionHandler
ucstring creatorNameString; ucstring creatorNameString;
if( STRING_MANAGER::CStringManagerClient::instance()->getString ( getInventory().getItemInfo(getInventory().getItemSlotId(pCS)).CreatorName, creatorNameString) ) if( STRING_MANAGER::CStringManagerClient::instance()->getString ( getInventory().getItemInfo(getInventory().getItemSlotId(pCS)).CreatorName, creatorNameString) )
{ {
if (toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString)) if (toLower(UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis) == toLower(creatorNameString.toUtf8()))
isTextEditionActive = true; isTextEditionActive = true;
} }
} }

@ -836,7 +836,7 @@ class CAHReplyTeller : public IActionHandler
{ {
w->setKeyboardFocus(); w->setKeyboardFocus();
w->enableBlink(1); w->enableBlink(1);
PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName)); PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName.toUtf8()));
CGroupEditBox *eb = w->getEditBox(); CGroupEditBox *eb = w->getEditBox();
if (eb != NULL) if (eb != NULL)
{ {
@ -863,7 +863,7 @@ class CAHReplyTellerOnce : public IActionHandler
{ {
w->setKeyboardFocus(); w->setKeyboardFocus();
w->enableBlink(1); w->enableBlink(1);
w->setCommand(ucstring("tell ") + CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName) + ucstring(" "), false); w->setCommand(ucstring("tell ") + CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName.toUtf8()) + ucstring(" "), false);
CGroupEditBox *eb = w->getEditBox(); CGroupEditBox *eb = w->getEditBox();
if (eb != NULL) if (eb != NULL)
{ {
@ -916,7 +916,7 @@ NLMISC_COMMAND(slsn, "Temp : set the name of the last sender.", "<name>")
bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut) bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut)
{ {
// extract the replacement id // extract the replacement id
ucstring strNewTitle = CEntityCL::getTitleFromName(inOut); ucstring strNewTitle = CEntityCL::getTitleFromName(inOut.toUtf8());
// retrieve the translated string // retrieve the translated string
if (!strNewTitle.empty()) if (!strNewTitle.empty())
@ -927,7 +927,7 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut)
ucstring::size_type pos = inOut.find('$'); ucstring::size_type pos = inOut.find('$');
if (pos != ucstring::npos) if (pos != ucstring::npos)
{ {
inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(inOut), Woman); inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(inOut.toUtf8()), Woman);
} }
} }
} }
@ -940,14 +940,14 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut)
// *************************************************************************** // ***************************************************************************
bool CStringPostProcessRemoveTitle::cbIDStringReceived(ucstring &inOut) bool CStringPostProcessRemoveTitle::cbIDStringReceived(ucstring &inOut)
{ {
inOut = CEntityCL::removeTitleAndShardFromName(inOut); inOut = CEntityCL::removeTitleAndShardFromName(inOut.toUtf8());
return true; return true;
} }
// *************************************************************************** // ***************************************************************************
bool CStringPostProcessNPCRemoveTitle::cbIDStringReceived(ucstring &inOut) bool CStringPostProcessNPCRemoveTitle::cbIDStringReceived(ucstring &inOut)
{ {
ucstring sOut = CEntityCL::removeTitleAndShardFromName(inOut); ucstring sOut = CEntityCL::removeTitleAndShardFromName(inOut.toUtf8());
if (sOut.empty()) if (sOut.empty())
{ {
CStringPostProcessRemoveName SPPRM; CStringPostProcessRemoveName SPPRM;

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

@ -560,7 +560,7 @@ bool buildCompassTargetFromTeamMember(CCompassTarget &ct, uint teamMemberId)
CStringManagerClient *pSMC = CStringManagerClient::instance(); CStringManagerClient *pSMC = CStringManagerClient::instance();
ucstring name; ucstring name;
if (pSMC->getString(nameNode->getValue32(), name)) if (pSMC->getString(nameNode->getValue32(), name))
ct.Name = CEntityCL::removeTitleAndShardFromName(name); // TODO : dynamic support for name ct.Name = CEntityCL::removeTitleAndShardFromName(name.toUtf8()); // TODO : dynamic support for name
else else
ct.Name = CI18N::get("uiNotReceived"); ct.Name = CI18N::get("uiNotReceived");
return true; return true;

@ -97,7 +97,7 @@ void addWebIGParams (string &url, bool trustedDomain)
if (url.find('$') != string::npos) if (url.find('$') != string::npos)
{ {
strFindReplace(url, "$gender$", GSGENDER::toString(UserEntity->getGender())); strFindReplace(url, "$gender$", GSGENDER::toString(UserEntity->getGender()));
strFindReplace(url, "$displayName$", UserEntity->getDisplayName().toString()); strFindReplace(url, "$displayName$", UserEntity->getDisplayName()); // FIXME: UrlEncode...
strFindReplace(url, "$posx$", toString(UserEntity->pos().x)); strFindReplace(url, "$posx$", toString(UserEntity->pos().x));
strFindReplace(url, "$posy$", toString(UserEntity->pos().y)); strFindReplace(url, "$posy$", toString(UserEntity->pos().y));
strFindReplace(url, "$posz$", toString(UserEntity->pos().z)); strFindReplace(url, "$posz$", toString(UserEntity->pos().z));
@ -113,7 +113,7 @@ void addWebIGParams (string &url, bool trustedDomain)
if (target) if (target)
{ {
strFindReplace(url, "$tdatasetid$", toString(target->dataSetId())); strFindReplace(url, "$tdatasetid$", toString(target->dataSetId()));
strFindReplace(url, "$tdisplayName$", target->getDisplayName().toString()); strFindReplace(url, "$tdisplayName$", target->getDisplayName()); // FIXME: UrlEncode...
strFindReplace(url, "$tposx$", toString(target->pos().x)); strFindReplace(url, "$tposx$", toString(target->pos().x));
strFindReplace(url, "$tposy$", toString(target->pos().y)); strFindReplace(url, "$tposy$", toString(target->pos().y));
strFindReplace(url, "$tposz$", toString(target->pos().z)); strFindReplace(url, "$tposz$", toString(target->pos().z));

@ -1201,7 +1201,7 @@ void CGroupMap::checkCoords()
CEntityCL *sel = EntitiesMngr.entity(UserEntity->selection()); CEntityCL *sel = EntitiesMngr.entity(UserEntity->selection());
if (sel) if (sel)
{ {
_TargetLM->setDefaultContextHelp(NLMISC::CI18N::get("uiTargetTwoPoint") + sel->removeTitleAndShardFromName(sel->getEntityName()).toUtf8()); _TargetLM->setDefaultContextHelp(NLMISC::CI18N::get("uiTargetTwoPoint") + sel->removeTitleAndShardFromName(sel->getEntityName()));
} }
} }
} }
@ -1405,8 +1405,8 @@ void CGroupMap::checkCoords()
if (pSMC->getString(val,res)) if (pSMC->getString(val,res))
{ {
res = CEntityCL::removeTitleAndShardFromName(res); std::string res2 = CEntityCL::removeTitleAndShardFromName(res.toUtf8());
_TeammateLM[i]->setDefaultContextHelp(res.toUtf8()); _TeammateLM[i]->setDefaultContextHelp(res2);
} }
} }
updateLMPosFromDBPos(_TeammateLM[i], px, py); updateLMPosFromDBPos(_TeammateLM[i], px, py);

@ -359,7 +359,7 @@ void CGuildManager::update()
for (uint i = 0; i < _GuildMembers.size(); ++i) for (uint i = 0; i < _GuildMembers.size(); ++i)
{ {
if (!pSMC->getString (_GuildMembers[i].NameID, _GuildMembers[i].Name)) bAllValid = false; if (!pSMC->getString (_GuildMembers[i].NameID, _GuildMembers[i].Name)) bAllValid = false;
else _GuildMembers[i].Name = CEntityCL::removeTitleAndShardFromName(_GuildMembers[i].Name); else _GuildMembers[i].Name = CEntityCL::removeTitleAndShardFromName(_GuildMembers[i].Name.toUtf8());
} }
// If all is valid no more need update and if guild is opened update the interface // If all is valid no more need update and if guild is opened update the interface
@ -875,7 +875,7 @@ class CAHGuildSheetOpen : public IActionHandler
CCtrlBase *inviteButton = pLine->getCtrl("invite_button"); CCtrlBase *inviteButton = pLine->getCtrl("invite_button");
if (inviteButton != NULL) if (inviteButton != NULL)
inviteButton->setActive(rGuildMembers[i].Online != ccs_offline && rGuildMembers[i].Name != UserEntity->getEntityName()); inviteButton->setActive(rGuildMembers[i].Online != ccs_offline && rGuildMembers[i].Name.toUtf8() != UserEntity->getEntityName());
// Enter Date // Enter Date
CViewText *pViewEnterDate = dynamic_cast<CViewText*>(pLine->getView(TEMPLATE_GUILD_MEMBER_ENTER_DATE)); CViewText *pViewEnterDate = dynamic_cast<CViewText*>(pLine->getView(TEMPLATE_GUILD_MEMBER_ENTER_DATE));

@ -358,7 +358,7 @@ public:
} }
else else
{ {
std::string name = UserEntity->getEntityName().toUtf8(); std::string name = UserEntity->getEntityName();
if (*it == 'P') name = toUpper(name); if (*it == 'P') name = toUpper(name);
formatedResult += name; formatedResult += name;
} }
@ -391,7 +391,7 @@ public:
} }
else else
{ {
botName = entity->getDisplayName().toUtf8(); botName = entity->getDisplayName();
} }
CCharacterCL *pChar = dynamic_cast<CCharacterCL*>(entity); CCharacterCL *pChar = dynamic_cast<CCharacterCL*>(entity);
if (pChar != NULL) if (pChar != NULL)
@ -405,7 +405,7 @@ public:
spprn.Woman = womanTitle; spprn.Woman = womanTitle;
spprn.cbIDStringReceived(sTitleTranslated); spprn.cbIDStringReceived(sTitleTranslated);
botName = CEntityCL::removeTitleAndShardFromName(botName).toUtf8(); botName = CEntityCL::removeTitleAndShardFromName(botName);
// short name (with no title such as 'guard', 'merchant' ...) // short name (with no title such as 'guard', 'merchant' ...)
if (*it == 's') if (*it == 's')
@ -4214,7 +4214,7 @@ bool CInterfaceManager::parseTokens(string& ucstr)
// Parse the parameter // Parse the parameter
if (token_param == "name") if (token_param == "name")
{ {
string name = pTokenSubjectEntity->getDisplayName().toUtf8(); string name = pTokenSubjectEntity->getDisplayName();
// special case where there is only a title, very rare case for some NPC // special case where there is only a title, very rare case for some NPC
if (name.empty()) if (name.empty())
{ {

@ -1363,7 +1363,7 @@ int CLuaIHMRyzom::getPlayerGender(CLuaState &ls)
int CLuaIHMRyzom::getPlayerName(CLuaState &ls) int CLuaIHMRyzom::getPlayerName(CLuaState &ls)
{ {
CLuaIHM::checkArgCount(ls, "getPlayerName", 0); CLuaIHM::checkArgCount(ls, "getPlayerName", 0);
ls.push(UserEntity->getEntityName().toUtf8()); ls.push(UserEntity->getEntityName());
return 1; return 1;
} }
@ -1441,7 +1441,7 @@ int CLuaIHMRyzom::getTargetName(CLuaState &ls)
if (!target) return 0; if (!target) return 0;
ls.push(target->getEntityName().toUtf8()); ls.push(target->getEntityName());
return 1; return 1;
} }
@ -3274,7 +3274,7 @@ void CLuaIHMRyzom::browseNpcWebPage(const std::string &htmlId, const std::string
if (UserEntity) if (UserEntity)
{ {
userName = UserEntity->getDisplayName().toString(); userName = UserEntity->getDisplayName();
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
ucstring ucsTmp; ucstring ucsTmp;
pSMC->getString(UserEntity->getGuildNameID(), ucsTmp); pSMC->getString(UserEntity->getGuildNameID(), ucsTmp);
@ -3648,7 +3648,7 @@ void CLuaIHMRyzom::tell(const ucstring &player, const ucstring &msg)
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
w->setKeyboardFocus(); w->setKeyboardFocus();
w->enableBlink(1); w->enableBlink(1);
w->setCommand(ucstring("tell ") + CEntityCL::removeTitleFromName(player) + ucstring(" "), false); w->setCommand(ucstring("tell ") + CEntityCL::removeTitleFromName(player.toUtf8()) + ucstring(" "), false);
CGroupEditBox *eb = w->getEditBox(); CGroupEditBox *eb = w->getEditBox();
if (eb != NULL) if (eb != NULL)

@ -1276,7 +1276,7 @@ void CPeopleInterraction::addContactInList(uint32 contactId, const ucstring &nam
CPeopleList &pl= nList==0?FriendList:IgnoreList; CPeopleList &pl= nList==0?FriendList:IgnoreList;
// remove the shard name if possible // remove the shard name if possible
ucstring name= CEntityCL::removeShardFromName(nameIn); ucstring name= CEntityCL::removeShardFromName(nameIn.toUtf8());
// add the contact to this list // add the contact to this list
sint index = pl.getIndexFromName(name); sint index = pl.getIndexFromName(name);
@ -1327,7 +1327,7 @@ bool CPeopleInterraction::isContactInList(const ucstring &nameIn, uint8 nList) c
// select correct people list // select correct people list
const CPeopleList &pl= nList==0?FriendList:IgnoreList; const CPeopleList &pl= nList==0?FriendList:IgnoreList;
// remove the shard name if possible // remove the shard name if possible
ucstring name= CEntityCL::removeShardFromName(nameIn); ucstring name= CEntityCL::removeShardFromName(nameIn.toUtf8());
return pl.getIndexFromName(name) != -1; return pl.getIndexFromName(name) != -1;
} }
@ -2250,7 +2250,7 @@ public:
if (peopleList) if (peopleList)
{ {
// don't add if it is the player name // don't add if it is the player name
if (!ClientCfg.Local && (UserEntity->getEntityName() == geb->getInputStringAsUtf16())) if (!ClientCfg.Local && (UserEntity->getEntityName() == geb->getInputString()))
{ {
displayVisibleSystemMsg(CI18N::get("uiCantAddYourSelfInContactList")); displayVisibleSystemMsg(CI18N::get("uiCantAddYourSelfInContactList"));
} }

@ -832,7 +832,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
} }
if (!senderName.empty()) if (!senderName.empty())
{ {
CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName), true, true); CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()), true, true);
if (senderEntity) if (senderEntity)
{ {
if (senderEntity->Type != CEntityCL::Player) if (senderEntity->Type != CEntityCL::Player)
@ -845,7 +845,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
} }
else else
{ {
CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName), false, true); CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName.toUtf8()), false, true);
if (destEntity) if (destEntity)
{ {
destEntity->removeStateFx(); destEntity->removeStateFx();
@ -866,7 +866,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// if tell, bkup sendername // if tell, bkup sendername
if (mode == CChatGroup::tell && windowVisible && !senderName.empty()) if (mode == CChatGroup::tell && windowVisible && !senderName.empty())
{ {
PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName); PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8());
} }
} }
@ -928,7 +928,7 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u
prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," ");
bool windowVisible; bool windowVisible;
ucstring goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName); ucstring goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8());
// The sender part is up to and including the first ":" after the goodSenderName // The sender part is up to and including the first ":" after the goodSenderName
ucstring::size_type pos = finalString.find(goodSenderName); ucstring::size_type pos = finalString.find(goodSenderName);

@ -1017,7 +1017,7 @@ void CDisplayerVisualEntity::updateName()
{ {
//BENCH(setEntityName) //BENCH(setEntityName)
_Entity->setEntityName(ucName); _Entity->setEntityName(ucName.toUtf8());
} }
{ {
//BENCH(buildInSceneInterface) //BENCH(buildInSceneInterface)

@ -734,7 +734,7 @@ restartLoop:
// If the shard name is the same as the player home shard name, remove it // If the shard name is the same as the player home shard name, remove it
uint len= (uint)PlayerSelectedHomeShardNameWithParenthesis.size(); uint len= (uint)PlayerSelectedHomeShardNameWithParenthesis.size();
uint start= (uint)str.size()-len; uint start= (uint)str.size()-len;
if(ucstrnicmp(str, start, len, PlayerSelectedHomeShardNameWithParenthesis)==0) if(ucstrnicmp(str, start, len, PlayerSelectedHomeShardNameWithParenthesis)==0) // TODO: NLMISC::compareCaseInsensitive
str.resize(start); str.resize(start);
} }
} }
@ -744,7 +744,7 @@ restartLoop:
ucstring::size_type pos = str.find('$'); ucstring::size_type pos = str.find('$');
if ( ! str.empty() && pos != ucstring::npos) if ( ! str.empty() && pos != ucstring::npos)
{ {
str = CEntityCL::removeTitleFromName(str); str = CEntityCL::removeTitleFromName(str.toUtf8());
} }
// append this string // append this string

Loading…
Cancel
Save