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

Method MoveToWorld

src/ClientHandle.cpp:1586–1616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1584
1585
1586void cClientHandle::MoveToWorld(cWorld & a_World, bool a_SendRespawnPacket)
1587{
1588 UNUSED(a_World);
1589 ASSERT(m_Player != NULL);
1590
1591 if (a_SendRespawnPacket)
1592 {
1593 SendRespawn();
1594 }
1595
1596 cWorld * World = m_Player->GetWorld();
1597
1598 // Remove all associated chunks:
1599 cChunkCoordsList Chunks;
1600 {
1601 cCSLock Lock(m_CSChunkLists);
1602 std::swap(Chunks, m_LoadedChunks);
1603 m_ChunksToSend.clear();
1604 }
1605 for (cChunkCoordsList::iterator itr = Chunks.begin(), end = Chunks.end(); itr != end; ++itr)
1606 {
1607 World->RemoveChunkClient(itr->m_ChunkX, itr->m_ChunkZ, this);
1608 m_Protocol->SendUnloadChunk(itr->m_ChunkX, itr->m_ChunkZ);
1609 } // for itr - Chunks[]
1610
1611 // StreamChunks() called in cPlayer::MoveToWorld() after new world has been set
1612 // Meanwhile here, we set last streamed values to bogus ones so everything is resent
1613 m_LastStreamedChunkX = 0x7fffffff;
1614 m_LastStreamedChunkZ = 0x7fffffff;
1615 m_HasSentPlayerChunk = false;
1616}
1617
1618
1619

Callers

nothing calls this directly

Calls 6

clearMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
GetWorldMethod · 0.45
RemoveChunkClientMethod · 0.45
SendUnloadChunkMethod · 0.45

Tested by

no test coverage detected