From 2ed0917b4ee942ff55639500f846ae9cb4f48b90 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 16 Oct 2012 00:27:51 +0300 Subject: Fix some signed/unsigned chars issues. --- src/net/tmwa/chathandler.cpp | 4 ++-- src/net/tmwa/loginhandler.cpp | 10 +++++----- src/net/tmwa/playerhandler.cpp | 2 +- src/net/tmwa/playerhandler.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 3c9f335a9..ef6ff2847 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -181,7 +181,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, std::string &line) { const int i = atoi(line.c_str()); if (line.length() <= 3) - outMsg.writeInt8(static_cast(i)); + outMsg.writeInt8(static_cast(i)); else if (line.length() <= 5) outMsg.writeInt16(static_cast(i)); else @@ -210,7 +210,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, std::string &line) switch (header[0]) { case '1': - outMsg.writeInt8(static_cast(i)); + outMsg.writeInt8(static_cast(i)); break; case '2': outMsg.writeInt16(static_cast(i)); diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index f8daecf20..eb0364d44 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -159,11 +159,11 @@ void LoginHandler::requestUpdateHosts() void LoginHandler::processServerVersion(Net::MessageIn &msg) { - const char b1 = msg.readInt8(); // -1 - const char b2 = msg.readInt8(); // E - const char b3 = msg.readInt8(); // V - const char b4 = msg.readInt8(); // L - if (b1 == -1 && b2 == 'E' && b3 == 'V' && b4 == 'L') + const uint8_t b1 = msg.readInt8(); // -1 + const uint8_t b2 = msg.readInt8(); // E + const uint8_t b3 = msg.readInt8(); // V + const uint8_t b4 = msg.readInt8(); // L + if (b1 == 255 && b2 == 'E' && b3 == 'V' && b4 == 'L') { const unsigned int options = msg.readInt8(); mRegistrationEnabled = options; diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 963f4839d..1067418e2 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -162,7 +162,7 @@ void PlayerHandler::pickUp(const FloorItem *floorItem) handler->pushPickup(floorItem->getId()); } -void PlayerHandler::setDirection(char direction) +void PlayerHandler::setDirection(unsigned char direction) { MessageOut outMsg(CMSG_PLAYER_CHANGE_DIR); outMsg.writeInt16(0); diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h index 6c342785c..90a25fb79 100644 --- a/src/net/tmwa/playerhandler.h +++ b/src/net/tmwa/playerhandler.h @@ -50,7 +50,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler void increaseSkill(unsigned short skillId); void pickUp(const FloorItem *floorItem); - void setDirection(char direction); + void setDirection(unsigned char direction); void setDestination(int x, int y, int direction = -1); void changeAction(Being::Action action); void processOnlineList(Net::MessageIn &msg); -- cgit v1.2.3-70-g09d2