Only print out missing models once

Don't print duplicated
This commit is contained in:
Kawe Mazidjatari 2022-04-29 22:46:37 +02:00
parent 7441bf156b
commit 1bf7b96641
3 changed files with 11 additions and 5 deletions

View File

@ -144,11 +144,15 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, vo
}
else
{
LABEL_ERROR:
if (g_pMDLFallback->m_hErrorMDL)
Error(eDLL_T::ENGINE, "Model \"%s\" not found; replacing with \"%s\".\n", v8, ERROR_MODEL);
else
Error(eDLL_T::ENGINE, "Model \"%s\" not found and \"%s\" couldn't be loaded.\n", v8, ERROR_MODEL);
LABEL_ERROR:
if (std::find(g_vBadMDLHandles.begin(), g_vBadMDLHandles.end(), handle) == g_vBadMDLHandles.end())
{
if (g_pMDLFallback->m_hErrorMDL)
Error(eDLL_T::ENGINE, "Model \"%s\" not found; replacing with \"%s\".\n", v8, ERROR_MODEL);
else
Error(eDLL_T::ENGINE, "Model \"%s\" not found and \"%s\" couldn't be loaded.\n", v8, ERROR_MODEL);
g_vBadMDLHandles.push_back(handle);
}
v17 = g_pMDLFallback->m_pErrorHDR;
}
}

View File

@ -35,6 +35,7 @@ struct CMDLFallBack
}
};
inline CMDLFallBack* g_pMDLFallback = new CMDLFallBack();
inline vector<MDLHandle_t> g_vBadMDLHandles;
class CMDLCache
{

View File

@ -326,6 +326,7 @@ FORCEINLINE void CHostState::UnloadPakFile(void) const
}
}
g_LoadedPakHandle.clear();
g_vBadMDLHandles.clear();
}
//-----------------------------------------------------------------------------