summaryrefslogtreecommitdiff
path: root/src/packet.cpp
diff options
context:
space:
mode:
authorAaron Marks <nymacro@gmail.com>2005-07-13 02:59:19 +0000
committerAaron Marks <nymacro@gmail.com>2005-07-13 02:59:19 +0000
commitb426d3e5d269007f95360e40f906c5568a5abc99 (patch)
tree0dd6a4ad8ed1db374b74b6ea01d0eacb7dd50abb /src/packet.cpp
parent960f631a2be601357424f9e6c5cdc64b68bff856 (diff)
downloadmanaserv-b426d3e5d269007f95360e40f906c5568a5abc99.tar.gz
manaserv-b426d3e5d269007f95360e40f906c5568a5abc99.tar.bz2
manaserv-b426d3e5d269007f95360e40f906c5568a5abc99.tar.xz
manaserv-b426d3e5d269007f95360e40f906c5568a5abc99.zip
Implemented MessageOut.
Rewrote MessageIn::readString - it was overly complex and didn't operate correctly. Update test client so it sends a login message.
Diffstat (limited to 'src/packet.cpp')
-rw-r--r--src/packet.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/packet.cpp b/src/packet.cpp
index a7cd00cb..9ab27d84 100644
--- a/src/packet.cpp
+++ b/src/packet.cpp
@@ -23,6 +23,7 @@
#include "packet.h"
#include <string.h>
+#include <cstdlib>
Packet::Packet(const char *data, int length):
length(length)
@@ -30,6 +31,7 @@ Packet::Packet(const char *data, int length):
// Create a copy of the data
this->data = new char[length];
memcpy(this->data, data, length);
+ size = length;
}
Packet::~Packet()
@@ -37,3 +39,9 @@ Packet::~Packet()
// Clean up the data
delete[] data;
}
+
+void Packet::expand(unsigned int bytes)
+{
+ realloc(data, length + bytes);
+ size += bytes;
+}