CHANGED: #1471 The local string mapper is now instantiated by CWidgetManager.

This commit is contained in:
dfighter1985 2012-07-16 06:16:43 +02:00
parent 73c63a99c7
commit da53ae9206
4 changed files with 21 additions and 20 deletions

View file

@ -521,7 +521,6 @@ namespace NLGUI
TLinkVect *_Links; // links, or NULL if no link
};
extern NLMISC::CStringMapper *_UIStringMapper;
/**
* class to compress string usage in the interface
* \author Matthieu 'Trap' Besson
@ -586,9 +585,13 @@ namespace NLGUI
}
}
static void createStringMapper();
static void deleteStringMapper();
private:
NLMISC::TStringId _Id;
static NLMISC::CStringMapper *_UIStringMapper;
};
inline bool operator==(const CStringShared &lhs, const CStringShared &rhs) { return lhs.getStringId() == rhs.getStringId(); }

View file

@ -32,8 +32,6 @@ using namespace NLMISC;
namespace NLGUI
{
CStringMapper *_UIStringMapper = NULL;
// ------------------------------------------------------------------------------------------------
CInterfaceElement::~CInterfaceElement()
{
@ -1271,6 +1269,19 @@ namespace NLGUI
return false;
}
CStringMapper* CStringShared::_UIStringMapper = NULL;
void CStringShared::createStringMapper()
{
if( _UIStringMapper == NULL )
_UIStringMapper = CStringMapper::createLocalMapper();
}
void CStringShared::deleteStringMapper()
{
delete _UIStringMapper;
}
}

View file

@ -3093,6 +3093,8 @@ namespace NLGUI
CWidgetManager::CWidgetManager()
{
CStringShared::createStringMapper();
CReflectableRegister::registerClasses();
parser = IParser::createParser();
@ -3133,6 +3135,8 @@ namespace NLGUI
_Pointer = NULL;
curContextHelp = NULL;
CStringShared::deleteStringMapper();
}
}

View file

@ -137,7 +137,6 @@ using namespace NLMISC;
namespace NLGUI
{
extern void luaDebuggerMainLoop();
extern NLMISC::CStringMapper *_UIStringMapper;
}
extern CClientChatManager ChatMngr;
@ -543,10 +542,6 @@ CInterfaceManager::~CInterfaceManager()
CViewTextFormated::setFormatter( NULL );
reset(); // to flush IDStringWaiters
// release the local string mapper
delete _UIStringMapper;
_UIStringMapper = NULL;
// release the database observers
releaseServerToLocalAutoCopyObservers();
@ -636,10 +631,6 @@ void CInterfaceManager::initLogin()
// Init LUA Scripting
initLUA();
// Create String mapper
if (_UIStringMapper == NULL)
_UIStringMapper = CStringMapper::createLocalMapper();
// Clear the action manager
Actions.clear();
EditActions.clear();
@ -708,10 +699,6 @@ void CInterfaceManager::uninitLogin()
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::initOutGame()
{
// create String mapper
if (_UIStringMapper == NULL)
_UIStringMapper = CStringMapper::createLocalMapper();
// Clear the action manager
Actions.clear();
EditActions.clear();
@ -871,10 +858,6 @@ void CInterfaceManager::initInGame()
// Init LUA Scripting
initLUA();
// create the _UIStringMapper
if (_UIStringMapper == NULL)
_UIStringMapper = CStringMapper::createLocalMapper();
// Clear the action manager
Actions.clear();
EditActions.clear();