Use configured resolution for login/outgame/ingame
[ryzomcore.git] / ryzom / client / src / ping.cpp
blobf9526e6fe4f664ad866cd76efb9252cdc6a1915d
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013-2014 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "stdpch.h"
21 #include "ping.h"
23 #include "interface_v3/interface_manager.h"
24 #include "time_client.h"
26 using namespace NLMISC;
27 using namespace NLGUI;
29 void CPing::init()
31 CInterfaceManager *pIM = CInterfaceManager::getInstance();
32 if(pIM)
34 CCDBNodeLeaf *pNodeLeaf = CDBManager::getInstance()->getDbProp("SERVER:DEBUG_INFO:Ping", false);
35 if(pNodeLeaf)
37 ICDBNode::CTextId textId;
38 pNodeLeaf->addObserver(this, textId);
39 // nlwarning("CPing: cannot add the observer");
41 else
42 nlwarning("CPing: 'SERVER:DEBUG_INFO:Ping' does not exist.");
46 void CPing::release()
48 CInterfaceManager *pIM = CInterfaceManager::getInstance();
49 if(pIM)
51 CCDBNodeLeaf *pNodeLeaf = CDBManager::getInstance()->getDbProp("SERVER:DEBUG_INFO:Ping", false);
52 if(pNodeLeaf)
54 ICDBNode::CTextId textId;
55 pNodeLeaf->removeObserver(this, textId);
57 else
58 nlwarning("CPing: 'SERVER:DEBUG_INFO:Ping' does not exist.");
62 void CPing::update(NLMISC::ICDBNode* node)
64 CCDBNodeLeaf *leaf = safe_cast<CCDBNodeLeaf *>(node);
65 uint32 before = (uint32)leaf->getValue32();
66 uint32 current = (uint32)(0xFFFFFFFF & ryzomGetLocalTime());
67 if(before > current)
69 //nlwarning("DB PING Pb before '%u' after '%u'.", before, current);
70 if(ClientCfg.Check)
71 nlstop;
73 _Ping = current - before;
74 _RdyToPing = true;
77 /* end of file */