summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-16 00:27:51 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-16 00:27:51 +0300
commitc3434fa53d1c83bc65b640951364f842fe6c79f4 (patch)
tree51aa552c585518d7b2e2d67eba7c9500065dae05 /src/net/tmwa
parent185a53c504a0d53e54a7425ea829b5c951661ea8 (diff)
downloadmv-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.gz
mv-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.bz2
mv-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.xz
mv-c3434fa53d1c83bc65b640951364f842fe6c79f4.zip
Fix some signed/unsigned chars issues.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/chathandler.cpp4
-rw-r--r--src/net/tmwa/loginhandler.cpp10
-rw-r--r--src/net/tmwa/playerhandler.cpp2
-rw-r--r--src/net/tmwa/playerhandler.h2
4 files changed, 9 insertions, 9 deletions
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<char>(i));
+ outMsg.writeInt8(static_cast<unsigned char>(i));
else if (line.length() <= 5)
outMsg.writeInt16(static_cast<short>(i));
else
@@ -210,7 +210,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, std::string &line)
switch (header[0])
{
case '1':
- outMsg.writeInt8(static_cast<char>(i));
+ outMsg.writeInt8(static_cast<unsigned char>(i));
break;
case '2':
outMsg.writeInt16(static_cast<short>(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);