summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/net/ea/itemhandler.cpp8
-rw-r--r--src/net/messagein.cpp12
-rw-r--r--src/net/messagein.h2
3 files changed, 18 insertions, 4 deletions
diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp
index 8719c6256..e5ed730a0 100644
--- a/src/net/ea/itemhandler.cpp
+++ b/src/net/ea/itemhandler.cpp
@@ -47,8 +47,8 @@ void ItemHandler::processItemVisible(Net::MessageIn &msg)
const int x = msg.readInt16();
const int y = msg.readInt16();
const int amount = msg.readInt16();
- const int subX = msg.readUInt8();
- const int subY = msg.readUInt8();
+ const int subX = static_cast<int>(msg.readInt8());
+ const int subY = static_cast<int>(msg.readInt8());
if (actorManager)
{
@@ -64,8 +64,8 @@ void ItemHandler::processItemDropped(Net::MessageIn &msg)
const uint8_t identify = msg.readUInt8(); // identify flag
const int x = msg.readInt16();
const int y = msg.readInt16();
- const int subX = static_cast<int>(msg.readUInt8());
- const int subY = static_cast<int>(msg.readUInt8());
+ const int subX = static_cast<int>(msg.readInt8());
+ const int subY = static_cast<int>(msg.readInt8());
const int amount = msg.readInt16();
if (actorManager)
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 301d51ad9..ccc80a838 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -55,6 +55,18 @@ unsigned char MessageIn::readUInt8()
mPos += 1;
PacketCounters::incInBytes(1);
+ DEBUGLOG("readUInt8: " + toStringPrint(static_cast<int>(value)));
+ return value;
+}
+
+signed char MessageIn::readInt8()
+{
+ signed char value = static_cast<signed char>(-1);
+ if (mPos < mLength)
+ value = static_cast<signed char>(mData[mPos]);
+
+ mPos += 1;
+ PacketCounters::incInBytes(1);
DEBUGLOG("readInt8: " + toStringPrint(static_cast<int>(value)));
return value;
}
diff --git a/src/net/messagein.h b/src/net/messagein.h
index f9f2aceb0..932764b8c 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -60,6 +60,8 @@ class MessageIn notfinal
virtual unsigned char readUInt8(); /**< Reads a byte. */
+ virtual signed char readInt8(); /**< Reads a byte. */
+
virtual int16_t readInt16() = 0; /**< Reads a short. */
virtual int readInt32() = 0; /**< Reads a long. */