From 95b1c7dc2b7aa3b1cb42c8a2ef70f3d0d56be76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Tue, 29 Aug 2023 22:05:12 +0200 Subject: [PATCH] Hide `client is not online` log message except when using `record` The log message is otherwise shown multiple times when starting the client. Now it's only shown when the `record` command is used manually, i.e. not for automatically recorded demos anymore. --- src/engine/client.h | 2 +- src/engine/client/client.cpp | 11 +++++++---- src/engine/client/client.h | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/engine/client.h b/src/engine/client.h index 33a8d2cc4..7d75fea3a 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -167,7 +167,7 @@ public: #if defined(CONF_VIDEORECORDER) virtual const char *DemoPlayer_Render(const char *pFilename, int StorageType, const char *pVideoName, int SpeedIndex, bool StartPaused = false) = 0; #endif - virtual void DemoRecorder_Start(const char *pFilename, bool WithTimestamp, int Recorder) = 0; + virtual void DemoRecorder_Start(const char *pFilename, bool WithTimestamp, int Recorder, bool Verbose = false) = 0; virtual void DemoRecorder_HandleAutoStart() = 0; virtual void DemoRecorder_Stop(int Recorder, bool RemoveFile = false) = 0; virtual class IDemoRecorder *DemoRecorder(int Recorder) = 0; diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 1d940f381..9470c65a8 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -3957,10 +3957,13 @@ void CClient::Con_DemoSpeed(IConsole::IResult *pResult, void *pUserData) pSelf->m_DemoPlayer.SetSpeed(pResult->GetFloat(0)); } -void CClient::DemoRecorder_Start(const char *pFilename, bool WithTimestamp, int Recorder) +void CClient::DemoRecorder_Start(const char *pFilename, bool WithTimestamp, int Recorder, bool Verbose) { if(State() != IClient::STATE_ONLINE) - m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demorec/record", "client is not online"); + { + if(Verbose) + m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demorec/record", "client is not online"); + } else { char aFilename[IO_MAX_PATH_LENGTH]; @@ -4038,9 +4041,9 @@ void CClient::Con_Record(IConsole::IResult *pResult, void *pUserData) { CClient *pSelf = (CClient *)pUserData; if(pResult->NumArguments()) - pSelf->DemoRecorder_Start(pResult->GetString(0), false, RECORDER_MANUAL); + pSelf->DemoRecorder_Start(pResult->GetString(0), false, RECORDER_MANUAL, true); else - pSelf->DemoRecorder_Start(pSelf->m_aCurrentMap, true, RECORDER_MANUAL); + pSelf->DemoRecorder_Start(pSelf->m_aCurrentMap, true, RECORDER_MANUAL, true); } void CClient::Con_StopRecord(IConsole::IResult *pResult, void *pUserData) diff --git a/src/engine/client/client.h b/src/engine/client/client.h index a57dd5fce..6578e5ae3 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -482,7 +482,7 @@ public: void RegisterCommands(); const char *DemoPlayer_Play(const char *pFilename, int StorageType) override; - void DemoRecorder_Start(const char *pFilename, bool WithTimestamp, int Recorder) override; + void DemoRecorder_Start(const char *pFilename, bool WithTimestamp, int Recorder, bool Verbose = false) override; void DemoRecorder_HandleAutoStart() override; void DemoRecorder_StartReplayRecorder(); void DemoRecorder_Stop(int Recorder, bool RemoveFile = false) override;