Merge pull request #7865 from Robyt3/Demo-AddDemoMarker-Error-Messages

Show error messages in console when `add_demomarker` fails
This commit is contained in:
heinrich5991 2024-01-27 12:56:50 +00:00 committed by GitHub
commit 8157ea4ce4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -415,20 +415,34 @@ void CDemoRecorder::AddDemoMarker(int Tick)
{
dbg_assert(Tick >= 0, "invalid marker tick");
if(m_NumTimelineMarkers >= MAX_TIMELINE_MARKERS)
{
if(m_pConsole)
{
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demo_recorder", "Too many timeline markers", gs_DemoPrintColor);
}
return;
}
// not more than 1 marker in a second
if(m_NumTimelineMarkers > 0)
{
int Diff = Tick - m_aTimelineMarkers[m_NumTimelineMarkers - 1];
const int Diff = Tick - m_aTimelineMarkers[m_NumTimelineMarkers - 1];
if(Diff < (float)SERVER_TICK_SPEED)
{
if(m_pConsole)
{
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demo_recorder", "Previous timeline marker too close", gs_DemoPrintColor);
}
return;
}
}
m_aTimelineMarkers[m_NumTimelineMarkers++] = Tick;
if(m_pConsole)
{
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demo_recorder", "Added timeline marker", gs_DemoPrintColor);
}
}
CDemoPlayer::CDemoPlayer(class CSnapshotDelta *pSnapshotDelta, bool UseVideo, TUpdateIntraTimesFunc &&UpdateIntraTimesFunc)