From e23c3d3705529bc80819592d9196ffefdab755f5 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 11 Apr 2020 02:25:41 -0400 Subject: [PATCH] Runtime: Wrap fmt::print calls in #ifndef NDEBUG --- Runtime/CStopwatch.hpp | 4 ++++ Runtime/World/CScriptGunTurret.cpp | 2 ++ Runtime/World/CStateMachine.cpp | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Runtime/CStopwatch.hpp b/Runtime/CStopwatch.hpp index 8d1d5fa30..7f376d21d 100644 --- a/Runtime/CStopwatch.hpp +++ b/Runtime/CStopwatch.hpp @@ -12,13 +12,17 @@ public: double report(const char* name) const { double t = std::chrono::duration_cast( std::chrono::steady_clock::now() - m_start).count() / 1000000.0; +#ifndef NDEBUG fmt::print(fmt("{} {}\n"), name, t); +#endif return t; } double reportReset(const char* name) { std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); double t = std::chrono::duration_cast(now - m_start).count() / 1000000.0; +#ifndef NDEBUG fmt::print(fmt("{} {}\n"), name, t); +#endif m_start = now; return t; } diff --git a/Runtime/World/CScriptGunTurret.cpp b/Runtime/World/CScriptGunTurret.cpp index dde720de5..596a52c27 100644 --- a/Runtime/World/CScriptGunTurret.cpp +++ b/Runtime/World/CScriptGunTurret.cpp @@ -394,7 +394,9 @@ void CScriptGunTurret::SetTurretState(ETurretState state, CStateManager& mgr) { } if (state != ETurretState::Invalid && x520_state != state) { +#ifndef NDEBUG fmt::print(fmt("{} {} {} - {}\n"), GetUniqueId(), GetEditorId(), GetName(), StateNames[size_t(state)]); +#endif } x520_state = state; diff --git a/Runtime/World/CStateMachine.cpp b/Runtime/World/CStateMachine.cpp index f8979a42d..14ddf2e4e 100644 --- a/Runtime/World/CStateMachine.cpp +++ b/Runtime/World/CStateMachine.cpp @@ -78,10 +78,10 @@ void CStateMachineState::Update(CStateManager& mgr, CAi& ai, float delta) { if (andPassed && state) { x4_state->CallFunc(mgr, ai, EStateMsg::Deactivate, 0.f); x4_state = state; -//#ifndef NDEBUG +#ifndef NDEBUG fmt::print(fmt("{} {} {} - {} {}\n"), ai.GetUniqueId(), ai.GetEditorId(), ai.GetName(), state->xc_name, int(state - x0_machine->GetStateVector().data())); -//#endif +#endif x8_time = 0.f; x18_24_codeTrigger = false; xc_random = mgr.GetActiveRandom()->Float();