From 7d4934534e9c58a111215859ba83c32a9bc0fa8a Mon Sep 17 00:00:00 2001 From: Mat Date: Thu, 5 Mar 2020 12:52:34 +0200 Subject: Stabilise MoveToWorld (#4004) * Stabilise MoveToWorld * Fix comments and deprecate ScheduleMoveToWorld * Enhanced thread safety for m_WorldChangeInfo * Return unique_ptr from cAtomicUniquePtr::exchange * cWorld now calls entity cEntity::OnAddToWorld and cEntity::OnRemoveFromWorld. Allows broadcasting entities added to the world from the world's tick thread. This also factors out some common code from cEntity::DoMoveToWorld and cEntity::Initialize. As a consequence, cEntity::Destroy(false) (i.e. Destroying the entity without broadcasting) is impossible. This isn't used anywhere in Cuberite so it's now deprecated. * Update entity position after removing it from the world. Fixes broadcasts being sent to the wrong chunk. * Fix style * cEntity: Update LastSentPosition when sending spawn packet * Add Wno-deprecated-declarations to the lua bindings * Kill uses of ScheduleMoveToWorld --- src/World.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/World.h') diff --git a/src/World.h b/src/World.h index 159fa7d93..4363804c6 100644 --- a/src/World.h +++ b/src/World.h @@ -263,9 +263,8 @@ public: /** Removes the player from the world. Removes the player from the addition queue, too, if appropriate. If the player has a ClientHandle, the ClientHandle is removed from all chunks in the world and will not be ticked by this world anymore. - @param a_RemoveFromChunk determines if the entity should be removed from its chunk as well. Should be false when ticking from cChunk. @return An owning reference to the given player. */ - std::unique_ptr RemovePlayer(cPlayer & a_Player, bool a_RemoveFromChunk); + std::unique_ptr RemovePlayer(cPlayer & a_Player); #ifdef _DEBUG bool IsPlayerReferencedInWorldOrChunk(cPlayer & a_Player); -- cgit v1.2.3