From 1fcc02e803d83ae8415ff44f9696cb215f475daa Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 21 Feb 2014 13:30:39 +0300 Subject: fix signed shifts. --- src/net/ea/inventoryhandler.cpp | 2 +- src/net/eathena/messageout.cpp | 2 +- src/net/messagein.cpp | 4 ++-- src/net/tmwa/messageout.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 3f4eb9228..d64050e1a 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -160,7 +160,7 @@ int InventoryHandler::getSlot(const int eAthenaSlot) const if (eAthenaSlot & 0x8000) return Equipment::EQUIP_PROJECTILE_SLOT; - int mask = 1; + unsigned int mask = 1; int position = 0; while (!(eAthenaSlot & mask)) { diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp index 3ac6a417e..ff16f5dd0 100644 --- a/src/net/eathena/messageout.cpp +++ b/src/net/eathena/messageout.cpp @@ -96,7 +96,7 @@ void MessageOut::writeCoordinates(const uint16_t x, mNetwork->mOutSize += 3; mPos += 3; - int16_t temp = x; + uint16_t temp = x; temp <<= 6; data[0] = 0; data[1] = 1; diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 9d9c68b94..81340ba33 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -115,7 +115,7 @@ void MessageIn::readCoordinates(uint16_t &restrict x, uint16_t &restrict y, if (mPos + 3 <= mLength) { const char *const data = mData + mPos; - int16_t temp = MAKEWORD(data[1] & 0x00c0, data[0] & 0x00ff); + uint16_t temp = MAKEWORD(data[1] & 0x00c0, data[0] & 0x00ff); x = static_cast(temp >> 6); temp = MAKEWORD(data[2] & 0x00f0, data[1] & 0x003f); y = static_cast(temp >> 4); @@ -147,7 +147,7 @@ void MessageIn::readCoordinatePair(uint16_t &restrict srcX, if (mPos + 5 <= mLength) { const char *const data = mData + mPos; - int16_t temp = MAKEWORD(data[3], data[2] & 0x000f); + uint16_t temp = MAKEWORD(data[3], data[2] & 0x000f); dstX = static_cast(temp >> 2); dstY = MAKEWORD(data[4], data[3] & 0x0003); diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index 8dfbf2bd7..8c3ecb5ec 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -98,7 +98,7 @@ void MessageOut::writeCoordinates(const uint16_t x, mNetwork->mOutSize += 3; mPos += 3; - int16_t temp = x; + uint16_t temp = x; temp <<= 6; data[0] = 0; data[1] = 1; -- cgit v1.2.3-70-g09d2