Avoid redundant per-frame calls to getDbProp in CNetManager
This commit is contained in:
parent
70f83e1fb9
commit
8bbb438674
2 changed files with 20 additions and 6 deletions
|
@ -3861,22 +3861,28 @@ bool CNetManager::update()
|
||||||
CInterfaceManager *im = CInterfaceManager::getInstance();
|
CInterfaceManager *im = CInterfaceManager::getInstance();
|
||||||
if (im)
|
if (im)
|
||||||
{
|
{
|
||||||
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PING", false);
|
CCDBNodeLeaf *node = m_PingLeaf ? &*m_PingLeaf
|
||||||
|
: (m_PingLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PING", false));
|
||||||
if (node)
|
if (node)
|
||||||
node->setValue32(getPing());
|
node->setValue32(getPing());
|
||||||
node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:UPLOAD", false);
|
node = m_UploadLeaf ? &*m_UploadLeaf
|
||||||
|
: (m_UploadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:UPLOAD", false));
|
||||||
if (node)
|
if (node)
|
||||||
node->setValue32((sint32)(getMeanUpload()*1024.f/8.f));
|
node->setValue32((sint32)(getMeanUpload()*1024.f/8.f));
|
||||||
node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DOWNLOAD", false);
|
node = m_DownloadLeaf ? &*m_DownloadLeaf
|
||||||
|
: (m_DownloadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DOWNLOAD", false));
|
||||||
if (node)
|
if (node)
|
||||||
node->setValue32((sint32)(getMeanDownload()*1024.f/8.f));
|
node->setValue32((sint32)(getMeanDownload()*1024.f/8.f));
|
||||||
node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PACKETLOST", false);
|
node = m_PacketLostLeaf ? &* m_PacketLostLeaf
|
||||||
|
: (m_PacketLostLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PACKETLOST", false));
|
||||||
if (node)
|
if (node)
|
||||||
node->setValue32((sint32)getMeanPacketLoss());
|
node->setValue32((sint32)getMeanPacketLoss());
|
||||||
node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SERVERSTATE", false);
|
node = m_ServerStateLeaf ? &*m_ServerStateLeaf
|
||||||
|
: (m_ServerStateLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SERVERSTATE", false));
|
||||||
if (node)
|
if (node)
|
||||||
node->setValue32((sint32)getConnectionState());
|
node->setValue32((sint32)getConnectionState());
|
||||||
node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CONNECTION_QUALITY", false);
|
node = m_ConnectionQualityLeaf ? &*m_ConnectionQualityLeaf
|
||||||
|
: (m_ConnectionQualityLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CONNECTION_QUALITY", false));
|
||||||
if (node)
|
if (node)
|
||||||
node->setValue32((sint32)getConnectionQuality());
|
node->setValue32((sint32)getConnectionQuality());
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ void initializeNetwork();
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
class CBitMemStream;
|
class CBitMemStream;
|
||||||
|
class CCDBNodeLeaf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,6 +127,13 @@ public:
|
||||||
protected:
|
protected:
|
||||||
bool _IsReplayStarting;
|
bool _IsReplayStarting;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_PingLeaf;
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_UploadLeaf;
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_DownloadLeaf;
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_PacketLostLeaf;
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_ServerStateLeaf;
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_ConnectionQualityLeaf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue