From c9692cfc0543da60e28a37ca746588f13c9e6d81 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Thu, 12 Jul 2012 09:01:35 +0200 Subject: [PATCH] CHANGED: #1471 Moved some Lua related code from CInterfaceManager to CLuaManager and CInterfaceParser. --- code/nel/include/nel/gui/interface_parser.h | 22 +++-- code/nel/include/nel/gui/lua_manager.h | 6 +- code/nel/src/gui/interface_parser.cpp | 38 ++++---- code/nel/src/gui/lua_manager.cpp | 14 +++ code/ryzom/client/src/commands.cpp | 4 +- code/ryzom/client/src/connection.cpp | 14 +-- .../src/interface_v3/action_handler_game.cpp | 2 +- .../client/src/interface_v3/chat_window.cpp | 2 +- .../client/src/interface_v3/group_html_cs.cpp | 2 +- .../src/interface_v3/interface_manager.cpp | 96 ++----------------- .../src/interface_v3/interface_manager.h | 10 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 4 +- code/ryzom/client/src/main_loop.cpp | 12 +-- code/ryzom/client/src/net_manager.cpp | 5 +- code/ryzom/client/src/r2/editor.cpp | 3 +- .../client/src/r2/tool_create_entity.cpp | 2 +- code/ryzom/client/src/user_entity.cpp | 2 +- 17 files changed, 87 insertions(+), 151 deletions(-) diff --git a/code/nel/include/nel/gui/interface_parser.h b/code/nel/include/nel/gui/interface_parser.h index 17e4af59a..d98c2fd20 100644 --- a/code/nel/include/nel/gui/interface_parser.h +++ b/code/nel/include/nel/gui/interface_parser.h @@ -299,17 +299,23 @@ namespace NLGUI protected: std::map< std::string, IParserModule* > moduleMap; - // LUA - // ---------------------------------------------------------------------------------- - // LUA Interface State. NB: The LUA environnement is not shared between Login/OutGame/InGame - NLMISC::CSmartPtr _LuaState; - virtual void initLUA(); - void uninitLUA(); + // List of script loaded (for reloadLua command) std::set _LuaFileScripts; - // Load A .lua. false if parse error. string 'error' contains the eventual error desc (but warning still displayed) - bool loadLUA(const std::string &luaFile, std::string &error); + bool cacheUIParsing; + bool luaInitialized; + + public: + void initLUA(); + void uninitLUA(); + bool isLuaInitialized() const{ return luaInitialized; } + + /// Load A .lua. false if parse error. string 'error' contains the eventual error desc (but warning still displayed) + bool loadLUA( const std::string &luaFile, std::string &error ); + + /// Reload all LUA scripts inserted through + void reloadAllLuaFileScripts(); }; } diff --git a/code/nel/include/nel/gui/lua_manager.h b/code/nel/include/nel/gui/lua_manager.h index 1e6868f57..0f1eb3b3b 100644 --- a/code/nel/include/nel/gui/lua_manager.h +++ b/code/nel/include/nel/gui/lua_manager.h @@ -45,13 +45,17 @@ namespace NLGUI bool executeLuaScript( const std::string &luaScript, bool smallScript = false ); + void ResetLuaState(); + + void forceGarbageCollect(); + private: CLuaManager(); static CLuaManager *instance; static bool debugLua; - NLMISC::CSmartPtr< NLGUI::CLuaState > luaState; + NLGUI::CLuaState *luaState; }; } diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index baa4853ca..0cb5d2d47 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -198,14 +198,12 @@ namespace NLGUI // ---------------------------------------------------------------------------- CInterfaceParser::CInterfaceParser() { - // LUA - _LuaState= NULL; + luaInitialized = false; cacheUIParsing = false; } CInterfaceParser::~CInterfaceParser() { - _LuaState = NULL; removeAllModules(); } /** Convert a string into a memstream @@ -2674,15 +2672,7 @@ namespace NLGUI // *************************************************************************** void CInterfaceParser::initLUA() { - // do nothing if LUA environment already exists - if( _LuaState != NULL ) - return; - - // create a new LUA environnement - nlassert(_LuaState==NULL); CLuaManager::enableLuaDebugging(); - CLuaManager::getInstance(); - _LuaState= CLuaManager::getInstance().getLuaState(); #ifdef LUA_NEVRAX_VERSION extern ILuaIDEInterface *LuaDebuggerIDE; @@ -2690,18 +2680,16 @@ namespace NLGUI #endif // register LUA methods - CLuaIHM::registerAll(*_LuaState); + CLuaIHM::registerAll( *( CLuaManager::getInstance().getLuaState() ) ); + luaInitialized = true; } // *************************************************************************** void CInterfaceParser::uninitLUA() { - // Delete all LUA environnement (and hence variables) - // delete _LuaState; - // _LuaState= NULL; - - // delete all .lua file loaded _LuaFileScripts.clear(); + CLuaManager::getInstance().ResetLuaState(); + luaInitialized = false; } // *************************************************************************** @@ -2740,10 +2728,9 @@ namespace NLGUI } // Parse script - nlassert(_LuaState); try { - _LuaState->executeFile(pathName); + CLuaManager::getInstance().getLuaState()->executeFile(pathName); } catch(const ELuaError &e) { @@ -2755,5 +2742,18 @@ namespace NLGUI return true; } + void CInterfaceParser::reloadAllLuaFileScripts() + { + std::set< std::string >::const_iterator it; + for( it = _LuaFileScripts.begin(); it != _LuaFileScripts.end(); ++it ) + { + std::string error; + // if fail to reload a script, display the error code + if( !loadLUA( *it, error ) ) + { + nlwarning( LuaHelperStuff::formatLuaErrorSysInfo( error ).c_str() ); + } + } + } } diff --git a/code/nel/src/gui/lua_manager.cpp b/code/nel/src/gui/lua_manager.cpp index 4307db15d..0ce8ce979 100644 --- a/code/nel/src/gui/lua_manager.cpp +++ b/code/nel/src/gui/lua_manager.cpp @@ -31,6 +31,7 @@ namespace NLGUI CLuaManager::~CLuaManager() { + delete luaState; luaState = NULL; } @@ -51,5 +52,18 @@ namespace NLGUI return true; } + + void CLuaManager::ResetLuaState() + { + delete luaState; + luaState = new CLuaState( debugLua ); + } + + void CLuaManager::forceGarbageCollect() + { + nlinfo("Collecting Garbaged LUA variables"); + luaState->setGCThreshold( 0 ); + nlinfo( NLMISC::toString( "Memory Used : %d Kb", luaState->getGCCount() ).c_str() ); + } } diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index c504ca9f0..993fb0936 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -5105,7 +5105,7 @@ NLMISC_COMMAND(luaScript, "Execute a lua script", "direct_script_code") } // not smallScript because suppose var can change a lot - pIM->executeLuaScript(script, false); + CLuaManager::getInstance().executeLuaScript(script, false); return true; } @@ -5186,7 +5186,7 @@ NLMISC_COMMAND(luaGC, "Force a garbage collector of lua", "") CInterfaceManager *pIM= CInterfaceManager::getInstance(); if(ClientCfg.AllowDebugLua) { - pIM->luaGarbageCollect(); + CLuaManager::getInstance().forceGarbageCollect(); return true; } else diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index db4999907..551488822 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -838,7 +838,7 @@ void updateBGDownloaderUI() { if (LuaBGDSuccessFlag) { - LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:setPatchSuccess()"); + LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setPatchSuccess()"); } } else @@ -858,19 +858,19 @@ void updateBGDownloaderUI() } if (LuaBGDSuccessFlag && bgWindowVisible) { - LuaBGDSuccessFlag = im->executeLuaScript(toString("bgdownloader:setPatchProgress(%f)", progress)); + LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript(toString("bgdownloader:setPatchProgress(%f)", progress)); } // display current priority of the downloader if (LuaBGDSuccessFlag && bgWindowVisible) { - LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:displayPriority()"); + LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:displayPriority()"); } } break; case BGDownloader::TaskResult_Success: if (LuaBGDSuccessFlag && bgWindowVisible) { - LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:setPatchSuccess()"); + LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setPatchSuccess()"); } // task finished AvailablePatchs = 0; @@ -887,7 +887,7 @@ void updateBGDownloaderUI() // error case if (LuaBGDSuccessFlag && bgWindowVisible) { - LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:setPatchError()"); + LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setPatchError()"); } break; } @@ -900,12 +900,12 @@ void updateBGDownloaderUI() if (isBGDownloadEnabled()) { // no necessary patch for now - LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:setNoNecessaryPatch()"); + LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setNoNecessaryPatch()"); } else { // no download ui - LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:setNoDownloader()"); + LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setNoDownloader()"); } } } diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 1b245abea..0704ada7c 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -1080,7 +1080,7 @@ public: CInterfaceManager *pIM= CInterfaceManager::getInstance(); // start the npc web page - pIM->executeLuaScript("game:startNpcWebPage()", true); + CLuaManager::getInstance().executeLuaScript("game:startNpcWebPage()", true); } }; REGISTER_ACTION_HANDLER( CHandlerContextWebPage, "context_web_page"); diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index 9ecbbd630..0ed59a659 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -1422,7 +1422,7 @@ public: CInterfaceManager *im = CInterfaceManager::getInstance(); im->displaySystemInfo(ucstring("@{6F6F}") + playerName +ucstring(" @{FFFF}") + CI18N::get("uiRingInvitationSent"), "BC"); // force a refresh of the ui - im->executeLuaScript("CharTracking:forceRefresh()"); + CLuaManager::getInstance().executeLuaScript("CharTracking:forceRefresh()"); } } }; diff --git a/code/ryzom/client/src/interface_v3/group_html_cs.cpp b/code/ryzom/client/src/interface_v3/group_html_cs.cpp index 063a9bbe9..ae36da87f 100644 --- a/code/ryzom/client/src/interface_v3/group_html_cs.cpp +++ b/code/ryzom/client/src/interface_v3/group_html_cs.cpp @@ -127,7 +127,7 @@ void CGroupHTMLCS::getParameters (std::vector ¶meters, bool enco { webIgReady = true; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->executeLuaScript("game:onWebIgReady()"); + CLuaManager::getInstance().executeLuaScript("game:onWebIgReady()"); } // For each line diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index e545993d6..125becd73 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -622,15 +622,15 @@ void CInterfaceManager::destroy () void CInterfaceManager::initLUA() { - if( _LuaState != NULL ) + if( isLuaInitialized() ) return; CInterfaceParser::initLUA(); - if( _LuaState == NULL ) + if( !isLuaInitialized() ) return; - CLuaIHMRyzom::RegisterRyzomFunctions( *_LuaState ); + CLuaIHMRyzom::RegisterRyzomFunctions( *( CLuaManager::getInstance().getLuaState() ) ); } // ------------------------------------------------------------------------------------------------ @@ -1518,7 +1518,7 @@ void CInterfaceManager::updateFrameEvents() luaDebuggerMainLoop(); // handle gc for lua - if (_LuaState) _LuaState->handleGC(); + CLuaManager::getInstance().getLuaState()->handleGC(); CBGDownloaderAccess::getInstance().update(); @@ -3251,72 +3251,6 @@ void CInterfaceManager::connectYuboChat() } } -// *************************************************************************** -bool CInterfaceManager::executeLuaScript(const std::string &luaScript, bool smallScript) -{ - H_AUTO ( RZ_Interface_executeLuaScript ) - - nlassert(_LuaState); - try - { - if(smallScript) - _LuaState->executeSmallScript(luaScript); - else - _LuaState->executeScript(luaScript); - } - catch(const ELuaError &e) - { - std::string msg = e.luaWhat(); - char filename[MAX_PATH]; - char exceptionName[MAX_PATH]; - uint32 line; - // Hamster: quick fix on AJM code but sscanf is still awfull - if (sscanf(msg.c_str(), "%s: %s.lua:%d:",exceptionName, filename, &line) == 3) // NB: test not exact here, but should work in 99,9 % of cases - { - msg = CLuaIHMRyzom::createGotoFileButtonTag(filename, line) + msg; - nlwarning(LuaHelperStuff::formatLuaErrorNlWarn(msg).c_str()); - displaySystemInfo(LuaHelperStuff::formatLuaErrorSysInfo(msg)); - } - else // AJM: handle the other 0.1% of cases - { - // Yoyo: seems that previous test doesn't work.... btw, must still print the message please... - std::vector error; - splitString(msg.c_str(), ":", error); - if (error.size() > 3) - { - std::vector contextList; - explode(luaScript, string("\n"), contextList); - fromString(error[2], line); - if (line >= 3 && contextList.size() >= line) - msg = error[0]+": \n>>> "+contextList[line-3]+"\n>>> "+contextList[line-2]+"\n>>> "+contextList[line-1]+"\nError:"+error[2]+": "+error[3]; - else if (line >= 2 && contextList.size() >= line) - msg = error[0]+": \n>>>"+contextList[line-2]+"\n>>>"+contextList[line-1]+"\nError:"+error[2]+": "+error[3]; - else if (line >= 1 && contextList.size() >= line) - msg = error[0]+": \n>>>"+contextList[line-1]+"\nError:"+error[2]+": "+error[3]; - } - nlwarning(LuaHelperStuff::formatLuaErrorNlWarn(msg).c_str()); - displaySystemInfo(LuaHelperStuff::formatLuaErrorSysInfo(msg)); - } - return false; - } - return true; -} - -// *************************************************************************** -void CInterfaceManager::reloadAllLuaFileScripts() -{ - std::set::const_iterator it= _LuaFileScripts.begin(); - for(;it!=_LuaFileScripts.end();it++) - { - string error; - // if fail to reload a script, display the error code - if(!loadLUA(*it, error)) - { - displaySystemInfo(LuaHelperStuff::formatLuaErrorSysInfo(error)); - } - } -} - // *************************************************************************** std::vector CInterfaceManager::getInGameXMLInterfaceFiles() { @@ -3374,8 +3308,7 @@ void CInterfaceManager::dumpLuaString(const std::string &str) // *************************************************************************** void CInterfaceManager::getLuaValueInfo(std::string &str, sint index) { - nlassert(_LuaState); - CLuaState &ls= *_LuaState; + CLuaState &ls= *( CLuaManager::getInstance().getLuaState() ); sint type= ls.type(index); if(type==LUA_TNIL) @@ -3421,8 +3354,7 @@ void CInterfaceManager::getLuaValueInfo(std::string &str, sint index) // *************************************************************************** void CInterfaceManager::dumpLuaKeyValueInfo(uint recursTableLevel, uint tabLevel) { - nlassert(_LuaState); - CLuaState &ls= *_LuaState; + CLuaState &ls= *( CLuaManager::getInstance().getLuaState() ); CLuaStackChecker lsc(&ls); // Dump Key Str @@ -3458,11 +3390,7 @@ void CInterfaceManager::dumpLuaKeyValueInfo(uint recursTableLevel, uint tabLeve // *************************************************************************** void CInterfaceManager::dumpLuaState(uint detail) { - if(!_LuaState) - { - dumpLuaString("LUA State not created"); - return; - } + CLuaState *_LuaState = CLuaManager::getInstance().getLuaState(); // clamp detailed info to 2 (display at max content of eaxh Env of each group) clamp(detail, 0U, 2U); @@ -3496,16 +3424,6 @@ void CInterfaceManager::dumpLuaState(uint detail) } } -// *************************************************************************** -void CInterfaceManager::luaGarbageCollect() -{ - if(!_LuaState) - return; - dumpLuaString("Collecting Garbaged LUA variables"); - _LuaState->setGCThreshold(0); - dumpLuaString(NLMISC::toString("Memory Used : %d Kb", _LuaState->getGCCount())); -} - // ------------------------------------------------------------------------------------------------ void CInterfaceManager::createLocalBranch(const std::string &fileName, NLMISC::IProgressCallback &progressCallBack) { diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index 38d6d7af9..bdd74a68f 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -51,6 +51,8 @@ #include "../ingame_database_manager.h" +#include "nel/gui/lua_manager.h" + //the network database node extern CCDBSynchronised IngameDbMngr; @@ -365,14 +367,8 @@ public: /// \name LUA // @{ - /// Execute a lua script (smallScript for speed optimisation, see lua_helper). return false if parse/execute error (warning/sysinfo displayed) - bool executeLuaScript(const std::string &luaScript, bool smallScript= false); - /// Reload all LUA scripts inserted through - void reloadAllLuaFileScripts(); /// For debug: dump in the sysinfo and nlwarning state of lua. detail range from 0 to 2 (clamped). - void dumpLuaState(uint detail); - /// For debug: force a garbage collector - void luaGarbageCollect(); + void dumpLuaState(uint detail); // @} // Get the list of InGame XML Interface files, with any AddOn ones diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index c63f302b6..0a8bb6413 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -133,7 +133,7 @@ public: // execute a small script. NB: use a small script here because // most often action handlers are called from xml files => lot of redundant script - pIM->executeLuaScript(sParams, true); + CLuaManager::getInstance().executeLuaScript(sParams, true); // pop UI caller if(pCaller) @@ -179,7 +179,7 @@ static DECLARE_INTERFACE_USER_FCT(lua) // assign return value in retId. script= retId + "= " + script; // execute a small script here, because most often exprs are called from xml files => lot of redundant script - pIM->executeLuaScript(script, true); + CLuaManager::getInstance().executeLuaScript(script, true); // *** retrieve and convert return value diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index bc78aa1ce..9a42a29cc 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -1520,7 +1520,7 @@ bool mainLoop() CSessionBrowserImpl::getInstance().init(CLuaManager::getInstance().getLuaState()); } - CInterfaceManager::getInstance()->executeLuaScript("game:onMainLoopBegin()"); + CLuaManager::getInstance().executeLuaScript("game:onMainLoopBegin()"); if (StartInitTime != 0) @@ -1782,7 +1782,7 @@ bool mainLoop() if (group) group->updateAllLinks(); // send a msg to lua for specific ui update - pIM->executeLuaScript("game:onInGameDbInitialized()"); + CLuaManager::getInstance().executeLuaScript("game:onInGameDbInitialized()"); } } @@ -2896,7 +2896,7 @@ bool mainLoop() // This code must remain at the very end of the main loop. if(LoginSM.getCurrentState() == CLoginStateMachine::st_enter_far_tp_main_loop) { - CInterfaceManager::getInstance()->executeLuaScript("game:onFarTpStart()"); + CLuaManager::getInstance().executeLuaScript("game:onFarTpStart()"); // Will loop the network until the end of the relogging process FarTP.farTPmainLoop(); @@ -2974,7 +2974,7 @@ bool mainLoop() lastConnectionState = CNetworkConnection::Connected; connectionState = NetMngr.getConnectionState(); - CInterfaceManager::getInstance()->executeLuaScript("game:onFarTpEnd()"); + CLuaManager::getInstance().executeLuaScript("game:onFarTpEnd()"); } } // end of main loop @@ -2982,7 +2982,7 @@ bool mainLoop() CInterfaceManager *im = CInterfaceManager::getInstance(); if (CLuaManager::getInstance().getLuaState()) { - CInterfaceManager::getInstance()->executeLuaScript("game:onMainLoopEnd()"); + CLuaManager::getInstance().executeLuaScript("game:onMainLoopEnd()"); } // Stop Running Profiles (kick result) @@ -4550,7 +4550,7 @@ void displayDebugClusters() void inGamePatchUncompleteWarning() { CInterfaceManager *im = CInterfaceManager::getInstance(); - im->executeLuaScript("bgdownloader:inGamePatchUncompleteWarning()"); + CLuaManager::getInstance().executeLuaScript("bgdownloader:inGamePatchUncompleteWarning()"); /* CInterfaceManager *im = CInterfaceManager::getInstance(); CGroupContainer *gc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:bg_downloader")); diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index 03a10aec4..344340820 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -893,7 +893,7 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u // for now, '&' are removed by server so use another format until a special msg is made if (strFindReplace(finalString, ucstring(""), ucstring())) { - CInterfaceManager::getInstance()->executeLuaScript("RingAccessPoint:forceRefresh()"); + CLuaManager::getInstance().executeLuaScript("RingAccessPoint:forceRefresh()"); } @@ -1704,8 +1704,7 @@ void impulseTeamInvitation(NLMISC::CBitMemStream &impulse) impulse.serial(textID); if (PermanentlyBanned) return; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->executeLuaScript("game:onTeamInvation("+toString(textID)+")", 0); + CLuaManager::getInstance().executeLuaScript("game:onTeamInvation("+toString(textID)+")", 0); }// impulseTeamInvitation // //----------------------------------------------- diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index 11e29fd5a..c22ee1ada 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -7646,8 +7646,7 @@ class CAHR2FreezeUnfreezeBotObjects : public IActionHandler { virtual void execute(CCtrlBase * /* pCaller */, const std::string &/* sParams */) { - CInterfaceManager *im = CInterfaceManager::getInstance(); - im->executeLuaScript("r2:freezeUnfreezeBotObjects()"); + CLuaManager::getInstance().executeLuaScript("r2:freezeUnfreezeBotObjects()"); } }; REGISTER_ACTION_HANDLER(CAHR2FreezeUnfreezeBotObjects, "r2ed_freeze_unfreeze_botobjects"); diff --git a/code/ryzom/client/src/r2/tool_create_entity.cpp b/code/ryzom/client/src/r2/tool_create_entity.cpp index 97e20a871..bee3a501c 100644 --- a/code/ryzom/client/src/r2/tool_create_entity.cpp +++ b/code/ryzom/client/src/r2/tool_create_entity.cpp @@ -114,7 +114,7 @@ void CToolCreateEntity::commit(const NLMISC::CVector &createPosition, float crea if (!getEditor().verifyRoomLeft(0, 1)) { - getUI().executeLuaScript("r2:checkStaticQuota(1)"); + CLuaManager::getInstance().executeLuaScript("r2:checkStaticQuota(1)"); return; } setContextHelp(CI18N::get("uiR2EDDrawArrayContextHelp")); diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index 45bffbf57..2fa5784cd 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -1662,7 +1662,7 @@ void CUserEntity::moveToAction(CEntityCL *ent) break; // Outpost case CUserEntity::Outpost: - IM->executeLuaScript("game:outpostBCOpenStateWindow()", 0); + CLuaManager::getInstance().executeLuaScript("game:outpostBCOpenStateWindow()", 0); break; // BuildTotem case CUserEntity::BuildTotem: