fixed 'player clone' bug

This commit is contained in:
CPunch 2020-09-17 18:03:23 -05:00
parent f4db0830ba
commit 22e3e9e4de

View File

@ -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;