MCPcopy Create free account
hub / github.com/cuberite/cuberite / TickClients

Method TickClients

src/Server.cpp:372–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370
371
372void cServer::TickClients(float a_Dt)
373{
374 cClientHandleList RemoveClients;
375 {
376 cCSLock Lock(m_CSClients);
377
378 // Remove clients that have moved to a world (the world will be ticking them from now on)
379 for (cClientHandleList::const_iterator itr = m_ClientsToRemove.begin(), end = m_ClientsToRemove.end(); itr != end; ++itr)
380 {
381 m_Clients.remove(*itr);
382 } // for itr - m_ClientsToRemove[]
383 m_ClientsToRemove.clear();
384
385 // Tick the remaining clients, take out those that have been destroyed into RemoveClients
386 for (cClientHandleList::iterator itr = m_Clients.begin(); itr != m_Clients.end();)
387 {
388 if ((*itr)->IsDestroyed())
389 {
390 // Remove the client later, when CS is not held, to avoid deadlock ( http://forum.mc-server.org/showthread.php?tid=374 )
391 RemoveClients.push_back(*itr);
392 itr = m_Clients.erase(itr);
393 continue;
394 }
395 (*itr)->ServerTick(a_Dt);
396 ++itr;
397 } // for itr - m_Clients[]
398 }
399
400 // Delete the clients that have been destroyed
401 for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr)
402 {
403 delete *itr;
404 } // for itr - RemoveClients[]
405}
406
407
408

Callers

nothing calls this directly

Calls 5

beginMethod · 0.80
endMethod · 0.80
clearMethod · 0.80
ServerTickMethod · 0.80
IsDestroyedMethod · 0.45

Tested by

no test coverage detected