Runtime: Wrap fmt::print calls in #ifndef NDEBUG

This commit is contained in:
Luke Street 2020-04-11 02:25:41 -04:00
parent 11d948943d
commit e23c3d3705
3 changed files with 8 additions and 2 deletions

View File

@ -12,13 +12,17 @@ public:
double report(const char* name) const { double report(const char* name) const {
double t = std::chrono::duration_cast<std::chrono::microseconds>( double t = std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::steady_clock::now() - m_start).count() / 1000000.0; std::chrono::steady_clock::now() - m_start).count() / 1000000.0;
#ifndef NDEBUG
fmt::print(fmt("{} {}\n"), name, t); fmt::print(fmt("{} {}\n"), name, t);
#endif
return t; return t;
} }
double reportReset(const char* name) { double reportReset(const char* name) {
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
double t = std::chrono::duration_cast<std::chrono::microseconds>(now - m_start).count() / 1000000.0; double t = std::chrono::duration_cast<std::chrono::microseconds>(now - m_start).count() / 1000000.0;
#ifndef NDEBUG
fmt::print(fmt("{} {}\n"), name, t); fmt::print(fmt("{} {}\n"), name, t);
#endif
m_start = now; m_start = now;
return t; return t;
} }

View File

@ -394,7 +394,9 @@ void CScriptGunTurret::SetTurretState(ETurretState state, CStateManager& mgr) {
} }
if (state != ETurretState::Invalid && x520_state != state) { if (state != ETurretState::Invalid && x520_state != state) {
#ifndef NDEBUG
fmt::print(fmt("{} {} {} - {}\n"), GetUniqueId(), GetEditorId(), GetName(), StateNames[size_t(state)]); fmt::print(fmt("{} {} {} - {}\n"), GetUniqueId(), GetEditorId(), GetName(), StateNames[size_t(state)]);
#endif
} }
x520_state = state; x520_state = state;

View File

@ -78,10 +78,10 @@ void CStateMachineState::Update(CStateManager& mgr, CAi& ai, float delta) {
if (andPassed && state) { if (andPassed && state) {
x4_state->CallFunc(mgr, ai, EStateMsg::Deactivate, 0.f); x4_state->CallFunc(mgr, ai, EStateMsg::Deactivate, 0.f);
x4_state = state; x4_state = state;
//#ifndef NDEBUG #ifndef NDEBUG
fmt::print(fmt("{} {} {} - {} {}\n"), ai.GetUniqueId(), ai.GetEditorId(), ai.GetName(), fmt::print(fmt("{} {} {} - {} {}\n"), ai.GetUniqueId(), ai.GetEditorId(), ai.GetName(),
state->xc_name, int(state - x0_machine->GetStateVector().data())); state->xc_name, int(state - x0_machine->GetStateVector().data()));
//#endif #endif
x8_time = 0.f; x8_time = 0.f;
x18_24_codeTrigger = false; x18_24_codeTrigger = false;
xc_random = mgr.GetActiveRandom()->Float(); xc_random = mgr.GetActiveRandom()->Float();