From 22e3e9e4de09fe35a33a9467508bbb6262f9b61e Mon Sep 17 00:00:00 2001 From: CPunch Date: Thu, 17 Sep 2020 18:03:23 -0500 Subject: [PATCH] fixed 'player clone' bug --- src/PlayerManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PlayerManager.cpp b/src/PlayerManager.cpp index aa525b0..2222667 100644 --- a/src/PlayerManager.cpp +++ b/src/PlayerManager.cpp @@ -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 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) if (ChunkManager::chunks.find(view.chunkPos) != ChunkManager::chunks.end()) 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 view.chunkPos = newPos; view.currentChunks = allChunks;