Merge pull request #7391 from furo321/incorrect-ghost

Fix incorrect ghost being loaded with `cl_race_ghost_save_best`
This commit is contained in:
Dennis Felsing 2023-10-30 09:40:25 +00:00 committed by GitHub
commit 795a2699ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -432,14 +432,14 @@ void CGhost::StopRecord(int Time)
CMenus::CGhostItem *pOwnGhost = m_pClient->m_Menus.GetOwnGhost();
if(Time > 0 && (!pOwnGhost || Time < pOwnGhost->m_Time || !g_Config.m_ClRaceGhostSaveBest))
{
if(pOwnGhost && pOwnGhost->Active())
Unload(pOwnGhost->m_Slot);
// add to active ghosts
int Slot = GetSlot();
if(Slot != -1)
if(Slot != -1 && (!pOwnGhost || Time < pOwnGhost->m_Time))
m_aActiveGhosts[Slot] = std::move(m_CurGhost);
if(pOwnGhost && pOwnGhost->Active() && Time < pOwnGhost->m_Time)
Unload(pOwnGhost->m_Slot);
// create ghost item
CMenus::CGhostItem Item;
if(RecordingToFile)

View file

@ -956,7 +956,7 @@ void CMenus::UpdateOwnGhost(CGhostItem Item)
if(Item.HasFile() || !m_vGhosts[Own].HasFile())
DeleteGhostItem(Own);
}
if(m_vGhosts[Own].m_Time >= Item.m_Time)
if(m_vGhosts[Own].m_Time > Item.m_Time)
{
Item.m_Own = true;
m_vGhosts[Own].m_Own = false;