fix LuaData becoming incorrectly set after a reset

This commit is contained in:
Glenn Maynard
2005-02-27 00:22:13 +00:00
parent 35f086ceb2
commit 3e3bad9c9c
2 changed files with 9 additions and 1 deletions
+8 -1
View File
@@ -185,11 +185,18 @@ void LuaData::LoadFromString( const CString &s )
void LuaData::BeforeReset()
{
m_sSerializedData = Serialize();
/* If we're unset, Register() should leave us unset, not set us to LUA_REFNIL. */
m_bWasSet = IsSet();
if( m_bWasSet )
m_sSerializedData = Serialize();
}
void LuaData::Register()
{
if( !m_bWasSet )
return;
LoadFromString( m_sSerializedData );
m_sSerializedData.erase( m_sSerializedData.begin(), m_sSerializedData.end() );
}
+1
View File
@@ -77,6 +77,7 @@ protected:
virtual void Register();
CString m_sSerializedData;
bool m_bWasSet;
};
#endif