From 041bf4cd992c253c7198e64a4dfb7d2b3e4751f9 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 28 Jul 2013 05:48:59 +0200 Subject: [PATCH] Avoid redundant per-frame calls to getDbProp("UI:ENTITY:GUILD:#:ICON") --- .../src/interface_v3/group_in_scene_user_info.cpp | 10 ++++++++-- .../client/src/interface_v3/group_in_scene_user_info.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index e313c7ae4..679a9a16d 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -41,6 +41,7 @@ uint CGroupInSceneUserInfo::_BatLength = 0; CCDBNodeLeaf *CGroupInSceneUserInfo::_Value = NULL; CCDBNodeLeaf *CGroupInSceneUserInfo::_ValueBegin = NULL; CCDBNodeLeaf *CGroupInSceneUserInfo::_ValueEnd = NULL; +NLMISC::CRefPtr CGroupInSceneUserInfo::_GuildIconLeaf[256]; // *************************************************************************** NLMISC_REGISTER_OBJECT(CViewBase, CGroupInSceneUserInfo, std::string, "in_scene_user_info"); @@ -943,8 +944,13 @@ void CGroupInSceneUserInfo::updateDynamicData () if (_Entity->getGuildSymbol() != 0) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - string dbLeaf = "UI:ENTITY:GUILD:"+toString (_Entity->slot())+":ICON"; - NLGUI::CDBManager::getInstance()->getDbProp(dbLeaf)->setValue64(_Entity->getGuildSymbol()); + if (!_GuildIconLeaf[_Entity->slot()]) + { + string dbLeaf = "UI:ENTITY:GUILD:"+toString (_Entity->slot())+":ICON"; + _GuildIconLeaf[_Entity->slot()] = NLGUI::CDBManager::getInstance()->getDbProp(dbLeaf); + } + nlassert(&*_GuildIconLeaf[_Entity->slot()]); + (&*_GuildIconLeaf[_Entity->slot()])->setValue64(_Entity->getGuildSymbol()); } // Set the event faction diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.h b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.h index 4a9dd6ddd..1f9db3a4c 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.h +++ b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.h @@ -97,6 +97,9 @@ protected: static NLMISC::CCDBNodeLeaf *_ValueBegin; static NLMISC::CCDBNodeLeaf *_ValueEnd; + // Guild icon leafs + static NLMISC::CRefPtr _GuildIconLeaf[256]; + // Special guild bool _NeedGuildNameId; bool _NeedGuildSymbolId;