From 107fdf4c8ff7893942deb57ef4a6219136406bd2 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 20 Sep 2006 22:15:56 +0000 Subject: [PATCH] Remove Profile::m_SavedLuaData. Don't store data as serialized Lua blobs. The Lua blob format may change with Lua upgrades, and it's hard to impossible to use the data with other apps. This wasn't used right now anyway, but if it's needed, use an XML format. --- stepmania/src/Profile.cpp | 24 ------------------------ stepmania/src/Profile.h | 2 -- 2 files changed, 26 deletions(-) diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 12843870e4..6661d23924 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -136,11 +136,6 @@ void Profile::InitGeneralData() m_iNumTotalSongsPlayed = 0; ZERO( m_iNumStagesPassedByPlayMode ); ZERO( m_iNumStagesPassedByGrade ); - - Lua *L = LUA->Get(); - lua_newtable( L ); - m_SavedLuaData.SetFromStack( L ); - LUA->Release( L ); } void Profile::InitSongScores() @@ -1025,7 +1020,6 @@ XNode* Profile::SaveGeneralDataCreateNode() const pGeneralDataNode->AppendChild( "TotalRolls", m_iTotalRolls ); pGeneralDataNode->AppendChild( "TotalMines", m_iTotalMines ); pGeneralDataNode->AppendChild( "TotalHands", m_iTotalHands ); - pGeneralDataNode->AppendChild( "Data", m_SavedLuaData.Serialize() ); // Keep declared variables in a very local scope so they aren't // accidentally used where they're not intended. There's a lot of @@ -1189,22 +1183,6 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode ) pNode->GetChildValue( "TotalMines", m_iTotalMines ); pNode->GetChildValue( "TotalHands", m_iTotalHands ); - { - RString sData; - if( pNode->GetChildValue( "Data", sData ) ) - { - m_SavedLuaData.LoadFromString( sData ); - if( m_SavedLuaData.GetLuaType() != LUA_TTABLE ) - { - LOG->Warn( "Profile data did not evaluate to a table" ); - Lua *L = LUA->Get(); - lua_newtable( L ); - m_SavedLuaData.SetFromStack( L ); - LUA->Release( L ); - } - } - } - { const XNode* pDefaultModifiers = pNode->GetChild("DefaultModifiers"); if( pDefaultModifiers ) @@ -1944,7 +1922,6 @@ public: static int GetGoalSeconds( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iGoalSeconds ); return 1; } static int SetGoalSeconds( T* p, lua_State *L ) { p->m_iGoalSeconds = IArg(1); return 0; } static int GetCaloriesBurnedToday( T* p, lua_State *L ) { lua_pushnumber(L, p->GetCaloriesBurnedToday() ); return 1; } - static int GetSaved( T* p, lua_State *L ) { p->m_SavedLuaData.PushSelf(L); return 1; } static int GetTotalNumSongsPlayed( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iNumTotalSongsPlayed ); return 1; } static int IsCodeUnlocked( T* p, lua_State *L ) { lua_pushboolean(L, p->IsCodeUnlocked(SArg(1)) ); return 1; } static int GetSongsActual( T* p, lua_State *L ) { lua_pushnumber(L, p->GetSongsActual((StepsType)IArg(1),(Difficulty)IArg(2)) ); return 1; } @@ -2006,7 +1983,6 @@ public: ADD_METHOD( GetGoalSeconds ); ADD_METHOD( SetGoalSeconds ); ADD_METHOD( GetCaloriesBurnedToday ); - ADD_METHOD( GetSaved ); ADD_METHOD( GetTotalNumSongsPlayed ); ADD_METHOD( IsCodeUnlocked ); ADD_METHOD( GetSongsActual ); diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index bac7286561..9c4783c19c 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -15,7 +15,6 @@ #include "CourseUtil.h" // for CourseID #include "TrailUtil.h" // for TrailID #include "StyleUtil.h" // for StyleID -#include "LuaReference.h" // for LuaData class XNode; struct lua_State; @@ -337,7 +336,6 @@ public: // Lua void PushSelf( lua_State *L ); - LuaData m_SavedLuaData; private: const HighScoresForASong *GetHighScoresForASong( const SongID& songID ) const;