summaryrefslogtreecommitdiffstats
path: root/source/packets
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-13 22:47:03 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-13 22:47:03 +0100
commit4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c (patch)
treefebea3ecd89c0d4aa83924e430bf11366d754733 /source/packets
parentNew makefile with automatic *.cpp sourcefile import, automatic header file dependencies and switchable debug / release configuration. gnumake-specific :( (diff)
downloadcuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.gz
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.bz2
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.lz
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.xz
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.tar.zst
cuberite-4f17362aeb80e5339c58a5d3b0fbaeb88d9e701c.zip
Diffstat (limited to '')
-rw-r--r--source/packets/cPacket_MapChunk.cpp3
-rw-r--r--source/packets/cPacket_MapChunk.h16
-rw-r--r--source/packets/cPacket_Metadata.cpp14
-rw-r--r--source/packets/cPacket_Metadata.h1
4 files changed, 31 insertions, 3 deletions
diff --git a/source/packets/cPacket_MapChunk.cpp b/source/packets/cPacket_MapChunk.cpp
index a9448f050..522842d32 100644
--- a/source/packets/cPacket_MapChunk.cpp
+++ b/source/packets/cPacket_MapChunk.cpp
@@ -19,8 +19,9 @@ cPacket_MapChunk::~cPacket_MapChunk()
-cPacket_MapChunk::cPacket_MapChunk(cChunk* a_Chunk)
+cPacket_MapChunk::cPacket_MapChunk(cChunk * a_Chunk)
{
+ assert(a_Chunk->IsValid());
m_PacketID = E_MAP_CHUNK;
m_PosX = a_Chunk->GetPosX() * 16; // It has to be block coordinates
diff --git a/source/packets/cPacket_MapChunk.h b/source/packets/cPacket_MapChunk.h
index b4994f12b..2cefd8b59 100644
--- a/source/packets/cPacket_MapChunk.h
+++ b/source/packets/cPacket_MapChunk.h
@@ -8,7 +8,13 @@
class cChunk;
-class cPacket_MapChunk : public cPacket
+
+
+
+
+
+class cPacket_MapChunk :
+ public cPacket
{
public:
cPacket_MapChunk()
@@ -21,7 +27,7 @@ public:
, m_CompressedSize( 0 )
, m_CompressedData( 0 )
{ m_PacketID = E_MAP_CHUNK; m_CompressedData = 0; }
- cPacket_MapChunk(cChunk* a_Chunk);
+
cPacket_MapChunk( const cPacket_MapChunk & a_Copy );
~cPacket_MapChunk();
virtual cPacket* Clone() const { return new cPacket_MapChunk(*this); }
@@ -38,6 +44,12 @@ public:
static const unsigned int c_Size = 1 + 4 + 2 + 4 + 1 + 1 + 1 + 4;
char * m_CompressedData;
+
+protected:
+ friend class cChunk;
+
+ cPacket_MapChunk(cChunk * a_Chunk); // Called only from within cChunk, therefore it CAN receive a direct pointer
+
};
diff --git a/source/packets/cPacket_Metadata.cpp b/source/packets/cPacket_Metadata.cpp
index 9d2d61704..595801b54 100644
--- a/source/packets/cPacket_Metadata.cpp
+++ b/source/packets/cPacket_Metadata.cpp
@@ -35,6 +35,20 @@ cPacket_Metadata::cPacket_Metadata()
+cPacket_Metadata::cPacket_Metadata(const cPacket_Metadata & a_Other)
+ : m_EMetaData( a_Other.m_EMetaData )
+ , m_UniqueID( a_Other.m_UniqueID )
+ , m_Type( a_Other.m_Type )
+ , m_MetaData( NULL )
+{
+ m_PacketID = E_METADATA;
+ FormPacket();
+}
+
+
+
+
+
cPacket_Metadata::~cPacket_Metadata()
{
delete [] m_MetaData;
diff --git a/source/packets/cPacket_Metadata.h b/source/packets/cPacket_Metadata.h
index 4900bad0a..24818e379 100644
--- a/source/packets/cPacket_Metadata.h
+++ b/source/packets/cPacket_Metadata.h
@@ -13,6 +13,7 @@ class cPacket_Metadata : public cPacket
public:
cPacket_Metadata(int s, int id);
cPacket_Metadata();
+ cPacket_Metadata(const cPacket_Metadata & a_Other);
~cPacket_Metadata();
virtual void Serialize(AString & a_Data) const override;