From f04957321d063f8755d4634551ab9eece05f009e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 28 Apr 2014 20:37:12 +0200 Subject: Fixed missing return value warning in MSVC. --- src/ClientHandle.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index fc3f98aaf..efcc89bab 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -220,6 +220,7 @@ AString cClientHandle::FormatMessageType(bool ShouldAppendChatPrefixes, eMessage } } ASSERT(!"Unhandled chat prefix type!"); + return ""; } -- cgit v1.2.3 From 8ab8fb344f49c2c4ce857594159e9cdba3336853 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 28 Apr 2014 20:37:22 +0200 Subject: Fixed braces. --- src/ClientHandle.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index efcc89bab..f3588c253 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -214,13 +214,17 @@ AString cClientHandle::FormatMessageType(bool ShouldAppendChatPrefixes, eMessage case mtPrivateMessage: { if (ShouldAppendChatPrefixes) + { return Printf("%s[MSG: %s] %s%s", cChatColor::LightBlue.c_str(), a_AdditionalData.c_str(), cChatColor::White.c_str(), cChatColor::Italic.c_str()); + } else + { return Printf("%s: %s", a_AdditionalData.c_str(), cChatColor::LightBlue.c_str()); + } } } ASSERT(!"Unhandled chat prefix type!"); - return ""; + return AString(); } -- cgit v1.2.3 From 1dbdb8ed912ff235538b9b2dc75575cadc3a5566 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 29 Apr 2014 23:10:50 +0200 Subject: Delayed sending the KeepAlive packet for 3 seconds after login. This should alleviate #889. --- src/ClientHandle.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index f3588c253..2362abe1e 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -336,6 +336,11 @@ void cClientHandle::Authenticate(const AString & a_Name, const AString & a_UUID) // Send scoreboard data World->GetScoreBoard().SendTo(*this); + + // Delay the first ping until the client "settles down" + // This should fix #889, "BadCast exception, cannot convert bit to fm" error in client + cTimer t1; + m_LastPingTime = t1.GetNowTime() + 3000; // Send the first KeepAlive packet in 3 seconds cRoot::Get()->GetPluginManager()->CallHookPlayerSpawned(*m_Player); } -- cgit v1.2.3 From ed75d3a8364f360b213956c40c51729ea53f3616 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:58:58 +0200 Subject: Fixed warnings in ClientHandle. --- src/ClientHandle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 2362abe1e..7a4158491 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1658,7 +1658,7 @@ void cClientHandle::SendData(const char * a_Data, size_t a_Size) { // There is a queued overflow. Append to it, then send as much from its front as possible m_OutgoingDataOverflow.append(a_Data, a_Size); - int CanFit = m_OutgoingData.GetFreeSpace(); + size_t CanFit = m_OutgoingData.GetFreeSpace(); if (CanFit > 128) { // No point in moving the data over if it's not large enough - too much effort for too little an effect @@ -2522,7 +2522,7 @@ void cClientHandle::SendWindowOpen(const cWindow & a_Window) -void cClientHandle::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value) +void cClientHandle::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) { m_Protocol->SendWindowProperty(a_Window, a_Property, a_Value); } -- cgit v1.2.3 From e24bdc9328278b676c7acf83fd9f31b430561b98 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 23:03:23 +0200 Subject: More ClientHandle fixes. --- src/ClientHandle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 7a4158491..4ed0d682f 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -716,7 +716,7 @@ void cClientHandle::UnregisterPluginChannels(const AStringVector & a_ChannelList -void cClientHandle::HandleCommandBlockMessage(const char * a_Data, unsigned int a_Length) +void cClientHandle::HandleCommandBlockMessage(const char * a_Data, size_t a_Length) { if (a_Length < 14) { @@ -2522,7 +2522,7 @@ void cClientHandle::SendWindowOpen(const cWindow & a_Window) -void cClientHandle::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) +void cClientHandle::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value) { m_Protocol->SendWindowProperty(a_Window, a_Property, a_Value); } -- cgit v1.2.3 From 4d704255de1368d7d9912458053c2de14be1b5ac Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 2 May 2014 11:18:02 +0200 Subject: HOOK_DISCONNECT has cClientHandle as its first parameter. Ref.: #655. --- src/ClientHandle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 4ed0d682f..29213ca2d 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1510,7 +1510,7 @@ void cClientHandle::HandleDisconnect(const AString & a_Reason) { LOGD("Received d/c packet from %s with reason \"%s\"", m_Username.c_str(), a_Reason.c_str()); - cRoot::Get()->GetPluginManager()->CallHookDisconnect(m_Player, a_Reason); + cRoot::Get()->GetPluginManager()->CallHookDisconnect(*this, a_Reason); m_HasSentDC = true; Destroy(); @@ -2689,9 +2689,9 @@ void cClientHandle::SocketClosed(void) LOGD("Player %s @ %s disconnected", m_Username.c_str(), m_IPString.c_str()); - if (m_Username != "") // Ignore client pings + if (!m_Username.empty()) // Ignore client pings { - cRoot::Get()->GetPluginManager()->CallHookDisconnect(m_Player, "Player disconnected"); + cRoot::Get()->GetPluginManager()->CallHookDisconnect(*this, "Player disconnected"); } Destroy(); -- cgit v1.2.3