mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
fixed 'player clone' bug
This commit is contained in:
parent
f4db0830ba
commit
22e3e9e4de
@ -169,13 +169,13 @@ void PlayerManager::updatePlayerPosition(CNSocket* sock, int X, int Y, int Z) {
|
|||||||
// first, remove all the old npcs & players from the old chunks
|
// first, remove all the old npcs & players from the old chunks
|
||||||
removePlayerFromChunks(ChunkManager::getDeltaChunks(view.currentChunks, allChunks), sock);
|
removePlayerFromChunks(ChunkManager::getDeltaChunks(view.currentChunks, allChunks), sock);
|
||||||
|
|
||||||
// now, add all the new npcs & players!
|
|
||||||
addPlayerToChunks(ChunkManager::getDeltaChunks(allChunks, view.currentChunks), sock);
|
|
||||||
|
|
||||||
// remove us from that old stinky chunk (+ a sanity check)
|
// remove us from that old stinky chunk (+ a sanity check)
|
||||||
if (ChunkManager::chunks.find(view.chunkPos) != ChunkManager::chunks.end())
|
if (ChunkManager::chunks.find(view.chunkPos) != ChunkManager::chunks.end())
|
||||||
ChunkManager::chunks[view.chunkPos]->players.erase(sock);
|
ChunkManager::chunks[view.chunkPos]->players.erase(sock);
|
||||||
|
|
||||||
|
// now, add all the new npcs & players!
|
||||||
|
addPlayerToChunks(ChunkManager::getDeltaChunks(allChunks, view.currentChunks), sock);
|
||||||
|
|
||||||
ChunkManager::addPlayer(X, Y, sock); // takes care of adding the player to the chunk if it exists or not
|
ChunkManager::addPlayer(X, Y, sock); // takes care of adding the player to the chunk if it exists or not
|
||||||
view.chunkPos = newPos;
|
view.chunkPos = newPos;
|
||||||
view.currentChunks = allChunks;
|
view.currentChunks = allChunks;
|
||||||
|
Loading…
Reference in New Issue
Block a user