From 054a89dd9e5d6819adede9d7ba781b69f98ff2f4 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 6 Jan 2021 00:35:42 +0000 Subject: Clarify cClientHandle, cPlayer ownership semantics + A cPlayer, once created, has a strong pointer to the cClientHandle. The player ticks the clienthandle. If he finds the handle destroyed, he destroys himself in turn. Nothing else can kill the player. * The client handle has a pointer to the player. Once a player is created, the client handle never outlasts the player, nor does it manage the player's lifetime. The pointer is always safe to use after FinishAuthenticate, which is also the point where cProtocol is put into the Game state that allows player manipulation. + Entities are once again never lost by constructing a chunk when they try to move into one that doesn't exist. * Fixed a forgotten Super invocation in cPlayer::OnRemoveFromWorld. * Fix SaveToDisk usage in destructor by only saving things cPlayer owns, instead of accessing cWorld. --- src/Mobs/Monster.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'src/Mobs/Monster.cpp') diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 52b3f8454..b115b241a 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -598,20 +598,6 @@ bool cMonster::DoTakeDamage(TakeDamageInfo & a_TDI) -void cMonster::DoMoveToWorld(const cEntity::sWorldChangeInfo & a_WorldChangeInfo) -{ - // Stop all mobs from targeting this entity - // Stop this entity from targeting other mobs - SetTarget(nullptr); - StopEveryoneFromTargetingMe(); - - Super::DoMoveToWorld(a_WorldChangeInfo); -} - - - - - void cMonster::KilledBy(TakeDamageInfo & a_TDI) { Super::KilledBy(a_TDI); -- cgit v1.2.3