From 23ac008cf1ad486efa559ac20ac424fda68f6584 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 28 Jul 2013 08:13:19 +0200 Subject: [PATCH] Avoid redundant per-frame calls to getDbProp("SERVER:WEATHER:VALUE") --HG-- branch : kaetemi-optimize --- code/ryzom/client/src/weather.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/weather.cpp b/code/ryzom/client/src/weather.cpp index 1f5f0f822..17288fbe9 100644 --- a/code/ryzom/client/src/weather.cpp +++ b/code/ryzom/client/src/weather.cpp @@ -194,10 +194,13 @@ bool ServerDrivenWeather = false; const float WEATHER_BLEND_SPEED = 1.f / 8.f; // number of seconds to blend betwen weather states +static NLMISC::CRefPtr s_ServerWeatherValueDB; + // *************************************************************************** static uint16 getServerWeather() { - CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:WEATHER:VALUE"); + CCDBNodeLeaf *node = s_ServerWeatherValueDB ? &*s_ServerWeatherValueDB + : (s_ServerWeatherValueDB = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:WEATHER:VALUE")); if (!node) return 0; return (uint16) node->getValue16(); }