Avoid redundant per-frame calls to getDbProp("UI:SAVE:USER_CHAR_FADE")

--HG--
branch : kaetemi-optimize
This commit is contained in:
kaetemi 2013-07-28 08:16:02 +02:00
parent 23ac008cf1
commit cc2465199c
3 changed files with 7 additions and 2 deletions

View file

@ -58,6 +58,7 @@ uint32 MissionRingId = 0;
UInstance selectedInstance;
const UInstance noSelectedInstance;
string selectedInstanceURL;
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> s_UserCharFade;
///////////////
@ -273,7 +274,8 @@ void checkUnderCursor()
entity= EntitiesMngr.getEntityUnderPos(cursX, cursY, ClientCfg.SelectionDist, isPlayerUnderCursor);
// If the mouse is over the player make the player transparent
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false);
CCDBNodeLeaf *pNL = s_UserCharFade ? &*s_UserCharFade
: (s_UserCharFade = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false));
if ((pNL != NULL) && (pNL->getValue32() == 1) && UserEntity->selectable())
{
// If the nearest entity is the player, hide!

View file

@ -55,6 +55,7 @@ const uint32 DEFAULT_ENTITY_MIN_OPACITY = 128;
bool CTool::_MouseCaptured = false;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> CTool::_UserCharFade;
static const CVector cardinals[] =
{
@ -551,7 +552,8 @@ void CTool::handleMouseOverPlayer(bool over)
{
//H_AUTO(R2_CTool_handleMouseOverPlayer)
// If the mouse is over the player make the player transparent
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false);
CCDBNodeLeaf *pNL = _UserCharFade ? &*_UserCharFade
: (_UserCharFade = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false));
if ((pNL != NULL) && (pNL->getValue32() == 1) && UserEntity->selectable())
{
// If the nearest entity is the player, hide!

View file

@ -284,6 +284,7 @@ private:
sint64 _AutoPanDelay;
sint64 _NumPans;
static bool _MouseCaptured;
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _UserCharFade;
private:
/** compute the nearest valid surface at a given position from the island heightmap
* (heightmap must not be empty or an assertion is raised)