Merge branch 'master' into potions
This commit is contained in:
@@ -40,9 +40,6 @@
|
||||
/** Maximum number of block change interactions a player can perform per tick - exceeding this causes a kick */
|
||||
#define MAX_BLOCK_CHANGE_INTERACTIONS 20
|
||||
|
||||
/** How many ticks before the socket is closed after the client is destroyed (#31) */
|
||||
static const int TICKS_BEFORE_CLOSE = 20;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -79,7 +76,6 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) :
|
||||
m_PingID(1),
|
||||
m_BlockDigAnimStage(-1),
|
||||
m_HasStartedDigging(false),
|
||||
m_TicksSinceDestruction(0),
|
||||
m_State(csConnected),
|
||||
m_ShouldCheckDownloaded(false),
|
||||
m_NumExplosionsThisTick(0),
|
||||
@@ -104,7 +100,7 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) :
|
||||
|
||||
cClientHandle::~cClientHandle()
|
||||
{
|
||||
ASSERT(m_State >= csDestroyedWaiting); // Has Destroy() been called?
|
||||
ASSERT(m_State == csDestroyed); // Has Destroy() been called?
|
||||
|
||||
LOGD("Deleting client \"%s\" at %p", GetUsername().c_str(), this);
|
||||
|
||||
@@ -169,7 +165,7 @@ void cClientHandle::Destroy(void)
|
||||
RemoveFromAllChunks();
|
||||
m_Player->GetWorld()->RemoveClientFromChunkSender(this);
|
||||
}
|
||||
m_State = csDestroyedWaiting;
|
||||
m_State = csDestroyed;
|
||||
}
|
||||
|
||||
|
||||
@@ -1366,7 +1362,7 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, e
|
||||
NewBlock->OnPlacedByPlayer(ChunkInterface,*World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
|
||||
|
||||
// Step sound with 0.8f pitch is used as block placement sound
|
||||
World->BroadcastSoundEffect(NewBlock->GetStepSound(), a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 1.0f, 0.8f);
|
||||
World->BroadcastSoundEffect(NewBlock->GetStepSound(), (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 1.0f, 0.8f);
|
||||
cRoot::Get()->GetPluginManager()->CallHookPlayerPlacedBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
|
||||
}
|
||||
|
||||
@@ -1824,18 +1820,7 @@ bool cClientHandle::CheckBlockInteractionsRate(void)
|
||||
|
||||
|
||||
void cClientHandle::Tick(float a_Dt)
|
||||
{
|
||||
// Handle clients that are waiting for final close while destroyed:
|
||||
if (m_State == csDestroyedWaiting)
|
||||
{
|
||||
m_TicksSinceDestruction += 1; // This field is misused for the timeout counting
|
||||
if (m_TicksSinceDestruction > TICKS_BEFORE_CLOSE)
|
||||
{
|
||||
m_State = csDestroyed;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
// Process received network data:
|
||||
AString IncomingData;
|
||||
{
|
||||
@@ -1901,15 +1886,7 @@ void cClientHandle::Tick(float a_Dt)
|
||||
|
||||
|
||||
void cClientHandle::ServerTick(float a_Dt)
|
||||
{
|
||||
// Handle clients that are waiting for final close while destroyed:
|
||||
if (m_State == csDestroyedWaiting)
|
||||
{
|
||||
// Do not wait while the client is not in the world, simply cut them off.
|
||||
m_State = csDestroyed;
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
// Process received network data:
|
||||
AString IncomingData;
|
||||
{
|
||||
@@ -2450,9 +2427,9 @@ void cClientHandle::SendDisplayObjective(const AString & a_Objective, cScoreboar
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch)
|
||||
void cClientHandle::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
|
||||
{
|
||||
m_Protocol->SendSoundEffect(a_SoundName, a_SrcX, a_SrcY, a_SrcZ, a_Volume, a_Pitch);
|
||||
m_Protocol->SendSoundEffect(a_SoundName, a_X, a_Y, a_Z, a_Volume, a_Pitch);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user