Fix Profiler1 "time per turn".
Actually call Turn() when a turn is processed. Fixes #6144 Differential Revision: https://code.wildfiregames.com/D3885 This was SVN commit r25394.
This commit is contained in:
parent
e0800bc092
commit
64b475b390
@ -393,11 +393,6 @@ void CGame::Update(const double deltaRealTime, bool doInterpolate)
|
||||
|
||||
if (deltaSimTime)
|
||||
{
|
||||
// To avoid confusing the profiler, we need to trigger the new turn
|
||||
// while we're not nested inside any PROFILE blocks
|
||||
if (m_TurnManager->WillUpdate(deltaSimTime))
|
||||
g_Profiler.Turn();
|
||||
|
||||
// At the normal sim rate, we currently want to render at least one
|
||||
// frame per simulation turn, so let maxTurns be 1. But for fast-forward
|
||||
// sim rates we want to allow more, so it's not bounded by framerate,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
#define PROFILE_AMORTIZE_FRAMES 30
|
||||
#define PROFILE_AMORTIZE_TURNS 1
|
||||
#define PROFILE_AMORTIZE_TURNS 5
|
||||
|
||||
class CProfileManager;
|
||||
class CProfileNodeTable;
|
||||
|
@ -62,22 +62,6 @@ void CTurnManager::SetPlayerID(int playerId)
|
||||
m_PlayerId = playerId;
|
||||
}
|
||||
|
||||
bool CTurnManager::WillUpdate(float simFrameLength) const
|
||||
{
|
||||
// Keep this in sync with the return value of Update()
|
||||
|
||||
if (m_CurrentTurn > m_FinalTurn)
|
||||
return false;
|
||||
|
||||
if (m_DeltaSimTime + simFrameLength < 0)
|
||||
return false;
|
||||
|
||||
if (m_ReadyTurn <= m_CurrentTurn)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CTurnManager::Update(float simFrameLength, size_t maxTurns)
|
||||
{
|
||||
if (m_CurrentTurn > m_FinalTurn)
|
||||
@ -124,6 +108,10 @@ bool CTurnManager::Update(float simFrameLength, size_t maxTurns)
|
||||
if (m_ReadyTurn <= m_CurrentTurn && m_CommandDelay > 1)
|
||||
break;
|
||||
|
||||
// To avoid confusing the profiler, we need to trigger the new turn
|
||||
// while we're not nested inside any PROFILE blocks
|
||||
g_Profiler.Turn();
|
||||
|
||||
NotifyFinishedOwnCommands(m_CurrentTurn + m_CommandDelay);
|
||||
|
||||
// Increase now, so Update can send new commands for a subsequent turn
|
||||
|
@ -111,12 +111,6 @@ public:
|
||||
*/
|
||||
bool UpdateFastForward();
|
||||
|
||||
/**
|
||||
* Returns whether Update(simFrameLength, ...) will process at least one new turn.
|
||||
* @param simFrameLength Length of the previous frame, in simulation seconds
|
||||
*/
|
||||
bool WillUpdate(float simFrameLength) const;
|
||||
|
||||
/**
|
||||
* Advance the graphics by a certain time.
|
||||
* @param simFrameLength Length of the previous frame, in simulation seconds
|
||||
|
Loading…
Reference in New Issue
Block a user