mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-17 13:01:41 +00:00
CHANGED: #1471 Don't execute action handlers and/or Lua scripts in editor mode. Warning log message when trying to look up non-existent action handlers.
This commit is contained in:
parent
2dc85e1136
commit
c2b902250f
5 changed files with 29 additions and 1 deletions
|
@ -72,7 +72,13 @@ namespace NLGUI
|
|||
IActionHandler *getActionHandler(const std::string &name) const
|
||||
{
|
||||
TFactoryMap::const_iterator it = FactoryMap.find(name);
|
||||
return it != FactoryMap.end() ? it->second : NULL;
|
||||
if( it == FactoryMap.end() )
|
||||
{
|
||||
nlwarning( "Couldn't find action handler %s", name.c_str() );
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
return it->second;
|
||||
}
|
||||
|
||||
/// Return the name of the action handler given its pointer
|
||||
|
@ -110,10 +116,12 @@ namespace NLGUI
|
|||
|
||||
// Submit a generic event
|
||||
void submitEvent( const std::string &evt );
|
||||
static void setEditorMode( bool b ){ editorMode = b; }
|
||||
|
||||
private:
|
||||
CAHManager(){}
|
||||
static CAHManager *_GlobalInstance;
|
||||
static bool editorMode;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -61,11 +61,14 @@ namespace NLGUI
|
|||
/// Forces the Garbage Collector to run.
|
||||
void forceGarbageCollect();
|
||||
|
||||
static void setEditorMode( bool b ){ editorMode = b; }
|
||||
|
||||
private:
|
||||
CLuaManager();
|
||||
|
||||
static CLuaManager *instance;
|
||||
static bool debugLua;
|
||||
static bool editorMode;
|
||||
|
||||
NLGUI::CLuaState *luaState;
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace NLGUI
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
CAHManager *CAHManager::_GlobalInstance = NULL;
|
||||
bool CAHManager::editorMode = false;
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -210,6 +211,9 @@ namespace NLGUI
|
|||
{
|
||||
if (ahCmdLine.empty()) return;
|
||||
|
||||
if( editorMode )
|
||||
return;
|
||||
|
||||
// Special AH form ("ah:params") ?
|
||||
string::size_type i = ahCmdLine.find(':');
|
||||
string ahName;
|
||||
|
@ -259,6 +263,10 @@ namespace NLGUI
|
|||
nlwarning ("no action handler");
|
||||
return;
|
||||
}
|
||||
|
||||
if( editorMode )
|
||||
return;
|
||||
|
||||
pAH->execute (pCaller, Params);
|
||||
string AHName = CAHManager::getInstance()->getAHName(pAH);
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace NLGUI
|
|||
{
|
||||
|
||||
bool CLuaManager::debugLua = false;
|
||||
bool CLuaManager::editorMode = false;
|
||||
CLuaManager* CLuaManager::instance = NULL;
|
||||
|
||||
CLuaManager::CLuaManager()
|
||||
|
@ -37,6 +38,9 @@ namespace NLGUI
|
|||
|
||||
bool CLuaManager::executeLuaScript( const std::string &luaScript, bool smallScript )
|
||||
{
|
||||
if( editorMode )
|
||||
return true;
|
||||
|
||||
try
|
||||
{
|
||||
if( smallScript )
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "nel/gui/view_renderer.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
#include "nel/gui/widget_manager.h"
|
||||
#include "nel/gui/action_handler.h"
|
||||
#include "nel/gui/lua_manager.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/i18n.h"
|
||||
#include <set>
|
||||
|
@ -58,6 +60,9 @@ namespace GUIEditor
|
|||
Nel3DWidget::init();
|
||||
createTextContext( "Ryzom.ttf" );
|
||||
|
||||
NLGUI::CAHManager::setEditorMode( true );
|
||||
NLGUI::CLuaManager::setEditorMode( true );
|
||||
|
||||
NLGUI::CViewRenderer::setDriver( getDriver() );
|
||||
NLGUI::CViewRenderer::setTextContext( getTextContext() );
|
||||
NLGUI::CViewRenderer::hwCursors = &hwCursors;
|
||||
|
|
Loading…
Reference in a new issue