summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/Bindings.cpp10
-rw-r--r--source/Bindings.h2
-rw-r--r--source/cClientHandle.cpp17
-rw-r--r--source/cSocket.cpp23
-rw-r--r--source/cSocket.h8
-rw-r--r--source/cSocketThreads.h2
6 files changed, 13 insertions, 49 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index f1f051ef5..56e17be1a 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 08/24/12 10:55:13.
+** Generated automatically by tolua++-1.0.92 on 08/25/12 23:57:06.
*/
#ifndef __cplusplus
@@ -12264,14 +12264,14 @@ static int tolua_AllToLua_cWorld_CastThunderbolt00(lua_State* tolua_S)
#endif
{
cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0);
- int a_X = ((int) tolua_tonumber(tolua_S,2,0));
- int a_Y = ((int) tolua_tonumber(tolua_S,3,0));
- int a_Z = ((int) tolua_tonumber(tolua_S,4,0));
+ int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CastThunderbolt'", NULL);
#endif
{
- self->CastThunderbolt(a_X,a_Y,a_Z);
+ self->CastThunderbolt(a_BlockX,a_BlockY,a_BlockZ);
}
}
return 0;
diff --git a/source/Bindings.h b/source/Bindings.h
index 1119dd642..82dfb6034 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 08/24/12 10:55:13.
+** Generated automatically by tolua++-1.0.92 on 08/25/12 23:57:07.
*/
/* Exported function */
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 206ad9acd..5cfd0a510 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -217,11 +217,9 @@ cClientHandle::~cClientHandle()
if (m_Socket.IsValid())
{
- if(!m_bKicking)
+ if (!m_bKicking)
{
- cPacket_Disconnect Disconnect;
- Disconnect.m_Reason = "Server shut down? Kthnxbai";
- m_Socket.Send(&Disconnect);
+ SendDisconnect("Server shut down? Kthnxbai");
}
}
@@ -295,7 +293,7 @@ void cClientHandle::Kick(const AString & a_Reason)
{
LOG("Kicking user \"%s\" for \"%s\"", m_Username.c_str(), a_Reason.c_str());
}
- Send(cPacket_Disconnect(a_Reason));
+ SendDisconnect(a_Reason);
m_bKicking = true;
}
@@ -1333,8 +1331,7 @@ void cClientHandle::Tick(float a_Dt)
(void)a_Dt;
if (cWorld::GetTime() - m_TimeLastPacket > 30.f) // 30 seconds time-out
{
- cPacket_Disconnect DC("Nooooo!! You timed out! D: Come back!");
- m_Socket.Send(&DC);
+ SendDisconnect("Nooooo!! You timed out! D: Come back!");
// TODO: Cannot sleep in the tick thread!
cSleep::MilliSleep(1000); // Give packet some time to be received
@@ -1506,7 +1503,7 @@ void cClientHandle::Send(const cPacket & a_Packet, ENUM_PRIORITY a_Priority /* =
void cClientHandle::SendDisconnect(const AString & a_Reason)
{
cPacket_Disconnect DC(a_Reason);
- m_Socket.Send(&DC); // Send it immediately to the socket, bypassing any packet buffers
+ Send(DC); // TODO: Send it immediately to the socket, bypassing any packet buffers (? is it safe? packet boundaries...)
}
@@ -2021,6 +2018,7 @@ void cClientHandle::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ)
ThunderboltPacket.m_xLBPos = a_BlockX;
ThunderboltPacket.m_yLBPos = a_BlockY;
ThunderboltPacket.m_zLBPos = a_BlockZ;
+ Send(ThunderboltPacket);
}
@@ -2198,8 +2196,7 @@ void cClientHandle::GetOutgoingData(AString & a_Data)
if (m_PendingNrmSendPackets.size() + m_PendingLowSendPackets.size() > MAX_OUTGOING_PACKETS)
{
LOGERROR("ERROR: Too many packets in queue for player %s !!", m_Username.c_str());
- cPacket_Disconnect DC("Too many packets in queue.");
- m_Socket.Send(DC);
+ SendDisconnect("Too many packets in queue.");
// DEBUG: Dump all outstanding packets' types to the log:
int Idx = 0;
diff --git a/source/cSocket.cpp b/source/cSocket.cpp
index edce83981..031a1c63a 100644
--- a/source/cSocket.cpp
+++ b/source/cSocket.cpp
@@ -2,7 +2,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cSocket.h"
-#include "packets/cPacket.h"
#ifndef _WIN32
#include <netdb.h>
@@ -314,28 +313,6 @@ int cSocket::Send(const char * a_Buffer, unsigned int a_Length)
-int cSocket::Send(const cPacket * a_Packet)
-{
- AString Serialized;
- a_Packet->Serialize(Serialized);
- return Send(Serialized.data(), Serialized.size());
-}
-
-
-
-
-
-int cSocket::Send(const cPacket & a_Packet)
-{
- AString Serialized;
- a_Packet.Serialize(Serialized);
- return Send(Serialized.data(), Serialized.size());
-}
-
-
-
-
-
unsigned short cSocket::GetPort(void) const
{
ASSERT(IsValid());
diff --git a/source/cSocket.h b/source/cSocket.h
index 62c2e74d1..f1c3f233c 100644
--- a/source/cSocket.h
+++ b/source/cSocket.h
@@ -5,12 +5,6 @@
-class cPacket;
-
-
-
-
-
class cSocket
{
public:
@@ -74,8 +68,6 @@ public:
int Connect(const AString & a_HostNameOrAddr, unsigned short a_Port); // Returns 0 on success, !0 on failure
int Receive( char* a_Buffer, unsigned int a_Length, unsigned int a_Flags );
int Send (const char * a_Buffer, unsigned int a_Length);
- int Send (const cPacket * a_Packet); // Sends the packet, doesn't handle partial sends
- int Send (const cPacket & a_Packet); // Sends the packet, doesn't handle partial sends
unsigned short GetPort(void) const; // Returns 0 on failure
diff --git a/source/cSocketThreads.h b/source/cSocketThreads.h
index 682b0d5c4..c90a4ede3 100644
--- a/source/cSocketThreads.h
+++ b/source/cSocketThreads.h
@@ -148,8 +148,6 @@ private:
virtual void Execute(void) override;
- void AddOrUpdatePacket(int a_Slot, cPacket * a_Packet); // Adds the packet to the specified slot, or updates an existing packet in that queue (EntityMoveLook filtering)
-
void PrepareSet (fd_set * a_Set, cSocket::xSocket & a_Highest); // Puts all sockets into the set, along with m_ControlSocket1
void ReadFromSockets(fd_set * a_Read); // Reads from sockets indicated in a_Read
void WriteToSockets (fd_set * a_Write); // Writes to sockets indicated in a_Write