assert if we try to use a non-loaded string
This commit is contained in:
@@ -32,12 +32,15 @@ RString LocalizedString::LocalizeString( const RString &sSection, const RString
|
|||||||
LocalizedString::LocalizedString()
|
LocalizedString::LocalizedString()
|
||||||
{
|
{
|
||||||
g_Subscribers.Subscribe( this );
|
g_Subscribers.Subscribe( this );
|
||||||
|
m_bValueLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalizedString::LocalizedString( const RString &sSection, const RString &sName )
|
LocalizedString::LocalizedString( const RString &sSection, const RString &sName )
|
||||||
{
|
{
|
||||||
Load( sSection, sName );
|
|
||||||
g_Subscribers.Subscribe( this );
|
g_Subscribers.Subscribe( this );
|
||||||
|
m_bValueLoaded = false;
|
||||||
|
|
||||||
|
Load( sSection, sName );
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,11 +73,12 @@ const RString &LocalizedString::GetValue() const
|
|||||||
void LocalizedString::Refresh()
|
void LocalizedString::Refresh()
|
||||||
{
|
{
|
||||||
m_sValue = LocalizeString( m_sSection, m_sName );
|
m_sValue = LocalizeString( m_sSection, m_sName );
|
||||||
|
m_bValueLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocalizedString::IsLoaded() const
|
bool LocalizedString::IsLoaded() const
|
||||||
{
|
{
|
||||||
return !m_sSection.empty() && !m_sName.empty();
|
return m_bValueLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
LuaFunction( LocalizeString, LocalizedString::LocalizeString( SArg(1), SArg(2) ) )
|
LuaFunction( LocalizeString, LocalizedString::LocalizeString( SArg(1), SArg(2) ) )
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ private:
|
|||||||
RString m_sSection;
|
RString m_sSection;
|
||||||
RString m_sName;
|
RString m_sName;
|
||||||
RString m_sValue;
|
RString m_sValue;
|
||||||
|
bool m_bValueLoaded;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user