diff --git a/code/ryzom/client/src/interface_v3/interface_parser.cpp b/code/ryzom/client/src/interface_v3/interface_parser.cpp index f09df1f4a..b874b709e 100644 --- a/code/ryzom/client/src/interface_v3/interface_parser.cpp +++ b/code/ryzom/client/src/interface_v3/interface_parser.cpp @@ -2197,8 +2197,8 @@ bool CInterfaceParser::parseTree (xmlNodePtr cur, SMasterGroup *parentGroup) for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j) { CInterfaceGroup *pIG = rMG.Group->getGroups()[j]; - string stmp = strlwr(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size())); - string stmp2 = strlwr(string((const char*)ptr)); + string stmp = NLMISC::toLower(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size())); + string stmp2 = NLMISC::toLower(string((const char*)ptr)); if (stmp == stmp2) { pEltFound = pIG; diff --git a/code/ryzom/client/src/r2/displayer_lua.cpp b/code/ryzom/client/src/r2/displayer_lua.cpp index a2df79851..cb823c033 100644 --- a/code/ryzom/client/src/r2/displayer_lua.cpp +++ b/code/ryzom/client/src/r2/displayer_lua.cpp @@ -22,6 +22,12 @@ namespace R2 { +// ********************************************************************************************************* +CDisplayerLua::CDisplayerLua() +{ + _ToLua._Displayer = this; +} + // ********************************************************************************************************* bool CDisplayerLua::init(const CLuaObject ¶meters) { @@ -53,9 +59,14 @@ bool CDisplayerLua::init(const CLuaObject ¶meters) } // ********************************************************************************************************* -CDisplayerLua &CDisplayerLua::CToLua::getEnclosing() +CDisplayerLua::CToLua::CToLua():_Displayer(NULL) { - return *(CDisplayerLua *) ((uint8 *) this - offsetof(CDisplayerLua, _ToLua)); // ugly, yes ... +} + +// ********************************************************************************************************* +CDisplayerLua* CDisplayerLua::CToLua::getEnclosing() +{ + return _Displayer; } // ********************************************************************************************************* @@ -79,7 +90,8 @@ void CDisplayerLua::CToLua::executeHandler(const CLuaString &eventName, int numA ls.insert(- numArgs - 1); if (dumpStackWanted) ls.dumpStack(); // First arg always is the instance being displayed - getEnclosing().getDisplayedInstance()->getLuaProjection().push(); + if (getEnclosing()) + getEnclosing()->getDisplayedInstance()->getLuaProjection().push(); ls.insert(- numArgs - 1); if (dumpStackWanted) ls.dumpStack(); CLuaIHM::executeFunctionOnStack(*_LuaTable.getLuaState(), numArgs + 2, 0); diff --git a/code/ryzom/client/src/r2/displayer_lua.h b/code/ryzom/client/src/r2/displayer_lua.h index 675042bf0..6cfb2ac64 100644 --- a/code/ryzom/client/src/r2/displayer_lua.h +++ b/code/ryzom/client/src/r2/displayer_lua.h @@ -28,6 +28,7 @@ class CDisplayerLua : public CDisplayerBase { public: NLMISC_DECLARE_CLASS(R2::CDisplayerLua); + CDisplayerLua(); // expected parameter is a ctor function virtual bool init(const CLuaObject ¶meters); virtual void pushLuaAccess(CLuaState &ls); @@ -55,11 +56,13 @@ private: class CToLua : public CLuaEventForwarder { public: + CToLua(); CLuaObject _LuaTable; // reference to lua version of the displayer + CDisplayerLua *_Displayer; virtual CLuaState *getLua(); virtual void executeHandler(const CLuaString &eventName, int numArgs); void pushLuaAccess(CLuaState &ls); - CDisplayerLua &getEnclosing(); + CDisplayerLua* getEnclosing(); }; friend class CToLua; CToLua _ToLua; diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index 50d54c230..a068af182 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -1856,7 +1856,7 @@ CInstanceObserverLua::~CInstanceObserverLua() #ifdef NL_DEBUG nlassert(!getEditor().isInstanceObserver(this)); #endif - nlassert(_Count >= 0); + nlassert(_Count < 1000000000); -- _Count; }