Merge branch 'develop' into ryzomclassic-develop

ryzomclassic-develop
kaetemi 4 years ago
commit 35e18597ee

@ -40,7 +40,7 @@ class CTextureFile;
class CAsyncFileManager3D class CAsyncFileManager3D
{ {
NLMISC_SAFE_SINGLETON_DECL(CAsyncFileManager3D); NLMISC_SAFE_RELEASABLE_SINGLETON_DECL(CAsyncFileManager3D);
CAsyncFileManager3D(); CAsyncFileManager3D();
public: public:

@ -22,6 +22,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/georges/u_form.h" #include "nel/georges/u_form.h"
#include "form_dfn.h"
#include "form_elm.h" #include "form_elm.h"
#include "header.h" #include "header.h"
@ -124,6 +125,10 @@ private:
// The form filename // The form filename
std::string _Filename; std::string _Filename;
// The dfn
NLMISC::CSmartPtr<CFormDfn> _Dfn;
}; };
} // NLGEORGES } // NLGEORGES

@ -282,6 +282,10 @@ public:
{ {
Element = NULL; Element = NULL;
} }
~CFormElmStructElm()
{
nlassert(!Element);
}
std::string Name; std::string Name;
CFormElm* Element; CFormElm* Element;
@ -400,6 +404,10 @@ public:
{ {
Element = NULL; Element = NULL;
} }
~CElement ()
{
nlassert(!Element);
}
std::string Name; std::string Name;
CFormElm* Element; CFormElm* Element;

@ -69,7 +69,7 @@ namespace NLGUI
static CAHManager* getInstance() static CAHManager* getInstance()
{ {
if (_GlobalInstance == NULL) if (_GlobalInstance == NULL && !s_Deleted)
_GlobalInstance = new CAHManager; _GlobalInstance = new CAHManager;
return _GlobalInstance; return _GlobalInstance;
} }
@ -134,6 +134,19 @@ namespace NLGUI
static CAHManager *_GlobalInstance; static CAHManager *_GlobalInstance;
static bool editorMode; static bool editorMode;
class CDeleter
{
public:
~CDeleter()
{
delete _GlobalInstance;
_GlobalInstance = NULL;
s_Deleted = true;
}
};
static CDeleter s_Deleter;
static bool s_Deleted;
}; };
/// Ah name must all be lower case /// Ah name must all be lower case

@ -42,9 +42,13 @@ namespace NLGUI
UInt32, UInt32,
Float, Float,
String, String,
#ifdef RYZOM_LUA_UCSTRING
UCString, UCString,
#endif
StringRef, StringRef,
#ifdef RYZOM_LUA_UCSTRING
UCStringRef, UCStringRef,
#endif
RGBA, RGBA,
LuaMethod LuaMethod
}; // other types will be added when needed }; // other types will be added when needed
@ -79,9 +83,13 @@ namespace NLGUI
TGetUInt32 GetUInt32; TGetUInt32 GetUInt32;
TGetFloat GetFloat; TGetFloat GetFloat;
TGetString GetString; TGetString GetString;
#ifdef RYZOM_LUA_UCSTRING
TGetUCString GetUCString; TGetUCString GetUCString;
#endif
TGetStringRef GetStringRef; TGetStringRef GetStringRef;
#ifdef RYZOM_LUA_UCSTRING
TGetUCStringRef GetUCStringRef; TGetUCStringRef GetUCStringRef;
#endif
TGetRGBA GetRGBA; TGetRGBA GetRGBA;
TLuaMethod GetLuaMethod; // lua method can only be obtained, not written ... TLuaMethod GetLuaMethod; // lua method can only be obtained, not written ...
} GetMethod; } GetMethod;
@ -92,7 +100,9 @@ namespace NLGUI
TSetUInt32 SetUInt32; TSetUInt32 SetUInt32;
TSetFloat SetFloat; TSetFloat SetFloat;
TSetString SetString; TSetString SetString;
#ifdef RYZOM_LUA_UCSTRING
TSetUCString SetUCString; TSetUCString SetUCString;
#endif
TSetRGBA SetRGBA; TSetRGBA SetRGBA;
} SetMethod; } SetMethod;
// name of the property // name of the property

@ -58,12 +58,8 @@ public:
static CFactory &instance() static CFactory &instance()
{ {
// Singleton instance pointer. // Singleton instance pointer.
static CFactory *instance = NULL; static CFactory instance;
if (!instance) return instance;
{
instance = new CFactory();
}
return *instance;
} }
/** Register a factorable object in the factory. /** Register a factorable object in the factory.
@ -182,12 +178,8 @@ public:
/// Get the singleton instance reference. /// Get the singleton instance reference.
static CFactoryIndirect &instance() static CFactoryIndirect &instance()
{ {
static CFactoryIndirect *instance = NULL; static CFactoryIndirect instance;
if (!instance) return instance;
{
instance = new CFactoryIndirect();
}
return *instance;
} }
void registerClass(const KeyType &key, IFactoryIndirectRegister<BaseFactoryClass> *factoryRegister) void registerClass(const KeyType &key, IFactoryIndirectRegister<BaseFactoryClass> *factoryRegister)

@ -0,0 +1,131 @@
// NeL - MMORPG Framework <https://wiki.ryzom.dev/>
// Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#ifndef NLMISC_STRING_VIEW_H
#define NLMISC_STRING_VIEW_H
#include <nel/misc/types_nl.h>
#include <string>
#ifdef NL_CPP14
using namespace std::string_literals;
#ifdef NL_CPP17
#include <string_view>
using namespace std::string_view_literals;
#endif
#endif
#ifdef NL_CPP14
/// Obtain an std::string from a string literal.
#define nlstr(strLit) (strLit##s)
#else
/// Obtain an std::string from a string literal.
#define nlstr(strLit) (std::string(strLit))
#endif
#ifdef NL_CPP17
/// Obtain a string view from a string literal.
#define nlsv(strLit) (strLit##sv)
/// Obtain an std::string from a string view.
#define nlsvs(strView) (std::string(strView))
#else
/// Obtain a string view from a string literal.
#define nlsv(strLit) (CStringView(strLit, ::strlen(strLit)))
/// Obtain an std::string from a string view.
#define nlsvs(strView) (std::string(strView.data(), strView.size()))
#endif
/// Obtain a temporary C-string from a string view. Use directly in argument, do not store.
#define nlsvc(strView) ((strView.data()[strView.size()]) ? nlsvs(strView).c_str() : strView.data())
namespace NLMISC {
/// String view literals allow bypassing allocation and strlen calls.
/// CStringView is a 100% drop-in replacement for (const char *str, size_t len) tuples. It's a non-owning reference.
/// Always use `CStringView` where previously `const std::string &` would have been used. It avoids accidental copy.
/// Gotcha: CStringView doesn't need to end with \0, so there's no guarantee with functions that expect \0 terminated strings,
/// use the `nlsvc` macro to get a temporary C-string from a CStringView.
/// Use the `nlsv` macro to get a CStringView from a string literal.
/// Use the `nlstr` macro to get an std::string from a string literal.
/// Use the `nlsvs` macro to get an std::string from a CStringView.
#ifdef NL_CPP17
typedef std::string_view CStringView;
#else
class CStringView
{
public:
CStringView(const std::string &str) : m_Str(&str[0]), m_Len(str.size()) {}
CStringView(const char *const str, const size_t len) : m_Str(str), m_Len(len) {}
CStringView(const char *const str) : m_Str(str), m_Len(sizeof(str)) {}
inline const char *data() const { return m_Str; }
inline size_t length() const { return m_Len; }
inline size_t size() const { return m_Len; }
inline CStringView substr(const size_t offset, const size_t count = -1) { return CStringView(m_Str + offset, std::min(m_Len - offset, count)); }
inline bool operator==(const CStringView o) { if (m_Len != o.m_Len) return false; return memcmp(m_Str, o.m_Str, m_Len) == 0; }
inline bool operator!=(const CStringView o) { if (m_Len != o.m_Len) return true; return memcmp(m_Str, o.m_Str, m_Len) != 0; }
struct const_iterator
{
public:
const_iterator() : m_Addr(NULL) { }
inline void operator++()
{
++m_Addr;
}
inline void operator+=(ptrdiff_t v)
{
m_Addr += v;
}
inline void operator--()
{
--m_Addr;
}
inline void operator-=(ptrdiff_t v)
{
m_Addr -= v;
}
inline bool operator!=(const const_iterator &o) const { return m_Addr != o.m_Addr; }
inline bool operator==(const const_iterator &o) const { return m_Addr == o.m_Addr; }
inline const char &operator*() const { return *m_Addr; }
private:
friend class CStringView;
inline const_iterator(const char *addr) : m_Addr(addr) {}
const char *m_Addr;
};
typedef const_iterator iterator;
iterator begin() const { return iterator(m_Str); }
inline iterator end() const { return iterator(m_Str + m_Len); }
private:
const char *m_Str;
size_t m_Len;
};
#endif
}
#endif /* #ifndef NLMISC_STRING_VIEW_H */
/* end of file */

@ -18,9 +18,12 @@
#define NLMISC_UTF_STRING_VIEW_H #define NLMISC_UTF_STRING_VIEW_H
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include <nel/misc/ucstring.h>
#include <string> #include <string>
#include <nel/misc/string_view.h>
#include <nel/misc/ucstring.h>
namespace NLMISC { namespace NLMISC {
class IStream; class IStream;
@ -40,6 +43,9 @@ public:
{ {
nlassert(len <= strlen(utf8Str)); nlassert(len <= strlen(utf8Str));
} }
inline CUtfStringView(CStringView utf8Str) : m_Str(utf8Str.data()), m_Size(utf8Str.size()), m_Iterator(utf8Iterator) {}
#if defined(NL_OS_WINDOWS) #if defined(NL_OS_WINDOWS)
inline CUtfStringView(const wchar_t *utf16Str) : m_Str(utf16Str), m_Size(wcslen(utf16Str)), m_Iterator(utf16Iterator) {} inline CUtfStringView(const wchar_t *utf16Str) : m_Str(utf16Str), m_Size(wcslen(utf16Str)), m_Iterator(utf16Iterator) {}
inline CUtfStringView(const wchar_t *utf16Str, size_t len): m_Str(utf16Str), m_Size(len), m_Iterator(utf16Iterator) inline CUtfStringView(const wchar_t *utf16Str, size_t len): m_Str(utf16Str), m_Size(len), m_Iterator(utf16Iterator)
@ -125,7 +131,8 @@ public:
inline bool empty() const { return !m_Size; } inline bool empty() const { return !m_Size; }
const void *ptr() const { return m_Str; } const void *ptr() const { return m_Str; }
size_t count() const; // Slow count of UTF-32 characters size_t count() const; //< Slow count of UTF-32 codepoints
ptrdiff_t offset(ptrdiff_t i); const //< Get byte offset by utf-32 codepoint index
inline CUtfStringView substr(const iterator &begin, const iterator &end) const inline CUtfStringView substr(const iterator &begin, const iterator &end) const
{ {
@ -166,6 +173,6 @@ private:
} /* namespace NLMISC */ } /* namespace NLMISC */
#endif /* #ifndef NLMISC_STREAMED_PACKAGE_PROVIDER_H */ #endif /* #ifndef NLMISC_UTF_STRING_VIEW_H */
/* end of file */ /* end of file */

@ -146,8 +146,10 @@ void CFontManager::computeString (NLMISC::CUtfStringView sv,
{ {
// Creating font // Creating font
k.Char = *it; k.Char = *it;
if (k.Char < 0x20) if (k.Char < 0x20) // Control Characters
k.Char += 0x2400; k.Char += 0x2400;
if (k.Char == 0x7F) // DEL
k.Char = 0x2421;
k.FontGenerator = fontGen; k.FontGenerator = fontGen;
k.Size = fontSize; k.Size = fontSize;
k.Embolden = embolden; k.Embolden = embolden;

@ -191,6 +191,9 @@ void CForm::read (xmlNodePtr node, CFormLoader &loader, CFormDfn *dfn, const std
// Reset form // Reset form
clean (); clean ();
// Save the dfn
_Dfn = dfn;
// Check node name // Check node name
if ( ((const char*)node->name == NULL) || (strcmp ((const char*)node->name, "FORM") != 0) ) if ( ((const char*)node->name == NULL) || (strcmp ((const char*)node->name, "FORM") != 0) )
{ {

@ -1707,6 +1707,7 @@ CFormElmStruct::CFormElmStruct (CForm *form, CFormElm *parentNode, const CFormDf
CFormElmStruct::~CFormElmStruct () CFormElmStruct::~CFormElmStruct ()
{ {
// Job done in clean() // Job done in clean()
clean();
} }
// *************************************************************************** // ***************************************************************************
@ -1717,10 +1718,10 @@ void CFormElmStruct::clean ()
uint elm; uint elm;
for (elm =0; elm<Elements.size(); elm++) for (elm =0; elm<Elements.size(); elm++)
{ {
if (Elements[elm].Element) delete Elements[elm].Element;
delete Elements[elm].Element;
Elements[elm].Element = NULL; Elements[elm].Element = NULL;
} }
Elements.clear();
} }
// *************************************************************************** // ***************************************************************************
@ -2270,6 +2271,7 @@ CFormElmArray::CFormElmArray (CForm *form, const CFormDfn *formDfn, const CType
CFormElmArray::~CFormElmArray () CFormElmArray::~CFormElmArray ()
{ {
// Job done in clean() // Job done in clean()
clean();
} }
// *************************************************************************** // ***************************************************************************
@ -2280,8 +2282,8 @@ void CFormElmArray::clean ()
uint elm; uint elm;
for (elm =0; elm<Elements.size(); elm++) for (elm =0; elm<Elements.size(); elm++)
{ {
if (Elements[elm].Element) delete Elements[elm].Element;
delete Elements[elm].Element; Elements[elm].Element = NULL;
} }
Elements.clear (); Elements.clear ();
} }

@ -241,7 +241,7 @@ UForm *CFormLoader::loadForm (const std::string &filename)
name += ".dfn"; name += ".dfn";
// Load the dfn // Load the dfn
CFormDfn *dfn = loadFormDfn (name, false); CSmartPtr<CFormDfn> dfn = loadFormDfn (name, false);
if (dfn) if (dfn)
{ {
// Open the file // Open the file

@ -42,6 +42,8 @@ namespace NLGUI
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
CAHManager *CAHManager::_GlobalInstance = NULL; CAHManager *CAHManager::_GlobalInstance = NULL;
bool CAHManager::editorMode = false; bool CAHManager::editorMode = false;
CAHManager::CDeleter CAHManager::s_Deleter;
bool CAHManager::s_Deleted = false;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

@ -54,6 +54,36 @@ namespace NLGUI
CGroupEditBox *CGroupEditBox::_MenuFather = NULL; CGroupEditBox *CGroupEditBox::_MenuFather = NULL;
CGroupEditBox::IComboKeyHandler* CGroupEditBox::comboKeyHandler = NULL; CGroupEditBox::IComboKeyHandler* CGroupEditBox::comboKeyHandler = NULL;
// For now, just trim unsupported codepoints to make emoji fallback to text form
static bool supportedCodepoint(u32char c)
{
if (c >= 0xFE00 && c < 0xFE10)
return false; // Variation Selectors
else if (c >= 0xE0100 && c < 0xE01F0)
return false; // Variation Selectors Supplement
else if (c >= 0x200B && c < 0x2010)
return false; // ZERO WIDTH JOINER, etcetera
else if (c >= 0x2028 && c < 0x202F)
return false; // PARAGRAPH SEPARATOR, etcetera
else if (c >= 0x2060 && c < 0x2070)
return false; // WORD JOINER, etcetera
else if (c == 0xFEFF)
return false; // BOM
return true;
}
// For now, just trim unsupported codepoints to make emoji fallback to text form
static ::u32string trimUnsupported(const ::u32string str)
{
::u32string res;
res.reserve(str.size());
for (::u32string::const_iterator it(str.begin()), end(str.end()); it != end; ++it)
{
if (supportedCodepoint(*it))
res.push_back(*it);
}
return res;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
NLMISC_REGISTER_OBJECT(CViewBase, CGroupEditBox, std::string, "edit_box"); NLMISC_REGISTER_OBJECT(CViewBase, CGroupEditBox, std::string, "edit_box");
@ -850,7 +880,8 @@ namespace NLGUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CGroupEditBox::writeString(const std::string &str16, bool replace, bool atEnd) void CGroupEditBox::writeString(const std::string &str16, bool replace, bool atEnd)
{ {
::u32string str = CUtfStringView(str16).toUtf32(); // For now, just trim unsupported codepoints to make emoji fallback to text form
::u32string str = trimUnsupported(CUtfStringView(str16).toUtf32());
sint length = (sint)str.length(); sint length = (sint)str.length();
::u32string toAppend; ::u32string toAppend;
@ -1111,6 +1142,7 @@ namespace NLGUI
u32char c = isKeyRETURN ? '\n' : rEDK.getChar(); u32char c = isKeyRETURN ? '\n' : rEDK.getChar();
if (isFiltered(c)) return; if (isFiltered(c)) return;
if (!supportedCodepoint(c)) return; // For now, just trim unsupported codepoints to make emoji fallback to text form
switch(_EntryType) switch(_EntryType)
{ {
case Integer: case Integer:

@ -553,15 +553,19 @@ namespace NLGUI
case CReflectedProperty::String: case CReflectedProperty::String:
result.setString ((elem->*(pRP->GetMethod.GetString))()); result.setString ((elem->*(pRP->GetMethod.GetString))());
break; break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString: case CReflectedProperty::UCString:
result.setString ((elem->*(pRP->GetMethod.GetUCString))().toUtf8()); result.setString ((elem->*(pRP->GetMethod.GetUCString))().toUtf8());
break; break;
#endif
case CReflectedProperty::StringRef: case CReflectedProperty::StringRef:
result.setString ((elem->*(pRP->GetMethod.GetStringRef))()); result.setString ((elem->*(pRP->GetMethod.GetStringRef))());
break; break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCStringRef: case CReflectedProperty::UCStringRef:
result.setString ((elem->*(pRP->GetMethod.GetUCStringRef))().toUtf8()); result.setString ((elem->*(pRP->GetMethod.GetUCStringRef))().toUtf8());
break; break;
#endif
case CReflectedProperty::RGBA: case CReflectedProperty::RGBA:
result.setRGBA ((elem->*(pRP->GetMethod.GetRGBA))()); result.setRGBA ((elem->*(pRP->GetMethod.GetRGBA))());
break; break;

@ -117,18 +117,18 @@ namespace NLGUI
return false; return false;
} }
break; break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString: case CReflectedProperty::UCString:
case CReflectedProperty::UCStringRef: case CReflectedProperty::UCStringRef:
#ifdef RYZOM_LUA_UCSTRING
if (valueToAffect.toString()) if (valueToAffect.toString())
{ {
(destElem.*(property.SetMethod.SetUCString))(ucstring::makeFromUtf8(valueToAffect.getString())); (destElem.*(property.SetMethod.SetUCString))(ucstring::makeFromUtf8(valueToAffect.getString()));
} }
else else
#endif
{ {
return false; return false;
} }
#endif
break; break;
case CReflectedProperty::RGBA: case CReflectedProperty::RGBA:
if (valueToAffect.toRGBA()) if (valueToAffect.toRGBA())

@ -1412,6 +1412,7 @@ namespace NLGUI
case CReflectedProperty::String: case CReflectedProperty::String:
ls.push( (reflectedObject.*(property.GetMethod.GetString))() ); ls.push( (reflectedObject.*(property.GetMethod.GetString))() );
break; break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString: case CReflectedProperty::UCString:
{ {
ucstring str = (reflectedObject.*(property.GetMethod.GetUCString))(); ucstring str = (reflectedObject.*(property.GetMethod.GetUCString))();
@ -1434,6 +1435,7 @@ namespace NLGUI
#endif #endif
} }
break; break;
#endif
case CReflectedProperty::StringRef: case CReflectedProperty::StringRef:
ls.push( (reflectedObject.*(property.GetMethod.GetStringRef))() ); ls.push( (reflectedObject.*(property.GetMethod.GetStringRef))() );
break; break;
@ -1508,6 +1510,7 @@ namespace NLGUI
(target.*(property.SetMethod.SetString))(val); (target.*(property.SetMethod.SetString))(val);
return; return;
} }
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString: case CReflectedProperty::UCString:
case CReflectedProperty::UCStringRef: case CReflectedProperty::UCStringRef:
{ {
@ -1532,6 +1535,7 @@ namespace NLGUI
(target.*(property.SetMethod.SetUCString))(val); (target.*(property.SetMethod.SetUCString))(val);
return; return;
} }
#endif
case CReflectedProperty::RGBA: case CReflectedProperty::RGBA:
{ {
CRGBA color; CRGBA color;

@ -135,12 +135,12 @@ CApplicationContext::~CApplicationContext()
while (it != iend) while (it != iend)
{ {
// can't use nldebug there because it'll create new displayers // can't use nldebug there because it'll create new displayers
std::string message = toString("Instance '%s' still allocated at %p", it->first.c_str(), it->second); std::string message = toString("Instance '%s' still allocated at %p\n", it->first.c_str(), it->second);
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
OutputDebugStringW(nlUtf8ToWide(message)); OutputDebugStringW(nlUtf8ToWide(message));
#else #else
printf("%s\n", message.c_str()); printf("%s", message.c_str());
#endif #endif
++it; ++it;

@ -0,0 +1,31 @@
// NeL - MMORPG Framework <https://wiki.ryzom.dev/>
// Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#include "stdmisc.h"
#include "nel/misc/string_view.h"
// STL includes
// Project includes
namespace NLMISC
{
void nothing_here_string_view_nl() { }
} /* namespace NLMISC */
/* end of file */

@ -230,6 +230,18 @@ size_t CUtfStringView::count() const
return res; return res;
} }
ptrdiff_t CUtfStringView::offset(ptrdiff_t i)
{
size_t res = 0;
for (iterator it(begin()), end(this->end()); it != end; ++it)
{
if (res == i)
return (ptrdiff_t)it.ptr() - (ptrdiff_t)ptr();
++res;
}
return res;
}
u32char CUtfStringView::utf8Iterator(const void **addr) u32char CUtfStringView::utf8Iterator(const void **addr)
{ {
// Decode UTF-8 // Decode UTF-8

@ -695,6 +695,7 @@ void CAudioMixerUser::initDevice(const std::string &deviceName, const CInitInfo
setBackgroundFlags(flags); setBackgroundFlags(flags);
} }
form = NULL;
NLGEORGES::UFormLoader::releaseLoader(formLoader); NLGEORGES::UFormLoader::releaseLoader(formLoader);
} }
} }

@ -451,6 +451,7 @@ int main(int argc, char **argv)
// delete all logs and displayers when we're not using logs macros anymore // delete all logs and displayers when we're not using logs macros anymore
destroyDebug(); destroyDebug();
CLog::releaseProcessName(); CLog::releaseProcessName();
// CCoTask::releaseInstance();
// delete the Nel context // delete the Nel context
delete appContext; delete appContext;

@ -329,7 +329,7 @@ void CClientChatManager::tell( const string& receiverIn, const string& strIn )
// *** send str // *** send str
CBitMemStream bms; CBitMemStream bms;
string msgType = "STRING:TELL"; const char *msgType = "STRING:TELL";
if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) )
{ {
bms.serial( receiver ); bms.serial( receiver );
@ -385,7 +385,7 @@ void CClientChatManager::tell( const string& receiverIn, const string& strIn )
void CClientChatManager::filter( uint8 filter ) void CClientChatManager::filter( uint8 filter )
{ {
CBitMemStream bms; CBitMemStream bms;
string msgType = "STRING:FILTER"; const char *msgType = "STRING:FILTER";
if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) )
{ {
bms.serial( filter ); bms.serial( filter );
@ -417,7 +417,7 @@ void CClientChatManager::setChatMode(CChatGroup::TGroupType group, TChanID dynam
if (group != CChatGroup::team) if (group != CChatGroup::team)
{ {
CBitMemStream bms; CBitMemStream bms;
string msgType = "STRING:CHAT_MODE"; const char *msgType = "STRING:CHAT_MODE";
if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) )
{ {
bms.serial( mode ); bms.serial( mode );

@ -181,14 +181,14 @@ NLMISC_COMMAND(where, "Ask information on the position", "")
// Check parameters. // Check parameters.
if(args.empty()) if(args.empty())
{ // Create the message and send. { // Create the message and send.
const string msgName = "COMMAND:WHERE"; const char *msgName = "COMMAND:WHERE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlwarning("command 'where': unknown message named '%s'", msgName.c_str()); nlwarning("command 'where': unknown message named '%s'", msgName);
return true; return true;
} }
return false; return false;
@ -1803,14 +1803,14 @@ NLMISC_COMMAND(usePreprogCombat, "use the specified combat preprog sentence", "<
NLMISC_COMMAND(engage, "engage target in combat", "") NLMISC_COMMAND(engage, "engage target in combat", "")
{ {
// Create the message for the server to execute a phrase. // Create the message for the server to execute a phrase.
const string msgName = "COMBAT:ENGAGE"; const char *msgName = "COMBAT:ENGAGE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); nlwarning("mainLoop : unknown message name : '%s'", msgName);
return true; return true;
} }
@ -1836,14 +1836,14 @@ NLMISC_COMMAND(disengage, "disengage from combat", "")
NLMISC_COMMAND(leaveTeam, "leave team", "") NLMISC_COMMAND(leaveTeam, "leave team", "")
{ {
// Create the message for the server to execute a phrase. // Create the message for the server to execute a phrase.
const string msgName = "TEAM:LEAVE"; const char *msgName = "TEAM:LEAVE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); nlwarning("mainLoop : unknown message name : '%s'", msgName);
return true; return true;
} }
@ -1851,14 +1851,14 @@ NLMISC_COMMAND(leaveTeam, "leave team", "")
NLMISC_COMMAND(joinTeam, "join the specified team", "") NLMISC_COMMAND(joinTeam, "join the specified team", "")
{ {
// Create the message for the server to execute a phrase. // Create the message for the server to execute a phrase.
const string msgName = "TEAM:JOIN"; const char *msgName = "TEAM:JOIN";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); nlwarning("mainLoop : unknown message name : '%s'", msgName);
return true; return true;
} }
@ -1866,14 +1866,14 @@ NLMISC_COMMAND(joinTeam, "join the specified team", "")
NLMISC_COMMAND(joinTeamProposal, "propose to current target to join the team", "") NLMISC_COMMAND(joinTeamProposal, "propose to current target to join the team", "")
{ {
// Create the message for the server to execute a phrase. // Create the message for the server to execute a phrase.
const string msgName = "TEAM:JOIN_PROPOSAL"; const char *msgName = "TEAM:JOIN_PROPOSAL";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); nlwarning("mainLoop : unknown message name : '%s'", msgName);
return true; return true;
} }
@ -1881,14 +1881,14 @@ NLMISC_COMMAND(joinTeamProposal, "propose to current target to join the team", "
NLMISC_COMMAND(joinTeamDecline, "decline a join team proposal", "") NLMISC_COMMAND(joinTeamDecline, "decline a join team proposal", "")
{ {
// Create the message for the server to execute a phrase. // Create the message for the server to execute a phrase.
const string msgName = "TEAM:JOIN_PROPOSAL_DECLINE"; const char *msgName = "TEAM:JOIN_PROPOSAL_DECLINE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); nlwarning("mainLoop : unknown message name : '%s'", msgName);
return true; return true;
} }
@ -1896,14 +1896,14 @@ NLMISC_COMMAND(joinTeamDecline, "decline a join team proposal", "")
NLMISC_COMMAND(kickTeammate, "kick someone from your team", "") NLMISC_COMMAND(kickTeammate, "kick someone from your team", "")
{ {
// Create the message for the server to execute a phrase. // Create the message for the server to execute a phrase.
const string msgName = "TEAM:KICK"; const char *msgName = "TEAM:KICK";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); nlwarning("mainLoop : unknown message name : '%s'", msgName);
return true; return true;
} }
@ -1913,14 +1913,14 @@ NLMISC_COMMAND(cancelCurrentSentence, "cancel the sentence being executed", "")
// no parameter needed // no parameter needed
// Create the message for the server to cancel the phrase being executed // Create the message for the server to cancel the phrase being executed
const string msgName = "SENTENCE:CANCEL_CURRENT"; const char *msgName = "SENTENCE:CANCEL_CURRENT";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlwarning("command : unknown message name : '%s'", msgName.c_str()); nlwarning("command : unknown message name : '%s'", msgName);
return true; return true;
} }
@ -1952,7 +1952,7 @@ NLMISC_COMMAND(drop,"drop an item to the ground","<id>")
sint32 z = (sint32)UserEntity->pos().z * 1000; sint32 z = (sint32)UserEntity->pos().z * 1000;
CBitMemStream bms; CBitMemStream bms;
string msgType = "ITEM:DROP"; const char *msgType = "ITEM:DROP";
if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) )
{ {
bms.serial( itemId ); bms.serial( itemId );
@ -3769,7 +3769,7 @@ NLMISC_COMMAND( createPerso, "create a new character", "Parameters:\n-Character
fromString(args[4], level); fromString(args[4], level);
CBitMemStream bms; CBitMemStream bms;
string msgType = "CHEAT:CREATE_CHARACTER"; const char *msgType = "CHEAT:CREATE_CHARACTER";
if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) )
{ {
bms.serial( characterName ); bms.serial( characterName );
@ -3800,7 +3800,7 @@ NLMISC_COMMAND( add_role, "add role to character", "<Role( MeleeFighter, RangeFi
fromString(args[1], level); fromString(args[1], level);
CBitMemStream bms; CBitMemStream bms;
string msgType = "CHEAT:ADD_ROLE"; const char *msgType = "CHEAT:ADD_ROLE";
if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) )
{ {
bms.serialEnum( role ); bms.serialEnum( role );
@ -4130,11 +4130,11 @@ NLMISC_COMMAND(browseRingAdmin, "Browse a HTML document with the ring web browse
NLMISC_COMMAND(GUCreate, "create a guild", "<guild name>") NLMISC_COMMAND(GUCreate, "create a guild", "<guild name>")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
const string msgName = "GUILD:CREATE"; const char *msgName = "GUILD:CREATE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
string buf = args[0]; ucstring buf = ucstring::makeFromUtf8(args[0]); // FIXME: UTF-8 (serial)
out.serial( buf ); out.serial( buf );
NetMngr.push(out); NetMngr.push(out);
} }
@ -4144,7 +4144,7 @@ NLMISC_COMMAND(GUCreate, "create a guild", "<guild name>")
NLMISC_COMMAND(GUQuit, "quit a guild", "") NLMISC_COMMAND(GUQuit, "quit a guild", "")
{ {
if (args.size() != 0) return false; if (args.size() != 0) return false;
const string msgName = "GUILD:QUIT"; const char *msgName = "GUILD:QUIT";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4156,7 +4156,7 @@ NLMISC_COMMAND(GUQuit, "quit a guild", "")
NLMISC_COMMAND(GULeaveLeadership, "abandon leadership of a guild", "") NLMISC_COMMAND(GULeaveLeadership, "abandon leadership of a guild", "")
{ {
if (args.size() != 0) return false; if (args.size() != 0) return false;
const string msgName = "GUILD:ABANDON_LEADERSHIP"; const char *msgName = "GUILD:ABANDON_LEADERSHIP";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4167,7 +4167,7 @@ NLMISC_COMMAND(GULeaveLeadership, "abandon leadership of a guild", "")
NLMISC_COMMAND(GULeaveOfficerTitle, "abandon officer title", "") NLMISC_COMMAND(GULeaveOfficerTitle, "abandon officer title", "")
{ {
if (args.size() != 0) return false; if (args.size() != 0) return false;
const string msgName = "GUILD:ABANDON_OFFICER_TITLE"; const char *msgName = "GUILD:ABANDON_OFFICER_TITLE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4179,7 +4179,7 @@ NLMISC_COMMAND(GULeaveOfficerTitle, "abandon officer title", "")
NLMISC_COMMAND(GUNameOfficer, "name an officer", "<player name>") NLMISC_COMMAND(GUNameOfficer, "name an officer", "<player name>")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
const string msgName = "GUILD:NAME_OFFICER"; const char *msgName = "GUILD:NAME_OFFICER";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4193,7 +4193,7 @@ NLMISC_COMMAND(GUNameOfficer, "name an officer", "<player name>")
NLMISC_COMMAND(GUDismissOfficer, "dismiss an officer", "<player name>") NLMISC_COMMAND(GUDismissOfficer, "dismiss an officer", "<player name>")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
const string msgName = "GUILD:DISMISS_OFFICER"; const char *msgName = "GUILD:DISMISS_OFFICER";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4207,7 +4207,7 @@ NLMISC_COMMAND(GUDismissOfficer, "dismiss an officer", "<player name>")
NLMISC_COMMAND(GUKick, "kick a member", "<player name>") NLMISC_COMMAND(GUKick, "kick a member", "<player name>")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
const string msgName = "GUILD:KICK_MEMBER"; const char *msgName = "GUILD:KICK_MEMBER";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4234,7 +4234,7 @@ NLMISC_COMMAND(GURefuse, "refuse an invitation", "")
NLMISC_COMMAND(GUFriend, "invite a player to become a friend of the guild", "<player name>") NLMISC_COMMAND(GUFriend, "invite a player to become a friend of the guild", "<player name>")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
const string msgName = "GUILD:FRIEND_INVITATION"; const char *msgName = "GUILD:FRIEND_INVITATION";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4248,7 +4248,7 @@ NLMISC_COMMAND(GUFriend, "invite a player to become a friend of the guild", "<pl
NLMISC_COMMAND(GUFriendAccept, "accept to be a friend of a guild that invited you", "") NLMISC_COMMAND(GUFriendAccept, "accept to be a friend of a guild that invited you", "")
{ {
if (args.size() != 0) return false; if (args.size() != 0) return false;
const string msgName = "GUILD:ACCEPT_FRIEND_INVITATION"; const char *msgName = "GUILD:ACCEPT_FRIEND_INVITATION";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4260,7 +4260,7 @@ NLMISC_COMMAND(GUFriendAccept, "accept to be a friend of a guild that invited yo
NLMISC_COMMAND(GUFriendRefuse, "refuse to be a friend of a guild that invited you", "") NLMISC_COMMAND(GUFriendRefuse, "refuse to be a friend of a guild that invited you", "")
{ {
if (args.size() != 0) return false; if (args.size() != 0) return false;
const string msgName = "GUILD:REFUSE_FRIEND_INVITATION"; const char *msgName = "GUILD:REFUSE_FRIEND_INVITATION";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4272,7 +4272,7 @@ NLMISC_COMMAND(GUFriendRefuse, "refuse to be a friend of a guild that invited yo
NLMISC_COMMAND(GUSetSuccessor, "set the successor of the guild leader", "<player name>") NLMISC_COMMAND(GUSetSuccessor, "set the successor of the guild leader", "<player name>")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
const string msgName = "GUILD:SET_SUCCESSOR"; const char *msgName = "GUILD:SET_SUCCESSOR";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4286,7 +4286,7 @@ NLMISC_COMMAND(GUSetSuccessor, "set the successor of the guild leader", "<player
NLMISC_COMMAND(GUInfos, "get information on a guild", "<guild name>") NLMISC_COMMAND(GUInfos, "get information on a guild", "<guild name>")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
const string msgName = "GUILD:GET_INFOS"; const char *msgName = "GUILD:GET_INFOS";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4300,7 +4300,7 @@ NLMISC_COMMAND(GUInfos, "get information on a guild", "<guild name>")
NLMISC_COMMAND(GUJournal, "get the guild journal", "") NLMISC_COMMAND(GUJournal, "get the guild journal", "")
{ {
if (args.size() != 0) return false; if (args.size() != 0) return false;
const string msgName = "GUILD:GET_LOG"; const char *msgName = "GUILD:GET_LOG";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4314,7 +4314,7 @@ NLMISC_COMMAND(buildingTeleport, "teleport to a building", "building index")
if (args.size() != 1) return false; if (args.size() != 1) return false;
uint16 index; uint16 index;
fromString(args[0], index); fromString(args[0], index);
const string msgName = "GUILD:TELEPORT"; const char *msgName = "GUILD:TELEPORT";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {

@ -1704,7 +1704,7 @@ public:
string sCharSumPath = getParam(Params, "charsum"); string sCharSumPath = getParam(Params, "charsum");
SCharacter3DSetup::setupCharacterSummaryFromDB(CS, sCharSumPath); SCharacter3DSetup::setupCharacterSummaryFromDB(CS, sCharSumPath);
CS.Mainland = MainlandSelected; CS.Mainland = MainlandSelected;
CS.Name = sFirstName; CS.Name = ucstring::makeFromUtf8(sFirstName); // FIXME: UTF-8 (serial)
//CS.Surname = sSurName; //CS.Surname = sSurName;
// Create the message to send to the server from the character summary // Create the message to send to the server from the character summary
@ -1861,8 +1861,9 @@ string getTarget(CCtrlBase * /* ctrl */, const string &targetName)
return ""; return "";
} }
#ifdef RYZOM_LUA_UCSTRING
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName) // TODO: UTF-8 Lua ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName)
{ {
string sTmp = targetName; string sTmp = targetName;
std::vector<CInterfaceLink::CTargetInfo> targetsVector; std::vector<CInterfaceLink::CTargetInfo> targetsVector;
@ -1882,6 +1883,7 @@ ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName) // TODO:
return ((elem->*(pRP->GetMethod.GetUCString))()); return ((elem->*(pRP->GetMethod.GetUCString))());
return ucstring(""); // TODO: UTF-8 Lua return ucstring(""); // TODO: UTF-8 Lua
} }
#endif
/*// Ask the server to rename a character /*// Ask the server to rename a character
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -1953,7 +1955,11 @@ public:
string sDBLink = getParam(Params, "dblink"); string sDBLink = getParam(Params, "dblink");
CharNameValidDBLink = sDBLink; CharNameValidDBLink = sDBLink;
#ifdef RYZOM_LUA_UCSTRING
string sName = getUCTarget(NULL,sTarget).toUtf8(); // TODO: UTF-8 Lua string sName = getUCTarget(NULL,sTarget).toUtf8(); // TODO: UTF-8 Lua
#else
string sName = getTarget(NULL, sTarget);
#endif
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (sName.empty()) if (sName.empty())

@ -1010,13 +1010,13 @@ void CFarTP::hookNextFarTPForEditor()
*/ */
void CFarTP::requestReturnToPreviousSession(TSessionId rejectedSessionId) void CFarTP::requestReturnToPreviousSession(TSessionId rejectedSessionId)
{ {
const string msgName = "CONNECTION:RET_MAINLAND"; const char *msgName = "CONNECTION:RET_MAINLAND";
CBitMemStream out; CBitMemStream out;
nlverify(GenericMsgHeaderMngr.pushNameToStream(msgName, out)); nlverify(GenericMsgHeaderMngr.pushNameToStream(msgName, out));
out.serial(PlayerSelectedSlot); out.serial(PlayerSelectedSlot);
out.serial(rejectedSessionId); out.serial(rejectedSessionId);
NetMngr.push(out); NetMngr.push(out);
nlinfo("%s sent", msgName.c_str()); nlinfo("%s sent", msgName);
} }
/* /*

@ -1166,7 +1166,7 @@ public:
game_exit_request = true; game_exit_request = true;
ryzom_exit_request = true; ryzom_exit_request = true;
const string msgName = "CONNECTION:CLIENT_QUIT_REQUEST"; const char *msgName = "CONNECTION:CLIENT_QUIT_REQUEST";
CBitMemStream out; CBitMemStream out;
nlverify(GenericMsgHeaderMngr.pushNameToStream(msgName, out)); nlverify(GenericMsgHeaderMngr.pushNameToStream(msgName, out));
bool bypassDisconnectionTimer = FarTP.isFastDisconnectGranted() && (!IsInRingSession); // no need on a ring shard, as it's very short bool bypassDisconnectionTimer = FarTP.isFastDisconnectGranted() && (!IsInRingSession); // no need on a ring shard, as it's very short
@ -1489,7 +1489,7 @@ void beastOrder (const std::string &orderStr, const std::string &beastIndexStr,
else else
{ {
// execute the order. // execute the order.
const string msgName = "ANIMALS:BEAST"; const char *msgName = "ANIMALS:BEAST";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -1500,7 +1500,7 @@ void beastOrder (const std::string &orderStr, const std::string &beastIndexStr,
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlwarning("<beastOrder> : unknown message name : '%s'.", msgName.c_str()); nlwarning("<beastOrder> : unknown message name : '%s'.", msgName);
} }
} }
@ -4518,7 +4518,7 @@ public:
if( sCustomPhrase.empty() ) if( sCustomPhrase.empty() )
{ {
// Create the message and send. // Create the message and send.
static const string msgName = "COMMAND:EMOTE"; static const char *msgName = "COMMAND:EMOTE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4528,12 +4528,12 @@ public:
//nlinfo("impulseCallBack : %s %d %d sent", msgName.c_str(), (uint32)behavToSend, phraseNbToSend); //nlinfo("impulseCallBack : %s %d %d sent", msgName.c_str(), (uint32)behavToSend, phraseNbToSend);
} }
else else
nlwarning("command 'emote': unknown message named '%s'.", msgName.c_str()); nlwarning("command 'emote': unknown message named '%s'.", msgName);
} }
else else
{ {
// Create the message and send. // Create the message and send.
static const string msgName = "COMMAND:CUSTOM_EMOTE"; static const char *msgName = "COMMAND:CUSTOM_EMOTE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4563,7 +4563,7 @@ public:
//nlinfo("impulseCallBack : %s %d %s sent", msgName.c_str(), (uint32)behavToSend, sCustomPhrase.c_str()); //nlinfo("impulseCallBack : %s %d %s sent", msgName.c_str(), (uint32)behavToSend, sCustomPhrase.c_str());
} }
else else
nlwarning("command 'emote': unknown message named '%s'.", msgName.c_str()); nlwarning("command 'emote': unknown message named '%s'.", msgName);
} }
} }
}; };

@ -3706,17 +3706,17 @@ public:
sint n = PeopleInterraction.TeamList.getIndexFromName(selection->getEntityName()); sint n = PeopleInterraction.TeamList.getIndexFromName(selection->getEntityName());
if (n >= 0) if (n >= 0)
{ {
const string msgName = "TEAM:KICK"; const char *msgName = "TEAM:KICK";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
uint8 teamMember = (uint8)n; uint8 teamMember = (uint8)n;
out.serialEnum(teamMember); out.serialEnum(teamMember);
NetMngr.push(out); NetMngr.push(out);
//nlinfo("impulseCallBack : %s %d sent", msgName.c_str(), teamMember); //nlinfo("impulseCallBack : %s %d sent", msgName, teamMember);
} }
else else
nlwarning("unknown message named '%s'.", msgName.c_str()); nlwarning("unknown message named '%s'.", msgName);
} }
} }
} }

@ -407,10 +407,10 @@ void CInterfaceItemEdition::CItemEditionWindow::validate()
if (textValid) if (textValid)
{ {
CBitMemStream out; CBitMemStream out;
const string msgName = "EVENT:SET_ITEM_CUSTOM_TEXT"; const char *msgName = "EVENT:SET_ITEM_CUSTOM_TEXT";
if (!GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if (!GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
nlwarning ("don't know message name %s", msgName.c_str()); nlwarning ("don't know message name %s", msgName);
} }
else else
{ {
@ -446,7 +446,7 @@ static void validateStackItem(CDBCtrlSheet *src, CDBCtrlSheet *dest, sint32 quan
static void sendSwapItemMsg(const CDBCtrlSheet *pCSSrc, const CDBCtrlSheet *pCSDst, sint32 quantitySrc) static void sendSwapItemMsg(const CDBCtrlSheet *pCSSrc, const CDBCtrlSheet *pCSDst, sint32 quantitySrc)
{ {
CBitMemStream out; CBitMemStream out;
const string sMsg = "ITEM:SWAP"; const char *sMsg = "ITEM:SWAP";
if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out))
{ {
// Swap all the Src (quantity= quantitySrc) to dest // Swap all the Src (quantity= quantitySrc) to dest
@ -479,7 +479,7 @@ static void sendSwapItemMsg(const CDBCtrlSheet *pCSSrc, const CDBCtrlSheet *pCSD
//nlinfo("impulseCallBack : %s %d %d %d %d %d sent", sMsg.c_str(), srcInvId, srcSlotId, dstInvId, dstSlotId, quantity); //nlinfo("impulseCallBack : %s %d %d %d %d %d sent", sMsg.c_str(), srcInvId, srcSlotId, dstInvId, dstSlotId, quantity);
} }
else else
nlwarning(" unknown message name '%s'",sMsg.c_str()); nlwarning(" unknown message name '%s'",sMsg);
} }
/** Display the popup to ask item quantity /** Display the popup to ask item quantity
@ -557,7 +557,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
CBitMemStream out; CBitMemStream out;
const string sMsg = "EXCHANGE:ADD"; const char *sMsg = "EXCHANGE:ADD";
if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out))
{ {
// Swap all the Src (quantity= quantitySrc) to dest // Swap all the Src (quantity= quantitySrc) to dest
@ -570,7 +570,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet
//nlinfo("impulseCallBack : %s %d %d %d sent", sMsg.c_str(), srcSlotIndex, destSlotIndex, quantitySrc); //nlinfo("impulseCallBack : %s %d %d %d sent", sMsg.c_str(), srcSlotIndex, destSlotIndex, quantitySrc);
} }
else else
nlwarning(" unknown message name '%s'",sMsg.c_str()); nlwarning(" unknown message name '%s'",sMsg);
} }
//===================================================================================================================== //=====================================================================================================================
@ -626,8 +626,8 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet
// send msg to server // send msg to server
CBitMemStream out; CBitMemStream out;
const string sMsg = "EXCHANGE:REMOVE"; const char *sMsg = "EXCHANGE:REMOVE";
if(GenericMsgHeaderMngr.pushNameToStream(sMsg.c_str(), out)) if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out))
{ {
// Swap all the Src (quantity= quantitySrc) to dest // Swap all the Src (quantity= quantitySrc) to dest
uint16 slotIndex = (uint16) exchangeSlot->getIndexInDB(); uint16 slotIndex = (uint16) exchangeSlot->getIndexInDB();
@ -637,7 +637,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet
//nlinfo("impulseCallBack : %s %d sent", sMsg.c_str(), slotIndex); //nlinfo("impulseCallBack : %s %d sent", sMsg.c_str(), slotIndex);
} }
else else
nlwarning(" unknown message name '%s'",sMsg.c_str()); nlwarning(" unknown message name '%s'",sMsg);
} }
@ -1648,7 +1648,7 @@ REGISTER_ACTION_HANDLER( CHandlerDragNDrop, "drag_n_drop" );
static void sendToServerEnchantMessage(uint8 invent, uint16 slot) static void sendToServerEnchantMessage(uint8 invent, uint16 slot)
{ {
CBitMemStream out; CBitMemStream out;
const string sMsg = "ITEM:ENCHANT"; const char *sMsg = "ITEM:ENCHANT";
if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out))
{ {
@ -1657,7 +1657,7 @@ static void sendToServerEnchantMessage(uint8 invent, uint16 slot)
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlinfo("unknown message %s", sMsg.c_str()); nlinfo("unknown message %s", sMsg);
} }
// ********************************************************************************************************** // **********************************************************************************************************
@ -2157,7 +2157,7 @@ static void sendMsgUseItem(uint16 slot)
if(!ClientCfg.Local) if(!ClientCfg.Local)
{ {
CBitMemStream out; CBitMemStream out;
const string sMsg = "ITEM:USE_ITEM"; const char *sMsg = "ITEM:USE_ITEM";
if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out))
{ {
@ -2165,7 +2165,7 @@ static void sendMsgUseItem(uint16 slot)
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlinfo("unknown message %s", sMsg.c_str()); nlinfo("unknown message %s", sMsg);
} }
} }
@ -2175,7 +2175,7 @@ static void sendMsgStopUseXpCat( bool isRingCatalyser )
if(!ClientCfg.Local) if(!ClientCfg.Local)
{ {
CBitMemStream out; CBitMemStream out;
const string sMsg = "ITEM:STOP_USE_XP_CAT"; const char *sMsg = "ITEM:STOP_USE_XP_CAT";
if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out))
{ {
@ -2183,7 +2183,7 @@ static void sendMsgStopUseXpCat( bool isRingCatalyser )
NetMngr.push(out); NetMngr.push(out);
} }
else else
nlinfo("unknown message %s", sMsg.c_str()); nlinfo("unknown message %s", sMsg);
} }
} }

@ -471,7 +471,7 @@ public:
startAttackTime= node->getValue32(); startAttackTime= node->getValue32();
// send a DECLARE_WAR_VALIDATE message to server // send a DECLARE_WAR_VALIDATE message to server
string sMsg= "OUTPOST:DECLARE_WAR_VALIDATE"; const char *sMsg= "OUTPOST:DECLARE_WAR_VALIDATE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out))
{ {
@ -483,7 +483,7 @@ public:
} }
else else
{ {
nlwarning("command : unknown message name : '%s'.", sMsg.c_str()); nlwarning("command : unknown message name : '%s'.", sMsg);
} }
} }
@ -508,7 +508,7 @@ public:
// Send a msg to server // Send a msg to server
if(outpostSheet) if(outpostSheet)
{ {
string sMsg= "OUTPOST:SELECT"; const char *sMsg= "OUTPOST:SELECT";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out))
{ {
@ -518,7 +518,7 @@ public:
} }
else else
{ {
nlwarning("command : unknown message name : '%s'.", sMsg.c_str()); nlwarning("command : unknown message name : '%s'.", sMsg);
} }
} }
} }

@ -79,7 +79,7 @@ class CHandlerGuildCreate : public IActionHandler
uint64 icon = CGuildManager::iconMake((uint8)pCS->getGuildBack(), (uint8)pCS->getGuildSymbol(), uint64 icon = CGuildManager::iconMake((uint8)pCS->getGuildBack(), (uint8)pCS->getGuildSymbol(),
pCS->getInvertGuildSymbol(), pCS->getGuildColor1(), pCS->getGuildColor2()); pCS->getInvertGuildSymbol(), pCS->getGuildColor1(), pCS->getGuildColor2());
const string msgName = "GUILD:CREATE"; const char *msgName = "GUILD:CREATE";
NLMISC::CBitMemStream out; NLMISC::CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {

@ -4696,8 +4696,8 @@ int CSPhraseComAdpater::luaGetDesc(CLuaState &ls)
if (*desc) if (*desc)
{ {
#ifdef RYZOM_LUA_UCSTRING #ifdef RYZOM_LUA_UCSTRING
ucstring desc = ucstring::makeFromUtf8(desc); // Compatibility ucstring uc = ucstring::makeFromUtf8(desc); // Compatibility
CLuaIHM::push(ls, desc); CLuaIHM::push(ls, uc);
#else #else
ls.push(desc); ls.push(desc);
#endif #endif

@ -43,6 +43,7 @@
#include "nel/3d/u_visual_collision_manager.h" #include "nel/3d/u_visual_collision_manager.h"
#include "nel/3d/u_shape_bank.h" #include "nel/3d/u_shape_bank.h"
#include "nel/3d/stereo_hmd.h" #include "nel/3d/stereo_hmd.h"
#include "nel/3d/async_file_manager_3d.h"
// Client // Client
#include "global.h" #include "global.h"
#include "release.h" #include "release.h"
@ -573,6 +574,8 @@ void release()
CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_GameExit, "login_step_game_exit&play_time=" + toString((NLMISC::CTime::getLocalTime() - StartPlayTime) / 1000))); CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_GameExit, "login_step_game_exit&play_time=" + toString((NLMISC::CTime::getLocalTime() - StartPlayTime) / 1000)));
} }
setCrashCallback(NULL);
#ifdef RYZOM_BG_DOWNLOADER #ifdef RYZOM_BG_DOWNLOADER
CBGDownloaderAccess::getInstance().release(); CBGDownloaderAccess::getInstance().release();
#endif #endif
@ -629,6 +632,9 @@ void release()
delete FXAA; FXAA = NULL; delete FXAA; FXAA = NULL;
CBloomEffect::releaseInstance(); CBloomEffect::releaseInstance();
// Release texture
endLoading();
// Release Scene, textcontexts, materials, ... // Release Scene, textcontexts, materials, ...
Driver->release(); Driver->release();
@ -701,6 +707,7 @@ void release()
CIXml::releaseLibXml(); CIXml::releaseLibXml();
CHttpCache::release(); CHttpCache::release();
CStrictTransportSecurity::release(); CStrictTransportSecurity::release();
CAsyncFileManager3D::releaseInstance();
#if FINAL_VERSION #if FINAL_VERSION
// openURL ("http://ryzom.com/exit/"); // openURL ("http://ryzom.com/exit/");

@ -46,6 +46,7 @@ class CStringManagerClient
public: public:
// Singleton pattern implementation // Singleton pattern implementation
static CStringManagerClient *instance(); static CStringManagerClient *instance();
static bool hasInstance() { return _Instance; }
static void release(bool mustReleaseStaticArrays); static void release(bool mustReleaseStaticArrays);
/** Prepare the string manager to use a persistent string cache. /** Prepare the string manager to use a persistent string cache.
@ -385,7 +386,8 @@ public:
virtual ~IStringWaiterRemover() virtual ~IStringWaiterRemover()
{ {
// signal the string manager that this waiter is destroyed // signal the string manager that this waiter is destroyed
CStringManagerClient::instance()->removeStringWaiter(this); if (CStringManagerClient::hasInstance())
CStringManagerClient::instance()->removeStringWaiter(this);
} }
}; };
@ -403,7 +405,8 @@ public:
virtual ~IStringWaitCallback() virtual ~IStringWaitCallback()
{ {
// signal the string manager that this waiter is destroyed // signal the string manager that this waiter is destroyed
CStringManagerClient::instance()->removeStringWaiter(this); if (CStringManagerClient::hasInstance())
CStringManagerClient::instance()->removeStringWaiter(this);
} }
}; };

Loading…
Cancel
Save