Fixed env_credits always resetting sv_unlockedchapters to 15 when it shouldn't

This commit is contained in:
Blixibon 2021-03-12 11:08:39 -06:00
parent 36a459d21c
commit d953468bc1
2 changed files with 13 additions and 0 deletions

View File

@ -212,6 +212,10 @@ static ConCommand creditsdone("creditsdone", CreditsDone_f );
extern ConVar sv_unlockedchapters;
#ifdef MAPBASE
extern int Mapbase_GetChapterCount();
#endif
void CCredits::OnRestore()
{
BaseClass::OnRestore();
@ -226,6 +230,10 @@ void CCredits::OnRestore()
void CCredits::RollOutroCredits()
{
#ifdef MAPBASE
// Don't set this if we're using Mapbase chapters or if sv_unlockedchapters is already greater than 15
if (Mapbase_GetChapterCount() <= 0 && sv_unlockedchapters.GetInt() < 15)
#endif
sv_unlockedchapters.SetValue( "15" );
CBasePlayer *pPlayer = UTIL_GetLocalPlayer();

View File

@ -553,6 +553,11 @@ CUtlVector<MODCHAPTER> *Mapbase_GetChapterList()
return &g_MapbaseChapterList;
}
int Mapbase_GetChapterCount()
{
return g_MapbaseChapterList.Count();
}
ThreeState_t Flashlight_GetLegacyVersionKey()
{
KeyValues *gameinfo = new KeyValues( "GameInfo" );