- Added basic ping handling.

Not sure what's up with the MC client, though. It doesn't seem to end up giving good results like the KA packet return is hanging and waiting for other things to process instead of being handled on its own to give a true result.

Feel free to update if there's any way to deliver truer results.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@133 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
mtilden@gmail.com
2011-12-27 18:39:06 +00:00
parent 8a21fbf0ce
commit 59af89235b
5 changed files with 38 additions and 10 deletions
+4 -4
View File
@@ -239,14 +239,14 @@ void cPlayer::Tick(float a_Dt)
}
cTimer t1;
// Send Player List (Once per m_LastPlayerListTime/1000 second(s))
if (m_LastPlayerListTime + cPlayer::E_PLAYER_LIST_TIME <= t1.GetNowTime()) {
// Send Player List (Once per m_LastPlayerListTime/1000 ms)
if (m_LastPlayerListTime + cPlayer::PLAYER_LIST_TIME_MS <= t1.GetNowTime()) {
cWorld::PlayerList PlayerList = cRoot::Get()->GetWorld()->GetAllPlayers();
for( cWorld::PlayerList::iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr )
{
if ((*itr) && (*itr)->GetClientHandle() && !((*itr)->GetClientHandle()->IsDestroyed())) {
cPacket_PlayerListItem PlayerList(GetColor() + GetName(), true, (*itr)->GetClientHandle()->GetPing());
(*itr)->GetClientHandle()->Send( PlayerList );
cPacket_PlayerListItem PlayerListItem(GetColor() + GetName(), true, (*itr)->GetClientHandle()->GetPing());
(*itr)->GetClientHandle()->Send( PlayerListItem );
}
}
m_LastPlayerListTime = t1.GetNowTime();