summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/network/connection.h2
-rw-r--r--src/util/pointer.h12
2 files changed, 13 insertions, 1 deletions
diff --git a/src/network/connection.h b/src/network/connection.h
index d569722bf..5062b73d0 100644
--- a/src/network/connection.h
+++ b/src/network/connection.h
@@ -325,7 +325,7 @@ struct ConnectionCommand
Address address;
u16 peer_id = PEER_ID_INEXISTENT;
u8 channelnum = 0;
- SharedBuffer<u8> data;
+ Buffer<u8> data;
bool reliable = false;
bool raw = false;
diff --git a/src/util/pointer.h b/src/util/pointer.h
index efca62d2d..59b6f5216 100644
--- a/src/util/pointer.h
+++ b/src/util/pointer.h
@@ -168,6 +168,18 @@ public:
/*
Copies whole buffer
*/
+ SharedBuffer(const Buffer<T> &buffer)
+ {
+ m_size = buffer.getSize();
+ if (m_size != 0) {
+ data = new T[m_size];
+ memcpy(data, *buffer, buffer.getSize());
+ }
+ else
+ data = NULL;
+ refcount = new unsigned int;
+ (*refcount) = 1;
+ }
~SharedBuffer()
{
drop();