Changed: #825 Remove all warnings when compiling Ryzom

This commit is contained in:
kervala 2011-02-09 14:42:03 +01:00
parent d6ba3db1ad
commit 50843ded97
4 changed files with 22 additions and 7 deletions

View file

@ -2197,8 +2197,8 @@ bool CInterfaceParser::parseTree (xmlNodePtr cur, SMasterGroup *parentGroup)
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j) for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
{ {
CInterfaceGroup *pIG = rMG.Group->getGroups()[j]; CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
string stmp = strlwr(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size())); string stmp = NLMISC::toLower(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
string stmp2 = strlwr(string((const char*)ptr)); string stmp2 = NLMISC::toLower(string((const char*)ptr));
if (stmp == stmp2) if (stmp == stmp2)
{ {
pEltFound = pIG; pEltFound = pIG;

View file

@ -22,6 +22,12 @@
namespace R2 namespace R2
{ {
// *********************************************************************************************************
CDisplayerLua::CDisplayerLua()
{
_ToLua._Displayer = this;
}
// ********************************************************************************************************* // *********************************************************************************************************
bool CDisplayerLua::init(const CLuaObject &parameters) bool CDisplayerLua::init(const CLuaObject &parameters)
{ {
@ -53,9 +59,14 @@ bool CDisplayerLua::init(const CLuaObject &parameters)
} }
// ********************************************************************************************************* // *********************************************************************************************************
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); ls.insert(- numArgs - 1);
if (dumpStackWanted) ls.dumpStack(); if (dumpStackWanted) ls.dumpStack();
// First arg always is the instance being displayed // First arg always is the instance being displayed
getEnclosing().getDisplayedInstance()->getLuaProjection().push(); if (getEnclosing())
getEnclosing()->getDisplayedInstance()->getLuaProjection().push();
ls.insert(- numArgs - 1); ls.insert(- numArgs - 1);
if (dumpStackWanted) ls.dumpStack(); if (dumpStackWanted) ls.dumpStack();
CLuaIHM::executeFunctionOnStack(*_LuaTable.getLuaState(), numArgs + 2, 0); CLuaIHM::executeFunctionOnStack(*_LuaTable.getLuaState(), numArgs + 2, 0);

View file

@ -28,6 +28,7 @@ class CDisplayerLua : public CDisplayerBase
{ {
public: public:
NLMISC_DECLARE_CLASS(R2::CDisplayerLua); NLMISC_DECLARE_CLASS(R2::CDisplayerLua);
CDisplayerLua();
// expected parameter is a ctor function // expected parameter is a ctor function
virtual bool init(const CLuaObject &parameters); virtual bool init(const CLuaObject &parameters);
virtual void pushLuaAccess(CLuaState &ls); virtual void pushLuaAccess(CLuaState &ls);
@ -55,11 +56,13 @@ private:
class CToLua : public CLuaEventForwarder class CToLua : public CLuaEventForwarder
{ {
public: public:
CToLua();
CLuaObject _LuaTable; // reference to lua version of the displayer CLuaObject _LuaTable; // reference to lua version of the displayer
CDisplayerLua *_Displayer;
virtual CLuaState *getLua(); virtual CLuaState *getLua();
virtual void executeHandler(const CLuaString &eventName, int numArgs); virtual void executeHandler(const CLuaString &eventName, int numArgs);
void pushLuaAccess(CLuaState &ls); void pushLuaAccess(CLuaState &ls);
CDisplayerLua &getEnclosing(); CDisplayerLua* getEnclosing();
}; };
friend class CToLua; friend class CToLua;
CToLua _ToLua; CToLua _ToLua;

View file

@ -1856,7 +1856,7 @@ CInstanceObserverLua::~CInstanceObserverLua()
#ifdef NL_DEBUG #ifdef NL_DEBUG
nlassert(!getEditor().isInstanceObserver(this)); nlassert(!getEditor().isInstanceObserver(this));
#endif #endif
nlassert(_Count >= 0); nlassert(_Count < 1000000000);
-- _Count; -- _Count;
} }