summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-24 20:17:00 +0100
committerMattes D <github@xoft.cz>2015-01-27 14:53:31 +0100
commit7dfeb67f016135c6da8373b96c32d447e8bf027e (patch)
treeb81a3fbc2399a2bbe2aac31f396234e58d67d49c /src/Entities/Player.cpp
parentcNetwork: Fixed IP address reading for incoming connections. (diff)
downloadcuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar.gz
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar.bz2
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar.lz
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar.xz
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar.zst
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.zip
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 1ca131375..527380761 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -47,7 +47,7 @@ const int cPlayer::EATING_TICKS = 30;
-cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) :
+cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) :
super(etPlayer, 0.6, 1.8),
m_bVisible(true),
m_FoodLevel(MAX_FOOD_LEVEL),
@@ -174,7 +174,7 @@ void cPlayer::Destroyed()
void cPlayer::SpawnOn(cClientHandle & a_Client)
{
- if (!m_bVisible || (m_ClientHandle == (&a_Client)))
+ if (!m_bVisible || (m_ClientHandle.get() == (&a_Client)))
{
return;
}
@@ -246,7 +246,7 @@ void cPlayer::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
if (CanMove)
{
- BroadcastMovementUpdate(m_ClientHandle);
+ BroadcastMovementUpdate(m_ClientHandle.get());
}
if (m_Health > 0) // make sure player is alive
@@ -419,7 +419,7 @@ void cPlayer::StartChargingBow(void)
LOGD("Player \"%s\" started charging their bow", GetName().c_str());
m_IsChargingBow = true;
m_BowCharge = 0;
- m_World->BroadcastEntityMetadata(*this, m_ClientHandle);
+ m_World->BroadcastEntityMetadata(*this, m_ClientHandle.get());
}
@@ -432,7 +432,7 @@ int cPlayer::FinishChargingBow(void)
int res = m_BowCharge;
m_IsChargingBow = false;
m_BowCharge = 0;
- m_World->BroadcastEntityMetadata(*this, m_ClientHandle);
+ m_World->BroadcastEntityMetadata(*this, m_ClientHandle.get());
return res;
}
@@ -446,7 +446,7 @@ void cPlayer::CancelChargingBow(void)
LOGD("Player \"%s\" cancelled charging their bow at a charge of %d", GetName().c_str(), m_BowCharge);
m_IsChargingBow = false;
m_BowCharge = 0;
- m_World->BroadcastEntityMetadata(*this, m_ClientHandle);
+ m_World->BroadcastEntityMetadata(*this, m_ClientHandle.get());
}
@@ -1391,7 +1391,7 @@ void cPlayer::SetVisible(bool a_bVisible)
if (!a_bVisible && m_bVisible)
{
m_bVisible = false;
- m_World->BroadcastDestroyEntity(*this, m_ClientHandle); // Destroy on all clients
+ m_World->BroadcastDestroyEntity(*this, m_ClientHandle.get()); // Destroy on all clients
}
}
@@ -2294,6 +2294,16 @@ void cPlayer::Detach()
+void cPlayer::RemoveClientHandle(void)
+{
+ ASSERT(m_ClientHandle != nullptr);
+ m_ClientHandle.reset();
+}
+
+
+
+
+
AString cPlayer::GetUUIDFileName(const AString & a_UUID)
{
AString UUID = cMojangAPI::MakeUUIDDashed(a_UUID);