RouletteSeeds now is updated dynamically based on unlocks.dat
This commit is contained in:
@@ -241,6 +241,7 @@ bool UnlockSystem::LoadFromDATFile( CString sPath )
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
SongEntry current;
|
SongEntry current;
|
||||||
|
int MaxRouletteSlot = 0;
|
||||||
|
|
||||||
song_title.MakeUpper(); //Avoid case-sensitive problems
|
song_title.MakeUpper(); //Avoid case-sensitive problems
|
||||||
current.m_sSongName = song_title;
|
current.m_sSongName = song_title;
|
||||||
@@ -283,9 +284,14 @@ bool UnlockSystem::LoadFromDATFile( CString sPath )
|
|||||||
if (unlock_type == "RO")
|
if (unlock_type == "RO")
|
||||||
{
|
{
|
||||||
current.m_iRouletteSeed = (int)datavalue;
|
current.m_iRouletteSeed = (int)datavalue;
|
||||||
current.isLocked = ((PREFSMAN->m_RouletteSeeds)[(int)datavalue] != '1');
|
if (datavalue > MaxRouletteSlot)
|
||||||
}
|
MaxRouletteSlot = datavalue;
|
||||||
|
|
||||||
|
current.isLocked = true;
|
||||||
|
// will read on first update
|
||||||
|
// current.isLocked = ((PREFSMAN->m_RouletteSeeds)[(int)datavalue] != '1');
|
||||||
|
}
|
||||||
|
InitRouletteSeeds(MaxRouletteSlot);
|
||||||
m_SongEntries.push_back(current);
|
m_SongEntries.push_back(current);
|
||||||
}
|
}
|
||||||
// sort list so we can make use of binary searching
|
// sort list so we can make use of binary searching
|
||||||
@@ -364,3 +370,29 @@ void UnlockSystem::DebugPrint()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is mainly to streamline the INI for unnecessary values.
|
||||||
|
void UnlockSystem::InitRouletteSeeds(int MaxRouletteSlot)
|
||||||
|
{
|
||||||
|
CString seeds = PREFSMAN->m_RouletteSeeds;
|
||||||
|
MaxRouletteSlot++; // we actually need one more
|
||||||
|
|
||||||
|
// have exactly the needed number of slots
|
||||||
|
if (seeds.GetLength() == MaxRouletteSlot) return;
|
||||||
|
|
||||||
|
if (seeds.GetLength() > MaxRouletteSlot) // truncate value
|
||||||
|
{
|
||||||
|
seeds = seeds.Left(MaxRouletteSlot);
|
||||||
|
PREFSMAN->m_RouletteSeeds = seeds;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we get here, the value isn't long enough
|
||||||
|
while (seeds.GetLength() != MaxRouletteSlot)
|
||||||
|
seeds += "0";
|
||||||
|
|
||||||
|
PREFSMAN->m_RouletteSeeds = seeds;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -75,6 +75,7 @@ private:
|
|||||||
void SortSongEntriesArray(); // sorts unlocks
|
void SortSongEntriesArray(); // sorts unlocks
|
||||||
bool ParseRow(CString text, CString &type, float &qty, CString &songname);
|
bool ParseRow(CString text, CString &type, float &qty, CString &songname);
|
||||||
SongEntry *FindSong( const Song *pSong );
|
SongEntry *FindSong( const Song *pSong );
|
||||||
|
void InitRouletteSeeds(int MaxRouletteSlot);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user