Avoid redundant per-frame calls to getDbProp("UI:VARIABLES:FPS", false)

--HG--
branch : kaetemi-optimize
This commit is contained in:
kaetemi 2013-07-28 00:29:32 +02:00
parent 2a57f6c647
commit 5f80a90a1c

View file

@ -382,6 +382,8 @@ CGameContextMenu GameContextMenu;
NLMISC::CValueSmoother smoothFPS; NLMISC::CValueSmoother smoothFPS;
NLMISC::CValueSmoother moreSmoothFPS(64); NLMISC::CValueSmoother moreSmoothFPS(64);
static CRefPtr<CCDBNodeLeaf> s_FpsLeaf;
// Profile // Profile
/* /*
@ -2296,7 +2298,8 @@ bool mainLoop()
deltaTime = smoothFPS.getSmoothValue (); deltaTime = smoothFPS.getSmoothValue ();
if (deltaTime > 0.0) if (deltaTime > 0.0)
{ {
CCDBNodeLeaf*pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:FPS"); CCDBNodeLeaf *pNL = (CCDBNodeLeaf *)s_FpsLeaf ? &*s_FpsLeaf
: (s_FpsLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:FPS"));
pNL->setValue64((sint64)(1.f/deltaTime)); pNL->setValue64((sint64)(1.f/deltaTime));
} }
} }