summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-08 14:44:50 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-08 14:44:50 +0000
commit96ed6284affefcba1b0ded75e4ef88e52b430c4d (patch)
tree6495166390f2279d8fb68b900191795ead09fda4 /src/net
parente481ad5466eb2b87036515a2a15166e41828c31f (diff)
downloadmanaserv-96ed6284affefcba1b0ded75e4ef88e52b430c4d.tar.gz
manaserv-96ed6284affefcba1b0ded75e4ef88e52b430c4d.tar.bz2
manaserv-96ed6284affefcba1b0ded75e4ef88e52b430c4d.tar.xz
manaserv-96ed6284affefcba1b0ded75e4ef88e52b430c4d.zip
Changed some argument types. Added untested protocol for moving objects between slots of inventory. Fixed position of the cleaning bit for looks, so that it actually fits into network data.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/messageout.cpp11
-rw-r--r--src/net/messageout.hpp11
2 files changed, 8 insertions, 14 deletions
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
index 57b2db78..7753d9d3 100644
--- a/src/net/messageout.cpp
+++ b/src/net/messageout.cpp
@@ -43,7 +43,7 @@ MessageOut::MessageOut():
mDataSize = INITIAL_DATA_CAPACITY;
}
-MessageOut::MessageOut(short id):
+MessageOut::MessageOut(int id):
mPos(0)
{
mData = (char*) malloc(INITIAL_DATA_CAPACITY);
@@ -79,16 +79,14 @@ MessageOut::expand(size_t bytes)
}
}
-void
-MessageOut::writeByte(char value)
+void MessageOut::writeByte(int value)
{
expand(mPos + 1);
mData[mPos] = value;
mPos += 1;
}
-void
-MessageOut::writeShort(short value)
+void MessageOut::writeShort(int value)
{
expand(mPos + 2);
uint16_t t = ENET_HOST_TO_NET_16(value);
@@ -96,8 +94,7 @@ MessageOut::writeShort(short value)
mPos += 2;
}
-void
-MessageOut::writeLong(long value)
+void MessageOut::writeLong(int value)
{
expand(mPos + 4);
uint32_t t = ENET_HOST_TO_NET_32(value);
diff --git a/src/net/messageout.hpp b/src/net/messageout.hpp
index 3515476f..2d0490f6 100644
--- a/src/net/messageout.hpp
+++ b/src/net/messageout.hpp
@@ -40,7 +40,7 @@ class MessageOut
/**
* Constructor that takes a message ID.
*/
- MessageOut(short id);
+ MessageOut(int id);
/**
* Destructor.
@@ -52,14 +52,11 @@ class MessageOut
*/
void clear();
- void
- writeByte(char value); /**< Writes a byte. */
+ void writeByte(int value); /**< Writes an integer on one byte. */
- void
- writeShort(short value); /**< Writes a short. */
+ void writeShort(int value); /**< Writes an integer on two bytes. */
- void
- writeLong(long value); /**< Writes a long. */
+ void writeLong(int value); /**< Writes an integer on four bytes. */
/**
* Writes a 3-byte block containing tile-based coordinates.