mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-30 04:40:53 +00:00
More checks before to get a pointer on a CCDBNodeLeaf, fixes #251
This commit is contained in:
parent
63366b4c9b
commit
58d6ebb7a6
2 changed files with 69 additions and 26 deletions
|
@ -1950,8 +1950,14 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
|
|||
nlctassert(CHARACTERISTICS::NUM_CHARACTERISTICS==8);
|
||||
for (uint i=0; i<CHARACTERISTICS::NUM_CHARACTERISTICS; ++i)
|
||||
{
|
||||
NLMISC::CCDBNodeLeaf *node = _CurrentPlayerCharacLeaf[i] ? &*_CurrentPlayerCharacLeaf[i]
|
||||
: &*(_CurrentPlayerCharacLeaf[i] = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:CHARACTERISTICS%d:VALUE", i), false));
|
||||
if (!_CurrentPlayerCharacLeaf[i])
|
||||
_CurrentPlayerCharacLeaf[i] = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:CHARACTERISTICS%d:VALUE", i), false);
|
||||
|
||||
NLMISC::CCDBNodeLeaf *node = NULL;
|
||||
|
||||
if (_CurrentPlayerCharacLeaf[i])
|
||||
node = &*_CurrentPlayerCharacLeaf[i];
|
||||
|
||||
_CurrentPlayerCharac[i] = node ? node->getValue32() : 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -3883,32 +3883,69 @@ bool CNetManager::update()
|
|||
CInterfaceManager *im = CInterfaceManager::getInstance();
|
||||
if (im)
|
||||
{
|
||||
CCDBNodeLeaf *node = m_PingLeaf ? &*m_PingLeaf
|
||||
: &*(m_PingLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PING", false));
|
||||
CCDBNodeLeaf *node = NULL;
|
||||
|
||||
if (!m_PingLeaf)
|
||||
m_PingLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PING", false);
|
||||
|
||||
if (m_PingLeaf)
|
||||
{
|
||||
node = &*m_PingLeaf;
|
||||
if (node)
|
||||
node->setValue32(getPing());
|
||||
node = m_UploadLeaf ? &*m_UploadLeaf
|
||||
: &*(m_UploadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:UPLOAD", false));
|
||||
}
|
||||
|
||||
if (!m_UploadLeaf)
|
||||
m_UploadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:UPLOAD", false);
|
||||
|
||||
if (m_UploadLeaf)
|
||||
{
|
||||
node = &*m_UploadLeaf;
|
||||
if (node)
|
||||
node->setValue32((sint32)(getMeanUpload()*1024.f/8.f));
|
||||
node = m_DownloadLeaf ? &*m_DownloadLeaf
|
||||
: &*(m_DownloadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DOWNLOAD", false));
|
||||
}
|
||||
|
||||
if (!m_DownloadLeaf)
|
||||
m_DownloadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DOWNLOAD", false);
|
||||
|
||||
if (m_DownloadLeaf)
|
||||
{
|
||||
node = &*m_DownloadLeaf;
|
||||
if (node)
|
||||
node->setValue32((sint32)(getMeanDownload()*1024.f/8.f));
|
||||
node = m_PacketLostLeaf ? &* m_PacketLostLeaf
|
||||
: &*(m_PacketLostLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PACKETLOST", false));
|
||||
}
|
||||
|
||||
if (!m_PacketLostLeaf)
|
||||
m_PacketLostLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PACKETLOST", false);
|
||||
|
||||
if (m_PacketLostLeaf)
|
||||
{
|
||||
node = &*m_PacketLostLeaf;
|
||||
if (node)
|
||||
node->setValue32((sint32)getMeanPacketLoss());
|
||||
node = m_ServerStateLeaf ? &*m_ServerStateLeaf
|
||||
: &*(m_ServerStateLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SERVERSTATE", false));
|
||||
}
|
||||
|
||||
if (!m_ServerStateLeaf)
|
||||
m_ServerStateLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SERVERSTATE", false);
|
||||
|
||||
if (m_ServerStateLeaf)
|
||||
{
|
||||
node = &*m_ServerStateLeaf;
|
||||
if (node)
|
||||
node->setValue32((sint32)getConnectionState());
|
||||
node = m_ConnectionQualityLeaf ? &*m_ConnectionQualityLeaf
|
||||
: &*(m_ConnectionQualityLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CONNECTION_QUALITY", false));
|
||||
}
|
||||
|
||||
if (!m_ConnectionQualityLeaf)
|
||||
m_ConnectionQualityLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CONNECTION_QUALITY", false);
|
||||
|
||||
if (m_ConnectionQualityLeaf)
|
||||
{
|
||||
node = &*m_ConnectionQualityLeaf;
|
||||
if (node)
|
||||
node->setValue32((sint32)getConnectionQuality());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return 'true' if data were sent/received.
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue