summaryrefslogtreecommitdiffstats
path: root/source/cClientHandle.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 14:43:47 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 14:43:47 +0100
commit2568bad3cc1ae70350f5ad31e97b4c13194e437e (patch)
tree31d0713dfe1b4e42c1f17ddae8ea0114c420fc61 /source/cClientHandle.cpp
parentRemoved a few duplicate includes (diff)
downloadcuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar.gz
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar.bz2
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar.lz
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar.xz
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar.zst
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.zip
Diffstat (limited to 'source/cClientHandle.cpp')
-rw-r--r--source/cClientHandle.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 1f7045d2b..53d2a40cf 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -507,11 +507,15 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
case E_PING: // Somebody tries to retrieve information about the server
{
LOGINFO("Got ping");
- char NumPlayers[8], cMaxPlayers[8];
- sprintf_s(NumPlayers, 8, "%i", cRoot::Get()->GetWorld()->GetNumPlayers());
- sprintf_s(cMaxPlayers, 8, "%i", cRoot::Get()->GetWorld()->GetMaxPlayers());
- std::string response = std::string(cRoot::Get()->GetWorld()->GetDescription() + cChatColor::Delimiter + NumPlayers + cChatColor::Delimiter + cMaxPlayers );
- Kick( response.c_str() );
+ AString Reply;
+ Printf(Reply, "%s%s%i%s%i",
+ cRoot::Get()->GetWorld()->GetDescription().c_str(),
+ cChatColor::Delimiter.c_str(),
+ cRoot::Get()->GetWorld()->GetNumPlayers(),
+ cChatColor::Delimiter.c_str(),
+ cRoot::Get()->GetWorld()->GetMaxPlayers()
+ );
+ Kick(Reply.c_str());
}
break;
case E_HANDSHAKE:
@@ -1659,9 +1663,9 @@ void cClientHandle::ReceiveThread( void *lpParam )
LOG("Unknown packet: 0x%02x \'%c\' %i", (unsigned char)temp, (unsigned char)temp, (unsigned char)temp );
- char c_Str[128];
- sprintf_s( c_Str, 128, "[C->S] Unknown PacketID: 0x%02x", (unsigned char)temp );
- cPacket_Disconnect DC(c_Str);
+ AString Reason;
+ Printf(Reason, "[C->S] Unknown PacketID: 0x%02x", (unsigned char)temp );
+ cPacket_Disconnect DC(Reason);
DC.Send( socket );
cSleep::MilliSleep( 1000 ); // Give packet some time to be received