Merge branch 'develop' into ryzomclassic-develop

ryzomclassic-develop
kaetemi 4 years ago
commit ea6ba2ec97

@ -39,7 +39,7 @@ namespace NLGUI
public:
virtual ~IOnReceiveTextId() {}
// the deriver may change the input text
virtual void onReceiveTextId(ucstring &str) =0;
virtual void onReceiveTextId(std::string &str) =0;
};
// ***************************************************************************

@ -255,6 +255,17 @@ 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()); }
/** ASCII to lowercase. Useful for internal identifiers.
* Characters outside of the 7-bit ASCII space, and control characters, are replaced.
*/
std::string toLowerAscii(const std::string &str, char replacement);
void toLowerAscii(char *str, char replacement);
/** ASCII to uppercase. Useful for internal identifiers.
* Characters outside of the 7-bit ASCII space, and control characters, are replaced.
*/
std::string toUpperAscii(const std::string &str, char replacement);
void toUpperAscii(char *str, char replacement);
/**
* Convert to an hexadecimal std::string

@ -23,6 +23,8 @@
namespace NLMISC {
class IStream;
/// String view for UTF-8 and UTF-32 iteration as 32-bit codepoints.
/// This string view keeps the string as a reference, it does not make a copy.
/// Only use this for iterating a string's codepoints.
@ -141,6 +143,13 @@ public:
static void append(std::string &str, u32char c);
/// Encode or decode a single UTF-8 character in a stream (also useful for packing unsigned 20-bit integers)
static void append(IStream &s, u32char c);
static u32char get(IStream &s);
/// Get an UTF-8 string from an undefined ASCII-based codepage
static std::string fromAscii(std::string &str);
private:
typedef u32char (*TIterator)(const void **addr);
static u32char utf8Iterator(const void **addr);

@ -231,9 +231,7 @@ namespace NLGUI
// Modify the text?
if (_StringModifier)
{
ucstring tmp = ucstring::makeFromUtf8(result);
_StringModifier->onReceiveTextId(tmp); // FIXME: UTF-8
result = tmp.toUtf8();
_StringModifier->onReceiveTextId(result);
}
// Set the Text

@ -689,6 +689,56 @@ void toUpper(char *str)
}
}
std::string toLowerAscii(const std::string &str, char replacement)
{
std::string res;
res.reserve(str.size());
for (std::string::const_iterator it(str.begin()), end(str.end()); it != end; ++it)
{
char c = *it;
if ((sint8)(c + '\x01') < (sint8)(' ' + '\x01')) res += replacement;
else if (c >= 'A' && c <= 'Z') res += c + ('a' - 'A');
else res += c;
}
return res;
}
void toLowerAscii(char *str, char replacement)
{
for (ptrdiff_t i = 0; str[i]; ++i)
{
char c = str[i];
if ((sint8)(c + '\x01') < (sint8)(' ' + '\x01')) str[i] = replacement;
else if (c >= 'A' && c <= 'Z') str[i] = c + ('a' - 'A');
else str[i] = c;
}
}
std::string toUpperAscii(const std::string &str, char replacement)
{
std::string res;
res.reserve(str.size());
for (std::string::const_iterator it(str.begin()), end(str.end()); it != end; ++it)
{
char c = *it;
if ((sint8)(c + '\x01') < (sint8)(' ' + '\x01')) res += replacement;
else if (c >= 'a' && c <= 'z') res += c - ('a' - 'A');
else res += c;
}
return res;
}
void toUpperAscii(char *str, char replacement)
{
for (ptrdiff_t i = 0; str[i]; ++i)
{
char c = str[i];
if ((sint8)(c + '\x01') < (sint8)(' ' + '\x01')) str[i] = replacement;
else if (c >= 'a' && c <= 'z') str[i] = c - ('a' - 'A');
else str[i] = c;
}
}
std::string toHexa(const uint8 &b)
{
return toString("%02hhx", b);

@ -18,6 +18,7 @@
// Project includes
#include <nel/misc/utf_string_view.h>
#include <nel/misc/stream.h>
// References:
// - https://twiserandom.com/unicode/unicode-encoding-utf-8-utf-16-utf-32/
@ -69,6 +70,44 @@ void CUtfStringView::append(std::string &str, u32char c)
appendUtf8(str, c);
}
void CUtfStringView::append(IStream &s, u32char c)
{
nlassert(!s.isReading());
std::string tmp;
tmp.reserve(4);
append(tmp, c);
s.serialBuffer((uint8_t *)&tmp[0], tmp.size());
}
u32char CUtfStringView::get(IStream &s)
{
nlassert(s.isReading());
std::string tmp;
tmp.reserve(4);
uint8_t c;
s.serial(c);
// Single byte
if (c < 0x80)
return c;
// Do a fast check of length
tmp += (char)c;
size_t len;
if ((c & 0xF0) == 0xF0) len = 4;
if ((c & 0xE0) == 0xE0) len = 3;
else len = 2;
// Read from stream
tmp.resize(len);
s.serialBuffer((uint8_t *)&tmp[1], len - 1);
// Decode
const void *str = tmp.c_str();
return utf8Iterator(&str);
}
std::string CUtfStringView::toUtf8(bool reEncode) const
{
// Decode UTF and encode UTF-8
@ -135,6 +174,21 @@ std::string CUtfStringView::toAscii() const
return res;
}
std::string CUtfStringView::fromAscii(std::string &str)
{
std::string res;
res.reserve(str.size());
for (std::string::iterator it(str.begin()), end(str.end()); it != end; ++it)
{
unsigned char c = *it;
if (c < 0x80)
res += (char)c;
else
res += '?';
}
return res;
}
std::wstring CUtfStringView::toWide() const
{
#ifdef NL_OS_WINDOWS

@ -42,7 +42,7 @@ extern CEventsListener EventsListener;
// Hierarchical timer
H_AUTO_DECL ( RZ_Client_Actions_Context_Mngr_Update )
static bool getParam (CBaseAction::CParameter::TType type, ucstring &paramName, ucstring &paramValue, const std::string &argu, uint paramId);
static bool getParam (CBaseAction::CParameter::TType type, string &paramName, string &paramValue, const std::string &argu, uint paramId);
/////////////////////////////////////////////////////
/////////////////////////////////////////////////////
@ -243,8 +243,8 @@ bool CActionsManager::isActionPresentInContext(const CAction::CName &name) const
const CBaseAction::CParameter &parameter = baseAction->Parameters[i];
if (parameter.Type == CBaseAction::CParameter::Constant)
{
ucstring paramName;
ucstring paramValue = parameter.DefaultValue;
string paramName;
string paramValue = parameter.DefaultValue;
// Get the param from the argu
getParam (parameter.Type, paramName, paramValue, name.Argu, i);
@ -252,7 +252,7 @@ bool CActionsManager::isActionPresentInContext(const CAction::CName &name) const
bool found = true;
for (uint k = 0; k < parameter.Values.size(); ++k)
{
if (parameter.Values[k].Value == paramValue.toUtf8())
if (parameter.Values[k].Value == paramValue)
{
if (!ActionsContext.matchContext(parameter.Values[k].Contexts)) return false;
found = true;
@ -631,7 +631,7 @@ CBaseAction::CParameter::CParameter ()
// ***************************************************************************
static bool getParam (CBaseAction::CParameter::TType type, ucstring &paramName, ucstring &paramValue, const std::string &argu, uint paramId)
static bool getParam (CBaseAction::CParameter::TType type, string &paramName, string &paramValue, const std::string &argu, uint paramId)
{
const string separator = "|";
const string equal_separator = "=";
@ -672,10 +672,7 @@ static bool getParam (CBaseAction::CParameter::TType type, ucstring &paramName,
}
// Value ?
if(type==CBaseAction::CParameter::User || type==CBaseAction::CParameter::UserName)
paramValue.fromUtf8(argu.substr(pos, end-pos));
else
paramValue = argu.substr(pos, end-pos);
paramValue = argu.substr(pos, end-pos);
// Ok
return true;
@ -683,10 +680,10 @@ static bool getParam (CBaseAction::CParameter::TType type, ucstring &paramName,
return false;
}
ucstring CBaseAction::getActionLocalizedText (const CAction::CName &name) const
string CBaseAction::getActionLocalizedText(const CAction::CName &name) const
{
// Action base name
ucstring temp = CI18N::get(LocalizedName);
string temp = CI18N::get(LocalizedName);
// Get the parameter
uint i;
@ -694,8 +691,8 @@ ucstring CBaseAction::getActionLocalizedText (const CAction::CName &name) const
{
bool parameterOk = false;
const CParameter &parameter = Parameters[i];
ucstring paramName;
ucstring paramValue;
string paramName;
string paramValue;
// Get the param from the argu
if (getParam (parameter.Type, paramName, paramValue, name.Argu, i))
@ -703,7 +700,7 @@ ucstring CBaseAction::getActionLocalizedText (const CAction::CName &name) const
switch (parameter.Type)
{
case CParameter::Hidden:
if ((ucstring (parameter.DefaultValue) == paramValue) && (ucstring (parameter.Name) == paramName))
if ((parameter.DefaultValue == paramValue) && (parameter.Name == paramName))
parameterOk = true;
break;
case CParameter::Constant:
@ -713,7 +710,7 @@ ucstring CBaseAction::getActionLocalizedText (const CAction::CName &name) const
{
// This value ?
const CParameter::CValue &value = parameter.Values[j];
if (ucstring(value.Value) == paramValue)
if (value.Value == paramValue)
{
temp += " ";
@ -746,7 +743,7 @@ ucstring CBaseAction::getActionLocalizedText (const CAction::CName &name) const
if (i==Parameters.size ())
return temp;
return ucstring("");
return string();
}
// ***************************************************************************
@ -791,8 +788,8 @@ const CActionsManager::CCategoryLocator *CActionsManager::getActionLocator (cons
{
bool parameterOk = false;
const CBaseAction::CParameter &parameter = baseAction.Parameters[i];
ucstring paramName;
ucstring paramValue;
string paramName;
string paramValue;
// Get the param from the argu
if (getParam (parameter.Type, paramName, paramValue, name.Argu, i))
@ -800,7 +797,7 @@ const CActionsManager::CCategoryLocator *CActionsManager::getActionLocator (cons
switch (parameter.Type)
{
case CBaseAction::CParameter::Hidden:
if ((ucstring (parameter.DefaultValue) == paramValue) && (ucstring (parameter.Name) == paramName))
if ((parameter.DefaultValue == paramValue) && (parameter.Name == paramName))
parameterOk = true;
break;
case CBaseAction::CParameter::Constant:
@ -810,7 +807,7 @@ const CActionsManager::CCategoryLocator *CActionsManager::getActionLocator (cons
for (j=0; j<parameter.Values.size (); j++)
{
const CBaseAction::CParameter::CValue &value = parameter.Values[j];
if (ucstring(value.Value) == paramValue)
if (value.Value == paramValue)
{
parameterOk = true;
break;
@ -886,11 +883,11 @@ bool CActionsManager::isActionDisplayForced(const CAction::CName &name) const
}
// ***************************************************************************
ucstring CActionsManager::getActionLocalizedText (const CAction::CName &name) const
string CActionsManager::getActionLocalizedText (const CAction::CName &name) const
{
const CBaseAction *baseAction= getBaseAction(name);
if(!baseAction)
return ucstring();
return string();
return baseAction->getActionLocalizedText(name);
}

@ -248,7 +248,7 @@ public:
std::string Contexts;
/// Get an action localized text
ucstring getActionLocalizedText (const CAction::CName &name) const;
std::string getActionLocalizedText (const CAction::CName &name) const;
// see if there's at least one set of parameters for which this action is usable in current context
bool isUsableInCurrentContext() const;
@ -415,7 +415,7 @@ public:
const TActionsForceDisplaySet &getActionsForceDisplaySet() const {return _ActionForceDisplay;}
/// Get an action localized text
ucstring getActionLocalizedText (const CAction::CName &name) const;
std::string getActionLocalizedText (const CAction::CName &name) const;
//@}

@ -19,6 +19,9 @@
#include "stdpch.h"
#include "bg_downloader_access.h"
#ifdef RYZOM_BG_DOWNLOADER
#include "global.h"
#include "login_patch.h"
//
@ -84,7 +87,7 @@ CBGDownloaderAccess::CBGDownloaderAccess()
//=====================================================
void CBGDownloaderAccess::clearCurrentMessage()
{
_CurrentMessage = ucstring();
_CurrentMessage = ucstring(); // OLD
_CurrentFilesToGet = 0;
_TotalFilesToGet = 0;
_PatchingSize = 0;
@ -194,7 +197,7 @@ void CBGDownloaderAccess::startTask(const BGDownloader::CTaskDesc &taskDesc, con
}
//=====================================================
bool CBGDownloaderAccess::isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const
bool CBGDownloaderAccess::isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const // OLD
{
if (_State == State_Finished)
{
@ -354,7 +357,7 @@ void CBGDownloaderAccess::CDownloadCoTask::run()
{
shutdownDownloader();
Parent->_TaskResult = TaskResult_Error;
Parent->_ErrorMsg = ucstring(e.what());
Parent->_ErrorMsg = ucstring(e.what()); // OLD
Parent->_DownloadThreadPriority = ThreadPriority_DownloaderError;
}
catch(const NLMISC::EStream &e)
@ -362,7 +365,7 @@ void CBGDownloaderAccess::CDownloadCoTask::run()
shutdownDownloader();
Parent->_TaskResult = TaskResult_Error;
nlwarning("BG DOWNLOADER PROTOCOL ERROR ! Stream error");
Parent->_ErrorMsg = CI18N::get("uiBGD_ProtocolError") + ucstring(" : ") + ucstring(e.what());
Parent->_ErrorMsg = CI18N::get("uiBGD_ProtocolError") + ucstring(" : ") + ucstring(e.what()); // OLD
Parent->_DownloadThreadPriority = ThreadPriority_DownloaderError;
}
catch (const EWaitMessageTimeoutException &e)
@ -370,7 +373,7 @@ void CBGDownloaderAccess::CDownloadCoTask::run()
shutdownDownloader();
Parent->_TaskResult = TaskResult_Error;
nlwarning("BG DOWNLOADER PROTOCOL ERROR ! Message timeout");
Parent->_ErrorMsg = CI18N::get("uiBGD_ProtocolError") + ucstring(" : ") + ucstring(e.what());
Parent->_ErrorMsg = CI18N::get("uiBGD_ProtocolError") + ucstring(" : ") + ucstring(e.what()); // OLD
Parent->_DownloadThreadPriority = ThreadPriority_DownloaderError;
}
Parent->_State = State_Finished;
@ -614,7 +617,7 @@ TDownloaderMode CBGDownloaderAccess::CDownloadCoTask::getDownloaderMode()
void CBGDownloaderAccess::CDownloadCoTask::getTaskResult(TTaskResult &result,
uint32 &availablePatchs,
bool &mustLaunchBatFile,
ucstring &errorMsg
ucstring &errorMsg // OLD
)
{
sendSimpleMsg(CL_GetTaskResult);
@ -623,7 +626,7 @@ void CBGDownloaderAccess::CDownloadCoTask::getTaskResult(TTaskResult &result,
inMsg.serialEnum(result);
inMsg.serial(availablePatchs);
inMsg.serial(mustLaunchBatFile);
inMsg.serial(errorMsg);
inMsg.serial(errorMsg); // OLD
}
//=====================================================
@ -687,7 +690,7 @@ void CBGDownloaderAccess::CDownloadCoTask::shutdownDownloader()
}
}
CWinProcess::terminateProcessFromModuleName(BGDownloaderName); // for safety
Parent->_CurrentMessage = ucstring();
Parent->_CurrentMessage = ucstring(); // OLD
}
//=====================================================
@ -795,7 +798,7 @@ bool CBGDownloaderAccess::CDownloadCoTask::defaultMessageHandling(BGDownloader::
case BGD_Error:
{
Parent->_TaskResult = TaskResult_Error;
ucstring errorMsg;
ucstring errorMsg; // OLD
msg.serial(errorMsg);
throw EDownloadException(errorMsg.toUtf8());
}
@ -885,7 +888,7 @@ void CBGDownloaderAccess::startTask(const BGDownloader::CTaskDesc &taskDesc, con
}
//=====================================================
bool CBGDownloaderAccess::isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const
bool CBGDownloaderAccess::isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const // OLD
{
// TODO for Linux
return false;
@ -956,3 +959,5 @@ void unpauseBGDownloader()
DownloaderPaused = false;
}
}
#endif

@ -14,11 +14,12 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef RYZOM_BG_DOWNLOADER
#ifndef CL_BG_DOWNLOADER_ACCESS
#define CL_BG_DOWNLOADER_ACCESS
#include "nel/misc/singleton.h"
#include "nel/misc/ucstring.h"
#include "nel/misc/ucstring.h" // OLD
#include "nel/misc/inter_window_msg_queue.h"
#include "nel/misc/co_task.h"
//
@ -36,7 +37,7 @@ public:
void release();
// jobs
void startTask(const BGDownloader::CTaskDesc &taskDesc, const std::string &commandLine, bool showDownloader);
bool isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const;
bool isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const; // OLD
// The following flag will be true after a 'patch' task has been completed successfully
bool getPatchCompletionFlag(bool clearFlag);
//
@ -50,7 +51,7 @@ public:
//
void update(); // call this at each frame to update the download process
// Get last displayed message by the background downloader
const ucstring &getCurrentMessage() const { return _CurrentMessage; }
const ucstring &getCurrentMessage() const { return _CurrentMessage; } // OLD
uint32 getCurrentFilesToGet() const { return _CurrentFilesToGet; }
uint32 getTotalFilesToGet() const { return _TotalFilesToGet; }
//
@ -66,17 +67,17 @@ public:
bool isDownloaderUIFrozen() const { return _FrozenUI; }
void requestDownloadThreadPriority(BGDownloader::TThreadPriority newPriority, bool freezeUI);
const ucstring &getLastErrorMessage() const { return _ErrorMsg; }
const ucstring &getLastErrorMessage() const { return _ErrorMsg; } // OLD
private:
enum TState { State_Idle, State_Patching, State_Finished };
TState _State;
ucstring _CurrentMessage;
ucstring _CurrentMessage; // OLD
#ifdef NL_OS_WINDOWS
NLMISC::CInterWindowMsgQueue _DownloaderMsgQueue;
#endif
ucstring _ErrorMsg;
ucstring _ErrorMsg; // OLD
std::string _CommandLine;
BGDownloader::TTaskResult _TaskResult;
uint32 _AvailablePatchs;
@ -122,7 +123,7 @@ private:
void getTaskResult(BGDownloader::TTaskResult &result,
uint32 &availablePatchs,
bool &mustLaunchBatFile,
ucstring &errorMsg
ucstring &errorMsg // OLD
);
void getDescFile();
BGDownloader::TDownloaderMode getDownloaderMode();
@ -146,3 +147,4 @@ void unpauseBGDownloader();
#endif
#endif

@ -14,6 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// FIXME: Lost code
#if 0
#ifndef CL_CANDIDATE_H
@ -33,7 +34,7 @@ struct Candidate
NLMISC::CEntityId id;
std::string name;
std::string surname;
std::list<ucstring> program;
std::list<std::string> program;
uint32 nbVotes;
};

@ -2030,7 +2030,7 @@ void CClientConfig::init(const string &configFileName)
}
// read the exising config file (don't parse it yet!)
ucstring content;
ucstring content; // UTF-16 and UTF-8 textfile support
NLMISC::CI18N::readTextFile(configFileName, content);
std::string contentUtf8 = content.toUtf8();

@ -65,7 +65,7 @@ extern CEntityManager EntitiesMngr;
//#ifdef OLD_STRING_SYSTEM
//
//bool CNetworkString::getString (ucstring &result, CClientChatManager *mng)
//bool CNetworkString::getString (ucstring &result, CClientChatManager *mng) // OLD
//{
// result = StaticString + " / ";
// for (uint i = 0; i < Args.size(); i++)
@ -86,7 +86,7 @@ extern CEntityManager EntitiesMngr;
// return mng->getString (result, Args, StaticString);
//}
//
//void CNetworkString::setString (const ucstring &staticStringId, CClientChatManager *mng)
//void CNetworkString::setString (const ucstring &staticStringId, CClientChatManager *mng) // OLD
//{
// CBitMemStream bms;
// mng->getStaticDB().getInfos(staticStringId, StaticString, bms);
@ -96,11 +96,11 @@ extern CEntityManager EntitiesMngr;
//// add
////
////-----------------------------------------------
//uint32 CChatDynamicDatabase::add( uint32 index, ucstring& ucstr, vector<bool>& code )
//uint32 CChatDynamicDatabase::add( uint32 index, ucstring& ucstr, vector<bool>& code ) // OLD
//{
// nlinfo ("receive dynamic string association '%d' '%s'", index, ucstr.toString().c_str());
//
// map<ucstring, uint32>::iterator itIdx = _StringToIndex.find( ucstr );
// map<ucstring, uint32>::iterator itIdx = _StringToIndex.find( ucstr ); // OLD
// if( itIdx == _StringToIndex.end() )
// {
// map<uint32,CDynamicStringInfos *>::iterator itStr = _Data.find( index );
@ -162,7 +162,7 @@ extern CEntityManager EntitiesMngr;
//// decodeString
////
////-----------------------------------------------
//void CChatDynamicDatabase::decodeString( ucstring& str, CBitMemStream& bms )
//void CChatDynamicDatabase::decodeString( ucstring& str, CBitMemStream& bms ) // OLD
//{
// _Huffman.getId( str, bms );
//

@ -54,7 +54,7 @@ class CCDBNodeLeaf;
struct CDynamicStringInfos
{
/// string
ucstring Str;
ucstring Str; // OLD
/// index in the infos buffer, same as the index in the client dynamic string known buffer
uint32 Index;
@ -89,12 +89,12 @@ public :
/// \param str the string
/// \param huffCode the Huffman code(may be empty)
/// \return the index of the string
uint32 add( uint32 index, ucstring& str, std::vector<bool>& huffCode );
uint32 add( uint32 index, ucstring& str, std::vector<bool>& huffCode ); // OLD
/// Get the string from its Huffman code
/// \param str will be filled with the string
/// \param bms contains the Huffman code
void decodeString( ucstring& str, NLMISC::CBitMemStream& bms );
void decodeString( ucstring& str, NLMISC::CBitMemStream& bms ); // OLD
/// Get infos on the dynamic string
CDynamicStringInfos * getDynamicStringInfos( uint32 index );
@ -111,7 +111,7 @@ private :
std::map< uint32, CDynamicStringInfos *> _Data;
/// Map to find index from the string (only for uncoded strings)
std::map< ucstring, uint32> _StringToIndex;
std::map< ucstring, uint32> _StringToIndex; // OLD
};
#endif
@ -372,13 +372,13 @@ private :
#ifdef OLD_STRING_SYSTEM
class CNetworkString
{
ucstring StaticString;
ucstring StaticString; // OLD
public:
std::vector<uint64> Args;
bool getString (ucstring &result, CClientChatManager *mng);
bool getString (ucstring &result, CClientChatManager *mng); // OLD
void setString (const ucstring &staticStringId, CClientChatManager *mng);
void setString (const ucstring &staticStringId, CClientChatManager *mng); // OLD
};
#endif

@ -241,7 +241,7 @@ NLMISC_COMMAND(equipGroup, "equip group <name>", "name")
if(CItemGroupManager::getInstance()->equipGroup(args[0]))
{
string msg = CI18N::get("cmdEquipGroupSuccess");
//Use ucstring because group name can contain accentued characters (and stuff like that)
//Use utf-8 string because group name can contain accentued characters (and stuff like that)
string nameUC = args[0];
strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg);
@ -250,7 +250,7 @@ NLMISC_COMMAND(equipGroup, "equip group <name>", "name")
else
{
string msg = CI18N::get("cmdEquipGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that)
//Use utf-8 string because group name can contain accentued characters (and stuff like that)
string nameUC = args[0];
strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg);
@ -273,7 +273,7 @@ NLMISC_COMMAND(moveGroup, "move group <name> to <dst>", "name dst")
if(CItemGroupManager::getInstance()->moveGroup(args[0], INVENTORIES::toInventory(args[1])))
{
string msg = CI18N::get("cmdMoveGroupSuccess");
//Use ucstring because group name can contain accentued characters (and stuff like that)
//Use utf-8 string because group name can contain accentued characters (and stuff like that)
string nameUC = args[0];
strFindReplace(msg, "%name", nameUC);
strFindReplace(msg, "%inventory", args[1]);
@ -283,7 +283,7 @@ NLMISC_COMMAND(moveGroup, "move group <name> to <dst>", "name dst")
else
{
string msg = CI18N::get("cmdMoveGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that)
//Use utf-8 string because group name can contain accentued characters (and stuff like that)
string nameUC = args[0];
strFindReplace(msg, "%name", nameUC);
strFindReplace(msg, "%inventory", args[1]);
@ -313,7 +313,7 @@ NLMISC_COMMAND(createGroup, "create group <name> [true](create a <remove> for ev
msg = CI18N::get("cmdCreateGroupSuccess2");
else
msg = CI18N::get("cmdCreateGroupSuccess1");
//Use ucstring because group name can contain accentued characters (and stuff like that)
//Use utf-8 string because group name can contain accentued characters (and stuff like that)
string nameUC = args[0];
strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg);
@ -322,7 +322,7 @@ NLMISC_COMMAND(createGroup, "create group <name> [true](create a <remove> for ev
else
{
string msg = CI18N::get("cmdCreateGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that)
//Use utf-8 string because group name can contain accentued characters (and stuff like that)
string nameUC = args[0];
strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg);
@ -345,7 +345,7 @@ NLMISC_COMMAND(deleteGroup, "delete group <name>", "name")
if(CItemGroupManager::getInstance()->deleteGroup(args[0]))
{
string msg = CI18N::get("cmdDeleteGroupSuccess");
//Use ucstring because group name can contain accentued characters (and stuff like that)
//Use utf-8 string because group name can contain accentued characters (and stuff like that)
string nameUC = args[0];
strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg);
@ -354,7 +354,7 @@ NLMISC_COMMAND(deleteGroup, "delete group <name>", "name")
else
{
string msg = CI18N::get("cmdDeleteGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that)
//Use utf-8 string because group name can contain accentued characters (and stuff like that)
string nameUC = args[0];
strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg);
@ -1672,10 +1672,10 @@ NLMISC_COMMAND(missionProgress, "debug"," ")
NLMISC_COMMAND( displayDBModifs, "display server database modification in the chat window"," ")
{
if ( VerboseDatabase )
CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("the database is already in verbose mode"),CRGBA(255,255,255,255));
CInterfaceManager::getInstance()->getChatOutput()->addTextChild("the database is already in verbose mode",CRGBA(255,255,255,255));
else
{
CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("database is now in verbose mode"),CRGBA(255,255,255,255));
CInterfaceManager::getInstance()->getChatOutput()->addTextChild("database is now in verbose mode",CRGBA(255,255,255,255));
VerboseDatabase = true;
}
return true;
@ -1684,10 +1684,10 @@ NLMISC_COMMAND( displayDBModifs, "display server database modification in the ch
NLMISC_COMMAND( hideDBModifs, "stop displaying server database modification in the chat window"," ")
{
if ( !VerboseDatabase )
CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("the database is already not in verbose mode"),CRGBA(255,255,255,255));
CInterfaceManager::getInstance()->getChatOutput()->addTextChild("the database is already not in verbose mode",CRGBA(255,255,255,255));
else
{
CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("database is not in verbose mode anymore"),CRGBA(255,255,255,255));
CInterfaceManager::getInstance()->getChatOutput()->addTextChild("database is not in verbose mode anymore",CRGBA(255,255,255,255));
VerboseDatabase = false;
}
return true;
@ -2297,7 +2297,7 @@ NLMISC_COMMAND(record, "Start Recording", "<name>")
// Warning when already recording.
if(NetMngr.isRecording())
{
IM->displaySystemInfo(ucstring("Already Recording. Stop the current Record first"));
IM->displaySystemInfo("Already Recording. Stop the current Record first");
return true;
}
@ -2641,12 +2641,12 @@ NLMISC_COMMAND(magic, "Cast a spell", "\n"
if(args.size() != 6)
{
// Help
// CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 or 3 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 or 3 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))));
// 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)));
// CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END));
}
else
{
@ -2695,7 +2695,7 @@ NLMISC_COMMAND(magic, "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.
@ -2714,12 +2714,12 @@ NLMISC_COMMAND(spell, "Cast a spell", "\n"
if(args.size() != 6)
{
// Help
// CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 or 3 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 or 3 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))));
// 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)));
// CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END));
}
else
{
@ -5314,8 +5314,8 @@ void CUserCommand::release()
// ***************************************************************************
CUserCommand::CUserCommand(const string &commandName, const ucstring &help, const ucstring &argsHelp)
: ICommand("user", commandName.c_str(), toString(help).c_str(), toString(argsHelp).c_str())
CUserCommand::CUserCommand(const string &commandName, const string &help, const string &argsHelp)
: ICommand("user", commandName.c_str(), help.c_str(), argsHelp.c_str())
{
CommandName = commandName;
}
@ -5369,7 +5369,7 @@ bool CUserCommand::execute(const std::string &/* rawCommandString */, const std:
else
{
if (keywords[i] == "$")
finalArgs += /*ucstring(*/args[index++]/*).toUtf8()*/;
finalArgs += args[index++];
else
{
while (index<args.size())
@ -5447,13 +5447,13 @@ void CUserCommand::createCommand (const char *name, const char *action, const ch
}
// Find action name
ucstring help;
string help;
const CBaseAction *ab = Actions.getBaseAction (::CAction::CName (action, ptrParams));
if (ab)
help = CI18N::get(ab->LocalizedName);
// Build a argument help
ucstring argsHelp;
string argsHelp;
if (ab)
{
@ -5477,7 +5477,7 @@ void CUserCommand::createCommand (const char *name, const char *action, const ch
// Add the string
if (!argsHelp.empty())
argsHelp += " ";
argsHelp += ucstring("<") + CI18N::get(ab->Parameters[j].LocalizedName) + ucstring(">");
argsHelp += "<" + CI18N::get(ab->Parameters[j].LocalizedName) + ">";
bFound = true;
}
}

@ -43,7 +43,7 @@ public:
std::vector<std::string> Keywords;
};
CUserCommand (const std::string &commandName, const ucstring &help, const ucstring &argsHelp);
CUserCommand (const std::string &commandName, const std::string &help, const std::string &argsHelp);
void addMode (const std::string &action, uint numArg, bool infiniteAgr, const std::vector<std::string> &keywords);

@ -149,8 +149,8 @@ std::string PlayerSelectedHomeShardName;
std::string PlayerSelectedHomeShardNameWithParenthesis;
extern std::string CurrentCookie;
ucstring NewKeysCharNameWanted; // name of the character for which a new keyset must be created
ucstring NewKeysCharNameValidated;
std::string NewKeysCharNameWanted; // name of the character for which a new keyset must be created
std::string NewKeysCharNameValidated;
std::string GameKeySet = "keys.xml";
std::string RingEditorKeySet = "keys_r2ed.xml";
@ -519,7 +519,9 @@ bool connection (const string &cookie, const string &fsaddr)
if (InterfaceState == GOGOGO_IN_THE_GAME)
{
// set background downloader to 'paused' to ease loading of client
#ifdef RYZOM_BG_DOWNLOADER
pauseBGDownloader();
#endif
return true;
}
@ -657,7 +659,9 @@ bool reconnection()
if (InterfaceState == GOGOGO_IN_THE_GAME)
{
#ifdef RYZOM_BG_DOWNLOADER
pauseBGDownloader();
#endif
return true;
}
if (InterfaceState == QUIT_THE_GAME)
@ -777,12 +781,12 @@ void globalMenuMovieShooter()
// ------------------------------------------------------------------------------------------------
// Build a valid PlayerName for file Save selection.
std::string buildPlayerNameForSaveFile(const ucstring &playerNameIn)
std::string buildPlayerNameForSaveFile(const std::string &playerNameIn)
{
// remove any shard name appended
ucstring playerName = playerNameIn;
ucstring::size_type pos = playerNameIn.find('(');
if(pos!=ucstring::npos && pos>0)
string playerName = playerNameIn;
string::size_type pos = playerNameIn.find('(');
if(pos!=string::npos && pos>0)
{
playerName.resize(pos);
}
@ -798,7 +802,7 @@ std::string buildPlayerNameForSaveFile(const ucstring &playerNameIn)
(c>='0' && c<='9') ||
(c=='_') )
{
ret[i]= tolower(c);
ret[i]= tolower(c); // TODO: toLowerAscii
}
else
ret[i]= '_';
@ -807,9 +811,9 @@ std::string buildPlayerNameForSaveFile(const ucstring &playerNameIn)
}
#ifdef RYZOM_BG_DOWNLOADER
static bool LuaBGDSuccessFlag = true; // tmp, for debug
void updateBGDownloaderUI()
{
CInterfaceManager *im = CInterfaceManager::getInstance();
@ -907,11 +911,12 @@ void updateBGDownloaderUI()
nlwarning("Some scipt error occurred");
}
}
#endif
// compute patcher priority, depending on the presence of one or more mainland characters : in this case, give the patch a boost
void updatePatcherPriorityBasedOnCharacters()
{
#ifdef RYZOM_BG_DOWNLOADER
if (isBGDownloadEnabled())
{
if (CBGDownloaderAccess::getInstance().getDownloadThreadPriority() != BGDownloader::ThreadPriority_Paused)
@ -930,6 +935,7 @@ void updatePatcherPriorityBasedOnCharacters()
CBGDownloaderAccess::getInstance().requestDownloadThreadPriority(hasMainlandChar ? BGDownloader::ThreadPriority_Normal : BGDownloader::ThreadPriority_Low, false);
}
}
#endif
}
// Launch the interface to choose a character
@ -938,6 +944,7 @@ TInterfaceState globalMenu()
{
CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_CharacterSelection, "login_step_character_selection"));
#ifdef RYZOM_BG_DOWNLOADER
CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance();
if (isBGDownloadEnabled())
@ -948,14 +955,14 @@ TInterfaceState globalMenu()
// if a task is already started, then this was a situation where player went back from game to the character selection,
// so just unpause
BGDownloader::TTaskResult dummyResult;
ucstring dummyMessage;
ucstring dummyMessage; // OLD
if (!bgDownloader.isTaskEnded(dummyResult, dummyMessage))
{
unpauseBGDownloader();
}
}
}
#endif
CInterfaceManager *pIM = CInterfaceManager::getInstance();
@ -1001,8 +1008,9 @@ TInterfaceState globalMenu()
}
#endif
#ifdef RYZOM_BG_DOWNLOADER
updateBGDownloaderUI();
#endif
// Update network.
try
@ -1085,7 +1093,7 @@ TInterfaceState globalMenu()
{
if (noUserChar || userChar)
{
#ifdef RYZOM_BG_DOWNLOADER
if (isBGDownloadEnabled())
{
// If there's a need for mainland download, then proceed
@ -1094,7 +1102,7 @@ TInterfaceState globalMenu()
// if a task is already started, then this was a situation where player went back from game to the character selection,
// so just unpause
BGDownloader::TTaskResult dummyResult;
ucstring dummyMessage;
ucstring dummyMessage; // OLD
if (bgDownloader.isTaskEnded(dummyResult, dummyMessage))
{
// launch mainland patch as a background task
@ -1109,6 +1117,7 @@ TInterfaceState globalMenu()
}
}
}
#endif
//nlinfo("impulseCallBack : received userChars list");
noUserChar = userChar = false;
@ -1258,8 +1267,8 @@ TInterfaceState globalMenu()
LoginSM.pushEvent(CLoginStateMachine::ev_global_menu_exited);
// Init the current Player Name (for interface.cfg and sentence.name save). Make a good File Name.
ucstring &playerName= CharacterSummaries[PlayerSelectedSlot].Name;
PlayerSelectedFileName= buildPlayerNameForSaveFile(playerName);
string playerName = CharacterSummaries[PlayerSelectedSlot].Name.toUtf8();
PlayerSelectedFileName = buildPlayerNameForSaveFile(playerName);
// Init the current Player Home shard Id and name
CharacterHomeSessionId = CharacterSummaries[PlayerSelectedSlot].Mainland;
@ -1335,7 +1344,7 @@ public:
REGISTER_ACTION_HANDLER (CAHNetInitCharSel, "net_init_char_sel");
// ------------------------------------------------------------------------------------------------
void setTarget(CCtrlBase *ctrl, const string &targetName, ucstring &value)
void setTarget(CCtrlBase *ctrl, const string &targetName, std::string &value)
{
std::vector<CInterfaceLink::CTargetInfo> targets;
// find first enclosing group
@ -1350,7 +1359,7 @@ void setTarget(CCtrlBase *ctrl, const string &targetName, ucstring &value)
if (ig)
{
CInterfaceExprValue exprValue;
exprValue.setString(value.toUtf8());
exprValue.setString(value);
CInterfaceLink::splitLinkTargets(targetName, ig, targets);
for(uint k = 0; k < targets.size(); ++k)
@ -1408,12 +1417,12 @@ public:
if (CharacterSummaries[PlayerSelectedSlot].Name.empty())
return;
ucstring sValue("");
string sValue;
uint32 nValue = 0;
if (sProp == "name")
{
sValue = CharacterSummaries[PlayerSelectedSlot].Name;
sValue = CharacterSummaries[PlayerSelectedSlot].Name.toUtf8();
setTarget (pCaller, sTarget, sValue);
}
/* else if (sProp == "surname")
@ -1438,10 +1447,10 @@ Deprecated {
sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(titleStr, womanTitle);
{
// Sometimes translation contains another title
ucstring::size_type pos = sValue.find('$');
if (pos != ucstring::npos)
string::size_type pos = sValue.find('$');
if (pos != string::npos)
{
sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sValue.toUtf8()), womanTitle);
sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sValue), womanTitle);
}
}
setTarget (pCaller, sTarget, sValue);
@ -1682,11 +1691,11 @@ public:
// Setup the name
string sEditBoxPath = getParam (Params, "name");
ucstring sFirstName = ucstring("NotSet");
ucstring sSurName = ucstring("NotSet");
string sFirstName = "NotSet";
string sSurName = "NotSet";
CGroupEditBox *pGEB = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(sEditBoxPath));
if (pGEB != NULL)
sFirstName = pGEB->getInputStringAsUtf16();
sFirstName = pGEB->getInputString();
else
nlwarning ("can't get edit box name : %s",sEditBoxPath.c_str());
@ -1801,8 +1810,8 @@ public:
out.serial (nSelectedSlot);
// Yoyo: delete the Local files. To avoid problem if recreate a character with same name.
ucstring &playerName= CharacterSummaries[nSelectedSlot].Name;
string playerDeletedFileName= buildPlayerNameForSaveFile(playerName);
string playerName = CharacterSummaries[nSelectedSlot].Name.toUtf8();
string playerDeletedFileName = buildPlayerNameForSaveFile(playerName);
// Delete the 2 Local files
pIM->deletePlayerConfig(playerDeletedFileName);
pIM->deletePlayerKeys(playerDeletedFileName);
@ -1853,7 +1862,7 @@ string getTarget(CCtrlBase * /* ctrl */, const string &targetName)
}
// ------------------------------------------------------------------------------------------------
ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName)
ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName) // TODO: UTF-8 Lua
{
string sTmp = targetName;
std::vector<CInterfaceLink::CTargetInfo> targetsVector;
@ -1865,13 +1874,13 @@ ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName)
if (!elem)
{
nlwarning("<CInterfaceExpr::getprop> : Element is NULL");
return ucstring("");
return ucstring(""); // TODO: UTF-8 Lua
}
const CReflectedProperty *pRP = elem->getReflectedProperty(rTI.PropertyName);
if (pRP->Type == CReflectedProperty::UCString)
return ((elem->*(pRP->GetMethod.GetUCString))());
return ucstring("");
return ucstring(""); // TODO: UTF-8 Lua
}
/*// Ask the server to rename a character
@ -1944,7 +1953,7 @@ public:
string sDBLink = getParam(Params, "dblink");
CharNameValidDBLink = sDBLink;
ucstring sName = getUCTarget(NULL,sTarget);
string sName = getUCTarget(NULL,sTarget).toUtf8(); // TODO: UTF-8 Lua
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (sName.empty())
@ -1986,13 +1995,13 @@ public:
if (Mainlands[k].Id == MainlandSelected)
{
// extract name from mainland
/*ucstring::size_type first = Mainlands[k].Name.find('(');
ucstring::size_type last = Mainlands[k].Name.find(')');
if (first != ucstring::npos && last != ucstring::npos && first < last)
/*ucstring::size_type first = Mainlands[k].Name.find('('); // OLD
ucstring::size_type last = Mainlands[k].Name.find(')');// OLD
if (first != ucstring::npos && last != ucstring::npos && first < last)// OLD
{
NewKeysCharNameWanted += Mainlands[k].Name.substr(first, last - first + 1);
}*/
NewKeysCharNameWanted += ('(' + Mainlands[k].Name + ')');
NewKeysCharNameWanted += ('(' + Mainlands[k].Name.toUtf8() + ')');
break;
}
}
@ -2015,7 +2024,7 @@ public:
for (uint i = 0; i < CharacterSummaries.size(); ++i)
{
ucstring ls = CharacterSummaries[i].Name.toString();
string ls = CharacterSummaries[i].Name.toString();
if (ls == sName)
CharNameValid = false;
}
@ -2302,7 +2311,7 @@ public:
}
// add a new keyset in the list
void addKeySet(const std::string &filename, const ucstring &name, const ucstring tooltip)
void addKeySet(const std::string &filename, const std::string &name, const std::string tooltip)
{
nlassert(List);
CInterfaceGroup *pNewLine = buildTemplate("t_keyset", toString(filename));
@ -2311,13 +2320,13 @@ public:
CViewText *pVT = dynamic_cast<CViewText*>(pNewLine->getView("name"));
if (pVT != NULL)
{
pVT->setTextLocalized(name.toUtf8(), false);
pVT->setTextLocalized(name, false);
}
CCtrlBase *pBut = pNewLine->getCtrl("but");
if (pBut != NULL)
{
pBut->setDefaultContextHelp(tooltip.toUtf8());
pBut->setDefaultContextHelp(tooltip);
}
addGroupInList(pNewLine);
}
@ -2353,12 +2362,12 @@ public:
std::string strId = "uiCP_KeysetName_" + keySetVar->asString(k);
strFindReplace(strId, ".", "_");
ucstring keySetName = CI18N::get(strId);
const string &keySetName = CI18N::get(strId);
strId = "uiCP_KeysetTooltip_" + keySetVar->asString(k);
strFindReplace(strId, ".", "_");
if (CI18N::hasTranslation(strId))
{
ucstring keySetTooltip = CI18N::get(strId);
const string &keySetTooltip = CI18N::get(strId);
addKeySet(keySetVar->asString(k), keySetName, keySetTooltip);
}
}
@ -2367,8 +2376,8 @@ public:
{
nlwarning("'%s' var not found in config file, or list is empty, proposing default keyset only", KeySetVarName);
std::string defaultKeySet = "keys";
ucstring keySetName = CI18N::get("uiCP_KeysetName_" + defaultKeySet);
ucstring keySetTooltip = CI18N::get("uiCP_KeysetTooltip_" + defaultKeySet);
const string &keySetName = CI18N::get("uiCP_KeysetName_" + defaultKeySet);
const string &keySetTooltip = CI18N::get("uiCP_KeysetTooltip_" + defaultKeySet);
addKeySet(defaultKeySet, keySetName, keySetTooltip);
}
@ -2394,19 +2403,19 @@ public:
{
for(TKeySetFileMap::iterator it = keySetFiles.begin(); it != keySetFiles.end(); ++it)
{
ucstring name;
string name;
if (ClientCfg.Local)
{
name = ucstring(it->first);
name = it->first;
}
else
{
// search matching ucstring name from character summaries
// search matching utf-8 string name from character summaries
for (uint k = 0; k < CharacterSummaries.size(); ++k)
{
if (it->first == buildPlayerNameForSaveFile(CharacterSummaries[k].Name))
if (it->first == buildPlayerNameForSaveFile(CharacterSummaries[k].Name.toUtf8()))
{
name = CharacterSummaries[k].Name;
name = CharacterSummaries[k].Name.toUtf8();
}
}
}
@ -2417,7 +2426,7 @@ public:
addSeparator();
separatorAdded = true;
}
addKeySet(it->first, ucstring(it->first), CI18N::get(std::string("uiCP_KeysetImport") + (it->second & GameKeys ? "_Game" : "")
addKeySet(it->first, it->first, CI18N::get(std::string("uiCP_KeysetImport") + (it->second & GameKeys ? "_Game" : "")
+ (it->second & EditorKeys ? "_Editor" : "")));
}
}
@ -2552,26 +2561,24 @@ REGISTER_ACTION_HANDLER (CAHResetKeysetSelect, "keyset_select");
// *************************** SCENARIO CONTROL WINDOW ***********************
// ***************************************************************************
// helper function for "setScenarioInformation"
static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName, const ucstring &text)
static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName, const std::string &text)
{
CInterfaceElement *result = scenarioWnd->findFromShortId(uiName);
if(result)
{
CViewText* viewText = dynamic_cast<CViewText*>(result);
if(viewText)
viewText->setTextLocalized(text.toUtf8(), false);
viewText->setTextLocalized(text, false);
CGroupEditBox* editBox = dynamic_cast<CGroupEditBox*>(result);
if(editBox)
editBox->setInputStringAsUtf16(text);
editBox->setInputString(text);
}
}
// helper function for "setScenarioInformation"
static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName, const std::string &utf8Text)
static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName, const ucstring &text) // TODO: UTF-8 Lua
{
ucstring ucText;
ucText.fromUtf8(utf8Text);
setTextField(scenarioWnd, uiName, ucText);
setTextField(scenarioWnd, uiName, text.toUtf8());
}
// helper function for "setScenarioInformation"
static std::string fieldLookup(const vector< pair< string, string > > &values, const std::string &id)
@ -3453,7 +3460,7 @@ class CAHInitImportCharacter : public IActionHandler
CPath::getPathContent("save/", false, false, true, savedCharacters);
CInterfaceGroup *newLine;
CInterfaceGroup *prevLine;
CInterfaceGroup *prevLine = NULL;
for (uint i = 0; i < savedCharacters.size(); ++i)
{
@ -3476,7 +3483,7 @@ class CAHInitImportCharacter : public IActionHandler
{
CViewText *text = dynamic_cast<CViewText*>(newLine->getView("name"));
if (text)
text->setText(ucstring(savedCharacters[i]));
text->setText(string(savedCharacters[i]));
// first button is pushed
CCtrlButton *button = dynamic_cast<CCtrlButton*>(newLine->getCtrl("but"));
@ -3642,7 +3649,7 @@ class CAHExportCharacter : public IActionHandler
return;
// extract name
const std::string name = buildPlayerNameForSaveFile(CS.Name.toString());
const std::string name = buildPlayerNameForSaveFile(CS.Name.toUtf8());
COFile fd;
bool success = false;

@ -36,8 +36,8 @@ extern std::vector<CCharacterSummary> CharacterSummaries;
extern std::string UserPrivileges;
extern sint LoginCharsel;
extern ucstring NewKeysCharNameWanted;
extern ucstring NewKeysCharNameValidated;
extern std::string NewKeysCharNameWanted;
extern std::string NewKeysCharNameValidated;
extern std::string GameKeySet;
extern std::string RingEditorKeySet;
@ -71,12 +71,14 @@ enum TInterfaceState
TInterfaceState autoLogin (const std::string &cookie, const std::string &fsaddr, bool firstConnection);
std::string buildPlayerNameForSaveFile(const ucstring &playerNameIn);
std::string buildPlayerNameForSaveFile(const std::string &playerNameIn);
void globalMenuMovieShooter();
#ifdef RYZOM_BG_DOWNLOADER
void updateBGDownloaderUI();
#endif
// compute patcher priority, depending on the presence of one or more mainland characters : in this case, give the patch a boost
void updatePatcherPriorityBasedOnCharacters();

@ -394,7 +394,9 @@ static uint getNumZones()
//-----------------------------------------------
void CContinent::select(const CVectorD &pos, NLMISC::IProgressCallback &progress, bool complete, bool unhibernate, EGSPD::CSeason::TSeason season)
{
#ifdef RYZOM_BG_DOWNLOADER
pauseBGDownloader();
#endif
CNiceInputAuto niceInputs;
// Season has changed ?
Season = season;

@ -43,7 +43,7 @@ public:
TContLMType Type;
NLMISC::CVector2f Pos; // Center of the zone
NLLIGO::CPrimZone Zone; // Region & Place
std::string TitleTextID; // should be converted with CStringManagerClient::getPlaceLocalizedName() to get the actual title in ucstring
std::string TitleTextID; // should be converted with CStringManagerClient::getPlaceLocalizedName() to get the actual title in utf-8 string
CContLandMark()
{

@ -246,7 +246,7 @@ public :
}
private:
std::list<CCDBNodeLeaf *> _PendingMissionTitle;
// std::set<ucstring> _AlreadyReceived;
// std::set<std::string> _AlreadyReceived;
};
//-----------------------------------------------
@ -2396,14 +2396,8 @@ CEntityCL *CEntityManager::getEntityByKeywords (const std::vector<string> &keywo
//-----------------------------------------------
CEntityCL *CEntityManager::getEntityByName (const string &name, bool caseSensitive, bool complete) const
{
string source = name;
const uint size = (uint)source.size();
if (!caseSensitive)
{
uint j;
for (j=0; j<size; j++)
source[j] = tolower (source[j]);
}
string source;
source = caseSensitive ? name : toLower(name); // TODO: toLowerInsensitive
uint i;
const uint count = (uint)_Entities.size();
@ -2414,16 +2408,9 @@ CEntityCL *CEntityManager::getEntityByName (const string &name, bool caseSensiti
{
if(_Entities[i])
{
string value = _Entities[i]->getDisplayName();
string value = caseSensitive ? _Entities[i]->getDisplayName() : toLower(_Entities[i]->getDisplayName()); // TODO: toLowerInsensitive
bool foundEntity = false;
uint j;
if (!caseSensitive)
{
for (j=0; j<value.size(); j++)
value[j] = tolower (value[j]);
}
// Complete test ?
if (complete)
{
@ -2432,11 +2419,8 @@ CEntityCL *CEntityManager::getEntityByName (const string &name, bool caseSensiti
}
else
{
if (value.size() >= size)
{
if (std::operator==(source, value.substr (0, size)))
foundEntity = true;
}
if (NLMISC::startsWith(value, source))
foundEntity = true;
}
if (foundEntity)

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

@ -422,11 +422,13 @@ void CLoginStateMachine::run()
bool mustReboot = false;
#ifdef RYZOM_BG_DOWNLOADER
if (isBGDownloadEnabled())
{
mustReboot = CBGDownloaderAccess::getInstance().mustLaunchBatFile();
}
else
#endif
{
mustReboot = CPatchManager::getInstance()->mustLaunchBatFile();
}
@ -470,11 +472,13 @@ void CLoginStateMachine::run()
}
initPatchCheck();
SM_BEGIN_EVENT_TABLE
#ifdef RYZOM_BG_DOWNLOADER
if (isBGDownloadEnabled())
{
SM_EVENT(ev_patch_needed, st_patch); // no choice for patch content when background downloader is used
}
else
#endif
{
SM_EVENT(ev_patch_needed, st_display_cat);
}
@ -600,7 +604,9 @@ void CLoginStateMachine::run()
break;
case st_enter_far_tp_main_loop:
// if bgdownloader is used, then pause it
#ifdef RYZOM_BG_DOWNLOADER
pauseBGDownloader();
#endif
// Far TP part 1.2: let the main loop finish the current frame.

@ -341,9 +341,7 @@ void ExitClientError (const char *format, ...)
CurrentErrorMessage = NLMISC::utf8ToWide(str);
DialogBox(HInstance, MAKEINTRESOURCE(IDD_ERROR_HELP_MESSAGE_BOX), NULL, ExitClientErrorDialogProc);
/*
ucstring ucstr;
ucstr.fromUtf8 (str);
MessageBoxW (NULL, (WCHAR *)ucstr.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONERROR);
MessageBoxW (NULL, nlUtf8ToWide(str.c_str()), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONERROR);
*/
#else
fprintf (stderr, "%s\n", str);
@ -357,18 +355,18 @@ void ExitClientError (const char *format, ...)
}
// Use this function to return an information to the final user
void ClientInfo (const ucstring &message)
void ClientInfo (const std::string &message)
{
#ifdef NL_OS_WINDOWS
MessageBoxW(NULL, (WCHAR *)message.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONINFORMATION);
MessageBoxW(NULL, nlUtf8ToWide(message.c_str()), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONINFORMATION);
#endif
}
// Use this function to ask a question to the final user
bool ClientQuestion (const ucstring &message)
bool ClientQuestion (const std::string &message)
{
#ifdef NL_OS_WINDOWS
return MessageBoxW(NULL, (WCHAR *)message.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_YESNO|MB_ICONQUESTION) != IDNO;
return MessageBoxW(NULL, nlUtf8ToWide(message.c_str()), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_YESNO|MB_ICONQUESTION) != IDNO;
#else
return false;
#endif
@ -379,7 +377,7 @@ void selectTipsOfTheDay (uint /* tips */)
/* todo tips of the day uncomment
tips %= RZ_NUM_TIPS;
TipsOfTheDayIndex = tips;
ucstring title = CI18N::get ("uiTipsTitle");
string title = CI18N::get ("uiTipsTitle");
title += toString (tips+1);
title += " : ";
TipsOfTheDay = title+CI18N::get ("uiTips"+toString (tips));*/
@ -541,7 +539,7 @@ void checkDriverVersion()
{
if (driverVersion < driversVersion[i])
{
ucstring message = CI18N::get ("uiUpdateDisplayDriversNotUpToDate") + "\n\n";
string message = CI18N::get ("uiUpdateDisplayDriversNotUpToDate") + "\n\n";
// message += CI18N::get ("uiUpdateDisplayDriversVendor") + driversVendor[i] + "\n";
message += CI18N::get ("uiUpdateDisplayDriversCard") + deviceName + "\n";
message += CI18N::get ("uiUpdateDisplayDriversCurrent") + getVersionString (driverVersion) + "\n";
@ -999,7 +997,7 @@ void prelogInit()
FPU_CHECKER_ONCE
// Set the data path for the localisation.
const ucstring nmsg("Loading I18N...");
const string nmsg("Loading I18N...");
ProgressBar.newMessage ( nmsg );
FPU_CHECKER_ONCE
@ -1179,7 +1177,9 @@ void prelogInit()
#ifdef NL_OS_WINDOWS
#ifdef RYZOM_BG_DOWNLOADER
CBGDownloaderAccess::getInstance().init();
#endif
if (SlashScreen)
DestroyWindow (SlashScreen);

@ -732,7 +732,7 @@ public:
CEntityCL *entity = EntitiesMngr.entity(trader);
if (entity)
{
ucstring playerName = entity->getEntityName();
string playerName = entity->getEntityName();
if (!playerName.empty())
{
PeopleInterraction.askAddContact(playerName, &PeopleInterraction.FriendList);
@ -4011,7 +4011,6 @@ 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(std::string &str, const string &dbScore, SCORES::TScores score, const string &ttFormat)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
@ -4555,7 +4554,7 @@ public:
}
else
{
ucstr = ucstring("&EMT&") + UserEntity->getDisplayName() + ucstring(" ") + ucstr;
ucstr = ucstring("&EMT&") + UserEntity->getDisplayName() + ucstring(" ") + ucstr; // FIXME: UTF-8 (serial)
}
out.serialEnum(behavToSend);

@ -89,14 +89,14 @@ using namespace STRING_MANAGER;
// STATIC FUNCTIONS DECLARATIONS //
///////////////////////////////////
static void setupCreatorName(CSheetHelpSetup &setup);
static void setHelpText(CSheetHelpSetup &setup, const ucstring &text);
static void setHelpText(CSheetHelpSetup &setup, const string &text);
static void setHelpTextID(CSheetHelpSetup &setup, sint32 id);
static void fillSabrinaPhraseListBrick(const CSPhraseCom &phrase, IListSheetBase *listBrick);
static void setupListBrickHeader(CSheetHelpSetup &setup);
static void hideListBrickHeader(CSheetHelpSetup &setup);
static void setupHelpPage(CInterfaceGroup *window, const string &url);
static void setupHelpTitle(CInterfaceGroup *group, const ucstring &title);
static void setupHelpTitle(CInterfaceGroup *group, const string &title);
static void setHelpCtrlSheet(CSheetHelpSetup &setup, uint32 sheetId);
// Setup help for an item in a window (type is known)
@ -187,7 +187,7 @@ void CInterfaceHelp::initWindows()
// add observers for the update of phrase help texts (depends of weight of equipped weapons)
for (uint i = 0; i < MAX_HANDINV_ENTRIES; ++i)
{
CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp(std::string(LOCAL_INVENTORY) + ":HAND:" + toString(i), false);
CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp(string(LOCAL_INVENTORY) + ":HAND:" + toString(i), false);
if(pNodeLeaf)
{
ICDBNode::CTextId textId;
@ -210,7 +210,7 @@ void CInterfaceHelp::release()
// add observers for the update of phrase help texts (depends of weight of equipped weapons)
for (uint i = 0; i < MAX_HANDINV_ENTRIES; ++i)
{
CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp(std::string(LOCAL_INVENTORY) + ":HAND:" + toString(i), false);
CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp(string(LOCAL_INVENTORY) + ":HAND:" + toString(i), false);
if(pNodeLeaf)
{
ICDBNode::CTextId textId;
@ -565,7 +565,7 @@ void CInterfaceHelp::updateWindowSPhraseTexts()
*/
class CHandlerCloseHelp : public IActionHandler
{
void execute (CCtrlBase *pCaller, const std::string &sParams)
void execute (CCtrlBase *pCaller, const string &sParams)
{
CInterfaceHelp::closeAll();
}
@ -578,7 +578,7 @@ REGISTER_ACTION_HANDLER( CHandlerCloseHelp, "close_help");
*/
class CHandlerOpenItemHelp : public IActionHandler
{
void execute (CCtrlBase *pCaller, const std::string &sParams)
void execute (CCtrlBase *pCaller, const string &sParams)
{
CDBCtrlSheet *cs = dynamic_cast<CDBCtrlSheet*>(pCaller);
if (cs != NULL && cs->getSheetId()!=0 )
@ -609,7 +609,7 @@ REGISTER_ACTION_HANDLER( CHandlerOpenItemHelp, "open_item_help");
*/
class CHandlerOpenPactHelp : public IActionHandler
{
void execute (CCtrlBase *pCaller, const std::string &sParams)
void execute (CCtrlBase *pCaller, const string &sParams)
{
CDBCtrlSheet *cs = dynamic_cast<CDBCtrlSheet*>(pCaller);
if (cs != NULL && cs->getSheetId()!=0 )
@ -633,7 +633,7 @@ REGISTER_ACTION_HANDLER( CHandlerOpenPactHelp, "open_pact_help");
*/
class CHandlerOpenTitleHelp : public IActionHandler
{
void execute (CCtrlBase *pCaller, const std::string &sParams)
void execute (CCtrlBase *pCaller, const string &sParams)
{
// display web profile if necessary
if (getParam(sParams, "from") == "contact")
@ -656,10 +656,10 @@ class CHandlerOpenTitleHelp : public IActionHandler
sint index = peopleList->getIndexFromContainerID(fatherGC->getId());
if (index == -1)
return;
ucstring name = peopleList->getName(index);
string name = peopleList->getName(index);
if ( ! name.empty())
{
CAHManager::getInstance()->runActionHandler("show_hide", pCaller, "profile|pname="+name.toUtf8()+"|ptype="+toString((int)CEntityCL::Player));
CAHManager::getInstance()->runActionHandler("show_hide", pCaller, "profile|pname="+name+"|ptype="+toString((int)CEntityCL::Player));
}
return;
}
@ -670,7 +670,7 @@ class CHandlerOpenTitleHelp : public IActionHandler
if (selection == NULL) return;
//if(selection->isNPC())
{
std::string name = selection->getEntityName();
string name = selection->getEntityName();
if(name.empty())
{
// 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();
pSMC->getString (nDBid, name);
std::string copyName = name;
string copyName = name;
name = CEntityCL::removeTitleAndShardFromName(name);
if (name.empty())
{
@ -689,7 +689,7 @@ class CHandlerOpenTitleHelp : public IActionHandler
woman = pChar->getGender() == GSGENDER::female;
// extract the replacement id
std::string strNewTitle = CEntityCL::getTitleFromName(copyName);
string strNewTitle = CEntityCL::getTitleFromName(copyName);
// retrieve the translated string
if (!strNewTitle.empty())
@ -716,8 +716,8 @@ class CHandlerOpenTitleHelp : public IActionHandler
// Get name and title
// ------------------
ucstring name;
ucstring title;
string name;
string title;
bool reservedTitle = false;
string sFrom = getParam(sParams, "from");
if (sFrom == "target")
@ -752,7 +752,7 @@ class CHandlerOpenTitleHelp : public IActionHandler
for (titleIDnb = 0; titleIDnb < CHARACTER_TITLE::NB_CHARACTER_TITLE; ++titleIDnb)
{
bool women = UserEntity && UserEntity->getGender()==GSGENDER::female;
if (CStringManagerClient::getTitleLocalizedName(CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)titleIDnb),women) == title.toUtf8())
if (CStringManagerClient::getTitleLocalizedName(CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)titleIDnb),women) == title)
break;
}
@ -764,21 +764,21 @@ class CHandlerOpenTitleHelp : public IActionHandler
// Display all infos found
// -----------------------
ucstring titleText = CI18N::get("uihelpTitleFormat");
strFindReplace(titleText, "%name", name.toString());
string titleText = CI18N::get("uihelpTitleFormat");
strFindReplace(titleText, "%name", name);
// Display title
ucstring::size_type p1 = title.find('(');
if (p1 != ucstring::npos)
string::size_type p1 = title.find('(');
if (p1 != string::npos)
{
ucstring::size_type p2 = title.find(')', p1+1);
if (p2 != ucstring::npos)
string::size_type p2 = title.find(')', p1+1);
if (p2 != string::npos)
title = title.substr(p1+1, p2-p1-1);
}
strFindReplace(titleText, "%title", title);
// Display all skills needed to obtain this title
ucstring sSkillsNeeded;
string sSkillsNeeded;
if (!title.empty() && pTU == NULL)
sSkillsNeeded = CI18N::get("uiTitleCantObtain");
@ -822,7 +822,7 @@ class CHandlerOpenTitleHelp : public IActionHandler
strFindReplace(titleText, "%skills", sSkillsNeeded);
// Display all bricks needed to obtain this title
ucstring sBricksNeeded;
string sBricksNeeded;
if (pTU != NULL)
{
sBricksNeeded = CI18N::get("uiTitleBrickHeader");
@ -861,7 +861,7 @@ REGISTER_ACTION_HANDLER( CHandlerOpenTitleHelp, "open_title_help");
*/
class CHandlerOpenSkillToTradeHelp : public IActionHandler
{
void execute (CCtrlBase *pCaller, const std::string &sParams)
void execute (CCtrlBase *pCaller, const string &sParams)
{
CDBCtrlSheet *cs = dynamic_cast<CDBCtrlSheet*>(pCaller);
if (cs != NULL)
@ -884,7 +884,7 @@ REGISTER_ACTION_HANDLER( CHandlerOpenSkillToTradeHelp, "open_skill_to_trade_help
*/
class CHandlerOpenHelpAuto : public IActionHandler
{
void execute (CCtrlBase *pCaller, const std::string &sParams)
void execute (CCtrlBase *pCaller, const string &sParams)
{
CDBCtrlSheet *cs = dynamic_cast<CDBCtrlSheet*>(pCaller);
if (!cs)
@ -914,7 +914,7 @@ REGISTER_ACTION_HANDLER( CHandlerOpenHelpAuto, "open_help_auto");
*/
class CHandlerBrowse : public IActionHandler
{
void execute (CCtrlBase *pCaller, const std::string &sParams)
void execute (CCtrlBase *pCaller, const string &sParams)
{
string container = getParam (sParams, "name");
CInterfaceElement *element = CWidgetManager::getInstance()->getElementFromId(container);
@ -973,12 +973,12 @@ class CHandlerBrowse : public IActionHandler
{
if(params[i]=='%' && i<params.size()-2)
{
if(isxdigit(params[i+1]) && isxdigit(params[i+2]))
if(isxdigit(params[i+1]) && isxdigit(params[i+2])) // FIXME: Locale dependent
{
// read value from heax decimal
uint8 val= 0;
params[i+1]= tolower(params[i+1]);
params[i+2]= tolower(params[i+2]);
params[i+1]= tolower(params[i+1]); // FIXME: toLowerAscii
params[i+2]= tolower(params[i+2]); // FIXME: toLowerAscii
if(isdigit(params[i+1])) val= params[i+1]-'0';
else val= 10+ params[i+1]-'a';
val*=16;
@ -1052,7 +1052,7 @@ REGISTER_ACTION_HANDLER( CHandlerBrowse, "browse");
class CHandlerBrowseUndo : public IActionHandler
{
public:
void execute (CCtrlBase *pCaller, const std::string &sParams)
void execute (CCtrlBase *pCaller, const string &sParams)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
string container = getParam (sParams, "name");
@ -1071,7 +1071,7 @@ REGISTER_ACTION_HANDLER( CHandlerBrowseUndo, "browse_undo");
class CHandlerBrowseRedo : public IActionHandler
{
public:
void execute (CCtrlBase *pCaller, const std::string &sParams)
void execute (CCtrlBase *pCaller, const string &sParams)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
string container = getParam (sParams, "name");
@ -1090,7 +1090,7 @@ REGISTER_ACTION_HANDLER( CHandlerBrowseRedo, "browse_redo");
class CHandlerBrowseRefresh : public IActionHandler
{
public:
void execute (CCtrlBase *pCaller, const std::string &sParams)
void execute (CCtrlBase *pCaller, const string &sParams)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
string container = getParam (sParams, "name");
@ -1108,7 +1108,7 @@ REGISTER_ACTION_HANDLER( CHandlerBrowseRefresh, "browse_refresh");
// ***************************************************************************
class CHandlerHTMLSubmitForm : public IActionHandler
{
void execute (CCtrlBase *pCaller, const std::string &sParams)
void execute (CCtrlBase *pCaller, const string &sParams)
{
string container = getParam (sParams, "name");
@ -1153,9 +1153,9 @@ static void setupHelpPage(CInterfaceGroup *window, const string &url)
}
// ***************************************************************************
void setHelpText(CSheetHelpSetup &setup, const ucstring &text)
void setHelpText(CSheetHelpSetup &setup, const string &text)
{
ucstring copyStr= text;
string copyStr= text;
// remove trailing \n
while(!copyStr.empty() && copyStr[copyStr.size()-1]=='\n')
{
@ -1166,7 +1166,7 @@ void setHelpText(CSheetHelpSetup &setup, const ucstring &text)
CViewText *viewText= dynamic_cast<CViewText *>(setup.HelpWindow->getView(setup.ViewText));
if(viewText)
{
viewText->setTextFormatTaged(copyStr.toUtf8());
viewText->setTextFormatTaged(copyStr);
}
CInterfaceGroup *viewTextGroup = setup.HelpWindow->getGroup(setup.ScrollTextGroup);
if (viewTextGroup) viewTextGroup->setActive(true);
@ -1203,12 +1203,12 @@ void setHelpTextID(CSheetHelpSetup &setup, sint32 id)
}
// ***************************************************************************
static void setupHelpTitle(CInterfaceGroup *group, const ucstring &title)
static void setupHelpTitle(CInterfaceGroup *group, const string &title)
{
CGroupContainer *pGC= dynamic_cast<CGroupContainer*>(group);
if(!group)
return;
pGC->setUCTitle(title);
pGC->setTitle(title);
}
// ***************************************************************************
@ -1237,10 +1237,10 @@ static void setupSkillToTradeHelp(CSheetHelpSetup &setup)
setup.DestSheet->setActive(true);
}
ucstring skillText;
string skillText;
// Name in title
const ucstring title(CStringManagerClient::getSkillLocalizedName(skill));
const char *title = CStringManagerClient::getSkillLocalizedName(skill);
setupHelpTitle(setup.HelpWindow, title);
// search all job that have minimum required level for that skill
@ -1249,7 +1249,7 @@ static void setupSkillToTradeHelp(CSheetHelpSetup &setup)
// {
// for (uint job = 0; job < 8; ++job)
// {
// std::string dbPath = toString("CHARACTER_INFO:CAREER%d:JOB%d:JOB_CAP", (int) career, (int) job);
// string dbPath = toString("CHARACTER_INFO:CAREER%d:JOB%d:JOB_CAP", (int) career, (int) job);
// uint level = (uint) NLGUI::CDBManager::getInstance()->getDbProp(dbPath)->getValue32();
// if (level != 0) // has the player this job ?
// {
@ -1265,10 +1265,11 @@ static void setupSkillToTradeHelp(CSheetHelpSetup &setup)
// }
// setup skill desc if available.
const ucstring desc(CStringManagerClient::getSkillLocalizedDescription(skill));
if( !desc.empty() )
const char *desc = CStringManagerClient::getSkillLocalizedDescription(skill);
if (*desc)
{
skillText+= "\n" + desc;
skillText += "\n";
skillText += desc;
}
setHelpText(setup, skillText);
@ -1305,7 +1306,7 @@ static string toPercentageText(float val)
}
// ***************************************************************************
void getItemDefenseText(CDBCtrlSheet *item, ucstring &itemText)
void getItemDefenseText(CDBCtrlSheet *item, string &itemText)
{
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
@ -1322,7 +1323,7 @@ void getItemDefenseText(CDBCtrlSheet *item, ucstring &itemText)
}
void getDamageText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText, bool displayAsMod)
void getDamageText(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText, bool displayAsMod)
{
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
@ -1347,7 +1348,7 @@ void getDamageText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText,
}
}
void getSpeedText(CDBCtrlSheet *item, ucstring &itemText, bool displayAsMod)
void getSpeedText(CDBCtrlSheet *item, string &itemText, bool displayAsMod)
{
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
@ -1358,7 +1359,7 @@ void getSpeedText(CDBCtrlSheet *item, ucstring &itemText, bool displayAsMod)
strFindReplace(itemText, "%speed", strMod + toReadableFloat(itemInfo.HitRate));
}
void getRangeText(CDBCtrlSheet *item, ucstring &itemText, bool displayAsMod)
void getRangeText(CDBCtrlSheet *item, string &itemText, bool displayAsMod)
{
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
@ -1369,7 +1370,7 @@ void getRangeText(CDBCtrlSheet *item, ucstring &itemText, bool displayAsMod)
strFindReplace(itemText, "%range", strMod + toReadableFloat(itemInfo.Range/1000.f));
}
void getHPAndSapLoadText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText)
void getHPAndSapLoadText(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText)
{
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
@ -1386,7 +1387,7 @@ void getHPAndSapLoadText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &ite
}
void getBuffText(CDBCtrlSheet *item, ucstring &itemText)
void getBuffText(CDBCtrlSheet *item, string &itemText)
{
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
@ -1394,7 +1395,7 @@ void getBuffText(CDBCtrlSheet *item, ucstring &itemText)
const string valIds[]={"Hp", "Sap", "Sta", "Focus"};
sint32 vals[]= {itemInfo.HpBuff, itemInfo.SapBuff, itemInfo.StaBuff, itemInfo.FocusBuff};
uint numVals= sizeof(vals) / sizeof(vals[0]);
ucstring bufInfo;
string bufInfo;
// For each buf, append a line if !=0
for(uint i=0;i<numVals;i++)
@ -1402,7 +1403,7 @@ void getBuffText(CDBCtrlSheet *item, ucstring &itemText)
sint32 modifier= vals[i];
if(modifier!=0)
{
ucstring line= CI18N::get( "uihelpItem" + valIds[i] + (modifier>0?"Bonus":"Malus") );
string line= CI18N::get( "uihelpItem" + valIds[i] + (modifier>0?"Bonus":"Malus") );
strFindReplace(line, "%val", toString(modifier) );
bufInfo+= line;
}
@ -1416,13 +1417,13 @@ void getBuffText(CDBCtrlSheet *item, ucstring &itemText)
strFindReplace(itemText, "%buffs", bufInfo);
}
void getMagicProtection(CDBCtrlSheet *item, ucstring &itemText)
void getMagicProtection(CDBCtrlSheet *item, string &itemText)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
ucstring mProtInfo;
string mProtInfo;
// Header (always here, because at least max absorb)
mProtInfo= CI18N::get("uihelpMagicProtectFormatHeader");
@ -1433,7 +1434,7 @@ void getMagicProtection(CDBCtrlSheet *item, ucstring &itemText)
if(itemInfo.MagicProtection[i] != PROTECTION_TYPE::None)
{
// Protection info
ucstring str= CI18N::get("uihelpMagicProtectFormat");
string str= CI18N::get("uihelpMagicProtectFormat");
strFindReplace(str, "%t", CI18N::get("pt"+PROTECTION_TYPE::toString(itemInfo.MagicProtection[i])) );
strFindReplace(str, "%v", toString(itemInfo.MagicProtectionFactor[i]) );
mProtInfo+= str;
@ -1449,7 +1450,7 @@ void getMagicProtection(CDBCtrlSheet *item, ucstring &itemText)
maxAbsorb= maxAbsorb*nodeFactor->getValue32()/100;
// Add to text
ucstring str= CI18N::get("uihelpMagicProtectMaxAbsorbFormat");
string str= CI18N::get("uihelpMagicProtectMaxAbsorbFormat");
strFindReplace(str, "%v", toString(maxAbsorb) );
mProtInfo+= str;
}
@ -1458,12 +1459,12 @@ void getMagicProtection(CDBCtrlSheet *item, ucstring &itemText)
strFindReplace(itemText, "%magic_protection", mProtInfo);
}
void getMagicResistance(CDBCtrlSheet *item, ucstring &itemText)
void getMagicResistance(CDBCtrlSheet *item, string &itemText)
{
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
ucstring mResistInfo;
string mResistInfo;
// Header (always here, because at least max absorb)
mResistInfo= CI18N::get("uihelpMagicResistFormatHeader");
@ -1481,7 +1482,7 @@ void getMagicResistance(CDBCtrlSheet *item, ucstring &itemText)
if(resist[i] != 0)
{
// Resist info
ucstring str= CI18N::get("uihelpMagicResistFormat");
string str= CI18N::get("uihelpMagicResistFormat");
strFindReplace(str, "%t", CI18N::get("rs"+RESISTANCE_TYPE::toString((RESISTANCE_TYPE::TResistanceType)i) ));
strFindReplace(str, "%v", toReadableFloat(float(resist[i])/100) );
mResistInfo+= str;
@ -1492,7 +1493,7 @@ void getMagicResistance(CDBCtrlSheet *item, ucstring &itemText)
strFindReplace(itemText, "%magic_resistance", mResistInfo);
}
void getActionMalus(CDBCtrlSheet *item, ucstring &itemText)
void getActionMalus(CDBCtrlSheet *item, string &itemText)
{
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
@ -1500,7 +1501,7 @@ void getActionMalus(CDBCtrlSheet *item, ucstring &itemText)
strFindReplace(itemText, "%actmalus", toPercentageText(itemInfo.WearEquipmentMalus) );
}
void getBulkText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText)
void getBulkText(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText)
{
// Display direct value: because cannot know where this item will be drop!! (bag, mektoub etc...)
float slotBulkTotal= max((sint32)1, item->getQuantity()) * pIS->Bulk;
@ -1513,7 +1514,7 @@ void getBulkText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText)
strFindReplace(itemText, "%bulk", toString("%.2f", slotBulkTotal) );
}
void getWeightText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText)
void getWeightText(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
@ -1550,14 +1551,14 @@ void getWeightText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText)
strFindReplace(itemText, "%weight", "???" );
}
void getMagicBonus(CDBCtrlSheet *item, ucstring &itemText)
void getMagicBonus(CDBCtrlSheet *item, string &itemText)
{
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
nlctassert(CClientItemInfo::NumMagicFactorType==4);
const string valIds[CClientItemInfo::NumMagicFactorType]={"OffElemental", "OffAffliction", "DefHeal", "DefAffliction"};
ucstring mbInfo;
string mbInfo;
// For each magic bonus, test first if equal
sint32 allCastSpeedFactor= sint(itemInfo.CastingSpeedFactor[0]*100);
@ -1582,7 +1583,7 @@ void getMagicBonus(CDBCtrlSheet *item, ucstring &itemText)
if(allCastSpeedFactor!=0 || allMagicPowerFactor!=0)
{
// else display "all"
ucstring line= CI18N::get( "uihelpItemMagicBonusAll");
string line= CI18N::get( "uihelpItemMagicBonusAll");
strFindReplace(line, "%cs", toString("%+d", allCastSpeedFactor) );
strFindReplace(line, "%mp", toString("%+d", allMagicPowerFactor) );
mbInfo+= line;
@ -1597,7 +1598,7 @@ void getMagicBonus(CDBCtrlSheet *item, ucstring &itemText)
sint32 mp= sint(itemInfo.MagicPowerFactor[i]*100);
if(cs!=0 || mp!=0)
{
ucstring line= CI18N::get( string("uihelpItemMagicBonus") + valIds[i] );
string line= CI18N::get( string("uihelpItemMagicBonus") + valIds[i] );
strFindReplace(line, "%cs", toString("%+d", cs) );
strFindReplace(line, "%mp", toString("%+d", mp) );
mbInfo+= line;
@ -1609,7 +1610,7 @@ void getMagicBonus(CDBCtrlSheet *item, ucstring &itemText)
if(!mbInfo.empty())
{
// add spell level header
ucstring spellRuleFmt= CI18N::get("uihelpItemMagicBonusHeader");
string spellRuleFmt= CI18N::get("uihelpItemMagicBonusHeader");
strFindReplace(spellRuleFmt, "%mglvl", toString(item->getQuality()));
mbInfo= spellRuleFmt + mbInfo;
}
@ -1618,11 +1619,11 @@ void getMagicBonus(CDBCtrlSheet *item, ucstring &itemText)
strFindReplace(itemText, "%magic_bonus", mbInfo);
}
void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText)
void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
bool requiredNeeded= false;
ucstring fmt, fmtc;
string fmt, fmtc;
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
@ -1655,7 +1656,7 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &
fmt = CI18N::get("uihelpItemSkillReqNotMetFmt");
strFindReplace(fmt, "%d", toString((uint)itemInfo.RequiredSkillLevel));
const ucstring skillName(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill));
const char *skillName = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill);
strFindReplace(fmt, "%s", skillName);
}
else
@ -1686,7 +1687,7 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &
fmt = CI18N::get("uihelpItemSkillReqNotMetFmt");
strFindReplace(fmt, "%d", toString((uint)itemInfo.RequiredSkillLevel2));
const ucstring skillName(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill2));
const char *skillName = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill2);
strFindReplace(fmt, "%s", skillName);
}
else
@ -1749,7 +1750,7 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &
if(req)
{
// Build the req string
ucstring fmt;
string fmt;
if(pIM->isItemCaracRequirementMet(caracType, (sint32)caracValue))
fmt= CI18N::get("uihelpItemCaracReqMetFmt");
else
@ -1784,7 +1785,7 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &
if (skillReq)
{
// Build the req string
ucstring fmt;
string fmt;
if (req)
fmt = CI18N::get("uihelpItemCaracReqAnd");
@ -1793,7 +1794,7 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &
else
fmt += CI18N::get("uihelpItemSkillReqNotMetFmt");
strFindReplace(fmt, "%d", toString((uint)itemInfo.MinRequiredSkillLevel));
const ucstring skillName = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill);
const char *skillName = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName(itemInfo.RequiredSkill);
strFindReplace(fmt, "%s", skillName);
strFindReplace(itemText, "%skillreq", fmt );
@ -1805,12 +1806,12 @@ void getItemRequirementText(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &
#endif
}
void getSkillModVsType(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemText)
void getSkillModVsType(CDBCtrlSheet *item, const CItemSheet*pIS, string &itemText)
{
// retrieve the current itemInfo
const CClientItemInfo &itemInfo= getInventory().getItemInfo(getInventory().getItemSlotId(item) );
ucstring sMod;
string sMod;
// check skill mod
if(!itemInfo.TypeSkillMods.empty())
{
@ -1831,9 +1832,9 @@ void getSkillModVsType(CDBCtrlSheet *item, const CItemSheet*pIS, ucstring &itemT
strFindReplace(itemText, "%skill_mod_vs_type", sMod);
}
void getArmorBonus(CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS)
void getArmorBonus(CDBCtrlSheet *item, string &itemText, const CItemSheet*pIS)
{
ucstring armor_bonus("");
string armor_bonus;
sint32 level = 0;
if (pIS->Armor.ArmorType == ARMORTYPE::HEAVY)
@ -1848,7 +1849,7 @@ void getArmorBonus(CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS)
}
// ***************************************************************************
void getItemText (CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS)
void getItemText (CDBCtrlSheet *item, string &itemText, const CItemSheet*pIS)
{
if ((item == NULL) || (pIS == NULL))
return;
@ -1894,24 +1895,24 @@ void getItemText (CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS)
CItemSpecialEffectHelper::getInstance()->getItemSpecialEffectText(pIS, itemText);
// Description
const ucstring desc(CStringManagerClient::getItemLocalizedDescription(pIS->Id));
if(!desc.empty())
const char *desc = CStringManagerClient::getItemLocalizedDescription(pIS->Id);
if (*desc)
{
strFindReplace(itemText, "%desc", "@{FFF9}" + CI18N::get("uiMissionDesc") + "\n@{FFFF}" + desc + "\n" );
}
else
strFindReplace(itemText, "%desc", ucstring() );
strFindReplace(itemText, "%desc", string() );
// Custom text
const CClientItemInfo &itemInfo = getInventory().getItemInfo(getInventory().getItemSlotId(item) );
if (!itemInfo.CustomText.empty())
{
strFindReplace(itemText, "%custom_text", "\n@{FFFF}" + itemInfo.CustomText + "\n");
ucstring itemMFC = CI18N::get("uiItemTextMessageFromCrafter");
strFindReplace(itemText, "%custom_text", "\n@{FFFF}" + itemInfo.CustomText.toUtf8() + "\n");
string itemMFC = CI18N::get("uiItemTextMessageFromCrafter");
strFindReplace(itemText, "%mfc", itemMFC);
}
else
strFindReplace(itemText, "%custom_text", ucstring() );
strFindReplace(itemText, "%custom_text", string() );
if ( pIS->Family == ITEMFAMILY::COSMETIC )
{
@ -1919,10 +1920,10 @@ void getItemText (CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS)
if ( UserEntity->getGender() != pIS->Cosmetic.Gender || UserEntity->people() != people )
strFindReplace(itemText, "%cansell", CI18N::get("uihelpItemCosmeticDontFit") );
else
strFindReplace(itemText, "%cansell", ucstring() );
strFindReplace(itemText, "%cansell", string() );
}
else if(pIS->DropOrSell )
strFindReplace(itemText, "%cansell", ucstring() );
strFindReplace(itemText, "%cansell", string() );
else
strFindReplace(itemText, "%cansell", CI18N::get("uihelpItemCantSell") );
@ -2012,8 +2013,8 @@ void getItemText (CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS)
// Craft some part?
if(pIS->canBuildSomeItemPart())
{
ucstring fmt= CI18N::get("uihelpItemMPCraft");
std::string ipList;
string fmt= CI18N::get("uihelpItemMPCraft");
string ipList;
pIS->getItemPartListAsText(ipList);
strFindReplace(fmt, "%ip", ipList);
strFindReplace(itemText, "%craft", fmt);
@ -2103,19 +2104,17 @@ void getItemText (CDBCtrlSheet *item, ucstring &itemText, const CItemSheet*pIS)
INVENTORIES::TInventory inventory = (INVENTORIES::TInventory)item->getInventoryIndex();
sint32 slot = item->getIndexInDB();
string debugText = NLMISC::toString("inventory: %s\nslot: %d\n", INVENTORIES::toString(inventory).c_str(), slot);
ucstring debugText2;
debugText2.fromUtf8(debugText);
itemText = debugText2 + itemText;
itemText = debugText + itemText;
#endif
}
// ***************************************************************************
static void setupEnchantedItem(CSheetHelpSetup &setup, ucstring &itemText)
static void setupEnchantedItem(CSheetHelpSetup &setup, string &itemText)
{
// if don't find the tag in the text (eg: if not useful), no-op
static const ucstring enchantTag("%enchantment");
if( itemText.find(enchantTag) == ucstring::npos )
static const string enchantTag("%enchantment");
if( itemText.find(enchantTag) == string::npos )
return;
// retrieve the current itemInfo
@ -2132,7 +2131,7 @@ static void setupEnchantedItem(CSheetHelpSetup &setup, ucstring &itemText)
CSPhraseManager *pPM= CSPhraseManager::getInstance();
// fill the enchantement info
ucstring enchantInfo;
string enchantInfo;
const CItemSheet *pIS= ctrl->asItemSheet();
if(pIS && pIS->Family == ITEMFAMILY::CRYSTALLIZED_SPELL)
pPM->buildPhraseDesc(enchantInfo, itemInfo.Enchantment, 0, false, "uihelpPhraseCrystalSpellFormat");
@ -2159,7 +2158,7 @@ static void setupEnchantedItem(CSheetHelpSetup &setup, ucstring &itemText)
hideListBrickHeader(setup);
// hide the text
strFindReplace(itemText, enchantTag, ucstring());
strFindReplace(itemText, enchantTag, string());
}
}
@ -2500,14 +2499,14 @@ void refreshItemHelp(CSheetHelpSetup &setup)
setupCreatorName(setup);
// **** setup the item Text info
ucstring itemText;
string itemText;
CEntitySheet *pES = SheetMngr.get ( CSheetId(setup.SrcSheet->getSheetId()) );
if ((pES != NULL) && (pES->type() == CEntitySheet::ITEM))
{
CItemSheet *pIS = (CItemSheet*)pES;
// ---- Common
ucstring title = setup.SrcSheet->getItemActualName();
string title = setup.SrcSheet->getItemActualName();
setupHelpTitle(setup.HelpWindow, title );
getItemText (setup.SrcSheet, itemText, pIS);
@ -2535,10 +2534,10 @@ void refreshItemHelp(CSheetHelpSetup &setup)
// itemText += CI18N::get("uiRingPlotItemDesc");
// itemText += mi->Description.empty() ? CI18N::get("uiRingPlotItemEmpty")
// : mi->Description;
// //itemText += ucstring("\n@{6F6F}") + CI18N::get("uiRingPlotItemComment") + ucstring("\n");
// //itemText += "\n@{6F6F}" + CI18N::get("uiRingPlotItemComment") + "\n";
// /*
// itemText += mi->Comment.empty() ? CI18N::get("uiRingPlotItemEmpty")
// : (ucstring("\n") + mi->Comment);
// : ("\n" + mi->Comment);
// */
// }
// }
@ -2591,7 +2590,7 @@ static void setupPactHelp(CSheetHelpSetup &setup)
const CPactSheet::SPact &pactLose = pact->PactLose[pactLevel];
// **** setup the brick Text info
ucstring pactText;
string pactText;
// TODO Localisation
setupHelpTitle(setup.HelpWindow, pactLose.Name);
@ -2698,7 +2697,7 @@ void refreshMissionHelp(CSheetHelpSetup &setup, const CPrerequisitInfos &infos)
// fill text, choose color according to conditions and block
for (uint j = i ; j < orIndexMax ; ++j )
{
const std::string text = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_%u",j+1);
const string text = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_%u",j+1);
CViewText *viewText = dynamic_cast<CViewText *>(setup.HelpWindow->getElement(text));
if (viewText)
{
@ -2709,7 +2708,7 @@ void refreshMissionHelp(CSheetHelpSetup &setup, const CPrerequisitInfos &infos)
viewText->setHardText("uiMissionOr");
}
const std::string textId = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_id_prereq_%u",j+1);
const string textId = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_id_prereq_%u",j+1);
CViewTextID *viewTextID = dynamic_cast<CViewTextID *>(setup.HelpWindow->getElement(textId));
if(viewTextID)
@ -2737,12 +2736,12 @@ void refreshMissionHelp(CSheetHelpSetup &setup, const CPrerequisitInfos &infos)
// inactivate other lines
for (uint i = (uint)infos.Prerequisits.size(); i < 15 ; ++i)
{
const std::string text = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_%u",i+1);
const string text = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_%u",i+1);
CViewText *viewText = dynamic_cast<CViewText *>(setup.HelpWindow->getElement(text));
if (viewText)
viewText->setActive(false);
const std::string textId = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_id_prereq_%u",i+1);
const string textId = setup.HelpWindow->getId() + ":content:scroll_text_id:text_list:" + NLMISC::toString("text_id_prereq_%u",i+1);
CViewTextID *viewTextID = dynamic_cast<CViewTextID *>(setup.HelpWindow->getElement(textId));
if(viewTextID)
viewTextID->setActive(false);
@ -2760,9 +2759,9 @@ void refreshMissionHelp(CSheetHelpSetup &setup, const CPrerequisitInfos &infos)
// ***************************************************************************
class CPlayerShardNameRemover : public IOnReceiveTextId
{
virtual void onReceiveTextId(ucstring &str)
virtual void onReceiveTextId(std::string &str)
{
str= CEntityCL::removeShardFromName(str.toUtf8());
str= CEntityCL::removeShardFromName(str);
}
};
static CPlayerShardNameRemover PlayerShardNameRemover;
@ -2873,12 +2872,12 @@ void setupOutpostBuildingHelp(CSheetHelpSetup &setup)
setupHelpTitle(setup.HelpWindow, CI18N::get("uihelpOutpostBuilding"));
ucstring sOBText;
string sOBText;
sOBText = CI18N::get("uihelpOBFormat_"+COutpostBuildingSheet::toString(pOBS->OBType));
{
ucstring timeText;
string timeText;
timeText = toString(pOBS->CostTime/60) + CI18N::get("uiBotChatTimeMinute");
if ((pOBS->CostTime % 60) != 0)
timeText += toString(pOBS->CostTime%60) + CI18N::get("uiBotChatTimeSecond");
@ -2944,7 +2943,7 @@ static sint getBonusMalusSpecialTT(CDBCtrlSheet *cs)
// ***************************************************************************
void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText)
void getSabrinaBrickText(CSBrickSheet *pBR, string &brickText)
{
if(!pBR)
return;
@ -2963,15 +2962,15 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText)
// Level
strFindReplace(brickText, "%lvl", toString(pBR->Level));
// Kill the whole text between %ks, if the skill is unknown
const ucstring killSkill("%ks");
const string killSkill("%ks");
if( pBR->getSkill()==SKILLS::unknown )
{
ucstring::size_type pos0= brickText.find(killSkill);
if(pos0 != ucstring::npos)
string::size_type pos0= brickText.find(killSkill);
if(pos0 != string::npos)
{
ucstring::size_type pos1= brickText.find(killSkill, pos0 + killSkill.size() );
if(pos1 != ucstring::npos)
brickText.replace(pos0, pos1+killSkill.size()-pos0, ucstring() );
string::size_type pos1= brickText.find(killSkill, pos0 + killSkill.size() );
if(pos1 != string::npos)
brickText.replace(pos0, pos1+killSkill.size()-pos0, string() );
}
}
else
@ -2984,7 +2983,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText)
strFindReplace(brickText, "%skill", CStringManagerClient::getSkillLocalizedName(pBR->getSkill()));
else
{
ucstring fullSkillText;
string fullSkillText;
bool first= true;
for(uint i=0;i<pBR->UsedSkills.size();i++)
{
@ -3014,13 +3013,13 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText)
// Kill the whole text between %krc, if the relative cost is 0
if(pBR->SabrinaRelativeCost==0.f)
{
const ucstring killRC("%krc");
ucstring::size_type pos0= brickText.find(killRC);
if(pos0 != ucstring::npos)
const string killRC("%krc");
string::size_type pos0= brickText.find(killRC);
if(pos0 != string::npos)
{
ucstring::size_type pos1= brickText.find(killRC, pos0 + killRC.size() );
if(pos1 != ucstring::npos)
brickText.replace(pos0, pos1+killRC.size()-pos0, ucstring() );
string::size_type pos1= brickText.find(killRC, pos0 + killRC.size() );
if(pos1 != string::npos)
brickText.replace(pos0, pos1+killRC.size()-pos0, string() );
}
}
else
@ -3053,7 +3052,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText)
}
else
{
ucstring mpInfo;
string mpInfo;
for(uint i=0;i<pBR->FaberPlan.ItemPartMps.size();i++)
{
CSBrickSheet::CFaberPlan::CItemPartMP &mpSlot= pBR->FaberPlan.ItemPartMps[i];
@ -3074,7 +3073,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText)
}
else
{
ucstring mpInfo;
string mpInfo;
for(uint i=0;i<pBR->FaberPlan.FormulaMps.size();i++)
{
CSBrickSheet::CFaberPlan::CFormulaMP &mpSlot= pBR->FaberPlan.FormulaMps[i];
@ -3090,7 +3089,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, ucstring &brickText)
}
// *** Magic
ucstring magicResistStr;
string magicResistStr;
// Has Some Magic Resistance setuped?
if( pBR->isMagic() && pBR->MagicResistType!=RESISTANCE_TYPE::None)
{
@ -3190,10 +3189,10 @@ void setupSabrinaPhraseHelp(CSheetHelpSetup &setup, const CSPhraseCom &phrase, u
}
// **** setup the phrase Text info
setupHelpTitle(setup.HelpWindow, phrase.Name);
setupHelpTitle(setup.HelpWindow, phrase.Name.toUtf8());
// get the phraseText
ucstring phraseText;
string phraseText;
// if required, add the .sphrase requirements.
// NB: don't add if from bot chat validation (useless cause already filtered by server)
pPM->buildPhraseDesc(phraseText, phrase, phraseSheetId, !setup.FromBotChat);
@ -3261,12 +3260,12 @@ static void setupSabrinaBrickHelp(CSheetHelpSetup &setup, bool auraDisabled)
// **** setup the brick Text info
ucstring brickText;
string brickText;
CSBrickManager *pBM= CSBrickManager::getInstance();
CSBrickSheet *pBR= pBM->getBrick(CSheetId(setup.SrcSheet->getSheetId()));
if(pBR)
{
const ucstring title(CStringManagerClient::getSBrickLocalizedName(pBR->Id));
const char *title = CStringManagerClient::getSBrickLocalizedName(pBR->Id);
setupHelpTitle(setup.HelpWindow, title);
// add brick info
@ -3596,7 +3595,7 @@ public:
else if( getAuraDisabledState(cs) )
{
// get the normal string, and append a short info.
std::string str;
string str;
cs->getContextHelp(str);
str+= CI18N::get("uittAuraDisabled");
@ -3667,7 +3666,7 @@ public:
}
}
ucstring str;
string str;
BOMB_IF( minTimeRemaining < 0, "at least one animal should be dead", return; );
str += CI18N::get("uittAnimalDeadPopupToolTip");
@ -3675,7 +3674,7 @@ public:
str += toString(minTimeRemaining);
// replace the context help that is required.
CWidgetManager::getInstance()->setContextHelpText(str.toUtf8());
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER( CHandlerAnimalDeadPopupTooltip, "animal_dead_popup_tooltip");
@ -3735,7 +3734,7 @@ REGISTER_ACTION_HANDLER( CAHMilkoKick, "milko_kick");
// ***************************************************************************
static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const std::string &statPrefixId)
static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const string &statPrefixId)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
@ -3799,13 +3798,13 @@ static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const s
CViewText *viewText= dynamic_cast<CViewText*>(groupMp->getElement(groupMp->getId()+":text" ));
if(viewText)
{
ucstring mpCraft;
string mpCraft;
// add the Origin filter.
string originFilterKey= "iompf" + ITEM_ORIGIN::enumToString((ITEM_ORIGIN::EItemOrigin)itemPart.OriginFilter);
mpCraft+= CI18N::get(originFilterKey);
viewText->setText(mpCraft.toUtf8());
viewText->setText(mpCraft);
}
@ -3939,7 +3938,7 @@ public:
s += getSystemInformation();
string progname;
std::string moduleName;
string moduleName;
#ifdef NL_OS_WINDOWS
wchar_t name[1024];
GetModuleFileNameW(NULL, name, 1023);

@ -141,14 +141,14 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived()
}
else
{
ucstring customText;
string customText;
if (!itemInfo.CustomText.empty())
{
customText = itemInfo.CustomText;
strFindReplace(customText, "%mfc", ucstring());
customText = itemInfo.CustomText.toUtf8(); // TODO: UTF-8 (serial)
strFindReplace(customText, "%mfc", string());
}
editBoxShort->setInputStringAsUtf16(customText);
editBoxShort->setInputString(customText);
editShort->setActive(true);
editBoxShort->setActive(true);
@ -160,24 +160,25 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived()
}
else
{
const char *localDesc = STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id);
if (itemInfo.CustomText.empty())
display->setTextFormatTaged(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id));
display->setTextFormatTaged(localDesc);
else
{
ucstring text = itemInfo.CustomText;
string text = itemInfo.CustomText.toUtf8();
string::size_type delimiter = text.find(' ');
if(text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B')
{
CGroupHTML *pGH = dynamic_cast<CGroupHTML*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html"));
if (pGH)
pGH->browse(ucstring(text.substr(4, delimiter-4)).toString().c_str());
pGH->browse(text.substr(4, delimiter-4).c_str());
if (delimiter == string::npos)
group->setActive(false);
else
text = text.substr(delimiter, text.size()-delimiter);
}
display->setTextFormatTaged(text.toUtf8());
display->setTextFormatTaged(text);
}
}
}
@ -255,14 +256,14 @@ void CInterfaceItemEdition::CItemEditionWindow::begin()
else
{
ucstring customText;
string customText;
if (!itemInfo.CustomText.empty())
{
customText = itemInfo.CustomText;
strFindReplace(customText, "%mfc", ucstring());
customText = itemInfo.CustomText.toUtf8();
strFindReplace(customText, "%mfc", string());
}
editBoxShort->setInputStringAsUtf16(customText);
editBoxShort->setInputString(customText);
editShort->setActive(true);
editBoxShort->setActive(true);
@ -298,23 +299,24 @@ void CInterfaceItemEdition::CItemEditionWindow::begin()
if (getInventory().isItemInfoUpToDate(ItemSlotId))
{
// If we already have item info
const char *localDesc = STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id);
if (itemInfo.CustomText.empty())
display->setTextFormatTaged(STRING_MANAGER::CStringManagerClient::getItemLocalizedDescription(pIS->Id));
display->setTextFormatTaged(localDesc);
else
{
ucstring text = itemInfo.CustomText;
string text = itemInfo.CustomText.toUtf8();
string::size_type delimiter = text.find(' ');
if(text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B')
{
CGroupHTML *pGH = dynamic_cast<CGroupHTML*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html"));
if (pGH)
pGH->browse(ucstring(text.substr(4, delimiter-4)).toString().c_str());
pGH->browse(text.substr(4, delimiter-4).c_str());
if (delimiter == string::npos)
group->setActive(false);
else
text = text.substr(delimiter, text.size()-delimiter);
}
display->setTextFormatTaged(text.toUtf8());
display->setTextFormatTaged(text);
}
}
else
@ -395,11 +397,11 @@ void CInterfaceItemEdition::CItemEditionWindow::validate()
if (group && editShort && editBoxShort && editLarge && editBoxLarge && display && editButtons && closeButton && background)
{
bool textValid = editShort->getActive();
ucstring text = editBoxShort->getInputStringAsUtf16();
string text = editBoxShort->getInputString();
if (!textValid)
{
textValid = editLarge->getActive();
text = editBoxLarge->getInputStringAsUtf16();
text = editBoxLarge->getInputString();
}
if (textValid)
@ -416,7 +418,8 @@ void CInterfaceItemEdition::CItemEditionWindow::validate()
out.serial(uiInventory);
uint32 uiSlot = (uint32)pCSItem->getIndexInDB();
out.serial(uiSlot);
out.serial(text);
ucstring ucText = ucstring::makeFromUtf8(text); // TODO: UTF-8 (serial)
out.serial(ucText);
NetMngr.push(out);
//nlinfo("impulseCallBack : %s %s %d \"%s\" sent", msgName.c_str(), INVENTORIES::toString((INVENTORIES::TInventory)pCSItem->getInventoryIndex()).c_str(), pCSItem->getIndexInDB(), text.toUtf8().c_str());
}
@ -2048,7 +2051,7 @@ class CHandlerItemMenuCheck : public IActionHandler
{
std::string name = groupNames[i];
std::string ahParams = "name=" + name;
//Use ucstring because group name can contain accentued characters (and stuff like that)
//Use utf-8 string because group name can contain accentued characters (and stuff like that)
pGroupMenu->addLine(name, "", "", name);
CGroupSubMenu* pNewSubMenu = new CGroupSubMenu(CViewBase::TCtorParam());
pGroupMenu->setSubMenu(pGroupMenu->getNumLine()-1, pNewSubMenu);

@ -836,7 +836,7 @@ class CAHReplyTeller : public IActionHandler
{
w->setKeyboardFocus();
w->enableBlink(1);
PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName.toUtf8()));
PeopleInterraction.ChatGroup.Filter.setTargetPlayer(CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName));
CGroupEditBox *eb = w->getEditBox();
if (eb != NULL)
{
@ -863,7 +863,7 @@ class CAHReplyTellerOnce : public IActionHandler
{
w->setKeyboardFocus();
w->enableBlink(1);
w->setCommand(ucstring("tell ") + CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName.toUtf8()) + ucstring(" "), false);
w->setCommand("tell " + CEntityCL::removeTitleAndShardFromName(PeopleInterraction.LastSenderName) + " ", false);
CGroupEditBox *eb = w->getEditBox();
if (eb != NULL)
{
@ -908,7 +908,7 @@ REGISTER_ACTION_HANDLER (CAHCycleTell, "cycle_tell")
NLMISC_COMMAND(slsn, "Temp : set the name of the last sender.", "<name>")
{
if (args.size() != 1) return false;
PeopleInterraction.LastSenderName = ucstring(args[0]);
PeopleInterraction.LastSenderName = args[0];
return true;
}
@ -924,8 +924,8 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(string &inOut)
inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(strNewTitle, Woman);
{
// Sometimes translation contains another title
ucstring::size_type pos = inOut.find('$');
if (pos != ucstring::npos)
string::size_type pos = inOut.find('$');
if (pos != string::npos)
{
inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(inOut), Woman);
}

@ -279,9 +279,9 @@ void launchPhraseComposition(bool creation)
// Set the Text of the Window
if(creation)
window->setUCTitle(CI18N::get("uiPhraseCreate"));
window->setTitle(CI18N::get("uiPhraseCreate"));
else
window->setUCTitle(CI18N::get("uiPhraseEdit"));
window->setTitle(CI18N::get("uiPhraseEdit"));
// clear the sentence for a New Phrase creation.
buildSentenceTarget->clearBuildingPhrase();
@ -1692,7 +1692,7 @@ public:
if(!ctrlSheet)
return;
ucstring str(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(CSheetId(ctrlSheet->getSheetId())));
string str(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(CSheetId(ctrlSheet->getSheetId())));
// According to locked state
if(ctrlSheet->getGrayed())
@ -1700,7 +1700,7 @@ public:
else
strFindReplace(str, "%comp", CI18N::get("uittPhraseCombatRestrictOK"));
CWidgetManager::getInstance()->setContextHelpText(str.toUtf8());
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER( CHandlerCombatRestrictTooltip, "phrase_combat_restrict_tooltip");

@ -188,8 +188,8 @@ void CActionPhraseFaber::launchFaberCastWindow(sint32 memoryLine, uint memoryIn
window->setActive(true);
// Setup the Title with a default text
ucstring title= CI18N::get("uiPhraseFaberExecuteNoPlan");
window->setUCTitle (title);
string title= CI18N::get("uiPhraseFaberExecuteNoPlan");
window->setTitle (title);
}
// **** setup DB observer!
@ -510,7 +510,7 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick
CViewText *viewText= dynamic_cast<CViewText*>(itemReqLineGroup->getView(FaberPhraseText));
if(viewText)
{
ucstring text;
string text;
if(mpBuild.RequirementType==CMPBuild::ItemPartReq)
{
text= CI18N::get("uihelpFaberMpHeader");
@ -524,7 +524,7 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick
{
nlstop;
}
viewText->setText( text.toUtf8() );
viewText->setText(text);
}
// Set as Icon the required MP FaberType / or Sheet Texture (directly...)
@ -570,9 +570,9 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick
if(window)
{
// Setup the Title with the item built
ucstring title= CI18N::get("uiPhraseFaberExecute");
string title= CI18N::get("uiPhraseFaberExecute");
strFindReplace(title, "%item", STRING_MANAGER::CStringManagerClient::getItemLocalizedName(_ExecuteFromItemPlanBrick->FaberPlan.ItemBuilt) );
window->setUCTitle (title);
window->setTitle (title);
}
@ -1687,7 +1687,7 @@ void CActionPhraseFaber::updateItemResult()
CViewText *successView= dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(FaberPhraseFpSuccessText));
if(successView)
{
ucstring text= CI18N::get("uiPhraseFaberSuccessRate");
string text= CI18N::get("uiPhraseFaberSuccessRate");
// Get the success rate of the related phrase
uint phraseSlot= pPM->getMemorizedPhrase(_ExecuteFromMemoryLine, _ExecuteFromMemoryIndex);
@ -1725,7 +1725,7 @@ void CActionPhraseFaber::updateItemResult()
+ "@{FFFF})";
}
strFindReplace(text, "%success", successStr );
successView->setTextFormatTaged(text.toUtf8());
successView->setTextFormatTaged(text);
}

@ -71,10 +71,10 @@ class CHandlerGuildCreate : public IActionHandler
CGroupEditBox *pDesc = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(guildDescWin));
ucstring guildName = pGEB->getInputStringAsUtf16();
ucstring guildName = pGEB->getInputStringAsUtf16(); // FIXME: UTF-8 (serial)
ucstring guildDesc;
if (pDesc != NULL) guildDesc = pDesc->getInputStringAsUtf16();
ucstring guildDesc; // FIXME: UTF-8 (serial)
if (pDesc != NULL) guildDesc = pDesc->getInputStringAsUtf16(); // FIXME: UTF-8 (serial)
uint64 icon = CGuildManager::iconMake((uint8)pCS->getGuildBack(), (uint8)pCS->getGuildSymbol(),
pCS->getInvertGuildSymbol(), pCS->getGuildColor1(), pCS->getGuildColor2());

@ -250,7 +250,7 @@ void CBotChatPageTrade::begin()
if (gc)
{
// set the title
gc->setUCTitle(_Title);
gc->setTitle(_Title);
// show the buy mean
CInterfaceGroup *money = dynamic_cast<CInterfaceGroup *>(gc->getGroup("money"));
if (money) money->setActive((_BuyMean == Money) || (_BuyMean == MoneyFactionPoints));
@ -1011,9 +1011,9 @@ void CBotChatPageTrade::startSellDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCal
CViewText *itemNameView = dynamic_cast<CViewText *>(ig->getView("object_name"));
if (itemNameView)
{
ucstring itemName;
string itemName;
itemName = sheet->getItemActualName();
itemNameView->setText(itemName.toUtf8());
itemNameView->setText(itemName);
}
// set help for item
@ -1678,16 +1678,16 @@ void CBotChatPageTrade::setupFactionPointPrice(bool /* sellMode */, uint default
CViewText *vt= dynamic_cast<CViewText*>(fpGroup->getView("unit_price_header"));
if(vt)
{
ucstring fmt= CI18N::get("uiUnitFPPrice");
string fmt= CI18N::get("uiUnitFPPrice");
strFindReplace(fmt, "%fac", factionName);
vt->setText(fmt.toUtf8());
vt->setText(fmt);
}
vt= dynamic_cast<CViewText*>(fpGroup->getView("total_price_header"));
if(vt)
{
ucstring fmt= CI18N::get("uiTotalFPPrice");
string fmt= CI18N::get("uiTotalFPPrice");
strFindReplace(fmt, "%fac", factionName);
vt->setText(fmt.toUtf8());
vt->setText(fmt);
}
// setup icon according to pvp clan

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

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

@ -156,14 +156,14 @@ static CInterfaceGroup *buildLineWithCommand(CInterfaceGroup *commandGroup, CVie
return group;
}
static inline bool isUrlTag(const ucstring &s, ucstring::size_type index, ucstring::size_type textSize)
static inline bool isUrlTag(const string &s, string::size_type index, string::size_type textSize)
{
// Format http://, https://
// or markdown style (title)[http://..]
if(textSize > index+7)
{
bool markdown = false;
ucstring::size_type i = index;
string::size_type i = index;
// advance index to url section if markdown style link is detected
if (s[i] == '(')
{
@ -188,7 +188,7 @@ static inline bool isUrlTag(const ucstring &s, ucstring::size_type index, ucstri
if (textSize > i + 7)
{
bool isUrl = (toLower(s.substr(i, 7)) == ucstring("http://") || toLower(s.substr(i, 8)) == ucstring("https://"));
bool isUrl = (toLower(s.substr(i, 7)) == "http://" || toLower(s.substr(i, 8)) == "https://");
// match "text http://" and not "texthttp://"
if (isUrl && i > 0 && !markdown)
{

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

@ -135,10 +135,7 @@ bool CChatWindow::create(const CChatWindowDesc &desc, const std::string &chatId)
return false;
}
_Chat->setLocalize (desc.Localize);
if (desc.Localize)
_Chat->setTitle(desc.Title.toString());
else
_Chat->setUCTitle(desc.Title);
_Chat->setTitle(desc.Title);
_Chat->setSavable(desc.Savable);
// groups like system info don't have edit box.
@ -259,12 +256,12 @@ void CChatWindow::setMenu(const std::string &menuName)
}
//=================================================================================
void CChatWindow::setPrompt(const ucstring &prompt)
void CChatWindow::setPrompt(const string &prompt)
{
if (!_Chat) return;
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(_Chat->getGroup("eb"));
if (!eb) return;
eb->setPrompt(prompt.toUtf8());
eb->setPrompt(prompt);
}
void CChatWindow::setPromptColor(NLMISC::CRGBA col)
@ -312,7 +309,7 @@ void CChatWindow::deleteContainer()
}
//=================================================================================
bool CChatWindow::rename(const ucstring &newName, bool newNameLocalize)
bool CChatWindow::rename(const string &newName, bool newNameLocalize)
{
return getChatWndMgr().rename(getTitle(), newName, newNameLocalize);
}
@ -354,30 +351,23 @@ void CChatWindow::setCommand(const std::string &command, bool execute)
_EB->setCommand(command, execute);
}
void CChatWindow::setCommand(const ucstring &command,bool execute)
{
if (!_EB) return;
_EB->setCommand(command.toUtf8(), execute);
}
//=================================================================================
void CChatWindow::setEntry(const ucstring &entry)
void CChatWindow::setEntry(const string &entry)
{
if (!_EB) return;
_EB->setInputStringAsUtf16(entry);
_EB->setInputString(entry);
}
//=================================================================================
ucstring CChatWindow::getTitle() const
string CChatWindow::getTitle() const
{
if (!_Chat)
{
return ucstring("");
return string();
}
else
{
return _Chat->getUCTitle();
return _Chat->getTitle();
}
}
@ -472,7 +462,7 @@ void CChatWindow::setHeaderColor(const std::string &n)
}
//=================================================================================
void CChatWindow::displayLocalPlayerTell(const ucstring &receiver, const ucstring &msg, uint numBlinks /*= 0*/)
void CChatWindow::displayLocalPlayerTell(const string &receiver, const string &msg, uint numBlinks /*= 0*/)
{
string finalMsg;
CInterfaceProperty prop;
@ -483,10 +473,10 @@ void CChatWindow::displayLocalPlayerTell(const ucstring &receiver, const ucstrin
finalMsg += csr + CI18N::get("youTell") + ": ";
prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," ");
encodeColorTag(prop.getRGBA(), finalMsg, true);
finalMsg += msg.toUtf8();
finalMsg += msg;
string s = CI18N::get("youTellPlayer");
strFindReplace(s, "%name", receiver.toUtf8());
strFindReplace(s, "%name", receiver);
strFindReplace(finalMsg, CI18N::get("youTell"), s);
displayMessage(finalMsg, prop.getRGBA(), CChatGroup::tell, 0, numBlinks);
CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell));
@ -627,7 +617,7 @@ void CChatGroupWindow::displayMessage(const string &msg, NLMISC::CRGBA col, CCha
prefix = (title.empty() ? "" : " ") + title;
pos = newmsg.find("] ");
if (pos == ucstring::npos)
if (pos == string::npos)
newmsg = prefix + newmsg;
else
newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos);
@ -730,13 +720,13 @@ const string CChatGroupWindow::getValidUiStringId(const string &stringId)
}
//=================================================================================
CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, const string &winColor)
CGroupContainer *CChatGroupWindow::createFreeTeller(const string &winNameIn, const string &winColor)
{
// must parse the entity name, and eventually make it Full with shard name (eg: 'ani.yoyo' becomes 'yoyo(Aniro)')
string winNameFull= CShardNames::getInstance().makeFullNameFromRelative(PlayerSelectedMainland, winNameIn.toString());
string winNameFull= CShardNames::getInstance().makeFullNameFromRelative(PlayerSelectedMainland, winNameIn);
// remove shard name if necessary
ucstring winName= CEntityCL::removeShardFromName(winNameFull);
string winName= CEntityCL::removeShardFromName(winNameFull);
// get the color
string sWinColor = winColor;
@ -745,12 +735,12 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c
// Look if the free teller do not already exists
uint32 i;
string sWinName = winName.toString();
string sWinName = winName;
sWinName = toLower(sWinName);
for (i = 0; i < _FreeTellers.size(); ++i)
{
CGroupContainer *pGC = _FreeTellers[i];
if (toLower(pGC->getUCTitle().toString()) == sWinName)
if (toLower(pGC->getTitle()) == sWinName)
break;
}
// Create container if not present
@ -772,11 +762,11 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c
if (!pGC)
{
delete pIG;
nlwarning("<CChatGroupWindow::createFreeTeller> group is not a container.(%s)", winName.toString().c_str());
nlwarning("<CChatGroupWindow::createFreeTeller> group is not a container.(%s)", winName.c_str());
return NULL;
}
// set title from the name
pGC->setUCTitle(winName);
pGC->setTitle(winName);
//
pGC->setSavable(true);
pGC->setEscapable(true);
@ -834,7 +824,7 @@ void CChatGroupWindow::updateAllFreeTellerHeaders()
//=================================================================================
void CChatGroupWindow::updateFreeTellerHeader(CGroupContainer &ft)
{
ucstring name = ft.getUCTitle();
string name = ft.getTitle();
CCtrlBaseButton *newFriendBut = dynamic_cast<CCtrlBaseButton *>(ft.getCtrl("new_friend"));
CCtrlBaseButton *ignoreBut = dynamic_cast<CCtrlBaseButton *>(ft.getCtrl("ignore"));
CCtrlBaseButton *inviteBut = dynamic_cast<CCtrlBaseButton *>(ft.getCtrl("invite"));
@ -868,7 +858,7 @@ void CChatGroupWindow::updateFreeTellerHeader(CGroupContainer &ft)
}
//=================================================================================
void CChatGroupWindow::setActiveFreeTeller(const ucstring &winName, bool bActive)
void CChatGroupWindow::setActiveFreeTeller(const string &winName, bool bActive)
{
CGroupContainer *pGC = createFreeTeller(winName);
if (pGC != NULL)
@ -932,7 +922,7 @@ void CChatGroupWindow::removeAllFreeTellers()
//=================================================================================
void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f)
{
f.serialVersion(2);
f.serialVersion(3);
// Save the free teller only if it is present in the friend list to avoid the only-growing situation
// because free tellers are never deleted in game if we save/load all the free tellers, we just create more
@ -940,7 +930,7 @@ void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f)
uint32 i, nNbFreeTellerSaved = 0;
for (i = 0; i < _FreeTellers.size(); ++i)
if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getUCTitle()) != -1)
if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getTitle()) != -1)
nNbFreeTellerSaved++;
f.serial(nNbFreeTellerSaved);
@ -949,9 +939,9 @@ void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f)
{
CGroupContainer *pGC = _FreeTellers[i];
if (PeopleInterraction.FriendList.getIndexFromName(pGC->getUCTitle()) != -1)
if (PeopleInterraction.FriendList.getIndexFromName(pGC->getTitle()) != -1)
{
ucstring sTitle = pGC->getUCTitle();
string sTitle = pGC->getTitle();
f.serial(sTitle);
}
}
@ -960,7 +950,7 @@ void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f)
//=================================================================================
void CChatGroupWindow::loadFreeTeller(NLMISC::IStream &f)
{
sint ver = f.serialVersion(2);
sint ver = f.serialVersion(3);
if (ver == 1)
{
@ -980,10 +970,15 @@ void CChatGroupWindow::loadFreeTeller(NLMISC::IStream &f)
string sID;
f.serial(sID);
}
ucstring sTitle;
f.serial(sTitle);
string title;
if (ver < 3)
{
ucstring sTitle; // Old UTF-16 serial
f.serial(sTitle);
title = sTitle.toUtf8();
}
CGroupContainer *pGC = createFreeTeller(sTitle, "");
CGroupContainer *pGC = createFreeTeller(title, "");
// With version 1 all tells are active because windows information have "title based" ids and no "sID based".
if ((ver == 1) && (pGC != NULL))
@ -1161,7 +1156,7 @@ CChatWindow *CChatWindowManager::createChatGroupWindow(const CChatWindowDesc &de
}
//=================================================================================
CChatWindow *CChatWindowManager::getChatWindow(const ucstring &title)
CChatWindow *CChatWindowManager::getChatWindow(const string &title)
{
TChatWindowMap::iterator it = _ChatWindowMap.find(title);
if (it == _ChatWindowMap.end())
@ -1174,12 +1169,12 @@ CChatWindow *CChatWindowManager::getChatWindow(const ucstring &title)
}
//=================================================================================
void CChatWindowManager::removeChatWindow(const ucstring &title)
void CChatWindowManager::removeChatWindow(const string &title)
{
TChatWindowMap::iterator it = _ChatWindowMap.find(title);
if (it == _ChatWindowMap.end())
{
nlwarning("Unknown chat window '%s'", title.toUtf8().c_str());
nlwarning("Unknown chat window '%s'", title.c_str());
return;
}
it->second->deleteContainer();
@ -1208,11 +1203,11 @@ CChatWindow *CChatWindowManager::getChatWindowFromCaller(CCtrlBase *caller)
}
if (!father) return NULL;
return getChatWindow(father->getUCTitle());
return getChatWindow(father->getTitle());
}
//=================================================================================
bool CChatWindowManager::rename(const ucstring &oldName, const ucstring &newName, bool newNameLocalize)
bool CChatWindowManager::rename(const string &oldName, const string &newName, bool newNameLocalize)
{
// if (oldName == newName) return true;
CChatWindow *newWin = getChatWindow(newName);
@ -1220,8 +1215,8 @@ bool CChatWindowManager::rename(const ucstring &oldName, const ucstring &newName
TChatWindowMap::iterator it = _ChatWindowMap.find(oldName);
if (it == _ChatWindowMap.end()) return false;
_ChatWindowMap[newName] = it->second;
it->second->getContainer()->setLocalize(false);
it->second->getContainer()->setTitle(newName.toUtf8());
it->second->getContainer()->setLocalize(newNameLocalize);
it->second->getContainer()->setTitle(newName);
_ChatWindowMap.erase(it);
return true;
}
@ -1334,13 +1329,13 @@ REGISTER_ACTION_HANDLER(CHandlerChatBoxEntry, "chat_box_entry");
static ucstring getFreeTellerName(CInterfaceElement *pCaller)
static string getFreeTellerName(CInterfaceElement *pCaller)
{
if (!pCaller) return ucstring();
if (!pCaller) return string();
CChatGroupWindow *cgw = PeopleInterraction.getChatGroupWindow();
if (!cgw) return ucstring();
if (!cgw) return string();
CInterfaceGroup *freeTeller = pCaller->getParentContainer();
if (!freeTeller) return ucstring();
if (!freeTeller) return string();
return cgw->getFreeTellerName( freeTeller->getId() );
}
@ -1350,7 +1345,7 @@ class CHandlerAddTellerToFriendList : public IActionHandler
public:
void execute (CCtrlBase *pCaller, const std::string &/* sParams */)
{
ucstring playerName = ::getFreeTellerName(pCaller);
string playerName = ::getFreeTellerName(pCaller);
if (!playerName.empty())
{
sint playerIndex = PeopleInterraction.IgnoreList.getIndexFromName(playerName);
@ -1378,7 +1373,7 @@ public:
CInterfaceManager *im = CInterfaceManager::getInstance();
std::string callerId = getParam(sParams, "id");
CInterfaceElement *prevCaller = CWidgetManager::getInstance()->getElementFromId(callerId);
ucstring playerName = ::getFreeTellerName(prevCaller);
string playerName = ::getFreeTellerName(prevCaller);
if (!playerName.empty())
{
// if already in friend list, ask to move rather than add
@ -1410,7 +1405,7 @@ class CHandlerInviteToRingSession : public IActionHandler
public:
void execute (CCtrlBase *pCaller, const std::string &/* sParams */)
{
string playerName = ::getFreeTellerName(pCaller).toUtf8();
string playerName = ::getFreeTellerName(pCaller);
if (!playerName.empty())
{
// ask the SBS to invite the character in the session

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

@ -102,9 +102,9 @@ void CControlSheetInfoWaiter::infoReceived()
}
ucstring CControlSheetInfoWaiter::infoValidated() const
string CControlSheetInfoWaiter::infoValidated() const
{
ucstring help;
ucstring help; // FIXME: Lua UTF-8
if (CtrlSheet && !LuaMethodName.empty())
{
// delegate setup of context he help ( & window ) to lua
@ -131,7 +131,7 @@ ucstring CControlSheetInfoWaiter::infoValidated() const
}
}
return help;
return help.toUtf8();
}
// ***************************************************************************
@ -1659,7 +1659,7 @@ void CDBCtrlSheet::setupSBrick ()
}
// ***************************************************************************
void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector<NLMISC::CSheetId> &bricks, const ucstring &phraseName)
void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector<NLMISC::CSheetId> &bricks, const string &phraseName)
{
CSBrickManager *pBM = CSBrickManager::getInstance();
@ -1712,7 +1712,7 @@ void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector<NLMISC::CSheetId> &bri
{
// Compute the text from the phrase only if needed
// string iconName= phraseName.toString();
string iconName= phraseName.toUtf8();
const string &iconName = phraseName;
if( _NeedSetup || iconName != _OptString )
{
// recompute text
@ -1735,7 +1735,7 @@ void CDBCtrlSheet::setupSPhrase()
CSPhraseSheet *pSPS = dynamic_cast<CSPhraseSheet*>(SheetMngr.get(CSheetId(sheet)));
if (pSPS && !pSPS->Bricks.empty())
{
const ucstring phraseName(STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(CSheetId(sheet)));
const char *phraseName = STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(CSheetId(sheet));
setupDisplayAsPhrase(pSPS->Bricks, phraseName);
}
else
@ -1793,7 +1793,7 @@ void CDBCtrlSheet::setupSPhraseId ()
}
else
{
setupDisplayAsPhrase(phrase.Bricks, phrase.Name);
setupDisplayAsPhrase(phrase.Bricks, phrase.Name.toUtf8()); // FIXME: UTF-8 (serial)
}
}
@ -3388,22 +3388,22 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const
if (!macro)
return;
ucstring macroName = macro->Name;
string macroName = macro->Name;
if (macroName.empty())
macroName = CI18N::get("uiNotAssigned");
ucstring assignedTo = macro->Combo.toString();
string assignedTo = macro->Combo.toString();
if (assignedTo.empty())
assignedTo = CI18N::get("uiNotAssigned");
ucstring dispText;
ucstring dispCommands;
string dispText;
string dispCommands;
const CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();
uint nb = 0;
for (uint i = 0; i < macro->Commands.size(); ++i)
{
ucstring commandName;
string commandName;
for (uint j = 0; j < pMCM->ActionManagers.size(); ++j)
{
CAction::CName c(macro->Commands[i].Name.c_str(), macro->Commands[i].Params.c_str());
@ -3419,14 +3419,14 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const
}
}
// formats
dispText = ucstring("%n (@{6F6F}%k@{FFFF})\n%c");
dispText = "%n (@{6F6F}%k@{FFFF})\n%c";
if (nb > 5) // more?
dispCommands += toString(" ... @{6F6F}%i@{FFFF}+", nb-5);
strFindReplace(dispText, ucstring("%n"), macroName);
strFindReplace(dispText, ucstring("%k"), assignedTo);
strFindReplace(dispText, ucstring("%c"), dispCommands);
help = dispText.toUtf8();
strFindReplace(dispText, "%n", macroName);
strFindReplace(dispText, "%k", assignedTo);
strFindReplace(dispText, "%c", dispCommands);
help = dispText;
}
else if(getType() == CCtrlSheetInfo::SheetType_Item)
{
@ -3437,10 +3437,10 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const
{
// call lua function to update tooltip window
_ItemInfoWaiter.sendRequest();
help = _ItemInfoWaiter.infoValidated().toUtf8();
help = _ItemInfoWaiter.infoValidated();
// its expected to get at least item name back
if (help.empty())
help = getItemActualName().toUtf8();
help = getItemActualName();
}
else if (!_ContextHelp.empty())
{
@ -3448,7 +3448,7 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const
}
else
{
help = getItemActualName().toUtf8();;
help = getItemActualName();;
}
}
else
@ -3506,11 +3506,11 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const
game = game["game"];
game.callMethodByNameNoThrow("updatePhraseTooltip", 1, 1);
// retrieve result from stack
ucstring tmpHelp;
ucstring tmpHelp; // FIXME: Lua UTF-8
if (!ls->empty())
{
CLuaIHM::pop(*ls, tmpHelp); // FIXME: Lua UTF-8
help = tmpHelp.toUtf8();
help = tmpHelp.toUtf8(); // FIXME: Lua UTF-8
}
else
{
@ -3531,10 +3531,10 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const
if (phraseSheetID != 0)
{
// is it a built-in phrase?
ucstring desc = STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId(phraseSheetID));
string desc = STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId(phraseSheetID));
if (!desc.empty())
{
help += ucstring("\n\n@{CCCF}") + desc;
help += "\n\n@{CCCF}" + desc;
}
}
*/
@ -3569,7 +3569,7 @@ void CDBCtrlSheet::getContextHelpToolTip(std::string &help) const
if (useItemInfoForFamily(item->Family))
{
_ItemInfoWaiter.sendRequest();
help = _ItemInfoWaiter.infoValidated().toUtf8();
help = _ItemInfoWaiter.infoValidated();
return;
}
}
@ -4557,11 +4557,11 @@ void CDBCtrlSheet::initArmourColors()
// ***************************************************************************
ucstring CDBCtrlSheet::getItemActualName() const
string CDBCtrlSheet::getItemActualName() const
{
const CItemSheet *pIS= asItemSheet();
if(!pIS)
return ucstring();
return string();
else
{
string ret;
@ -4581,7 +4581,7 @@ ucstring CDBCtrlSheet::getItemActualName() const
if (pIS->Family == ITEMFAMILY::SCROLL_R2)
{
const R2::TMissionItem *mi = R2::getEditor().getPlotItemInfos(getSheetId());
if (mi) return mi->Name;
if (mi) return mi->Name.toUtf8();
}
// if item is not a mp, append faber_quality & faber_stat_type
// Don't append quality and stat type for Named Items!!!

@ -73,7 +73,7 @@ public:
: IItemInfoWaiter(), Requesting(false)
{ }
public:
ucstring infoValidated() const;
std::string infoValidated() const;
void sendRequest();
virtual void infoReceived();
};
@ -582,7 +582,7 @@ public:
void setItemColor(sint32 val) {if(_UserColor) _UserColor->setValue32(val);}
// Get the Actual item name. Localized version of SheetId, or given by server through NAMEID.
ucstring getItemActualName() const;
std::string getItemActualName() const;
/// true if support drag copy (with CTRL). action handler has to check control.
bool canDragCopy() const {return _DragCopy;}
@ -626,7 +626,7 @@ protected:
// optSheet is for special faber
void setupDisplayAsSBrick(sint32 sheet, sint32 optSheet= 0);
// setup icon from phrases
void setupDisplayAsPhrase(const std::vector<NLMISC::CSheetId> &bricks, const ucstring &phraseName);
void setupDisplayAsPhrase(const std::vector<NLMISC::CSheetId> &bricks, const std::string &phraseName);
// draw a number and returns the width of the drawn number
sint32 drawNumber(sint32 x, sint32 y, sint32 wSheet, sint32 hSheet, NLMISC::CRGBA color, sint32 value, bool rightAlign=true);

@ -296,7 +296,7 @@ void CDBGroupBuildPhrase::startComposition(const CSPhraseCom &phrase)
CSBrickManager *pBM= CSBrickManager::getInstance();
ucstring name;
string name;
// if phrase empty (new phrase), invent a new name
if(phrase.empty())
@ -310,7 +310,7 @@ void CDBGroupBuildPhrase::startComposition(const CSPhraseCom &phrase)
else
{
// copy name
name= phrase.Name;
name= phrase.Name.toUtf8();
// get the root Brick. Must exist.
CSBrickSheet *rootBrick= pBM->getBrick(phrase.Bricks[0]);
@ -1242,9 +1242,9 @@ void CDBGroupBuildPhrase::updateAllDisplay(const CSPhraseCom &phrase)
// **** Setup the phrase Desc
if(_TextPhraseDesc)
{
ucstring text;
string text;
pPM->buildPhraseDesc(text, phrase, 0, false, "composition");
_TextPhraseDesc->setTextFormatTaged(text.toUtf8());
_TextPhraseDesc->setTextFormatTaged(text);
}

@ -136,13 +136,13 @@ void CDBGroupListSheetIconPhrase::setSectionGroupId(CInterfaceGroup *pIG, uin
CViewText *name = dynamic_cast<CViewText*>(pIG->getView("name"));
if (name != NULL)
{
ucstring sectionText= CI18N::get("uiPhraseSectionFmt");
string sectionText= CI18N::get("uiPhraseSectionFmt");
uint32 minLevel, maxLevel;
CSPhraseManager *pPM= CSPhraseManager::getInstance();
pPM->getPhraseLevelFromSection(sectionId, minLevel, maxLevel);
strFindReplace(sectionText, "%min", toString(minLevel));
strFindReplace(sectionText, "%max", toString(maxLevel));
name->setText (sectionText.toUtf8());
name->setText (sectionText);
}
}

@ -36,7 +36,7 @@ public:
// A child node
struct CSheetChildMission : public CDBGroupListSheetText::CSheetChild
{
virtual void updateText(CDBGroupListSheetText * /* pFather */, ucstring &/* text */) {}
//virtual void updateText(CDBGroupListSheetText * /* pFather */, std::string &/* text */) {}
virtual CViewText *createViewText() const;
virtual void updateViewText(CDBGroupListSheetText *pFather);
virtual bool isInvalidated(CDBGroupListSheetText *pFather);

@ -110,11 +110,11 @@ void CDBGroupListSheetTextBrickComposition::CSheetChildBrick::init(CDBGroupListS
// ***************************************************************************
bool hasOnlyBlankChars(const ucstring &str)
bool hasOnlyBlankChars(const char *str)
{
for(uint i=0;i!=str.size();++i)
for (ptrdiff_t i = 0; str[i]; ++i)
{
if(str[i]!=' ')
if (str[i] != ' ')
return false;
}
@ -128,20 +128,20 @@ void CDBGroupListSheetTextBrickComposition::CSheetChildBrick::updateViewText(CDB
CSBrickManager *pBM= CSBrickManager::getInstance();
CDBGroupListSheetTextBrickComposition *compoList= (CDBGroupListSheetTextBrickComposition*)pFather;
ucstring text;
string text;
if(Ctrl->getType()!=CCtrlSheetInfo::SheetType_SBrick)
return;
// Get the compo description of the phrase (Desc2)
CSheetId brickSheetId= CSheetId(Ctrl->getSheetId());
// Temp if the Desc2 is empty, set Name
ucstring desc2(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedCompositionDescription(brickSheetId));
if( !desc2.empty() && !hasOnlyBlankChars(desc2)) // tolerate Blank error in translation
Text->setText(desc2.toUtf8());
const char *desc2(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedCompositionDescription(brickSheetId));
if( *desc2 && !hasOnlyBlankChars(desc2)) // tolerate Blank error in translation
Text->setText(desc2);
else
{
desc2 = STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(brickSheetId);
Text->setText(desc2.toUtf8());
Text->setText(desc2);
}

@ -168,13 +168,13 @@ void CDBGroupListSheetTextPhrase::setSectionGroupId(CInterfaceGroup *pIG, uin
CViewText *name = dynamic_cast<CViewText*>(pIG->getView("name"));
if (name != NULL)
{
ucstring sectionText= CI18N::get("uiPhraseSectionFmt");
string sectionText= CI18N::get("uiPhraseSectionFmt");
uint32 minLevel, maxLevel;
CSPhraseManager *pPM= CSPhraseManager::getInstance();
pPM->getPhraseLevelFromSection(sectionId, minLevel, maxLevel);
strFindReplace(sectionText, "%min", toString(minLevel));
strFindReplace(sectionText, "%max", toString(maxLevel));
name->setText (sectionText.toUtf8());
name->setText (sectionText);
}
}

@ -281,15 +281,15 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT
if(Ctrl->getSheetCategory() == CDBCtrlSheet::Phrase)
{
// For combat action, Append weapon restriction
ucstring weaponRestriction;
string weaponRestriction;
CSPhraseManager *pPM= CSPhraseManager::getInstance();
bool melee,range;
pPM->getCombatWeaponRestriction(weaponRestriction, Ctrl->getSheetId(),melee,range);
// don't add also if no combat restriction
if(!weaponRestriction.empty() && weaponRestriction!=CI18N::getAsUtf16("uiawrSF"))
if(!weaponRestriction.empty() && weaponRestriction!=CI18N::get("uiawrSF"))
{
weaponRestriction= CI18N::get("uiPhraseWRHeader") + weaponRestriction;
text+= "\n" + weaponRestriction.toUtf8();
text+= "\n" + weaponRestriction;
}
}
@ -432,7 +432,7 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT
// else display the name of the vendor (not if this is the player himself, to avoid flood)
else if (LastSellerType == BOTCHATTYPE::Resale)
{
text+= "\n" + CI18N::get("uiBotChatVendorTag") + VendorNameString.toUtf8();
text+= "\n" + CI18N::get("uiBotChatVendorTag") + VendorNameString;
}
}
}

@ -96,7 +96,7 @@ public:
CInterfaceProperty CurrentVendorNameId;
CInterfaceProperty CurrentFactionType;
CInterfaceProperty CurrentFactionPointPrice;
ucstring VendorNameString;
std::string VendorNameString;
virtual void init(CDBGroupListSheetText *pFather, uint index);
virtual bool isInvalidated(CDBGroupListSheetText *pFather);

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

@ -750,8 +750,8 @@ void CGroupCompasMenu::setActive (bool state)
/*CEntityCL *entity = EntitiesMngr.entity(UserEntity->selection());
if (entity != NULL)
{*/
//ucstring targetName = CI18N::get("uiTargetTwoPoint") + entity->removeTitleAndShardFromName(entity->getEntityName());
std::string targetName = CI18N::get("uiTarget");
//string targetName = CI18N::get("uiTargetTwoPoint") + entity->removeTitleAndShardFromName(entity->getEntityName());
string targetName = CI18N::get("uiTarget");
ct.setType(CCompassTarget::Selection);
ct.Name = targetName;
Targets.push_back(ct);

@ -58,7 +58,7 @@ CGroupHTMLForum::~CGroupHTMLForum()
void CGroupHTMLForum::addHTTPGetParams (string &url, bool /*trustedDomain*/)
{
ucstring user_name = UserEntity->getLoginName ();
string user_name = UserEntity->getLoginName ();
const SGuild &guild = CGuildManager::getInstance()->getGuild();
string gname = guild.Name;
@ -76,7 +76,7 @@ void CGroupHTMLForum::addHTTPGetParams (string &url, bool /*trustedDomain*/)
url += ((url.find('?') != string::npos) ? "&" : "?") +
string("shard=") + toString(CharacterHomeSessionId) +
string("&user_login=") + user_name.toString() +
string("&user_login=") + user_name +
string("&forum=") + gname +
string("&session_cookie=") + NetMngr.getLoginCookie().toString();
}
@ -90,14 +90,14 @@ void CGroupHTMLForum::addHTTPGetParams (string &url, bool /*trustedDomain*/)
void CGroupHTMLForum::addHTTPPostParams (SFormFields &formfields, bool /*trustedDomain*/)
{
ucstring user_name = UserEntity->getLoginName ();
string user_name = UserEntity->getLoginName ();
const SGuild &guild = CGuildManager::getInstance()->getGuild();
string gname = guild.Name;
if (!gname.empty())
{
formfields.add("shard", toString(CharacterHomeSessionId));
formfields.add("user_login", user_name.toString());
formfields.add("user_login", user_name);
formfields.add("forum", gname);
formfields.add("session_cookie", NetMngr.getLoginCookie().toString());
}

@ -57,10 +57,10 @@ CGroupHTMLMail::~CGroupHTMLMail()
void CGroupHTMLMail::addHTTPGetParams (string &url, bool /*trustedDomain*/)
{
ucstring user_name = UserEntity->getLoginName ();
string user_name = UserEntity->getLoginName ();
url += ((url.find('?') != string::npos) ? "&" : "?") +
string("shard=") + toString(CharacterHomeSessionId) +
string("&user_login=") + user_name.toString() +
string("&user_login=") + user_name + // FIXME: UrlEncode
string("&session_cookie=") + NetMngr.getLoginCookie().toString() +
string("&lang=") + CI18N::getCurrentLanguageCode();
}
@ -69,9 +69,9 @@ void CGroupHTMLMail::addHTTPGetParams (string &url, bool /*trustedDomain*/)
void CGroupHTMLMail::addHTTPPostParams (SFormFields &formfields, bool /*trustedDomain*/)
{
ucstring user_name = UserEntity->getLoginName ();
string user_name = UserEntity->getLoginName ();
formfields.add("shard", toString(CharacterHomeSessionId));
formfields.add("user_login", user_name.toString());
formfields.add("user_login", user_name); // FIXME: UrlEncode
formfields.add("session_cookie", NetMngr.getLoginCookie().toString());
formfields.add("lang", CI18N::getCurrentLanguageCode());
}

@ -66,7 +66,7 @@ static string getWebAuthKey()
// authkey = <sharid><name><cid><cookie>
uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot;
string rawKey = toString(CharacterHomeSessionId) +
UserEntity->getLoginName().toString() +
UserEntity->getLoginName() +
toString(cid) +
NetMngr.getLoginCookie().toString();
string key = getMD5((const uint8*)rawKey.c_str(), (uint32)rawKey.size()).toString();
@ -85,7 +85,7 @@ void addWebIGParams (string &url, bool trustedDomain)
uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot;
url += ((url.find('?') != string::npos) ? "&" : "?") +
string("shardid=") + toString(CharacterHomeSessionId) +
string("&name=") + UserEntity->getLoginName().toUtf8() +
string("&name=") + UserEntity->getLoginName() + // FIXME: UrlEncode
string("&lang=") + CI18N::getCurrentLanguageCode() +
string("&datasetid=") + toString(UserEntity->dataSetId()) +
string("&ig=1");
@ -384,7 +384,7 @@ void CGroupHTMLAuth::addHTTPPostParams (SFormFields &formfields, bool trustedDom
uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot;
formfields.add("shardid", toString(CharacterHomeSessionId));
formfields.add("name", UserEntity->getLoginName().toUtf8());
formfields.add("name", UserEntity->getLoginName());
formfields.add("lang", CI18N::getCurrentLanguageCode());
formfields.add("ig", "1");
if (trustedDomain)

@ -472,11 +472,11 @@ void CGroupInSceneBubbleManager::update ()
// Send to the around me window
// TODO must get the name of the bot etc...
/*
ucstring finalString = res;
string finalString = res;
for(;;)
{
std::string::size_type index = finalString.find (ucstring("{break}"));
if (index == ucstring::npos) break;
std::string::size_type index = finalString.find ("{break}");
if (index == string::npos) break;
finalString = finalString.substr (0, index) + finalString.substr(index+7,finalString.size());
}
@ -1311,6 +1311,7 @@ class CAHDynChatClickOption : public IActionHandler
uint32 optStrId = InSceneBubbleManager.dynChatGetOptionStringId(nBubbleNb, nOpt);
if (!optStrId) return;
#ifdef RYZOM_BG_DOWNLOADER
if (isBGDownloadEnabled())
{
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
@ -1330,6 +1331,7 @@ class CAHDynChatClickOption : public IActionHandler
}
}
}
#endif
static const string sMsg = "BOTCHAT:DYNCHAT_SEND";
CBitMemStream out;

@ -212,10 +212,10 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
entityTitle.clear();
}
ucstring entityTag1 = entity->getTag(1);
ucstring entityTag2 = entity->getTag(2);
ucstring entityTag3 = entity->getTag(3);
ucstring entityTag4 = entity->getTag(4);
string entityTag1 = entity->getTag(1);
string entityTag2 = entity->getTag(2);
string entityTag3 = entity->getTag(3);
string entityTag4 = entity->getTag(4);
string entityPermanentContent = entity->getPermanentStatutIcon();
@ -471,17 +471,17 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
{
bitmap = dynamic_cast<CViewBitmap*>(leftGroup->getView ("rp_logo_1"));
if (bitmap)
bitmap->setTexture(entityTag1.toString());
bitmap->setTexture(entityTag1);
bitmap = dynamic_cast<CViewBitmap*>(leftGroup->getView ("rp_logo_2"));
if (bitmap)
bitmap->setTexture(entityTag2.toString());
bitmap->setTexture(entityTag2);
}
bitmap = dynamic_cast<CViewBitmap*>(leftGroup->getView ("rp_logo_3"));
if (bitmap)
bitmap->setTexture(entityTag3.toString());
bitmap->setTexture(entityTag3);
bitmap = dynamic_cast<CViewBitmap*>(leftGroup->getView ("rp_logo_4"));
if (bitmap)
bitmap->setTexture(entityTag4.toString());
bitmap->setTexture(entityTag4);
}
// Get the permanent content bitmap
@ -959,14 +959,14 @@ void CGroupInSceneUserInfo::updateDynamicData ()
{
_Name->setColor(entityColor);
_Name->setModulateGlobalColor(false);
ucstring entityName = _Entity->getDisplayName();
string entityName = _Entity->getDisplayName();
if (entityName.empty())
entityName = _Entity->getTitle();
if (pPlayer != NULL)
if (pPlayer->isAFK())
entityName += CI18N::get("uiAFK");
_Name->setText(entityName.toUtf8());
_Name->setText(entityName);
// Title color get the PVP color
if (_Title)

@ -146,7 +146,7 @@ static void popupLandMarkNameDialog()
else
{
NLGUI::CDBManager::getInstance()->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(cb->getTextPos(CUserLandMark::Misc));
eb->setInputStringAsUtf16(ucstring());
eb->setInputString(string());
}
CWidgetManager::getInstance()->setCaptureKeyboard(eb);

@ -111,8 +111,8 @@ bool CGroupModalGetKey::handleEvent (const NLGUI::CEventDescriptor &event)
const CBaseAction *baseAction = pCurAM->getBaseAction(it->second);
if (baseAction && pCurAM->isActionPresentInContext(it->second))
{
ucstring shortcutName = baseAction->getActionLocalizedText(it->second);
if (pVT != NULL) pVT->setText(shortcutName.toUtf8());
string shortcutName = baseAction->getActionLocalizedText(it->second);
if (pVT != NULL) pVT->setText(shortcutName);
}
}
else

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

@ -1266,7 +1266,7 @@ class CHandlerInvGuildToBag : public IActionHandler
if (!bPlaceFound)
{
ucstring msg = CI18N::get("msgCantPutItemInBag");
string msg = CI18N::get("msgCantPutItemInBag");
string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat);
return;

@ -351,7 +351,7 @@ void CInterfaceDDX::CParam::updateScrollView(sint32 nVal)
{
if(ResultView)
{
ResultView->setText(toString(nVal) + ResultUnit.toUtf8());
ResultView->setText(toString(nVal) + ResultUnit);
}
}
@ -362,7 +362,7 @@ void CInterfaceDDX::CParam::updateScrollView(double nVal)
{
// allow N digits
string fmt= toString("%%.%df", ResultDecimal);
ResultView->setText(toString(fmt.c_str(), nVal) + ResultUnit.toUtf8());
ResultView->setText(toString(fmt.c_str(), nVal) + ResultUnit);
}
}

@ -79,7 +79,7 @@ private:
// The tex view, result of the scroll
CViewTextPtr ResultView;
// The unit to append to the result string
ucstring ResultUnit;
std::string ResultUnit;
// For ScrollBarFloat widget only
uint8 ResultDecimal;
// For ScrollBarFloat widget only

@ -626,11 +626,11 @@ static DECLARE_INTERFACE_USER_FCT(getChatWin)
CChatWindowManager &rCWM = CChatWindowManager::getInstance();
ucstring title = CI18N::get(args[0].getString());
string title = CI18N::get(args[0].getString());
CChatWindow *window = rCWM.getChatWindow(title);
if (!window)
{
nlwarning("Can't find window named %s", title.toString().c_str());
nlwarning("Can't find window named %s", title.c_str());
return false;
}
string sTmp = window->getContainer()->getId();

@ -313,7 +313,7 @@ static DECLARE_INTERFACE_USER_FCT(getSheetName)
// if from ctrlSheet, then take the correct ACTUAL name (ie from NAMEID if not 0)
if(ctrlSheet)
{
result.setString(ctrlSheet->getItemActualName().toUtf8());
result.setString(ctrlSheet->getItemActualName());
return true;
}
// Standard (but less accurate) way

@ -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.toUtf8(), PeopleInterraction.SystemMessageBuffer[i].Cat);
displaySystemInfo(PeopleInterraction.SystemMessageBuffer[i].Str, PeopleInterraction.SystemMessageBuffer[i].Cat);
}
PeopleInterraction.SystemMessageBuffer.clear();
@ -1529,7 +1529,7 @@ void CInterfaceManager::updateFrameEvents()
if ((T0 - _UpdateWeatherTime) > (1 * 3 * 1000))
{
_UpdateWeatherTime = T0;
ucstring str = CI18N::get ("uiTheSeasonIs") +
string str = CI18N::get ("uiTheSeasonIs") +
CI18N::get ("uiSeason"+toStringEnum(computeCurrSeason())) +
CI18N::get ("uiAndTheWeatherIs") +
CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName) +
@ -1539,7 +1539,7 @@ void CInterfaceManager::updateFrameEvents()
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather"));
if (pVT != NULL)
pVT->setText(str.toUtf8());
pVT->setText(str);
CCtrlBase *pTooltip= dynamic_cast<CCtrlBase*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather_tt"));
if (pTooltip != NULL)
@ -1573,7 +1573,7 @@ void CInterfaceManager::updateFrameEvents()
pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:time"));
if (pVT != NULL)
pVT->setText(str.toUtf8());
pVT->setText(str);
str.clear();
// Update the clock in the compass if enabled.
@ -1586,7 +1586,7 @@ void CInterfaceManager::updateFrameEvents()
str = getTimestampHuman("%I:%M %p");
else
str = getTimestampHuman("%H:%M");
pVT->setText(str.toUtf8());
pVT->setText(str);
}
}
}
@ -1607,7 +1607,9 @@ void CInterfaceManager::updateFrameEvents()
// handle gc for lua
CLuaManager::getInstance().getLuaState()->handleGC();
#ifdef RYZOM_BG_DOWNLOADER
CBGDownloaderAccess::getInstance().update();
#endif
CItemGroupManager::getInstance()->update();
@ -2388,7 +2390,7 @@ void CInterfaceManager::processServerIDString()
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucstring &text, const string &masterGroup, TCaseMode caseMode)
void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const string &text, const string &masterGroup, TCaseMode caseMode)
{
CInterfaceGroup *group= dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(masterGroup+":" + msgBoxGroup));
CViewText *viewText= dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(masterGroup+":" + msgBoxGroup + ":text"));
@ -2396,7 +2398,7 @@ void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucst
if (group && viewText)
{
viewText->setCaseMode(caseMode);
viewText->setText(text.toUtf8());
viewText->setText(text);
CWidgetManager::getInstance()->enableModalWindow(NULL, group);
// don't understand why but need to update coords here
group->updateCoords();
@ -2405,14 +2407,14 @@ void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucst
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::messageBox(const ucstring &text, const string &masterGroup, TCaseMode caseMode)
void CInterfaceManager::messageBox(const string &text, const string &masterGroup, TCaseMode caseMode)
{
messageBoxInternal("message_box", text, masterGroup, caseMode);
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::messageBoxWithHelp(const ucstring &text, const std::string &masterGroup,
void CInterfaceManager::messageBoxWithHelp(const std::string &text, const std::string &masterGroup,
const std::string &ahOnOk, const std::string &paramsOnOk,
TCaseMode caseMode)
{
@ -2434,7 +2436,7 @@ void CInterfaceManager::messageBoxWithHelp(const ucstring &text, const std::stri
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::validMessageBox(TValidMessageIcon icon, const ucstring &text, const std::string &ahOnOk,
void CInterfaceManager::validMessageBox(TValidMessageIcon icon, const std::string &text, const std::string &ahOnOk,
const std::string &paramsOnOk, const std::string &ahOnCancel, const std::string &paramsOnCancel, const string &masterGroup)
{
CInterfaceGroup *group= dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(masterGroup+":valid_message_box"));
@ -2449,7 +2451,7 @@ void CInterfaceManager::validMessageBox(TValidMessageIcon icon, const ucstring &
CWidgetManager::getInstance()->setProcedureAction("proc_valid_message_box_cancel", 1, ahOnCancel, paramsOnCancel);
// set text and icon
viewText->setText(text.toUtf8());
viewText->setText(text);
if(viewBitmap)
{
bool active= true;
@ -2977,7 +2979,7 @@ bool CInterfaceManager::deletePlayerKeys (const std::string &playerFileIdent)
}
// ***************************************************************************
void CInterfaceManager::log(const ucstring &str, const std::string &cat)
void CInterfaceManager::log(const std::string &str, const std::string &cat)
{
if (_LogState)
{
@ -2986,7 +2988,7 @@ void CInterfaceManager::log(const ucstring &str, const std::string &cat)
FILE *f = nlfopen(fileName, "at");
if (f != NULL)
{
const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " (" + NLMISC::toUpper(cat) + ") * " + str.toUtf8();
const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " (" + NLMISC::toUpper(cat) + ") * " + str;
fprintf(f, "%s\n", finalString.c_str());
fclose(f);
}
@ -3175,8 +3177,8 @@ struct CEmoteEntry
string::size_type pos1 = path1.find('|');
string::size_type pos2 = path2.find('|');
ucstring s1 = toUpper(CI18N::get(path1.substr(0, pos1)));
ucstring s2 = toUpper(CI18N::get(path2.substr(0, pos2)));
string s1 = toUpper(CI18N::get(path1.substr(0, pos1)));
string s2 = toUpper(CI18N::get(path2.substr(0, pos2)));
sint result = s1.compare(s2);
if (result != 0)
@ -3194,14 +3196,14 @@ struct CEmoteEntry
}
};
static bool translateEmote(const std::string &id, ucstring &translatedName, std::string &commandName, std::string &commandNameAlt)
static bool translateEmote(const std::string &id, std::string &translatedName, std::string &commandName, std::string &commandNameAlt)
{
if (CI18N::hasTranslation(id))
{
translatedName = CI18N::get(id);
// convert command to utf8 since emote translation can have strange chars
commandName = toLower(translatedName).toUtf8();
commandName = toLower(translatedName);
// replace all spaces by _
while (strFindReplace(commandName, " ", "_"));
@ -3300,7 +3302,7 @@ void CInterfaceManager::initEmotes()
CGroupSubMenu *pMenu = pRootMenu->getRootMenu();
nlassert(pMenu);
ucstring sTranslatedName;
std::string sTranslatedName;
std::string sCommandName;
std::string sCommandNameAlt;
@ -3344,7 +3346,7 @@ void CInterfaceManager::initEmotes()
translateEmote(sTmp, sTranslatedName, sCommandName, sCommandNameAlt);
// Create a line
pMenu->addLine (sTranslatedName.toUtf8() + " (/" + sCommandName + ")", "emote",
pMenu->addLine (sTranslatedName + " (/" + sCommandName + ")", "emote",
"nb="+toString(nEmoteNb)+"|behav="+toString(nBehav), sTmp);
}
}

@ -241,7 +241,7 @@ public:
// Log system (all chat/tell
void setLogState(bool state) { _LogState = state; }
bool getLogState() const { return _LogState; }
void log(const ucstring &str, const std::string &cat = "");
void log(const std::string &str, const std::string &cat = "");
/// Text from here and from server
@ -305,12 +305,12 @@ public:
/** Open a MessageBox. this is a simple ModalWindow with a Ok button
* ui:interface:message_box must be defined in xml, with a "text" ViewText son
*/
void messageBox(const ucstring &text, const std::string &masterGroup="ui:interface", TCaseMode caseMode = CaseFirstSentenceLetterUp);
void messageBox(const std::string &text, const std::string &masterGroup="ui:interface", TCaseMode caseMode = CaseFirstSentenceLetterUp);
/** Open a MessageBox. this is a simple ModalWindow with a Ok and a HELP button.
* The help button with open a browser on ryzom.com faq
* ui:interface:message_box_with_help must be defined in xml, with a "text" ViewText son
*/
void messageBoxWithHelp(const ucstring &text, const std::string &masterGroup="ui:interface",
void messageBoxWithHelp(const std::string &text, const std::string &masterGroup="ui:interface",
const std::string &ahOnOk = std::string(), const std::string &paramsOnOk= std::string(),
TCaseMode caseMode = CaseFirstSentenceLetterUp);
@ -321,7 +321,7 @@ public:
* \param ahOnCancel => the action handler to call if cancel is pressed. NB: you don't have to call leave_modal in this ah (auto done).
* \param paramsOnCancel => params passed to ahOnCancel.
*/
void validMessageBox(TValidMessageIcon icon, const ucstring &text, const std::string &ahOnOk, const std::string &paramsOnOk= std::string(),
void validMessageBox(TValidMessageIcon icon, const std::string &text, const std::string &ahOnOk, const std::string &paramsOnOk= std::string(),
const std::string &ahOnCancel= std::string(), const std::string &paramsOnCancel= std::string(), const std::string &masterGroup="ui:interface");
/** Get the current running validMessageBox OnOk action. empty if no validMessageBox currently opened
@ -446,7 +446,7 @@ public:
*/
static char* getTimestampHuman(const char* format = "[%H:%M:%S] ");
/** Parses any tokens in the ucstring like $t$ or $g()$
/** Parses any tokens in the utf-8 string like $t$ or $g()$
*/
static bool parseTokens(std::string& ucstr);
@ -672,7 +672,7 @@ private:
CServerToLocalAutoCopy ServerToLocalAutoCopyDMGift;
// Pop a new message box. If the message box was found, returns a pointer on it
void messageBoxInternal(const std::string &msgBoxGroup, const ucstring &text, const std::string &masterGroup, TCaseMode caseMode);
void messageBoxInternal(const std::string &msgBoxGroup, const std::string &text, const std::string &masterGroup, TCaseMode caseMode);
CInterfaceLink::CInterfaceLinkUpdater *interfaceLinkUpdater;
};

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

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

@ -33,10 +33,10 @@ CItemConsumableEffectHelper* CItemConsumableEffectHelper::getInstance()
return instance;
}
void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *pIS, ucstring &itemText, sint32 itemQuality)
void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *pIS, string &itemText, sint32 itemQuality)
{
// check if some effects are present on this item
ucstring effects("");
string effects("");
uint i;
for( i=0; i<pIS->Consumable.Properties.size(); ++i )
@ -71,7 +71,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
uint32 timeInSec;
fromString(params[3].c_str(), timeInSec);
ucstring result;
string result;
if (bonus >= 0)
result = CI18N::get("uiItemConsumableEffectUpCharac");
@ -101,7 +101,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
uint32 userDisableTime;
fromString(params[4].c_str(), userDisableTime);
ucstring result = CI18N::get("uiItemConsumableEffectLifeAura");
string result = CI18N::get("uiItemConsumableEffectLifeAura");
strFindReplace(result, "%modifier", toString(regenMod));
strFindReplace(result, "%minutes", toString(duration/60));
strFindReplace(result, "%secondes", toString(duration%60));
@ -128,7 +128,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
uint32 userDisableTime;
fromString(params[4].c_str(), userDisableTime);
ucstring result = CI18N::get("uiItemConsumableEffectLifeAura");
string result = CI18N::get("uiItemConsumableEffectLifeAura");
strFindReplace(result, "%modifier", toString(bonus));
strFindReplace(result, "%minutes", toString(duration/60));
strFindReplace(result, "%secondes", toString(duration%60));
@ -154,7 +154,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
uint32 userDisableTime;
fromString(params[4].c_str(), userDisableTime);
ucstring result = CI18N::get("uiItemConsumableEffectStaminaAura");
string result = CI18N::get("uiItemConsumableEffectStaminaAura");
strFindReplace(result, "%modifier", toString(regenMod));
strFindReplace(result, "%minutes", toString(duration/60));
strFindReplace(result, "%secondes", toString(duration%60));
@ -182,7 +182,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
uint32 userDisableTime;
fromString(params[4].c_str(), userDisableTime);
ucstring result = CI18N::get("uiItemConsumableEffectStaminaAura");
string result = CI18N::get("uiItemConsumableEffectStaminaAura");
strFindReplace(result, "%modifier", toString(bonus));
strFindReplace(result, "%minutes", toString(duration/60));
strFindReplace(result, "%secondes", toString(duration%60));
@ -208,7 +208,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
uint32 userDisableTime;
fromString(params[4].c_str(), userDisableTime);
ucstring result = CI18N::get("uiItemConsumableEffectSapAura");
string result = CI18N::get("uiItemConsumableEffectSapAura");
strFindReplace(result, "%modifier", toString(regenMod));
strFindReplace(result, "%minutes", toString(duration/60));
strFindReplace(result, "%secondes", toString(duration%60));
@ -235,7 +235,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
uint32 userDisableTime;
fromString(params[4].c_str(), userDisableTime);
ucstring result = CI18N::get("uiItemConsumableEffectSapAura");
string result = CI18N::get("uiItemConsumableEffectSapAura");
strFindReplace(result, "%modifier", toString(bonus));
strFindReplace(result, "%minutes", toString(duration/60));
strFindReplace(result, "%secondes", toString(duration%60));
@ -249,7 +249,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
// skill modifier consumables
//---------------------------
ucstring result("");
string result("");
uint8 paramIdx = 0;
if( name == "SP_MOD_DEFENSE" )
{

@ -32,7 +32,7 @@ public:
static CItemConsumableEffectHelper* getInstance();
// Fill itemText with consumable effects from item sheet
void getItemConsumableEffectText(const CItemSheet *pIS, ucstring &itemText, sint32 itemQuality);
void getItemConsumableEffectText(const CItemSheet *pIS, std::string &itemText, sint32 itemQuality);
private:
CItemConsumableEffectHelper() {}

@ -51,8 +51,8 @@ void CItemSpecialEffectHelper::registerItemSpecialEffect(const string &name)
vector<string> params;
// get ui string
ucstring ucs = CI18N::get("uiItemFX_" + name);
CSString p, s = ucs.toString();
string ucs = CI18N::get("uiItemFX_" + name);
CSString p, s = ucs;
// locate and store parameters
// %p : percent
@ -66,7 +66,7 @@ void CItemSpecialEffectHelper::registerItemSpecialEffect(const string &name)
{
string tmp = "%";
tmp += s[0];
if (s.size() >=2 && isdigit(s[1]))
if (s.size() >=2 && (uint8)s[1] < (uint8)'\x80' && isdigit(s[1]))
tmp += s[1];
params.push_back(tmp);
}
@ -76,11 +76,11 @@ void CItemSpecialEffectHelper::registerItemSpecialEffect(const string &name)
effectMap.insert(make_pair(name, params));
}
void CItemSpecialEffectHelper::getItemSpecialEffectText(const CItemSheet *pIS, ucstring &itemText)
void CItemSpecialEffectHelper::getItemSpecialEffectText(const CItemSheet *pIS, string &itemText)
{
// check if some effects are present on this item
bool firstEffect = false;
ucstring effects;
string effects;
effects += getEffect(pIS->getEffect1(), firstEffect);
effects += getEffect(pIS->getEffect2(), firstEffect);
effects += getEffect(pIS->getEffect3(), firstEffect);
@ -92,9 +92,9 @@ void CItemSpecialEffectHelper::getItemSpecialEffectText(const CItemSheet *pIS, u
strFindReplace(itemText, "%special_effects", effects);
}
ucstring CItemSpecialEffectHelper::getEffect(const std::string &effect, bool &first)
string CItemSpecialEffectHelper::getEffect(const std::string &effect, bool &first)
{
ucstring result;
string result;
CSString eff = effect;
if (eff.empty())

@ -32,7 +32,7 @@ public:
static CItemSpecialEffectHelper* getInstance();
// Fill itemText with special effects from item sheet
void getItemSpecialEffectText(const CItemSheet *pIS, ucstring &itemText);
void getItemSpecialEffectText(const CItemSheet *pIS, std::string &itemText);
// Register a new item special effect
void registerItemSpecialEffect(const std::string &name);
@ -42,7 +42,7 @@ private:
CItemSpecialEffectHelper(const CItemSpecialEffectHelper&);
// Get UI text with values filled from 'effect' string
ucstring getEffect(const std::string &effect, bool &first);
std::string getEffect(const std::string &effect, bool &first);
// Map effects name with parameters
typedef std::vector<std::string> stringVector;

@ -512,16 +512,18 @@ void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls)
luabind::def("messageBox", (void(*)(const ucstring &, const std::string &)) &messageBox),
luabind::def("messageBox", (void(*)(const ucstring &, const std::string &, int caseMode)) &messageBox),
luabind::def("messageBox", (void(*)(const std::string &)) &messageBox),
luabind::def("messageBoxWithHelp", (void(*)(const ucstring &)) &messageBoxWithHelp),
luabind::def("messageBoxWithHelp", (void(*)(const ucstring &, const std::string &)) &messageBoxWithHelp),
luabind::def("messageBoxWithHelp", (void(*)(const ucstring &, const std::string &, int caseMode)) &messageBoxWithHelp),
luabind::def("messageBoxWithHelp", (void(*)(const ucstring &)) &messageBoxWithHelp), // TODO: Lua UTF-8
luabind::def("messageBoxWithHelp", (void(*)(const ucstring &, const std::string &)) &messageBoxWithHelp), // TODO: Lua UTF-8
luabind::def("messageBoxWithHelp", (void(*)(const ucstring &, const std::string &, int caseMode)) &messageBoxWithHelp), // TODO: Lua UTF-8
luabind::def("messageBoxWithHelp", (void(*)(const std::string &)) &messageBoxWithHelp),
LUABIND_FUNC(replacePvpEffectParam),
LUABIND_FUNC(secondsSince1970ToHour),
#ifdef RYZOM_BG_DOWNLOADER
LUABIND_FUNC(pauseBGDownloader),
LUABIND_FUNC(unpauseBGDownloader),
LUABIND_FUNC(requestBGDownloaderPriority),
LUABIND_FUNC(getBGDownloaderPriority),
#endif
LUABIND_FUNC(loadBackground),
LUABIND_FUNC(getPatchLastErrorMessage),
LUABIND_FUNC(getPlayerSelectedSlot),
@ -805,7 +807,7 @@ int CLuaIHMRyzom::validMessageBox(CLuaState &ls)
CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 6, LUA_TSTRING);
CInterfaceManager *im = CInterfaceManager::getInstance();
im->validMessageBox(CInterfaceManager::QuestionIconMsg, msg, ls.toString(2), ls.toString(3), ls.toString(4), ls.toString(5), ls.toString(6));
im->validMessageBox(CInterfaceManager::QuestionIconMsg, msg.toUtf8(), ls.toString(2), ls.toString(3), ls.toString(4), ls.toString(5), ls.toString(6));
return 0;
}
@ -2845,7 +2847,7 @@ void CLuaIHMRyzom::messageBox(const ucstring &text)
{
//H_AUTO(Lua_CLuaIHM_messageBox)
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->messageBox(text);
pIM->messageBox(text.toUtf8());
}
// ***************************************************************************
@ -2853,7 +2855,7 @@ void CLuaIHMRyzom::messageBox(const ucstring &text, const std::string &masterGr
{
//H_AUTO(Lua_CLuaIHM_messageBox)
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->messageBox(text, masterGroup);
pIM->messageBox(text.toUtf8(), masterGroup);
}
// ***************************************************************************
@ -2866,7 +2868,7 @@ void CLuaIHMRyzom::messageBox(const ucstring &text, const std::string &masterGr
//H_AUTO(Lua_CLuaIHM_messageBox)
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->messageBox(text, masterGroup, (TCaseMode) caseMode);
pIM->messageBox(text.toUtf8(), masterGroup, (TCaseMode) caseMode);
}
// ***************************************************************************
@ -2885,23 +2887,23 @@ void CLuaIHMRyzom::messageBox(const std::string &text)
}
// ***************************************************************************
void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text)
void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text) // TODO: Lua UTF-8
{
//H_AUTO(Lua_CLuaIHM_messageBox)
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->messageBoxWithHelp(text);
pIM->messageBoxWithHelp(text.toUtf8());
}
// ***************************************************************************
void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text, const std::string &masterGroup)
void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text, const std::string &masterGroup) // TODO: Lua UTF-8
{
//H_AUTO(Lua_CLuaIHM_messageBox)
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->messageBoxWithHelp(text, masterGroup);
pIM->messageBoxWithHelp(text.toUtf8(), masterGroup);
}
// ***************************************************************************
void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text, const std::string &masterGroup, int caseMode)
void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text, const std::string &masterGroup, int caseMode) // TODO: Lua UTF-8
{
if (caseMode < 0 || caseMode >= CaseCount)
{
@ -2910,7 +2912,7 @@ void CLuaIHMRyzom::messageBoxWithHelp(const ucstring &text, const std::string &
//H_AUTO(Lua_CLuaIHM_messageBox)
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->messageBoxWithHelp(text, masterGroup, "" , "", (TCaseMode) caseMode);
pIM->messageBoxWithHelp(text.toUtf8(), masterGroup, "" , "", (TCaseMode) caseMode);
}
// ***************************************************************************
@ -3038,6 +3040,7 @@ sint32 CLuaIHMRyzom::secondsSince1970ToHour(sint32 seconds)
return tstruct->tm_hour; // 0-23
}
#ifdef RYZOM_BG_DOWNLOADER
// ***************************************************************************
void CLuaIHMRyzom::pauseBGDownloader()
{
@ -3066,6 +3069,7 @@ sint CLuaIHMRyzom::getBGDownloaderPriority()
{
return CBGDownloaderAccess::getInstance().getDownloadThreadPriority();
}
#endif
// ***************************************************************************
void CLuaIHMRyzom::loadBackground(const std::string &bg)
@ -3078,11 +3082,13 @@ void CLuaIHMRyzom::loadBackground(const std::string &bg)
// ***************************************************************************
ucstring CLuaIHMRyzom::getPatchLastErrorMessage()
{
#ifdef RYZOM_BG_DOWNLOADER
if (isBGDownloadEnabled())
{
return CBGDownloaderAccess::getInstance().getLastErrorMessage();
}
else
#endif
{
CPatchManager *pPM = CPatchManager::getInstance();
return pPM->getLastErrorMessage();
@ -3582,7 +3588,7 @@ void CLuaIHMRyzom::tell(const ucstring &player, const ucstring &msg)
CInterfaceManager *im = CInterfaceManager::getInstance();
w->setKeyboardFocus();
w->enableBlink(1);
w->setCommand(ucstring("tell ") + CEntityCL::removeTitleFromName(player.toUtf8()) + ucstring(" "), false);
w->setCommand("tell " + CEntityCL::removeTitleFromName(player.toUtf8()) + " ", false);
CGroupEditBox *eb = w->getEditBox();
if (eb != NULL)

@ -168,12 +168,14 @@ private:
static void messageBoxWithHelp(const ucstring &text, const std::string &masterGroup, int caseMode);
static void messageBoxWithHelp(const std::string &text);
static ucstring replacePvpEffectParam(const ucstring &str, sint32 parameter);
static ucstring replacePvpEffectParam(const ucstring &str, sint32 parameter); // TODO: UTF-8 Lua
static sint32 secondsSince1970ToHour(sint32 seconds);
#ifdef RYZOM_BG_DOWNLOADER
static void pauseBGDownloader();
static void unpauseBGDownloader();
static void requestBGDownloaderPriority(uint priority);
static sint getBGDownloaderPriority();
#endif
static void loadBackground(const std::string &bg);
static ucstring getPatchLastErrorMessage();
static bool isInGame();

@ -87,7 +87,7 @@ using namespace NLMISC;
// ***************************************************************************
// Add the template key to the parent
void addKeyLine (CGroupList *pParent, const ucstring &keyName, const ucstring &shortcutName, bool grayed)
void addKeyLine (CGroupList *pParent, const string &keyName, const string &shortcutName, bool grayed)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();
@ -104,14 +104,14 @@ void addKeyLine (CGroupList *pParent, const ucstring &keyName, const ucstring &s
CViewText *pViewKeyName = dynamic_cast<CViewText*>(pKeysLine->getView(TEMPLATE_KEYS_KEY_NAME));
if (pViewKeyName != NULL)
{
pViewKeyName->setText (keyName.toUtf8());
pViewKeyName->setText (keyName);
pViewKeyName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White);
}
CViewText *pViewShortcutName = dynamic_cast<CViewText*>(pKeysLine->getView(TEMPLATE_KEYS_SHORTCUT_NAME));
if (pViewShortcutName != NULL)
{
pViewShortcutName->setText (shortcutName.toUtf8());
pViewShortcutName->setText (shortcutName);
pViewShortcutName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White);
}
@ -125,7 +125,7 @@ struct CComboActionName
CCombo Combo; // KeyCount <=> action name unbound
CAction::CName ActionName;
};
void buildActionToComboMap(uint8 nAM, CGroupList * /* pList */, string catName, map<ucstring, CComboActionName> &remaped)
void buildActionToComboMap(uint8 nAM, CGroupList * /* pList */, string catName, map<string, CComboActionName> &remaped)
{
CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();
CActionsManager *pAM = pMCM->ActionManagers[nAM];
@ -148,7 +148,7 @@ void buildActionToComboMap(uint8 nAM, CGroupList * /* pList */, string catName,
// see if action active in current context
if (pAM->isActionPresentInContext(it->second))
{
pair<ucstring, CComboActionName> value;
pair<string, CComboActionName> value;
// Don't take any risk: avoid any bug if the localisation is buggy and give same text for 2 differents CAction::CName
// Use the localized text first, to have correct sort according to language
value.first= pAM->getActionLocalizedText(rName) + rName.Name + rName.Argu;
@ -177,7 +177,7 @@ void buildActionToComboMap(uint8 nAM, CGroupList * /* pList */, string catName,
// see if action active in current context
if (pAM->isActionPresentInContext(rName))
{
pair<ucstring, CComboActionName> value;
pair<string, CComboActionName> value;
// Don't take any risk: avoid any bug if the localisation is buggy and give same text for 2 differents CAction::CName
// Use the localized text first, to have correct sort according to language
value.first= pAM->getActionLocalizedText(rName) + rName.Name + rName.Argu;
@ -197,15 +197,15 @@ void buildActionToComboMap(uint8 nAM, CGroupList * /* pList */, string catName,
// Get all the couple (combo,action) from the action manager nAM and insert them into pList (with the template)
void getAllComboAction(uint8 nAM, CGroupList *pList, const map<ucstring, CComboActionName> &remaped)
void getAllComboAction(uint8 nAM, CGroupList *pList, const map<string, CComboActionName> &remaped)
{
CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();
CActionsManager *pAM = pMCM->ActionManagers[nAM];
// *** Fill Actions
map<ucstring, CComboActionName>::const_iterator remapIT = remaped.begin();
map<string, CComboActionName>::const_iterator remapIT = remaped.begin();
while (remapIT != remaped.end())
{
ucstring keyName;
string keyName;
if(remapIT->second.Combo.Key==KeyCount)
keyName= CI18N::get("uiNotAssigned");
else
@ -213,7 +213,7 @@ void getAllComboAction(uint8 nAM, CGroupList *pList, const map<ucstring, CComboA
const CBaseAction *baseAction = pAM->getBaseAction(remapIT->second.ActionName);
if (baseAction)
{
ucstring shortcutName = baseAction->getActionLocalizedText(remapIT->second.ActionName);
string shortcutName = baseAction->getActionLocalizedText(remapIT->second.ActionName);
addKeyLine(pList, keyName, shortcutName, remapIT->second.Combo.Key==KeyCount);
CModalContainerEditCmd::CLine line;
@ -274,7 +274,7 @@ public:
pList->clearGroups();
pList->setDynamicDisplaySize(true);
map<ucstring, CComboActionName> remaped;
map<string, CComboActionName> remaped;
buildActionToComboMap(nAM, pList, rCats[i].Name, remaped);
if (!remaped.empty())
{

@ -65,7 +65,7 @@ void CMacroCmd::writeTo (xmlNodePtr node) const
xmlNodePtr macroNode = xmlNewChild ( node, NULL, (const xmlChar*)"macro", NULL );
// Props
xmlSetProp (macroNode, (const xmlChar*)"name", (const xmlChar*)ucstring(Name).toUtf8().c_str());
xmlSetProp (macroNode, (const xmlChar*)"name", (const xmlChar*)Name.c_str());
xmlSetProp (macroNode, (const xmlChar*)"id", (const xmlChar*)toString(ID).c_str());
xmlSetProp (macroNode, (const xmlChar*)"back", (const xmlChar*)toString(BitmapBack).c_str());
xmlSetProp (macroNode, (const xmlChar*)"icon", (const xmlChar*)toString(BitmapIcon).c_str());
@ -86,12 +86,7 @@ bool CMacroCmd::readFrom (xmlNodePtr node)
CXMLAutoPtr ptrName;
ptrName = (char*) xmlGetProp( node, (xmlChar*)"name" );
if (ptrName)
{
ucstring ucName;
ucName.fromUtf8((const char*)ptrName);
Name = ucName.toString();
}
if (ptrName) Name = (const char *)ptrName;
ptrName = (char*) xmlGetProp( node, (xmlChar*)"id" );
if (ptrName) fromString((const char*)ptrName, ID);
@ -818,7 +813,7 @@ public:
REGISTER_ACTION_HANDLER( CHandlerNewMacroCmdDelete, "new_macro_cmd_delete");
// ***************************************************************************
void addCommandLine (CGroupList *pParent, uint cmdNb, const ucstring &cmdName)
void addCommandLine (CGroupList *pParent, uint cmdNb, const string &cmdName)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
@ -828,7 +823,7 @@ void addCommandLine (CGroupList *pParent, uint cmdNb, const ucstring &cmdName)
if (pNewCmd == NULL) return;
CViewText *pVT = dynamic_cast<CViewText*>(pNewCmd->getView(TEMPLATE_NEWMACRO_COMMAND_TEXT));
if (pVT != NULL) pVT->setText(cmdName.toUtf8());
if (pVT != NULL) pVT->setText(cmdName);
pNewCmd->setParent (pParent);
pParent->addChild (pNewCmd);
@ -906,7 +901,7 @@ public:
for (uint i = 0; i < pMCM->CurrentEditMacro.Commands.size(); ++i)
{
ucstring commandName;
string commandName;
for (uint j = 0; j < pMCM->ActionManagers.size(); ++j)
{
CAction::CName c(pMCM->CurrentEditMacro.Commands[i].Name.c_str(), pMCM->CurrentEditMacro.Commands[i].Params.c_str());

@ -327,9 +327,7 @@ void CMusicPlayer::rebuildPlaylist()
CViewText *pVT = dynamic_cast<CViewText *>(pNew->getView(TEMPLATE_PLAYLIST_SONG_TITLE));
if (pVT)
{
ucstring title;
title.fromUtf8(_Songs[i].Title);
pVT->setText(title.toUtf8());
pVT->setText(_Songs[i].Title);
}
pVT = dynamic_cast<CViewText *>(pNew->getView(TEMPLATE_PLAYLIST_SONG_DURATION));
@ -588,9 +586,17 @@ static void addFromPlaylist(const std::string &playlist, const std::vector<std::
if (!useUtf8)
{
lineStr = ucstring(line).toUtf8();
lineStr = NLMISC::mbcsToUtf8(line); // Attempt local codepage first
if (lineStr.empty())
lineStr = CUtfStringView::fromAscii(std::string(line));
lineStr = trim(lineStr);
}
else
{
lineStr = trim(std::string(line + 3));
}
lineStr = CUtfStringView(lineStr).toUtf8(true); // Re-encode external string
// Not a comment line
if (lineStr[0] != '#')

@ -355,7 +355,7 @@ void CPeopleInterraction::release()
uint numCW = cwm.getNumChatWindow();
for(uint k = 0; k < numCW; ++k)
{
nlwarning("Window %d : %s", (int) k, (cwm.getChatWindowByIndex(k)->getTitle().toString()).c_str());
nlwarning("Window %d : %s", (int) k, (cwm.getChatWindowByIndex(k)->getTitle()).c_str());
}
}
}
@ -1089,7 +1089,7 @@ CFilteredChat *CPeopleInterraction::getFilteredChatFromChatWindow(CChatWindow *c
}
//===========================================================================================================
void CPeopleInterraction::askAddContact(const ucstring &contactName, CPeopleList *pl)
void CPeopleInterraction::askAddContact(const string &contactName, CPeopleList *pl)
{
if (pl == NULL)
return;
@ -1109,7 +1109,7 @@ void CPeopleInterraction::askAddContact(const ucstring &contactName, CPeopleList
}
// add into server (NB: will be added by the server response later)
const std::string sMsg = "TEAM:CONTACT_ADD";
const char *sMsg = "TEAM:CONTACT_ADD";
CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out))
{
@ -1121,14 +1121,14 @@ void CPeopleInterraction::askAddContact(const ucstring &contactName, CPeopleList
if (pl == &FriendList)
list = 0;
ucstring temp = contactName;
ucstring temp = ucstring::makeFromUtf8(contactName); // TODO: UTF-8 (serial)
out.serial(temp);
out.serial(list);
NetMngr.push(out);
//nlinfo("impulseCallBack : %s %s %d sent", sMsg.c_str(), contactName.toString().c_str(), list);
}
else
nlwarning("impulseCallBack : unknown message name : '%s'.", sMsg.c_str());
nlwarning("impulseCallBack : unknown message name : '%s'.", sMsg);
// NB: no client prediction, will be added by server later
@ -1192,7 +1192,7 @@ void CPeopleInterraction::askMoveContact(uint peopleIndexInSrc, CPeopleList *plS
// Fake Local simulation
if (ClientCfg.Local)
{
ucstring peopleName= plSRC->getName(peopleIndexInSrc);
string peopleName= plSRC->getName(peopleIndexInSrc);
plSRC->removePeople(peopleIndexInSrc);
sint dstIndex = plDST->addPeople(peopleName);
plDST->setOnline(dstIndex, ccs_online);
@ -1252,7 +1252,7 @@ void CPeopleInterraction::askRemoveContact(uint peopleIndex, CPeopleList *pl)
//=================================================================================================================
void CPeopleInterraction::initContactLists( const std::vector<uint32> &vFriendListName,
const std::vector<TCharConnectionState> &vFriendListOnline,
const std::vector<ucstring> &vIgnoreListName )
const std::vector<ucstring> &vIgnoreListName ) // TODO: UTF-8 (serial)
{
// clear the current lists if any
@ -1264,18 +1264,18 @@ void CPeopleInterraction::initContactLists( const std::vector<uint32> &vFriendLi
for (uint i = 0; i < vFriendListName.size(); ++i)
addContactInList(contactIdPool++, vFriendListName[i], vFriendListOnline[i], 0);
for (uint i = 0; i < vIgnoreListName.size(); ++i)
addContactInList(contactIdPool++, vIgnoreListName[i], ccs_offline, 1);
addContactInList(contactIdPool++, vIgnoreListName[i].toUtf8(), ccs_offline, 1);
updateAllFreeTellerHeaders();
}
//=================================================================================================================
void CPeopleInterraction::addContactInList(uint32 contactId, const ucstring &nameIn, TCharConnectionState online, uint8 nList)
void CPeopleInterraction::addContactInList(uint32 contactId, const string &nameIn, TCharConnectionState online, uint8 nList)
{
// select correct people list
CPeopleList &pl= nList==0?FriendList:IgnoreList;
// remove the shard name if possible
ucstring name= CEntityCL::removeShardFromName(nameIn.toUtf8());
string name= CEntityCL::removeShardFromName(nameIn);
// add the contact to this list
sint index = pl.getIndexFromName(name);
@ -1321,12 +1321,12 @@ void CPeopleInterraction::addContactInList(uint32 contactId, uint32 nameID, TCha
}
//=================================================================================================================
bool CPeopleInterraction::isContactInList(const ucstring &nameIn, uint8 nList) const
bool CPeopleInterraction::isContactInList(const string &nameIn, uint8 nList) const
{
// select correct people list
const CPeopleList &pl= nList==0?FriendList:IgnoreList;
// remove the shard name if possible
ucstring name= CEntityCL::removeShardFromName(nameIn.toUtf8());
string name= CEntityCL::removeShardFromName(nameIn);
return pl.getIndexFromName(name) != -1;
}
@ -1393,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;
string name = toLower(FriendList.getName(index).toUtf8());
string name = toLower(FriendList.getName(index));
for (uint i = 0; i < GuildMembers.size(); ++i)
{
if (toLower(GuildMembers[i].Name) == name)
@ -1410,7 +1410,7 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS
if (showMsg)
{
string msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline");
strFindReplace(msg, "%s", FriendList.getName(index).toUtf8());
strFindReplace(msg, "%s", FriendList.getName(index));
string cat = getStringCategory(msg, msg);
map<string, CClientConfig::SSysInfoParam>::const_iterator it;
NLMISC::CRGBA col = CRGBA::Yellow;
@ -1455,12 +1455,14 @@ void CPeopleInterraction::removeContactFromList(uint32 contactId, uint8 nList)
}
//=================================================================================================================
bool CPeopleInterraction::testValidPartyChatName(const ucstring &title)
bool CPeopleInterraction::testValidPartyChatName(const string &title)
{
if (title.empty()) return false;
// shouldn't begin like 'user chat 1-5'
ucstring userChatStr = CI18N::get("uiUserChat");
if (title.substr(0, userChatStr.length()) == userChatStr) return false;
const string &userChatStr = CI18N::get("uiUserChat");
if (NLMISC::startsWith(title, userChatStr)) return false;
// can't match a translation identifier
if (CI18N::hasTranslation(title)) return false;
for(uint k = 0; k < PartyChats.size(); ++k) // there shouldn't be that much party chat simultaneously so a linear search is ok
{
if (PartyChats[k].Window->getTitle() == title) return false;
@ -1526,7 +1528,7 @@ void CPeopleInterraction::assignPartyChatMenu(CChatWindow *partyChat)
}
//=================================================================================================================
bool CPeopleInterraction::createNewPartyChat(const ucstring &title)
bool CPeopleInterraction::createNewPartyChat(const string &title)
{
// now there are no party chat windows, party chat phrases must be filtered from the main chat
@ -1851,8 +1853,8 @@ void CPeopleInterraction::createUserChat(uint index)
return;
}
CChatWindowDesc chatDesc;
ucstring userChatStr = CI18N::get("uiUserChat");
userChatStr += ucchar(' ') + ucstring(toString(index + 1));
string userChatStr = CI18N::get("uiUserChat");
userChatStr += ' ' + toString(index + 1);
//chatDesc.FatherContainer = "ui:interface:communication";
chatDesc.FatherContainer = "ui:interface:contact_list";
chatDesc.Title = userChatStr;
@ -2137,7 +2139,7 @@ public:
uint peopleIndex;
if (PeopleInterraction.getPeopleFromCurrentMenu(list, peopleIndex))
{
CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8());
CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex));
}
}
};
@ -2159,7 +2161,7 @@ class CHandlerTellContact : public IActionHandler
uint peopleIndex;
if (PeopleInterraction.getPeopleFromContainerID(gc->getId(), list, peopleIndex))
{
CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8());
CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex));
}
}
@ -2255,7 +2257,7 @@ public:
}
else
{
PeopleInterraction.askAddContact(geb->getInputStringAsUtf16(), peopleList);
PeopleInterraction.askAddContact(geb->getInputString(), peopleList);
geb->setInputString(std::string());
}
}
@ -2592,7 +2594,7 @@ public:
{
for(uint l = 0; l < pl.PartyChats.size(); ++l)
{
menu->addLineAtIndex(insertionIndex, pl.PartyChats[l].Window->getTitle().toUtf8(), "chat_target_selected", toString(pl.PartyChats[l].ID));
menu->addLineAtIndex(insertionIndex, pl.PartyChats[l].Window->getTitle(), "chat_target_selected", toString(pl.PartyChats[l].ID));
++ insertionIndex;
}
}
@ -2939,7 +2941,7 @@ class CHandlerSelectChatSource : public IActionHandler
{
if (pc[l].Filter != NULL)
{
menu->addLineAtIndex(insertionIndex, pc[l].Window->getTitle().toUtf8(), FILTER_TOGGLE, toString(pc[l].ID));
menu->addLineAtIndex(insertionIndex, pc[l].Window->getTitle(), FILTER_TOGGLE, toString(pc[l].ID));
menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, toString(pc[l].ID), pc[l].Filter->isListeningWindow(cw)));
++ insertionIndex;
}
@ -3176,7 +3178,7 @@ NLMISC_COMMAND(ignore, "add or remove a player from the ignore list", "<player n
}
// NB: playernames cannot have special characters
ucstring playerName = ucstring(args[0]);
const string &playerName = args[0];
// add to the ignore list
PeopleInterraction.askAddContact(playerName, &PeopleInterraction.IgnoreList);
@ -3199,7 +3201,7 @@ NLMISC_COMMAND(party_chat, "Create a new party chat", "<party_chat_name>")
return true;
}
CPeopleInterraction &pi = PeopleInterraction;
ucstring title = args[0];
string title = args[0];
if (!pi.testValidPartyChatName(title))
{
@ -3219,16 +3221,16 @@ NLMISC_COMMAND(remove_party_chat, "Remove a party chat", "<party_chat_name>")
displayVisibleSystemMsg(CI18N::get("uiRemovePartyChatCmd"));
return true;
}
ucstring title = ucstring(args[0]);
string title = ucstring(args[0]);
CChatWindow *chat = getChatWndMgr().getChatWindow(title);
if (!chat)
{
displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiBadPartyChatName"));
displayVisibleSystemMsg(title + " : " + CI18N::get("uiBadPartyChatName"));
return true;
}
if (!PeopleInterraction.removePartyChat(chat))
{
displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiCantRemovePartyChat"));
displayVisibleSystemMsg(title + " : " + CI18N::get("uiCantRemovePartyChat"));
return true;
}
return true;

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

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

@ -28,7 +28,6 @@
#include "chat_window.h"
#include "interface_pointer.h"
// NeL
#include "nel/misc/ucstring.h"
#include "nel/misc/rgba.h"
@ -40,7 +39,7 @@
struct CPeopleListDesc
{
enum TContactType { Team, Contact, Ignore, Unknown };
ucstring PeopleListTitle; // title of the people list
std::string PeopleListTitle; // title of the people list
TContactType ContactType;
std::string FatherContainer; // name of the father container
std::string BaseContainerTemplateName; // name of the template for the base container
@ -75,13 +74,13 @@ public:
*/
bool create(const CPeopleListDesc &desc, const CChatWindowDesc *chat = NULL);
// Get index from the name of a people, or -1 if not found
sint getIndexFromName(const ucstring &name) const;
sint getIndexFromName(const std::string &name) const;
// Get index from the id of the container that represent the people
sint getIndexFromContainerID(const std::string &id) const;
// Get the number of people in this list
uint getNumPeople() const { return (uint)_Peoples.size(); }
// Get name of a people
ucstring getName(uint index) const;
std::string getName(uint index) const;
// Sort people alphabetically
void sort();
@ -99,7 +98,7 @@ public:
/** Add a people to the list, and returns its index or -1 if the creation failed
* If this is a team mate, tells its index so that ic can be bound to the database in the right location
*/
sint addPeople(const ucstring &name, uint teamMateIndex = 0);
sint addPeople(const std::string &name, uint teamMateIndex = 0);
// swap people position between the 2 given indexs
void swapPeople(uint index1, uint index2);
// Remove the people at the given index
@ -159,7 +158,7 @@ private:
bool Blocked;
uint32 ContactId;
bool operator < (const CPeople &other) const { return getName() < other.getName(); }
ucstring getName() const { return Container->getUCTitle(); }
std::string getName() const { return Container->getTitle(); }
};
typedef std::vector<CPeople> TPeopleVect;
private:

@ -343,7 +343,7 @@ void CReqSkillFormula::log(const char *prefix) const
}
// ***************************************************************************
void CReqSkillFormula::getInfoText(ucstring &info) const
void CReqSkillFormula::getInfoText(string &info) const
{
info.clear();
@ -363,7 +363,7 @@ void CReqSkillFormula::getInfoText(ucstring &info) const
{
const CSkillValue &sv= *itSv;
// get the colored line if the skill don't reach the req level
ucstring line;
string line;
if(!isSkillValueTrained(sv))
line= CI18N::get("uihelpPhraseRequirementNotMetLine");
else

@ -101,7 +101,7 @@ public:
void log(const char *prefix) const;
// For SPhrase Info
void getInfoText(ucstring &info) const;
void getInfoText(std::string &info) const;
// return true if the requirement formula completes regarding the actual player state (through CSkillMananger). return true if empty()
bool evaluate() const;

@ -486,7 +486,7 @@ void CSBrickManager::compileBrickProperties()
k++;
}
// Param Id modifier? (ie read not the 0th value, but the 1th etc... up to 9)
else if(k<textSize && isdigit(text[k]))
else if(k<textSize && (uint8)text[k] < (uint8)'\x80' && isdigit(text[k]))
{
char tp[2];
tp[0]= (char)text[k];

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

@ -960,7 +960,7 @@ bool CSPhraseManager::isPhraseKnown(const CSPhraseCom &phrase) const
}
// ***************************************************************************
ucstring CSPhraseManager::formatMalus(sint base, sint malus)
string CSPhraseManager::formatMalus(sint base, sint malus)
{
if(malus)
return toString("@{F80F}%d@{FFFF} (%d)", base+malus, base);
@ -969,7 +969,7 @@ ucstring CSPhraseManager::formatMalus(sint base, sint malus)
}
// ***************************************************************************
ucstring CSPhraseManager::formatMalus(float base, float malus)
string CSPhraseManager::formatMalus(float base, float malus)
{
if(malus)
return toString("@{F80F}%.1f@{FFFF} (%.1f)", base+malus, base);
@ -1008,7 +1008,7 @@ string CSPhraseManager::formatBonusMalus(sint32 base, sint32 mod)
}
// ***************************************************************************
void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, uint32 phraseSheetId, bool wantRequirement, const std::string &specialPhraseFormat)
void CSPhraseManager::buildPhraseDesc(string &text, const CSPhraseCom &phrase, uint32 phraseSheetId, bool wantRequirement, const std::string &specialPhraseFormat)
{
CSBrickManager *pBM= CSBrickManager::getInstance();
CInterfaceManager *pIM= CInterfaceManager::getInstance();
@ -1029,7 +1029,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
if(rootBrick)
{
static const string compoId= "composition";
static const ucstring compoTag("%compostart");
static const string compoTag("%compostart");
bool isComposition= specialPhraseFormat==compoId;
// if format not given by user, auto select it.
@ -1053,14 +1053,14 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
// if composition, cut the text before the tag (including)
if(isComposition)
{
ucstring::size_type pos= text.find(compoTag);
if(pos!=ucstring::npos)
string::size_type pos= text.find(compoTag);
if(pos!=string::npos)
text.erase(0, pos+compoTag.size());
}
// else just clear the tag
else
{
strFindReplace(text, compoTag, ucstring() );
strFindReplace(text, compoTag, string() );
}
}
else
@ -1071,7 +1071,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
// **** Phrase info basics
// replace name
strFindReplace(text, "%name", phrase.Name);
strFindReplace(text, "%name", phrase.Name.toUtf8());
// replace Sabrina Cost and credit.
uint32 cost, credit;
pBM->getSabrinaCom().getPhraseCost(phrase.Bricks, cost, credit);
@ -1079,7 +1079,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
strFindReplace(text, "%credit", toString(credit));
// for combat, fill weapon compatibility
ucstring weaponRestriction;
string weaponRestriction;
bool usableWithMelee;
bool usableWithRange;
if(rootBrick && rootBrick->isCombat())
@ -1099,7 +1099,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
bool resistMagic[RESISTANCE_TYPE::NB_RESISTANCE_TYPE];
getResistMagic(resistMagic, phrase.Bricks);
bool first= true;
ucstring resList;
string resList;
for(uint i=0;i<RESISTANCE_TYPE::NB_RESISTANCE_TYPE;i++)
{
if(resistMagic[i])
@ -1114,13 +1114,13 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
// If have some resist
if(!resList.empty())
{
ucstring fmt= CI18N::get("uihelpPhraseMagicResist");
string fmt= CI18N::get("uihelpPhraseMagicResist");
strFindReplace(fmt, "%t", resList);
strFindReplace(text, "%magicresist", fmt);
}
else
{
strFindReplace(text, "%magicresist", ucstring());
strFindReplace(text, "%magicresist", string());
}
}
@ -1208,7 +1208,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
strFindReplace(text, "%range", CI18N::get("uihelpPhraseRangeSelf"));
else
{
ucstring fmt= CI18N::get("uihelpPhraseRangeMeters");
string fmt= CI18N::get("uihelpPhraseRangeMeters");
strFindReplace(fmt, "%dist", formatMalus(range, rangeMalus));
strFindReplace(text, "%range", fmt);
}
@ -1217,7 +1217,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
if(rootBrick->isForageExtraction())
{
// Choose the fmt text
ucstring fmt= getForageExtractionPhraseEcotypeFmt(phrase);
string fmt= getForageExtractionPhraseEcotypeFmt(phrase);
// Replace forage success rate in any ecotype
successModifier = 0;
@ -1292,16 +1292,16 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
}
// **** Special .sphrase description
if(phraseSheetId)
if (phraseSheetId)
{
// get the text
ucstring desc(STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(CSheetId(phraseSheetId)));
if(desc.empty())
strFindReplace(text, "%desc", ucstring());
string desc = STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(CSheetId(phraseSheetId));
if (desc.empty())
strFindReplace(text, "%desc", string());
else
{
// append an \n before, for clearness
desc= ucstring("\n") + desc;
desc= string("\n") + desc;
// append \n at end if not done
if(desc[desc.size()-1]!='\n')
desc+= '\n';
@ -1311,13 +1311,13 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
}
else
{
strFindReplace(text, "%desc", ucstring());
strFindReplace(text, "%desc", string());
}
// **** Special .sphrase requirement
if(phraseSheetId && wantRequirement)
{
ucstring reqText;
string reqText;
reqText= CI18N::get("uihelpPhraseRequirementHeader");
// replace the skill point cost
@ -1331,7 +1331,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
const CReqSkillFormula &formula= it->second;
// from this formula, build the requirement tex
ucstring textForm;
string textForm;
formula.getInfoText(textForm);
reqText+= textForm;
}
@ -3632,7 +3632,7 @@ public:
bool Castable;
uint32 Type;
uint32 Icon;
ucstring Text;
string Text;
bool operator<(const CPhraseSortEntry &pse) const
{
@ -3840,20 +3840,20 @@ void CSPhraseManager::computePhraseProgression()
// replace each number with 001 format. toLower
for(uint k=0;k<pse.Text.size();k++)
{
if(pse.Text[k] < 256 && isalpha(pse.Text[k]))
pse.Text[k]= tolower(pse.Text[k]);
else if(pse.Text[k] < 256 && isdigit(pse.Text[k]))
if((uint8)pse.Text[k] < (uint8)'\x80' && isalpha(pse.Text[k]))
pse.Text[k]= tolower(pse.Text[k]); // FIXME: toLowerAscii
else if((uint8)pse.Text[k] < (uint8)'\x80' && isdigit(pse.Text[k]))
{
uint32 number= 0;
uint32 start= k;
// get the whole number
for(;k<pse.Text.size() && isdigit(pse.Text[k]);k++)
for(;k<pse.Text.size() && (uint8)pse.Text[k] < (uint8)'\x80' && isdigit(pse.Text[k]);k++)
{
number*=10;
number+= pse.Text[k] - '0';
}
// format, and replace in string
ucstring newNumber= toString("%3d", number);
string newNumber= toString("%3d", number);
pse.Text.replace(start, k-start, newNumber);
// and skip this number
k= start + (uint)newNumber.size();
@ -4089,7 +4089,7 @@ bool CSPhraseManager::allowListBrickInHelp(const CSPhraseCom &phrase) const
}
// ***************************************************************************
void CSPhraseManager::getCombatWeaponRestriction(ucstring &text, const CSPhraseCom &phrase, bool& usableWithMelee, bool& usableWithRange)
void CSPhraseManager::getCombatWeaponRestriction(string &text, const CSPhraseCom &phrase, bool& usableWithMelee, bool& usableWithRange)
{
text.clear();
@ -4165,7 +4165,7 @@ void CSPhraseManager::getCombatWeaponRestriction(ucstring &text, const CSPhra
}
// ***************************************************************************
void CSPhraseManager::getCombatWeaponRestriction(ucstring &text, sint32 phraseSheetId, bool& usableWithMelee, bool& usableWithRange)
void CSPhraseManager::getCombatWeaponRestriction(string &text, sint32 phraseSheetId, bool& usableWithMelee, bool& usableWithRange)
{
CSPhraseCom phrase;
buildPhraseFromSheet(phrase, phraseSheetId);
@ -4279,7 +4279,7 @@ void CSPhraseManager::fullDeletePhraseIfLast(uint32 memoryLine, uint32 memorySl
// ***************************************************************************
ucstring CSPhraseManager::getForageExtractionPhraseEcotypeFmt(const CSPhraseCom &phrase)
string CSPhraseManager::getForageExtractionPhraseEcotypeFmt(const CSPhraseCom &phrase)
{
CSBrickManager *pBM= CSBrickManager::getInstance();
@ -4688,7 +4688,8 @@ int CSPhraseComAdpater::luaGetDesc(CLuaState &ls)
if (phraseSheetID != 0)
{
// is it a built-in phrase?
ucstring desc(STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId(phraseSheetID)));
ucstring desc; // FIXME: UTF-8 Lua
desc.fromUtf8(STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId(phraseSheetID)));
if (!desc.empty())
{
CLuaIHM::push(ls, desc);

@ -338,7 +338,7 @@ public:
* \specialPhraseFormat if empty, format is auto selected. if "composition", same but the text is cut under the %compostart tag.
* else take directly this format.
*/
void buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, uint32 phraseSheetId, bool wantRequirement, const std::string &specialPhraseFormat= std::string());
void buildPhraseDesc(std::string &text, const CSPhraseCom &phrase, uint32 phraseSheetId, bool wantRequirement, const std::string &specialPhraseFormat= std::string());
// Get the Phrase Success Rate %
sint getPhraseSuccessRate(const CSPhraseCom &phrase);
// Get the Phrase Success Rate %. Manually gives the Skill to do the comparison (for craft)
@ -346,7 +346,7 @@ public:
// Get the Phrase Success Rate %. Manually gives the Skill to do the comparison (for Forage Extraction)
sint getForageExtractionPhraseSuccessRate(const CSPhraseCom &phrase, SKILLS::ESkills skill);
// return the fmt according to forage terrain specializing
ucstring getForageExtractionPhraseEcotypeFmt(const CSPhraseCom &phrase);
std::string getForageExtractionPhraseEcotypeFmt(const CSPhraseCom &phrase);
// Get the Phrase Sap Cost
void getPhraseSapCost(const CSPhraseCom &phrase, uint32 totalActionMalus, sint &cost, sint &costMalus);
// Get the Phrase Sta Cost
@ -370,8 +370,8 @@ public:
/// true if interesting to list the bricks of this phrase in help
bool allowListBrickInHelp(const CSPhraseCom &phrase) const;
/// return the combat restriction text (empty if not combat)
void getCombatWeaponRestriction(ucstring &text, const CSPhraseCom &phrase, bool& usableWithMelee, bool& usableWithRange);
void getCombatWeaponRestriction(ucstring &text, sint32 phraseSheetId, bool& usableWithMelee, bool& usableWithRange);
void getCombatWeaponRestriction(std::string &text, const CSPhraseCom &phrase, bool& usableWithMelee, bool& usableWithRange);
void getCombatWeaponRestriction(std::string &text, sint32 phraseSheetId, bool& usableWithMelee, bool& usableWithRange);
// return true if any of the Bricks contains AvoidCyclic==true (the phrase cannot be cyclic)
bool avoidCyclicForPhrase(const CSPhraseCom &phrase) const;
bool avoidCyclicForPhrase(sint32 phraseSheetId) const;
@ -693,8 +693,8 @@ private:
// @}
ucstring formatMalus(sint base, sint malus);
ucstring formatMalus(float base, float malus);
std::string formatMalus(sint base, sint malus);
std::string formatMalus(float base, float malus);
std::string formatBonusMalus(sint32 base, sint32 mod);
// Special for combat: Build the "phrase skill compatible" formula

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

@ -698,7 +698,7 @@ void CItemGroupManager::listGroup()
{
CItemGroup group = _Groups[i];
string msg = NLMISC::CI18N::get("cmdListGroupLine");
//Use ucstring because group name can contain accentued characters (and stuff like that)
//Use utf-8 string because group name can contain accentued characters (and stuff like that)
string nameUC = group.name;
NLMISC::strFindReplace(msg, "%name", nameUC);
NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.Items.size()));

@ -199,7 +199,7 @@ void setLoginFinished( bool f )
// ***************************************************************************
// Pop a fatal error message box, giving the option to 'quit' the client, plus a help button
static void fatalMessageBox(const ucstring &msg)
static void fatalMessageBox(const std::string &msg)
{
CInterfaceManager *im = CInterfaceManager::getInstance();
im->messageBoxWithHelp(msg, "ui:login", "login_quit");
@ -207,7 +207,7 @@ static void fatalMessageBox(const ucstring &msg)
// ***************************************************************************
// Pop an error message box, giving the option to go back to main menu, plus a help button
static void errorMessageBox(const ucstring &msg)
static void errorMessageBox(const std::string &msg)
{
CInterfaceManager *im = CInterfaceManager::getInstance();
im->messageBoxWithHelp(msg, "ui:login", "on_back_to_login");
@ -243,7 +243,7 @@ void createOptionalCatUI()
pVT = dynamic_cast<CViewText*>(pNewLine->getView("size"));
if (pVT != NULL)
{
pVT->setText(BGDownloader::getWrittenSize(InfoOnPatch.OptCat[i].Size).toUtf8());
pVT->setText(BGDownloader::getWrittenSize(InfoOnPatch.OptCat[i].Size));
}
// Add to the list
@ -281,25 +281,25 @@ void initEula()
}
// ***************************************************************************
static void setDataScanLog(const ucstring &text)
static void setDataScanLog(const std::string &text)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:log_txt:log"));
if (pVT != NULL)
{
pVT->setText(text.toUtf8());
pVT->setText(text);
}
}
// ***************************************************************************
static void setDataScanState(const ucstring &text, ucstring progress= ucstring())
static void setDataScanState(const std::string &text, const std::string &progress = string())
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:state"));
if (pVT != NULL) pVT->setText(text.toUtf8());
if (pVT != NULL) pVT->setText(text);
pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:progress"));
if (pVT != NULL) pVT->setText(progress.toUtf8());
if (pVT != NULL) pVT->setText(progress);
}
void initCatDisplay()
@ -332,24 +332,24 @@ void initReboot()
// ***************************************************************************
static void setPatcherStateText(const std::string &baseUIPath, const ucstring &str)
static void setPatcherStateText(const std::string &baseUIPath, const std::string &str)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(baseUIPath + ":content:state"));
if (pVT != NULL)
{
pVT->setText(str.toUtf8());
pVT->setText(str);
}
}
// ***************************************************************************
static void setPatcherProgressText(const std::string &baseUIPath, const ucstring &str)
static void setPatcherProgressText(const std::string &baseUIPath, const std::string &str)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(baseUIPath + ":content:progress"));
if (pVT != NULL)
{
pVT->setText(str.toUtf8());
pVT->setText(str);
}
}
@ -357,6 +357,7 @@ static void setPatcherProgressText(const std::string &baseUIPath, const ucstring
static void updatePatchingInfoText(const std::string &baseUIPath)
{
CPatchManager *pPM = CPatchManager::getInstance();
#ifdef RYZOM_BG_DOWNLOADER
CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance();
if (isBGDownloadEnabled())
{
@ -364,7 +365,7 @@ static void updatePatchingInfoText(const std::string &baseUIPath)
if (bgDownloader.getDownloadThreadPriority() == BGDownloader::ThreadPriority_Paused)
{
setPatcherStateText(baseUIPath, CI18N::get("uiBGD_Paused"));
setPatcherProgressText(baseUIPath, ucstring());
setPatcherProgressText(baseUIPath, string());
}
else
{
@ -375,14 +376,15 @@ static void updatePatchingInfoText(const std::string &baseUIPath)
}
else
{
setPatcherProgressText(baseUIPath, ucstring());
setPatcherProgressText(baseUIPath, string());
}
}
}
else
#endif
{
ucstring state;
vector<ucstring> log;
string state;
vector<string> log;
if(pPM->getThreadState(state, log))
{
setPatcherStateText(baseUIPath, state);
@ -392,7 +394,7 @@ static void updatePatchingInfoText(const std::string &baseUIPath)
}
else
{
setPatcherProgressText(baseUIPath, ucstring());
setPatcherProgressText(baseUIPath, string());
}
}
}
@ -406,7 +408,9 @@ void loginMainLoop()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CPatchManager *pPM = CPatchManager::getInstance();
#ifdef RYZOM_BG_DOWNLOADER
CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance();
#endif
bool windowBlinkDone = false;
bool fatalMessageBoxShown = false;
@ -463,21 +467,24 @@ void loginMainLoop()
bool res = false;
BGDownloader::TTaskResult taskResult = BGDownloader::TaskResult_Unknown;
bool finished = false;
ucstring bgDownloaderError;
#ifdef RYZOM_BG_DOWNLOADER
string bgDownloaderError;
if (isBGDownloadEnabled())
{
finished = bgDownloader.isTaskEnded(taskResult, bgDownloaderError);
}
else
#endif
{
finished = pPM->isCheckThreadEnded(res);
}
if (finished)
{
setPatcherStateText("ui:login:checking", ucstring());
setPatcherProgressText("ui:login:checking", ucstring());
setPatcherStateText("ui:login:checking", string());
setPatcherProgressText("ui:login:checking", string());
#ifdef RYZOM_BG_DOWNLOADER
if (isBGDownloadEnabled())
{
AvailablePatchs = bgDownloader.getAvailablePatchs();
@ -529,6 +536,7 @@ void loginMainLoop()
}
else
#endif
{
if(res)
{
@ -553,7 +561,7 @@ void loginMainLoop()
}
else
{
ucstring errMsg = CI18N::get("uiErrChecking");
string errMsg = CI18N::get("uiErrChecking");
if (!pPM->getLastErrorMessage().empty())
{
errMsg = pPM->getLastErrorMessage();
@ -596,14 +604,14 @@ void loginMainLoop()
setDataScanState(CI18N::get("uiScanDataSucess"));
else
{
ucstring fmt= CI18N::get("uiScanDataErrors");
string fmt= CI18N::get("uiScanDataErrors");
strFindReplace(fmt, "%d", toString(numFiles));
setDataScanState(fmt);
}
}
else
{
ucstring errMsg = CI18N::get("uiErrDataScanning");
string errMsg = CI18N::get("uiErrDataScanning");
if (!pPM->getLastErrorMessage().empty())
{
errMsg = pPM->getLastErrorMessage();
@ -612,7 +620,7 @@ void loginMainLoop()
}
// the log may have changed
ucstring dsLog;
string dsLog;
if(pPM->getDataScanLog(dsLog))
setDataScanLog(dsLog);
}
@ -620,8 +628,8 @@ void loginMainLoop()
else
{
// update inteface content
ucstring state;
vector<ucstring> log;
string state;
vector<string> log;
// get state
if(pPM->getThreadState(state, log))
{
@ -629,7 +637,7 @@ void loginMainLoop()
setDataScanState(state, toString("%d/%d", pPM->getCurrentFilesToGet(), pPM->getTotalFilesToGet()));
}
// set special data scan log
ucstring dsLog;
string dsLog;
if(pPM->getDataScanLog(dsLog))
setDataScanLog(dsLog);
}
@ -642,14 +650,14 @@ void loginMainLoop()
int currentPatchingSize;
int totalPatchSize;
#ifdef RYZOM_BG_DOWNLOADER
if (isBGDownloadEnabled())
{
currentPatchingSize = bgDownloader.getPatchingSize();
totalPatchSize = bgDownloader.getTotalSize();
BGDownloader::TTaskResult taskResult;
bool finished = false;
ucstring bgDownloaderError;
string bgDownloaderError;
finished = bgDownloader.isTaskEnded(taskResult, bgDownloaderError);
if (finished)
{
@ -662,8 +670,8 @@ void loginMainLoop()
if (taskResult == BGDownloader::TaskResult_Error)
{
setPatcherStateText("ui:login:patching", ucstring());
setPatcherProgressText("ui:login:patching", ucstring());
setPatcherStateText("ui:login:patching", string());
setPatcherProgressText("ui:login:patching", string());
if (!fatalMessageBoxShown)
{
@ -683,6 +691,7 @@ void loginMainLoop()
}
}
else
#endif
{
totalPatchSize = TotalPatchSize;
currentPatchingSize = pPM->getPatchingSize();
@ -695,7 +704,7 @@ void loginMainLoop()
}
else
{
ucstring errMsg = CI18N::get("uiErrPatchApply");
string errMsg = CI18N::get("uiErrPatchApply");
if (!pPM->getLastErrorMessage().empty())
{
errMsg = pPM->getLastErrorMessage();
@ -714,10 +723,10 @@ void loginMainLoop()
}
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(VIEW_TOTAL_SIZE_PATCH));
ucstring sTmp;
string sTmp;
sTmp = BGDownloader::getWrittenSize(currentPatchingSize);
sTmp += " / " + BGDownloader::getWrittenSize(totalPatchSize);
if (pVT != NULL) pVT->setText(sTmp.toUtf8());
if (pVT != NULL) pVT->setText(sTmp);
}
// else if (screen == UI_VARIABLES_SCREEN_CATDISP) // If we are displaying patch info
else if (LoginSM.getCurrentState() == CLoginStateMachine::st_display_cat)
@ -766,10 +775,10 @@ void loginMainLoop()
// Total size of the patches is optional cats + required cat (f(optCat)) + non opt cat
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(VIEW_TOTAL_SIZE));
if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(TotalPatchSize).toUtf8());
if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(TotalPatchSize));
pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(VIEW_NON_OPTIONAL_SIZE));
if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(nNonOptSize).toUtf8());
if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(nNonOptSize));
}
}
}
@ -793,7 +802,7 @@ void initLoginScreen()
// version
std::string ext;
if (ClientApp.find("ryzom_") != ucstring::npos)
if (ClientApp.find("ryzom_") != string::npos)
ext = " (" + ClientApp.substr(6) + ")";
CViewText *pV = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:ver_value"));
@ -1130,22 +1139,26 @@ void initPatchCheck()
LoginShardId = Shards[ShardSelected].ShardId;
}
#ifdef RYZOM_BG_DOWNLOADER
if (!isBGDownloadEnabled())
#endif
{
getPatchParameters(url, ver, patchURIs);
pPM->init(patchURIs, url, ver);
pPM->startCheckThread(true /* include background patchs */);
}
#ifdef RYZOM_BG_DOWNLOADER
else
{
BGDownloader::CTaskDesc taskDesc(BGDownloader::DLState_CheckPatch);
CBGDownloaderAccess::getInstance().requestDownloadThreadPriority(BGDownloader::ThreadPriority_Normal, false);
CBGDownloaderAccess::getInstance().startTask(taskDesc, getBGDownloaderCommandLine(), true /* showDownloader */);
}
#endif
NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKING);
setPatcherStateText("ui:login:checking", ucstring());
setPatcherProgressText("ui:login:checking", ucstring());
setPatcherStateText("ui:login:checking", string());
setPatcherProgressText("ui:login:checking", string());
}
void initShardDisplay()
@ -1650,8 +1663,9 @@ void initPatch()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CPatchManager *pPM = CPatchManager::getInstance();
#ifdef RYZOM_BG_DOWNLOADER
if (!isBGDownloadEnabled())
#endif
{
// Get the list of optional categories to patch
vector<string> vCategories;
@ -1686,6 +1700,7 @@ void initPatch()
}
pPM->startPatchThread(vCategories, true);
}
#ifdef RYZOM_BG_DOWNLOADER
else
{
// NB : here we only do a part of the download each time
@ -1695,14 +1710,15 @@ void initPatch()
NLMISC::CBigFile::getInstance().removeAll();
NLMISC::CStreamedPackageManager::getInstance().unloadAll();
}
#endif
NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_PATCHING);
CInterfaceElement *closeBtn = CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_CLOSE_PATCH);
if (closeBtn)
closeBtn->setActive(false);
setPatcherStateText("ui:login:patching", ucstring());
setPatcherProgressText("ui:login:patching", ucstring());
setPatcherStateText("ui:login:patching", string());
setPatcherProgressText("ui:login:patching", string());
}
// ***************************************************************************
@ -1840,11 +1856,13 @@ class CAHReboot : public IActionHandler
CInterfaceManager *im = CInterfaceManager::getInstance();
try
{
#ifdef RYZOM_BG_DOWNLOADER
if (isBGDownloadEnabled())
{
CBGDownloaderAccess::getInstance().reboot();
}
else
#endif
{
CPatchManager::getInstance()->reboot();
}
@ -1860,7 +1878,7 @@ class CAHReboot : public IActionHandler
}
catch (const std::exception &e)
{
im->messageBoxWithHelp(ucstring::makeFromUtf8(e.what()), "ui:login", "login_quit");
im->messageBoxWithHelp(e.what(), "ui:login", "login_quit");
}
}
};
@ -2256,7 +2274,7 @@ void initDataScan()
CPatchManager *pPM = CPatchManager::getInstance();
// reset the log
setDataScanLog(ucstring());
setDataScanLog(string());
// Start Scanning
pPM->startScanDataThread();
@ -2336,10 +2354,6 @@ inline string parseTooltip(const string & initString, const string & tagName)
tooltip = tooltip.substr(0, tooltip.find("<"));
}
ucstring uc;
uc.fromUtf8(tooltip);;
tooltip = uc.toString();
return tooltip;
}
@ -2359,10 +2373,6 @@ inline string parseCommentError(const string & initString, const string & tagNam
error = error.substr(0, error.find("<"));
}
ucstring uc;
uc.fromUtf8(error);;
error = uc.toString();
return error;
}
@ -2424,26 +2434,26 @@ bool initCreateAccount()
if(!CurlHttpClient.sendGet(url, params, pPM->isVerboseLog()))
{
ucstring errorMessage("Can't send (error code 60)");
string errorMessage("Can't send (error code 60)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return false;
}
string res;
if(!CurlHttpClient.receive(res, pPM->isVerboseLog()))
{
ucstring errorMessage("Can't receive (error code 61)");
string errorMessage("Can't receive (error code 61)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return false;
}
if(res.empty())
{
ucstring errorMessage("Empty result (error code 13)");
string errorMessage("Empty result (error code 13)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return false;
}
@ -2600,9 +2610,9 @@ class CAHOnCreateAccountSubmit : public IActionHandler
if (!CurlHttpClient.connect(url))
{
ucstring errorMessage("Can't connect");
string errorMessage("Can't connect");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return;
}
@ -2627,26 +2637,26 @@ class CAHOnCreateAccountSubmit : public IActionHandler
if(!CurlHttpClient.sendPost(url, params, pPM->isVerboseLog()))
{
ucstring errorMessage("Can't send (error code 60)");
string errorMessage("Can't send (error code 60)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return;
}
string res;
if(!CurlHttpClient.receive(res, pPM->isVerboseLog()))
{
ucstring errorMessage("Can't receive (error code 61)");
string errorMessage("Can't receive (error code 61)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return;
}
if(res.empty())
{
ucstring errorMessage("Empty result (error code 13)");
string errorMessage("Empty result (error code 13)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return;
}
@ -3286,7 +3296,7 @@ void loginIntro()
if (i != 0)
{
beginLoading(IntroNVidia);
ucstring nmsg("");
string nmsg("");
ProgressBar.newMessage (nmsg);
}
@ -3312,7 +3322,7 @@ void loginIntro()
Driver->AsyncListener.isKeyPushed (KeySPACE))
break;
const ucstring nmsg("");
const string nmsg("");
ProgressBar.newMessage (nmsg);
IngameDbMngr.flushObserverCalls();
NLGUI::CDBManager::getInstance()->flushObserverCalls();

@ -189,7 +189,7 @@ void CPatchManager::setClientRootPath(const std::string& clientRootPath)
}
// ****************************************************************************
void CPatchManager::setErrorMessage(const ucstring &message)
void CPatchManager::setErrorMessage(const std::string &message)
{
_ErrorMessage = message;
}
@ -656,7 +656,7 @@ bool CPatchManager::isPatchThreadEnded (bool &ok)
// ****************************************************************************
// Called in main thread
bool CPatchManager::getThreadState (ucstring &stateOut, vector<ucstring> &stateLogOut)
bool CPatchManager::getThreadState (std::string &stateOut, vector<string> &stateLogOut)
{
if ((PatchThread == NULL) && (CheckThread == NULL) && (ScanDataThread==NULL))
return false;
@ -685,7 +685,7 @@ bool CPatchManager::getThreadState (ucstring &stateOut, vector<ucstring> &stateL
// verbose log
if (isVerboseLog() && !stateLogOut.empty())
for (uint32 i = 0; i < stateLogOut.size(); ++i)
nlinfo("%s", stateLogOut[i].toUtf8().c_str());
nlinfo("%s", stateLogOut[i].c_str());
return changed;
}
@ -1120,28 +1120,28 @@ float CPatchManager::getCurrentFileProgress() const
// ****************************************************************************
void CPatchManager::setRWAccess (const string &filename, bool bThrowException)
{
ucstring s = CI18N::get("uiSetAttrib") + " " + CFile::getFilename(filename);
string s = CI18N::get("uiSetAttrib") + " " + CFile::getFilename(filename);
setState(true, s);
if (!NLMISC::CFile::setRWAccess(filename) && bThrowException)
{
s = CI18N::get("uiAttribErr") + " " + CFile::getFilename(filename) + " (" + toString(errno) + "," + strerror(errno) + ")";
setState(true, s);
throw Exception (s.toUtf8());
throw Exception (s);
}
}
// ****************************************************************************
string CPatchManager::deleteFile (const string &filename, bool bThrowException, bool bWarning)
{
ucstring s = CI18N::get("uiDelFile") + " " + CFile::getFilename(filename);
string s = CI18N::get("uiDelFile") + " " + CFile::getFilename(filename);
setState(true, s);
if (!NLMISC::CFile::fileExists(filename))
{
s = CI18N::get("uiDelNoFile");
setState(true, s);
return s.toUtf8();
return s;
}
if (!NLMISC::CFile::deleteFile(filename))
@ -1150,8 +1150,8 @@ string CPatchManager::deleteFile (const string &filename, bool bThrowException,
if(bWarning)
setState(true, s);
if(bThrowException)
throw Exception (s.toUtf8());
return s.toUtf8();
throw Exception (s);
return s;
}
return "";
}
@ -1159,20 +1159,20 @@ string CPatchManager::deleteFile (const string &filename, bool bThrowException,
// ****************************************************************************
void CPatchManager::renameFile (const string &src, const string &dst)
{
ucstring s = CI18N::get("uiRenameFile") + " " + NLMISC::CFile::getFilename(src);
string s = CI18N::get("uiRenameFile") + " " + NLMISC::CFile::getFilename(src);
setState(true, s);
if (!NLMISC::CFile::moveFile(dst, src))
{
s = CI18N::get("uiRenameErr") + " " + src + " -> " + dst + " (" + toString(errno) + "," + strerror(errno) + ")";
setState(true, s);
throw Exception (s.toUtf8());
throw Exception (s);
}
}
// ****************************************************************************
// Take care this function is called by the thread
void CPatchManager::setState (bool bOutputToLog, const ucstring &ucsNewState)
void CPatchManager::setState (bool bOutputToLog, const string &ucsNewState)
{
{
CSynchronized<CState>::CAccessor as(&State);
@ -1342,7 +1342,7 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const
try
{
ucstring s = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename(srcName);
string s = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename(srcName);
setState(true, s);
// get the new file
@ -1364,13 +1364,13 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const
// if emergency patch server, this is a real issue, rethrow exception
if (UsedServer < 0)
{
ucstring s = CI18N::get("uiDLFailed");
string s = CI18N::get("uiDLFailed");
setState(true, s);
throw Exception(e.what());
}
ucstring s = CI18N::get("uiDLURIFailed") + " " + serverDisplayPath;
string s = CI18N::get("uiDLURIFailed") + " " + serverDisplayPath;
setState(true, s);
// this server is unavailable
@ -1384,7 +1384,7 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const
// scanned all servers? use alternative
if (nextServer == UsedServer)
{
ucstring s = CI18N::get("uiNoMoreURI");
string s = CI18N::get("uiNoMoreURI");
setState(true, s);
UsedServer = -1;
nlwarning("EXCEPTION CATCH: getServerFile() failed - no alternative found");
@ -1409,7 +1409,7 @@ void CPatchManager::downloadFileWithCurl (const string &source, const string &de
try
{
#ifdef USE_CURL
ucstring s = CI18N::get("uiDLWithCurl") + " " + CFile::getFilename(dest);
string s = CI18N::get("uiDLWithCurl") + " " + CFile::getFilename(dest);
setState(true, s);
// user agent = nel_launcher
@ -1417,7 +1417,7 @@ void CPatchManager::downloadFileWithCurl (const string &source, const string &de
CURL *curl;
CURLcode res;
ucstring sTranslate = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename (source);
string sTranslate = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename (source);
setState(true, sTranslate);
CurrentFile = NLMISC::CFile::getFilename (source);
@ -1566,7 +1566,7 @@ void CPatchManager::downloadFile (const string &source, const string &dest, NLMI
void CPatchManager::decompressFile (const string &filename)
{
ucstring sTranslate = CI18N::get("uiDecompressing") + " " + NLMISC::CFile::getFilename(filename);
string sTranslate = CI18N::get("uiDecompressing") + " " + NLMISC::CFile::getFilename(filename);
setState(true, sTranslate);
//if(isVerboseLog()) nlinfo("Calling gzopen('%s','rb')", filename.c_str());
@ -1664,7 +1664,7 @@ void CPatchManager::applyDate (const string &sFilename, uint32 nDate)
if(nDate != 0)
{
setRWAccess(sFilename, false);
ucstring s = CI18N::get("uiChangeDate") + " " + NLMISC::CFile::getFilename(sFilename) + " " + timestampToHumanReadable(NLMISC::CFile::getFileModificationDate (sFilename)) +
string s = CI18N::get("uiChangeDate") + " " + NLMISC::CFile::getFilename(sFilename) + " " + timestampToHumanReadable(NLMISC::CFile::getFileModificationDate (sFilename)) +
" -> " + timestampToHumanReadable(nDate);
setState(true,s);
@ -1786,7 +1786,7 @@ void CPatchManager::getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn,
// If the version cannot be found with size and time try with sha1
if (nVersionFound == 0xFFFFFFFF)
{
ucstring sTranslate = CI18N::get("uiCheckInt") + " " + rFilename;
string sTranslate = CI18N::get("uiCheckInt") + " " + rFilename;
setState(true, sTranslate);
CHashKey hkLocalSHA1 = getSHA1(sFilePath);
for (j = 0; j < rFile.versionCount(); ++j)
@ -1806,7 +1806,7 @@ void CPatchManager::getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn,
// No version available found
if (nVersionFound == 0xFFFFFFFF)
{
ucstring sTranslate = CI18N::get("uiNoVersionFound");
string sTranslate = CI18N::get("uiNoVersionFound");
setState(true, sTranslate);
// Get all patches from beginning (first patch is reference file)
ftpOut.FileName = rFilename;
@ -1827,7 +1827,7 @@ void CPatchManager::getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn,
}
else // A version of the file has been found
{
ucstring sTranslate = CI18N::get("uiVersionFound") + " " + toString(nVersionFound);
string sTranslate = CI18N::get("uiVersionFound") + " " + toString(nVersionFound);
setState(true, sTranslate);
// Get All patches from this version !
ftpOut.FileName = rFilename;
@ -1883,7 +1883,7 @@ bool CPatchManager::bnpUnpack(const string &srcBigfile, const string &dstPath, v
else
DestPath = CPath::standardizePath (dstPath);
ucstring s = CI18N::get("uiUnpack") + " " + NLMISC::CFile::getFilename(SourceName);
string s = CI18N::get("uiUnpack") + " " + NLMISC::CFile::getFilename(SourceName);
setState(true,s);
// Read Header of the BNP File
@ -1892,7 +1892,7 @@ bool CPatchManager::bnpUnpack(const string &srcBigfile, const string &dstPath, v
if (!bnpFile.readHeader())
{
ucstring s = CI18N::get("uiUnpackErrHead") + " " + CFile::getFilename(SourceName);
string s = CI18N::get("uiUnpackErrHead") + " " + CFile::getFilename(SourceName);
setState(true,s);
return false;
}
@ -1938,8 +1938,8 @@ int CPatchManager::validateProgress(void *foo, double t, double d, double /* ult
CPatchManager *pPM = CPatchManager::getInstance();
double pour1 = t!=0.0?d*100.0/t:0.0;
ucstring sTranslate = CI18N::get("uiLoginGetFile") + ucstring::makeFromUtf8(toString(" %s : %s / %s (%.02f %%)", NLMISC::CFile::getFilename(pPM->CurrentFile).c_str(),
NLMISC::bytesToHumanReadableUnits((uint64)d, units).c_str(), NLMISC::bytesToHumanReadableUnits((uint64)t, units).c_str(), pour1));
string sTranslate = CI18N::get("uiLoginGetFile") + toString(" %s : %s / %s (%.02f %%)", NLMISC::CFile::getFilename(pPM->CurrentFile).c_str(),
NLMISC::bytesToHumanReadableUnits((uint64)d, units).c_str(), NLMISC::bytesToHumanReadableUnits((uint64)t, units).c_str(), pour1);
pPM->setState(false, sTranslate);
if (foo)
{
@ -1953,7 +1953,7 @@ void CPatchManager::MyPatchingCB::progress(float f)
{
CPatchManager *pPM = CPatchManager::getInstance();
double p = 100.0*f;
ucstring sTranslate = CI18N::get("uiApplyingDelta") + ucstring::makeFromUtf8(toString(" %s (%.02f %%)", CFile::getFilename(patchFilename).c_str(), p));
string sTranslate = CI18N::get("uiApplyingDelta") + toString(" %s (%.02f %%)", CFile::getFilename(patchFilename).c_str(), p);
pPM->setState(false, sTranslate);
}
@ -2079,7 +2079,7 @@ uint CPatchManager::applyScanDataResult()
}
// ***************************************************************************
bool CPatchManager::getDataScanLog(ucstring &text)
bool CPatchManager::getDataScanLog(string &text)
{
text.clear();
bool changed= false;
@ -2092,7 +2092,7 @@ bool CPatchManager::getDataScanLog(ucstring &text)
{
for(uint i=0;i<val.FilesWithScanDataError.size();i++)
{
ucstring str;
string str;
getCorruptedFileInfo(val.FilesWithScanDataError[i], str);
text+= str + "\n";
}
@ -2127,9 +2127,9 @@ void CPatchManager::clearDataScanLog()
}
// ***************************************************************************
void CPatchManager::getCorruptedFileInfo(const SFileToPatch &ftp, ucstring &sTranslate)
void CPatchManager::getCorruptedFileInfo(const SFileToPatch &ftp, string &sTranslate)
{
sTranslate = CI18N::get("uiCorruptedFile") + " " + ucstring::makeFromUtf8(ftp.FileName) + " (" +
sTranslate = CI18N::get("uiCorruptedFile") + " " + ftp.FileName + " (" +
toString("%.1f ", (float)ftp.FinalFileSize/1000000.f) + CI18N::get("uiMb") + ")";
}
@ -2167,7 +2167,7 @@ void CCheckThread::run ()
// Check if the client version is the same as the server version
string sClientVersion = pPM->getClientVersion();
string sServerVersion = pPM->getServerVersion();
ucstring sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") ";
string sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") ";
sTranslate += CI18N::get("uiServerVersion") + " (" + sServerVersion + ")";
pPM->setState(true, sTranslate);
@ -2216,7 +2216,7 @@ void CCheckThread::run ()
for (i = 0; i < rDescFiles.fileCount(); ++i)
{
CPatchManager::SFileToPatch ftp;
sTranslate = CI18N::get("uiCheckingFile") + " " + ucstring::makeFromUtf8(rDescFiles.getFile(i).getFileName());
sTranslate = CI18N::get("uiCheckingFile") + " " + rDescFiles.getFile(i).getFileName();
pPM->setState(true, sTranslate);
// get list of patch to apply to this file. don't to a full checksum test if possible
nlwarning(rDescFiles.getFile(i).getFileName().c_str());
@ -2408,7 +2408,7 @@ void CCheckThread::run ()
catch (const Exception &e)
{
nlwarning("EXCEPTION CATCH: CCheckThread::run() failed");
ucstring sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what();
string sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what();
pPM->setState(true, CI18N::get("uiCheckEndWithErr"));
pPM->setErrorMessage(sTranslate);
CheckOk = false;
@ -2478,7 +2478,7 @@ void CPatchThread::run()
CurrentFilePatched = 0.f;
ucstring sTranslate;
string sTranslate;
try
{
// First do all ref files
@ -2536,7 +2536,7 @@ void CPatchThread::run()
catch(const Exception &e)
{
nlwarning("EXCEPTION CATCH: CPatchThread::run() failed");
pPM->setState(true, ucstring(e.what()));
pPM->setState(true, string(e.what()));
sTranslate = CI18N::get("uiPatchEndWithErr");
bErr = true;
}
@ -2649,7 +2649,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
rFTP.LocalFileExists = false;
}
ucstring sTranslate;
string sTranslate;
sTranslate = CI18N::get("uiProcessing") + " " + rFTP.FileName;
pPM->setState(true, sTranslate);
@ -2984,7 +2984,7 @@ void CScanDataThread::run ()
uint32 i;
// Check if the client version is the same as the server version
string sClientVersion = pPM->getClientVersion();
ucstring sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") ";
string sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") ";
pPM->setState(true, sTranslate);
// For all bnp in the description file get all patches to apply
@ -3023,7 +3023,7 @@ void CScanDataThread::run ()
catch (const Exception &e)
{
nlwarning("EXCEPTION CATCH: CScanDataThread::run() failed");
ucstring sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what();
string sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what();
pPM->setState(true, sTranslate);
CheckOk = false;
Ended = true;
@ -3157,7 +3157,7 @@ bool CPatchManager::download(const std::string& patchFullname, const std::string
catch ( const std::exception& e)
{
nlwarning("%s", e.what());
pPM->setState(true, ucstring(e.what()) );
pPM->setState(true, string(e.what()) );
return false;
}
@ -3408,7 +3408,7 @@ void CDownloadThread::run()
catch ( const std::exception& e)
{
nlwarning("%s", e.what());
pPM->setState(true, ucstring(e.what()) );
pPM->setState(true, string(e.what()) );
pPM->fatalError("uiCanNotDownload", patchName.c_str(), "");
}
catch (...)
@ -3525,7 +3525,7 @@ void CInstallThread::run()
catch ( const std::exception& e)
{
nlwarning("%s", e.what());
pPM->setState(true, ucstring(e.what()) );
pPM->setState(true, string(e.what()) );
pPM->fatalError("uiCanNotInstall", patchName.c_str(), "");
return;

@ -56,7 +56,7 @@ public:
class IPatchManagerStateListener
{
public:
virtual void setState (bool /* bOutputToLog */, const ucstring &/* ucsNewState */){}
virtual void setState (bool /* bOutputToLog */, const std::string &/* ucsNewState */){}
};
// Get Info of file to install
@ -154,12 +154,12 @@ public:
// Get the string information about what the threads are doing
// Return true if the state has changed
bool getThreadState (ucstring &state, std::vector<ucstring> &stateLog);
bool getThreadState (std::string &state, std::vector<std::string> &stateLog);
/** Get the error message (filled after a patch of check)
* May be empty if the cause of error is unknown or unhandled
*/
const ucstring &getLastErrorMessage() { return _ErrorMessage; }
const std::string &getLastErrorMessage() { return _ErrorMessage; }
// ---------------------
// First Part : Checking
@ -235,7 +235,7 @@ public:
uint applyScanDataResult();
// get the current info Log for data Scan (true if some change from last get, else text is not filled)
bool getDataScanLog(ucstring &text);
bool getDataScanLog(std::string &text);
CProductDescriptionForClient &getDescFile() { return DescFile; }
@ -284,7 +284,7 @@ private:
friend class CPatchThreadDownloadProgress;
// Set the thread state (called by threads to let us know what they are doing)
void setState (bool bOutputToLog, const ucstring &ucsState);
void setState (bool bOutputToLog, const std::string &ucsState);
void touchState();
/// Get the version of the server given during init()
@ -330,7 +330,7 @@ private:
// add a file to the scan data log
void addDataScanLogCorruptedFile(const SFileToPatch &ftp);
void clearDataScanLog();
static void getCorruptedFileInfo(const SFileToPatch &ftp, ucstring &sTranslate);
static void getCorruptedFileInfo(const SFileToPatch &ftp, std::string &sTranslate);
static bool downloadAndUnpack(const std::string& patchPath, const std::string& sourceFilename, const std::string& extractPath, const std::string& tmpDirectory, uint32 timestamp);
// Forward message to Installation Software
@ -404,7 +404,7 @@ private:
std::vector<SFileToPatch> FilesToPatch;
std::vector<std::string> OptionalCat;
ucstring _ErrorMessage;
std::string _ErrorMessage;
// Threads
CPatchThread *PatchThread;
@ -417,8 +417,8 @@ private:
// State
struct CState
{
ucstring State;
std::vector<ucstring> StateLog;
std::string State;
std::vector<std::string> StateLog;
bool StateChanged;
CState()
{
@ -470,7 +470,7 @@ private:
bool _StartRyzomAtEnd;
public:
// used by threads to signal error at the end of execution
void setErrorMessage(const ucstring &message);
void setErrorMessage(const std::string &message);
};
/**

@ -1099,6 +1099,7 @@ bool mainLoop()
// Start Bench
H_AUTO_USE ( RZ_Client_Main_Loop )
#ifdef RYZOM_BG_DOWNLOADER
if (isBGDownloadEnabled())
{
CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance();
@ -1109,6 +1110,7 @@ bool mainLoop()
unpauseBGDownloader();
}
}
#endif
FPU_CHECKER_ONCE
@ -1280,7 +1282,9 @@ bool mainLoop()
// Get Mouse Position.
OldMouseX = MouseX; OldMouseY = MouseY;
#ifdef RYZOM_BG_DOWNLOADER
updateBGDownloaderUI();
#endif
}
// Get the pointer pos

@ -879,13 +879,13 @@ NLMISC::CRGBA interpClientCfgColor(const string &src, string &dest)
if (src[0] == '&')
{
string::size_type nextPos = src.find('&', 1);
if (nextPos != ucstring::npos)
if (nextPos != string::npos)
{
std::string colorCode;
colorCode.resize(nextPos - 1);
for(uint k = 0; k < nextPos - 1; ++k)
{
colorCode[k] = tolower((char) src[k + 1]);
colorCode[k] = tolower((char) src[k + 1]); // TODO: toLowerAscii
}
std::map<std::string, CClientConfig::SSysInfoParam>::const_iterator it = ClientCfg.SystemInfoParams.find(colorCode);
if (it != ClientCfg.SystemInfoParams.end())
@ -953,7 +953,7 @@ std::string getStringCategoryIfAny(const string &src, string &dest)
colorCode.resize( codeSize );
for(ptrdiff_t k = 0; k < (ptrdiff_t)codeSize; ++k)
{
colorCode[k] = tolower((char) src[k + startPos + 1]);
colorCode[k] = tolower((char) src[k + startPos + 1]); // TODO: toLowerAscii
}
string destTmp;
if ( startPos != 0 )
@ -980,7 +980,7 @@ std::string getStringCategoryIfAny(const string &src, string &dest)
// ***************************************************************************
sint ucstrnicmp(const ucstring &s0, uint p0, uint n0, const ucstring &s1)
sint ucstrnicmp(const ucstring &s0, uint p0, uint n0, const ucstring &s1) // OLD
{
// start
const ucchar *start1= s1.c_str();

@ -193,8 +193,8 @@ enum TFilter3d
RYZOM_MAX_FILTER_3D,
};
// compare 2 ucstring s0 and s1, without regard to case. give start and size for sequence p0
sint ucstrnicmp(const ucstring &s0, uint p0, uint n0, const ucstring &s1);
// compare 2 ucstring s0 and s1, without regard to case. give start and size for sequence p0 // OLD
sint ucstrnicmp(const ucstring &s0, uint p0, uint n0, const ucstring &s1); // OLD
/** Compute a non-continuous noise with uniform repartition in [0, 1], with the given noise object
* By default repartition is not uniform for noise

@ -404,7 +404,7 @@ void impulseUserChars(NLMISC::CBitMemStream &impulse)
// if there's a new char for which a key set was wanted, create it now
for (uint k = 0; k < CharacterSummaries.size(); ++k)
{
if (toLower(CharacterSummaries[k].Name) == toLower(NewKeysCharNameValidated))
if (toLower(CharacterSummaries[k].Name.toUtf8()) == toLower(NewKeysCharNameValidated))
{
// first, stripes server name
copyKeySet(lookupSrcKeyFile(GameKeySet), "save/keys_" + buildPlayerNameForSaveFile(NewKeysCharNameValidated) + ".xml");
@ -614,8 +614,8 @@ static CInterfaceChatDisplayer InterfaceChatDisplayer;
void CInterfaceChatDisplayer::colorizeSender(string &text, const string &senderName, CRGBA baseColor)
{
// find the sender/text separator to put color tags
ucstring::size_type pos = senderName.length() - 1;
if (pos != ucstring::npos)
string::size_type pos = senderName.length() - 1;
if (pos != string::npos)
{
string str;
@ -666,7 +666,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
for(;;)
{
string::size_type index = finalString.find("{break}");
if (index == ucstring::npos) break;
if (index == string::npos) break;
finalString = finalString.substr(0, index) + finalString.substr(index+7,finalString.size());
}
@ -819,7 +819,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
else
{
string::size_type index = finalString.find("<BPFX>");
if (index != ucstring::npos)
if (index != string::npos)
{
bubbleWanted = false;
finalString = finalString.substr(index+6,finalString.size());
@ -1015,7 +1015,7 @@ void inpulseDynStringInChatGroup(NLMISC::CBitMemStream &impulse)
// impulse.serialBit(huff);
//
// uint32 index;
// ucstring ucstr;
// ucstring ucstr; // OLD
//
// impulse.serial( index );
// impulse.serial( ucstr );
@ -1109,15 +1109,15 @@ void setFakeNews ()
CViewText *inter2 = (CViewText *)inter->getView("title0");
nlassert (inter2 != NULL);
inter2->setText(ucstring(shortNews[rnd*3]));
inter2->setText(ucstring(shortNews[rnd*3])); // OLD
CViewText *inter3 = (CViewText *)inter->getView("title1");
nlassert (inter3 != NULL);
inter3->setText(ucstring(shortNews[rnd*3+1]));
inter3->setText(ucstring(shortNews[rnd*3+1])); // OLD
CViewText *inter4 = (CViewText *)inter->getView("title2");
nlassert (inter4 != NULL);
inter4->setText(ucstring(shortNews[rnd*3+2]));
inter4->setText(ucstring(shortNews[rnd*3+2])); // OLD
}
{ // set test for the neutral main
string iname;
@ -1134,11 +1134,11 @@ void setFakeNews ()
CViewText *inter2 = (CViewText *)inter->getView("title0");
nlassert (inter2 != NULL);
inter2->setText(ucstring(shortNews[rnd*3]));
inter2->setText(ucstring(shortNews[rnd*3])); // OLD
CViewText *inter3 = (CViewText *)inter->getView("title1");
nlassert (inter3 != NULL);
inter3->setText(ucstring(shortNews[rnd*3+1]));
inter3->setText(ucstring(shortNews[rnd*3+1])); // OLD
}
{ // set test for the more news
string iname;
@ -1155,15 +1155,15 @@ void setFakeNews ()
CViewText *inter2 = (CViewText *)inter->getView("title0");
nlassert (inter2 != NULL);
inter2->setText(ucstring(longNews[rnd*3]));
inter2->setText(ucstring(longNews[rnd*3])); // OLD
CViewText *inter3 = (CViewText *)inter->getView("title1");
nlassert (inter3 != NULL);
inter3->setText(ucstring(longNews[rnd*3+1]));
inter3->setText(ucstring(longNews[rnd*3+1])); // OLD
CViewText *inter4 = (CViewText *)inter->getView("title2");
nlassert (inter4 != NULL);
inter4->setText(ucstring(longNews[rnd*3+2]));
inter4->setText(ucstring(longNews[rnd*3+2])); // OLD
}
}
}
@ -1180,7 +1180,7 @@ void setFakeNews ()
static void setupBotChatChoiceList(CInterfaceGroup *botChatGroup)
{
// Temp for test. Should then be read from server msg
std::vector<ucstring> choices;
std::vector<string> choices;
for(uint k = 0; k < 90; ++k)
{
choices.push_back("Choice " + toString(k));
@ -1195,7 +1195,7 @@ static void setupBotChatChoiceList(CInterfaceGroup *botChatGroup)
/*
static void setupBotChatDescription(CInterfaceGroup *botChatGroup)
{
ucstring desc;
string desc;
for(uint k = 0; k < 90; ++k)
{
desc += "This is a multi line description. ";
@ -1216,7 +1216,7 @@ static void setupBotChatBotGift(CInterfaceGroup *botChatGroup)
NLGUI::CDBManager::getInstance()->getDbProp("SERVER:INVENTORY:20:0:QUALITY")->setValue32(0);
NLGUI::CDBManager::getInstance()->getDbProp("SERVER:INVENTORY:20:1:SHEET")->setValue32(CSheetId("fyros_sword_lvl_01_05.item").asInt());
NLGUI::CDBManager::getInstance()->getDbProp("SERVER:INVENTORY:20:1:QUALITY")->setValue32(2);
CBotChat::setBotGift(botChatGroup, ucstring("Thanks to have succeeded the mission"), ucstring("Here's your reward"), ucstring("The bot has taken the object quest from your inventory"));
CBotChat::setBotGift(botChatGroup, "Thanks to have succeeded the mission", "Here's your reward", "The bot has taken the object quest from your inventory");
}
*/
@ -1582,8 +1582,8 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason)
R2::TTeleportContext tpContext = R2::TPContext_Unknown;
ucstring tpReason;
ucstring tpCancelText;
string tpReason;
string tpCancelText;
try
{
@ -1597,14 +1597,14 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason)
uint32 size = (uint32)tpInfos.TpReasonParams.size();
uint32 first = 0;
CSString str(tpReason.toString());
CSString str(tpReason);
for (;first != size ; ++first)
{
std::string value = tpInfos.TpReasonParams[first];
std::string key = NLMISC::toString("%%%u", first +1);
str = str.replace( key.c_str(), value.c_str());
}
tpReason = ucstring(str);
tpReason = string(str);
tpCancelText = CI18N::get(tpInfos.TpCancelTextId);
tpContext = tpInfos.TpContext;
}
@ -1612,16 +1612,16 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason)
}
catch (const EStream &)
{
tpReason = ucstring("TP Reason");
tpCancelText = ucstring("Cancel TP"); // for test
tpReason = "TP Reason";
tpCancelText = "Cancel TP"; // for test
// try to deduce tp context from current editor mode
switch (R2::getEditor().getMode())
{
case R2::CEditor::EditionMode:
case R2::CEditor::NotInitialized:
tpContext = R2::TPContext_Unknown;
tpReason = ucstring();
tpCancelText = ucstring();
tpReason = string();
tpCancelText = string();
break;
case R2::CEditor::GoingToDMMode:
case R2::CEditor::TestMode:
@ -1667,7 +1667,7 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason)
//InitMouseWithCursor(oldHardwareCursor);
// reset 'cancel' button
ProgressBar.setTPMessages(ucstring(), ucstring(), "");
ProgressBar.setTPMessages(string(), string(), "");
// ProgressBar.enableQuitButton(false); // TMP TMP
@ -1798,7 +1798,7 @@ void impulseTeamContactInit(NLMISC::CBitMemStream &impulse)
{
vector<uint32> vFriendListName;
vector<TCharConnectionState> vFriendListOnline;
vector<ucstring> vIgnoreListName;
vector<ucstring> vIgnoreListName; // TODO: UTF-8 (serial)
impulse.serialCont(vFriendListName);
uint32 nbState;
@ -2136,9 +2136,9 @@ void impulseWhere(NLMISC::CBitMemStream &impulse)
void impulseWho(NLMISC::CBitMemStream &impulse)
{
nlinfo("impulseWho Received");
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("Players currently in the game :"));
CInterfaceManager::getInstance()->displaySystemInfo("Players currently in the game :");
ucstring name;
ucstring name; // OLD
uint32 loginId;
uint16 dist;
uint8 dirshort;
@ -2176,7 +2176,7 @@ void impulseWho(NLMISC::CBitMemStream &impulse)
};
str = toString (" - uid %d - distance %hu meters - direction ", loginId, dist);
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(name + ucstring(str) + CI18N::get(txts[direction])));
CInterfaceManager::getInstance()->displaySystemInfo(name + str + CI18N::get(txts[direction]));
}
}// impulseWho //
*/
@ -2185,9 +2185,9 @@ void impulseWho(NLMISC::CBitMemStream &impulse)
void impulseWhoGM(NLMISC::CBitMemStream &impulse)
{
nlinfo("impulseWhoGM Received");
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("Players currently in the game :"));
CInterfaceManager::getInstance()->displaySystemInfo("Players currently in the game :");
ucstring name;
ucstring name; // OLD
uint32 loginId;
uint16 dist;
uint8 dirshort;
@ -2225,7 +2225,7 @@ void impulseWhoGM(NLMISC::CBitMemStream &impulse)
};
str = toString (" - uid %d - distance %hu meters - direction ", loginId, dist);
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(name + ucstring(str) + CI18N::get(txts[direction])));
CInterfaceManager::getInstance()->displaySystemInfo(name + str + CI18N::get(txts[direction]));
}
}// impulseWho //
*/
@ -2495,7 +2495,7 @@ void impulseRemoteAdmin (NLMISC::CBitMemStream &impulse)
impulse.serial (cmd);
// remove the 2 first rc character if exists, only there to say to the EGS that is a remote command
if (cmd.size()>2 && tolower(cmd[0])=='r' && tolower(cmd[1])=='c')
if (cmd.size()>2 && tolower(cmd[0])=='r' && tolower(cmd[1])=='c') // FIXME: toLowerAscii
cmd = cmd.substr(2);
mdDisplayVars.clear ();
@ -3116,12 +3116,12 @@ void impulsePVPChooseClan(NLMISC::CBitMemStream &impulse)
CCtrlTextButton * butClan1 = dynamic_cast<CCtrlTextButton*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:join_pvp_clan_proposal:content:clan1"));
if( butClan1 == NULL )
return;
butClan1->setText( ucstring(EGSPD::CPeople::toString( clan1 )) );
butClan1->setText( EGSPD::CPeople::toString( clan1 ) );
CCtrlTextButton * butClan2 = dynamic_cast<CCtrlTextButton*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:join_pvp_clan_proposal:content:clan2"));
if( butClan2 == NULL )
return;
butClan2->setText( ucstring(EGSPD::CPeople::toString( clan2 )) );
butClan2->setText( EGSPD::CPeople::toString( clan2 ) );
}
*/
@ -3315,8 +3315,8 @@ private:
if(i!=digitMaxEnd)
{
// get the width
ucstring digitStr= contentStr.substr(digitStart, i-digitStart);
fromString(digitStr.toString(), w);
string digitStr= contentStr.substr(digitStart, i-digitStart);
fromString(digitStr, w);
// remove the first tag
contentStr= contentStr.substr(i+1);
}
@ -4339,7 +4339,7 @@ NLMISC_COMMAND(testDuelInvite, "","")
//{
// uint32 index;
// fromString(args[0], index);
// ucstring ucstr = args[1];
// ucstring ucstr = args[1]; // OLD
//
// vector<bool> code;
//

@ -71,7 +71,7 @@ void CProgress::setFontFactor(float temp)
_FontFactor = temp;
}
void CProgress::newMessage (const ucstring& message)
void CProgress::newMessage (const string& message)
{
popCropedValues ();
_CurrentRootStep++;
@ -249,7 +249,7 @@ void CProgress::internalProgress (float value)
for(uint i = 0; i < ClientCfg.Logos.size(); i++)
{
std::vector<string> res;
explode(ClientCfg.Logos[i], std::string(":"), res);
explode(ClientCfg.Logos[i], string(":"), res);
if(res.size()==9 && i<LogoBitmaps.size() && LogoBitmaps[i]!=NULL)
{
fromString(res[1], x);
@ -312,7 +312,7 @@ void CProgress::internalProgress (float value)
// More help
TextContext->setFontSize((uint)(12.f * fontFactor));
/* todo tips of the day uncomment
ucstring ucstr = CI18N::get ("uiTipsEnd");
string ucstr = CI18N::get ("uiTipsEnd");
TextContext->printAt(0.5f, fY, ucstr); */
fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY);
fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY);
@ -338,7 +338,7 @@ void CProgress::internalProgress (float value)
TextContext->setFontSize((uint)(15.f * fontFactor));
TextContext->setHotSpot(UTextContext::BottomLeft);
string uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText.toUtf8() + ") - " + CI18N::get("uiDelayedTPCancel");
string uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText + ") - " + CI18N::get("uiDelayedTPCancel");
UTextContext::CStringInfo info = TextContext->getStringInfo(uc);
float stringX = 0.5f - info.StringWidth/(ClientCfg.Width*2);
TextContext->printAt(stringX, 7.f / ClientCfg.Height, uc);
@ -360,11 +360,9 @@ void CProgress::internalProgress (float value)
(uint)RT.getRyzomTime(),
CI18N::get ("uiSeason"+toStringEnum(CRyzomTime::getSeasonByDay(day))).c_str(),
CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName).c_str());
ucstring ucstr;
ucstr.fromUtf8 (str);
TextContext->setHotSpot(UTextContext::MiddleBottom);
TextContext->setColor(CRGBA(186, 179, 163, 255));
TextContext->printAt(0.5f, 25/768.f, ucstr);
TextContext->printAt(0.5f, 25/768.f, str);
}
// apply text commands
@ -452,8 +450,9 @@ void CProgress::internalProgress (float value)
_TPCancelFlag = true;
}
#ifdef RYZOM_BG_DOWNLOADER
CBGDownloaderAccess::getInstance().update();
#endif
// Display to screen.
Driver->swapBuffers();
@ -474,7 +473,7 @@ void CProgress::internalProgress (float value)
}
void CProgress::setTPMessages(const ucstring &tpReason,const ucstring &tpCancelText, const std::string &/* iconName */)
void CProgress::setTPMessages(const string &tpReason,const string &tpCancelText, const string &/* iconName */)
{
_TPReason = tpReason;
_TPCancelText = tpCancelText;
@ -497,7 +496,7 @@ bool CProgress::getTPCancelFlag(bool clearFlag /*=true*/)
void CProgress::release()
{
setTPMessages(ucstring(), ucstring(), "");
setTPMessages(string(), string(), string());
_TPCancelFlag = false;
}

@ -64,7 +64,7 @@ public:
void finish ();
// New message
void newMessage (const ucstring& message);
void newMessage (const std::string& message);
void setFontFactor(float f);
@ -72,7 +72,7 @@ public:
bool ApplyTextCommands;
// Set teleport specific message
void setTPMessages(const ucstring &tpReason, const ucstring &tpCancelText, const std::string &iconName);
void setTPMessages(const std::string &tpReason, const std::string &tpCancelText, const std::string &iconName);
bool getTPCancelFlag(bool clearFlag = true);
@ -83,7 +83,7 @@ private:
// Display a text to describe what is the application going to do.
// this function can be call even if texture is NULL, driver or textcontext not initialised
ucstring _ProgressMessage;
std::string _ProgressMessage;
// Time since last update
sint64 _LastUpdate;
@ -92,8 +92,8 @@ private:
uint _CurrentRootStep;
uint _RootStepCount;
ucstring _TPReason;
ucstring _TPCancelText;
std::string _TPReason;
std::string _TPCancelText;
bool _TPCancelFlag;

@ -968,9 +968,7 @@ void CDisplayerVisualEntity::updateName()
//H_AUTO(R2_CDisplayerVisualEntity_updateName)
if (!_Entity) return;
std::string name = getString(&getProps(), "Name");
ucstring ucName;
ucName.fromUtf8(name);
std::string ucName = getString(&getProps(), "Name");
if (ucName.empty())
{
ucName = CI18N::get("uiR2EDNoName");
@ -1011,13 +1009,11 @@ void CDisplayerVisualEntity::updateName()
actName = NLMISC::toString(" [%s]", actName.c_str());
ucstring ucActName;
ucActName.fromUtf8(actName);
ucName += ucActName;
ucName += actName;
{
//BENCH(setEntityName)
_Entity->setEntityName(ucName.toUtf8());
_Entity->setEntityName(ucName);
}
{
//BENCH(buildInSceneInterface)

@ -4244,7 +4244,7 @@ sint CEditor::getGeneratedNameIndex(const std::string &nameUtf8, const std::stri
{
++ strIt;
const char *numberStart = &*strIt;
for (; strIt != endStrIt && isdigit(*strIt); ++strIt) {}
for (; strIt != endStrIt && (uint8)(*strIt) < (uint8)'\x80' && isdigit(*strIt); ++strIt) {}
if (strIt == endStrIt)
{
sint ret;
@ -4266,7 +4266,7 @@ bool CEditor::isPostFixedByNumber(const ucstring &baseName)
while (lastIndex > 0)
{
int currChar = (int) baseName[lastIndex];
if (!isdigit(currChar) &&
if (((uint8)currChar >= (uint8)'\x80' || !isdigit(currChar)) &&
currChar != ' ' &&
currChar != '\t')
{
@ -4289,7 +4289,7 @@ ucstring CEditor::genInstanceName(const ucstring &baseName)
while (lastIndex > 0)
{
int currChar = (int) strippedName[lastIndex];
if (!isdigit(currChar) &&
if (((uint8)currChar >= (uint8)'\x80' || !isdigit(currChar)) &&
currChar != ' ' &&
currChar != '\t')
{

@ -30,6 +30,7 @@
#include "nel/misc/async_file_manager.h"
#include "nel/misc/system_utils.h"
#include "nel/misc/streamed_package_manager.h"
#include "nel/web/http_package_provider.h"
// 3D Interface.
#include "nel/3d/bloom_effect.h"
#include "nel/3d/fxaa.h"
@ -488,7 +489,9 @@ void releaseMainLoop(bool closeConnection)
// Called when Quit from OutGame
void releaseOutGame()
{
#ifdef RYZOM_BG_DOWNLOADER
CBGDownloaderAccess::getInstance().release();
#endif
ProgressBar.release();
@ -570,7 +573,9 @@ void release()
CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_GameExit, "login_step_game_exit&play_time=" + toString((NLMISC::CTime::getLocalTime() - StartPlayTime) / 1000)));
}
#ifdef RYZOM_BG_DOWNLOADER
CBGDownloaderAccess::getInstance().release();
#endif
ProgressBar.release();

@ -974,7 +974,7 @@ restartLoop:
return referenceFile;
}
void CLoadProxy::loadStringFile(const string &filename, ucstring &text)
void CLoadProxy::loadStringFile(const string &filename, ucstring &text) // TODO: UTF-8 (serial)
{
vector<TStringInfo> reference;
vector<TStringInfo> addition;
@ -1018,7 +1018,7 @@ restartLoop:
context.Diff.push_back(context.Addition[addIndex]);
//nldebug("Adding new string '%s' in CI18N", context.Addition[addIndex].Identifier.c_str());
if (ClientCfg.DebugStringManager)
context.Diff.back().Text = ucstring("<NEW>")+context.Diff.back().Text;
context.Diff.back().Text = ucstring("<NEW>")+context.Diff.back().Text; // TODO: UTF-8 (serial)
}
void CLoadProxy::onRemove(uint /* addIndex */, uint /* refIndex */, TStringDiffContext &/* context */)
{
@ -1030,7 +1030,7 @@ restartLoop:
context.Diff.push_back(context.Addition[addIndex]);
//nldebug("Using changed string '%s' in CI18N", context.Addition[addIndex].Identifier.c_str());
if (ClientCfg.DebugStringManager)
context.Diff.back().Text = ucstring("<CHG>")+context.Diff.back().Text;
context.Diff.back().Text = ucstring("<CHG>")+context.Diff.back().Text; // TODO: UTF-8 (serial)
}
void CLoadProxy::onSwap(uint /* newIndex */, uint /* refIndex */, TStringDiffContext &/* context */)
{
@ -1044,7 +1044,7 @@ restartLoop:
class CReadWorkSheetFile : public TWorkSheetDiff::IDiffCallback
{
public:
void readWorkSheetFile(const string &filename, ucstring &text)
void readWorkSheetFile(const string &filename, ucstring &text) // TODO: UTF-8 (serial)
{
TWorksheet addition;
TWorksheet reference;
@ -1181,9 +1181,9 @@ bool CStringManagerClient::checkWordFileDates(vector<CFileCheck> &fileChecks, co
// ***************************************************************************
void CStringManagerClient::initI18NSpecialWords(const string &languageCode)
{
ucstring womenNameColIdent = "women_name";
ucstring descColIdent = "description";
ucstring descColIdent2 = "description2";
ucstring womenNameColIdent = ucstring("women_name"); // TODO: UTF-8 (serial)
ucstring descColIdent = ucstring("description"); // TODO: UTF-8 (serial)
ucstring descColIdent2 = ucstring("description2"); // TODO: UTF-8 (serial)
// List of words to append to the local CI18N system.
static const char *specialWords[]=
@ -1222,11 +1222,11 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode)
{
uint32 profile0= (uint32)ryzomGetLocalTime();
ucstring ucs;
ucstring ucs; // TODO: UTF-8 (serial)
string fileName = fileNames[i];
string keyExtenstion = specialWords[i*3+2];
// read the ucstring and make diffs with data in ./translation/work.
// read the ucstring and make diffs with data in ./translation/work. // TODO: UTF-8 (serial)
CReadWorkSheetFile rwsf;
rwsf.readWorkSheetFile(fileName, ucs);
if(ucs.empty())
@ -1238,9 +1238,9 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode)
// Get the Key and Data ColIndex.
uint nameColIndex = 0, keyColIndex = 0;
if( !ws.findCol(ucstring("name"), nameColIndex) )
if( !ws.findCol(ucstring("name"), nameColIndex) ) // TODO: UTF-8 (serial)
continue;
if( !ws.findCol(ucstring(specialWords[i*3+1]), keyColIndex) )
if( !ws.findCol(ucstring(specialWords[i*3+1]), keyColIndex) ) // TODO: UTF-8 (serial)
continue;
// Get the women name index if possible.
@ -1285,7 +1285,7 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode)
// insert in map of Women Name if OK.
if(womenNameColIndex!=std::numeric_limits<uint>::max())
{
const ucstring &womenName= ws.getData(j, womenNameColIndex);
const ucstring &womenName= ws.getData(j, womenNameColIndex); // TODO: UTF-8 (serial)
_SpecItem_TempMap[keyStr].WomenName= womenName.toUtf8();
// replace all \n in the women name with true \n
while(strFindReplace(_SpecItem_TempMap[keyStr].WomenName, "\\n", "\n"));
@ -1294,7 +1294,7 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode)
// insert in map of Description if OK.
if(descColIndex!=std::numeric_limits<uint>::max())
{
const ucstring &desc= ws.getData(j, descColIndex);
const ucstring &desc= ws.getData(j, descColIndex); // TODO: UTF-8 (serial)
_SpecItem_TempMap[keyStr].Desc= desc.toUtf8();
// replace all \n in the desc with true \n
while(strFindReplace(_SpecItem_TempMap[keyStr].Desc, "\\n", "\n"));
@ -1303,7 +1303,7 @@ void CStringManagerClient::initI18NSpecialWords(const string &languageCode)
// insert in map of Description2 if OK.
if(descColIndex2!=std::numeric_limits<uint>::max())
{
const ucstring &desc= ws.getData(j, descColIndex2);
const ucstring &desc= ws.getData(j, descColIndex2); // TODO: UTF-8 (serial)
_SpecItem_TempMap[keyStr].Desc2= desc.toUtf8();
// replace all \n in the desc with true \n
while(strFindReplace(_SpecItem_TempMap[keyStr].Desc2, "\\n", "\n"));

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save