summaryrefslogtreecommitdiff
path: root/src/net/messagein.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-14 10:36:39 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-14 10:36:39 +0000
commitb9772c8575708a9f28d89b3b973af73e382e9329 (patch)
treed5490d229b2ff43d033d07c1c23e36027255406c /src/net/messagein.cpp
parent1c46904573aa83132afc90f86381034405ae796e (diff)
downloadmana-b9772c8575708a9f28d89b3b973af73e382e9329.tar.gz
mana-b9772c8575708a9f28d89b3b973af73e382e9329.tar.bz2
mana-b9772c8575708a9f28d89b3b973af73e382e9329.tar.xz
mana-b9772c8575708a9f28d89b3b973af73e382e9329.zip
Fixed error-prone interface. Handled money as an inventory part.
Diffstat (limited to 'src/net/messagein.cpp')
-rw-r--r--src/net/messagein.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index a1707e06..e90084ff 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -36,37 +36,33 @@ MessageIn::MessageIn(const char *data, unsigned int length):
mId = readShort();
}
-MessageIn::~MessageIn()
+int MessageIn::readByte()
{
-}
-
-char MessageIn::readByte()
-{
- char value = -1;
+ int value = -1;
if (mPos < mLength)
{
- value = mData[mPos];
+ value = (unsigned char) mData[mPos];
}
mPos += 1;
return value;
}
-short MessageIn::readShort()
+int MessageIn::readShort()
{
- short value = -1;
+ int value = -1;
if (mPos + 2 <= mLength)
{
uint16_t t;
memcpy(&t, mData + mPos, 2);
- value = ENET_NET_TO_HOST_16(t);
+ value = (unsigned short) ENET_NET_TO_HOST_16(t);
}
mPos += 2;
return value;
}
-long MessageIn::readLong()
+int MessageIn::readLong()
{
- long value = -1;
+ int value = -1;
if (mPos + 4 <= mLength)
{
uint32_t t;