Part of OpenITG's profile bugfix.
Needs some lua hooks on our end though apparently.
This commit is contained in:
+8
-5
@@ -85,11 +85,12 @@ public:
|
||||
m_iNumExtraStagesPassed(0), m_iNumExtraStagesFailed(0),
|
||||
m_iNumToasties(0), m_iTotalTapsAndHolds(0), m_iTotalJumps(0),
|
||||
m_iTotalHolds(0), m_iTotalRolls(0), m_iTotalMines(0),
|
||||
m_iTotalHands(0), m_iTotalLifts(0), m_UnlockedEntryIDs(),
|
||||
m_sLastPlayedMachineGuid(""), m_LastPlayedDate(),
|
||||
m_iNumSongsPlayedByStyle(), m_iNumTotalSongsPlayed(0),
|
||||
m_UserData(), m_SongHighScores(), m_CourseHighScores(),
|
||||
m_vScreenshots(), m_mapDayToCaloriesBurned()
|
||||
m_iTotalHands(0), m_iTotalLifts(0), m_bNewProfile(false),
|
||||
m_UnlockedEntryIDs(), m_sLastPlayedMachineGuid(""),
|
||||
m_LastPlayedDate(),m_iNumSongsPlayedByStyle(),
|
||||
m_iNumTotalSongsPlayed(0), m_UserData(), m_SongHighScores(),
|
||||
m_CourseHighScores(), m_vScreenshots(),
|
||||
m_mapDayToCaloriesBurned()
|
||||
{
|
||||
m_lastSong.Unset();
|
||||
m_lastCourse.Unset();
|
||||
@@ -182,6 +183,8 @@ public:
|
||||
int m_iTotalMines;
|
||||
int m_iTotalHands;
|
||||
int m_iTotalLifts;
|
||||
/** @brief Is this a brand new profile? */
|
||||
bool m_bNewProfile;
|
||||
set<RString> m_UnlockedEntryIDs;
|
||||
/**
|
||||
* @brief Which machine did we play on last, based on the Guid?
|
||||
|
||||
@@ -97,6 +97,7 @@ void ProfileManager::Init()
|
||||
m_bLastLoadWasTamperedOrCorrupt[p] = false;
|
||||
m_bLastLoadWasFromLastGood[p] = false;
|
||||
m_bNeedToBackUpLastLoad[p] = false;
|
||||
m_bNewProfile[p] = false;
|
||||
}
|
||||
|
||||
LoadMachineProfile();
|
||||
@@ -222,6 +223,7 @@ bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn, bool bLoadEdits
|
||||
|
||||
vector<RString> asDirsToTry;
|
||||
GetMemoryCardProfileDirectoriesToTry( asDirsToTry );
|
||||
m_bNewProfile[pn] = true;
|
||||
|
||||
for( unsigned i = 0; i < asDirsToTry.size(); ++i )
|
||||
{
|
||||
@@ -239,6 +241,7 @@ bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn, bool bLoadEdits
|
||||
ProfileLoadResult res = LoadProfile( pn, sDir, true );
|
||||
if( res == ProfileLoadResult_Success )
|
||||
{
|
||||
m_bNewProfile[pn] = false;
|
||||
/* If importing, store the directory we imported from, for display purposes. */
|
||||
if( i > 0 )
|
||||
m_sProfileDirImportedFrom[pn] = asDirsToTry[i];
|
||||
@@ -246,7 +249,10 @@ bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn, bool bLoadEdits
|
||||
}
|
||||
|
||||
if( res == ProfileLoadResult_FailedTampered )
|
||||
{
|
||||
m_bNewProfile[pn] = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we imported a profile fallback directory, change the memory card
|
||||
@@ -544,6 +550,11 @@ bool ProfileManager::ProfileWasLoadedFromMemoryCard( PlayerNumber pn ) const
|
||||
return !m_sProfileDir[pn].empty() && m_bWasLoadedFromMemoryCard[pn];
|
||||
}
|
||||
|
||||
bool ProfileManager::ProfileFromMemoryCardIsNew( PlayerNumber pn ) const
|
||||
{
|
||||
return GetProfile(pn) && m_bWasLoadedFromMemoryCard[pn] && m_bNewProfile[pn];
|
||||
}
|
||||
|
||||
bool ProfileManager::LastLoadWasTamperedOrCorrupt( PlayerNumber pn ) const
|
||||
{
|
||||
return !m_sProfileDir[pn].empty() && m_bLastLoadWasTamperedOrCorrupt[pn];
|
||||
|
||||
@@ -77,6 +77,7 @@ public:
|
||||
|
||||
RString GetPlayerName( PlayerNumber pn ) const;
|
||||
bool ProfileWasLoadedFromMemoryCard( PlayerNumber pn ) const;
|
||||
bool ProfileFromMemoryCardIsNew( PlayerNumber pn ) const;
|
||||
bool LastLoadWasTamperedOrCorrupt( PlayerNumber pn ) const;
|
||||
bool LastLoadWasFromLastGood( PlayerNumber pn ) const;
|
||||
|
||||
@@ -117,6 +118,7 @@ private:
|
||||
bool m_bLastLoadWasTamperedOrCorrupt[NUM_PLAYERS]; // true if Stats.xml was present, but failed to load (probably because of a signature failure)
|
||||
bool m_bLastLoadWasFromLastGood[NUM_PLAYERS]; // if true, then m_bLastLoadWasTamperedOrCorrupt is also true
|
||||
mutable bool m_bNeedToBackUpLastLoad[NUM_PLAYERS]; // if true, back up profile on next save
|
||||
bool m_bNewProfile[NUM_PLAYERS];
|
||||
|
||||
Profile *m_pMemoryCardProfile[NUM_PLAYERS]; // holds Profile for the currently inserted card
|
||||
Profile *m_pMachineProfile;
|
||||
|
||||
@@ -81,7 +81,8 @@ void ScreenNameEntryTraditional::BeginScreen()
|
||||
GAMESTATE->GetRankingFeats( pn, aFeats );
|
||||
|
||||
bool bNoStagesLeft = GAMESTATE->m_iPlayerStageTokens[pn] <= 0;
|
||||
m_bEnteringName[pn] = aFeats.size() > 0 && bNoStagesLeft;
|
||||
m_bEnteringName[pn] = ( aFeats.size() > 0 ||
|
||||
PROFILEMAN->ProfileFromMemoryCardIsNew(pn) ) && bNoStagesLeft;
|
||||
m_bFinalized[pn] = !m_bEnteringName[pn];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user