summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-14 22:44:37 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-14 22:44:37 +0300
commite1841e31c606f1d97ea54c3f00f3380db814f3d2 (patch)
treefa9c9b178fe5ba9ca931e67332aef016efa95145 /src/net/tmwa
parent72938b640199d03d6092366224d3927d5d2a33b9 (diff)
downloadmv-e1841e31c606f1d97ea54c3f00f3380db814f3d2.tar.gz
mv-e1841e31c606f1d97ea54c3f00f3380db814f3d2.tar.bz2
mv-e1841e31c606f1d97ea54c3f00f3380db814f3d2.tar.xz
mv-e1841e31c606f1d97ea54c3f00f3380db814f3d2.zip
Rename readInt8 into readUInt8 because it really read uint8_t.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/beinghandler.cpp34
-rw-r--r--src/net/tmwa/buysellhandler.cpp8
-rw-r--r--src/net/tmwa/charserverhandler.cpp40
-rw-r--r--src/net/tmwa/generalhandler.cpp4
-rw-r--r--src/net/tmwa/loginhandler.cpp12
5 files changed, 48 insertions, 50 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 7a86d2bd9..11467a0e1 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -276,14 +276,14 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
return;
}
- const int type = msg.readInt8();
+ const uint8_t type = msg.readUInt8();
int16_t id = 0;
int id2 = 0;
const std::string color;
if (!look2)
{
- id = msg.readInt8();
+ id = static_cast<int16_t>(msg.readUInt8());
id2 = 1; // default color
}
else
@@ -508,8 +508,8 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
dstBeing->setWalkSpeed(Vector(speed, speed, 0));
- const int hairStyle = msg.readInt8();
- const uint8_t look = msg.readInt8();
+ const uint8_t hairStyle = msg.readUInt8();
+ const uint8_t look = msg.readUInt8();
dstBeing->setSubtype(job, look);
const uint16_t weapon = msg.readInt16();
const uint16_t shield = msg.readInt16();
@@ -520,15 +520,15 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
const uint16_t headTop = msg.readInt16();
const uint16_t headMid = msg.readInt16();
- const uint8_t hairColor = msg.readInt8();
- msg.readInt8(); // free
+ const uint8_t hairColor = msg.readUInt8();
+ msg.readUInt8(); // free
- unsigned char colors[9];
- colors[0] = msg.readInt8();
- colors[1] = msg.readInt8();
- colors[2] = msg.readInt8();
+ uint8_t colors[9];
+ colors[0] = msg.readUInt8();
+ colors[1] = msg.readUInt8();
+ colors[2] = msg.readUInt8();
- msg.readInt8(); // unused
+ msg.readUInt8(); // unused
const int guild = msg.readInt32(); // guild
@@ -543,10 +543,10 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
msg.readInt16(); // emblem
msg.readInt16(); // manner
dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3
- msg.readInt8(); // karma
+ msg.readUInt8(); // karma
// reserving bit for future usage
dstBeing->setGender(Being::intToGender(
- static_cast<uint8_t>(msg.readInt8() & 3)));
+ static_cast<uint8_t>(msg.readUInt8() & 3)));
if (!disguiseId)
{
@@ -620,7 +620,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
if (msgType == 1 || msgType == 2)
{
- const int type = msg.readInt8();
+ const uint8_t type = msg.readUInt8();
switch (type)
{
case 0:
@@ -654,14 +654,14 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
}
else if (msgType == 3)
{
- msg.readInt8(); // unknown
+ msg.readUInt8(); // unknown
}
- const int level = msg.readInt8(); // Lv
+ const int level = static_cast<int>(msg.readUInt8()); // Lv
if (level)
dstBeing->setLevel(level);
- msg.readInt8(); // unknown
+ msg.readUInt8(); // unknown
if (dstBeing->getType() != ActorType::PLAYER
|| msgType != 3)
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index a51e0c7b1..b59d0f1f9 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -106,11 +106,11 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg)
{
const int value = msg.readInt32();
msg.readInt32(); // DCvalue
- msg.readInt8(); // type
+ msg.readUInt8(); // type
const int itemId = msg.readInt16();
- unsigned char color = 1;
+ uint8_t color = 1;
if (serverVersion > 0)
- color = msg.readInt8();
+ color = msg.readUInt8();
mBuyDialog->addItem(itemId, color, 0, value);
}
mBuyDialog->sort();
@@ -118,7 +118,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg)
void BuySellHandler::processNpcSellResponse(Net::MessageIn &msg)
{
- switch (msg.readInt8())
+ switch (msg.readUInt8())
{
case 0:
NotifyManager::notify(NotifyTypes::SOLD);
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 04c1d4928..67fff4029 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -163,8 +163,8 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
msg.readInt16(); // speed
const uint16_t race = msg.readInt16(); // class (used for race)
- const int hairStyle = msg.readInt8();
- const uint8_t look = msg.readInt8();
+ const uint8_t hairStyle = msg.readUInt8();
+ const uint8_t look = msg.readUInt8();
tempPlayer->setSubtype(race, look);
const uint16_t weapon = msg.readInt16(); // unused on server. need use?
tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true);
@@ -178,10 +178,8 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
const int hat = msg.readInt16(); // head option top
const int topClothes = msg.readInt16();
- int hairColor = msg.readInt8();
- if (hairColor > 255)
- hairColor = 255;
- msg.readInt8(); // free
+ uint8_t hairColor = msg.readUInt8();
+ msg.readUInt8(); // free
tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1,
ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
tempPlayer->setHairColor(static_cast<unsigned char>(hairColor));
@@ -192,29 +190,29 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
character->dummy = tempPlayer;
for (int i = 0; i < 6; i++)
- character->data.mStats[i + STR].base = msg.readInt8();
+ character->data.mStats[i + STR].base = msg.readUInt8();
if (withColors)
{
- tempPlayer->setSprite(SPRITE_SHOE, shoes, "", msg.readInt8());
- tempPlayer->setSprite(SPRITE_GLOVES, gloves, "", msg.readInt8());
- tempPlayer->setSprite(SPRITE_CAPE, cape, "", msg.readInt8());
- tempPlayer->setSprite(SPRITE_MISC1, misc1, "", msg.readInt8());
+ tempPlayer->setSprite(SPRITE_SHOE, shoes, "", msg.readUInt8());
+ tempPlayer->setSprite(SPRITE_GLOVES, gloves, "", msg.readUInt8());
+ tempPlayer->setSprite(SPRITE_CAPE, cape, "", msg.readUInt8());
+ tempPlayer->setSprite(SPRITE_MISC1, misc1, "", msg.readUInt8());
tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, bottomClothes,
- "", msg.readInt8());
+ "", msg.readUInt8());
// to avoid show error (error.xml) need remove this sprite
if (!config.getBoolValue("hideShield"))
- tempPlayer->setSprite(SPRITE_SHIELD, shield, "", msg.readInt8());
+ tempPlayer->setSprite(SPRITE_SHIELD, shield, "", msg.readUInt8());
else
- msg.readInt8();
+ msg.readUInt8();
tempPlayer->setSprite(SPRITE_HAT, hat, "",
- msg.readInt8()); // head option top
+ msg.readUInt8()); // head option top
tempPlayer->setSprite(SPRITE_TOPCLOTHES, topClothes, "",
- msg.readInt8());
- tempPlayer->setSprite(SPRITE_MISC2, misc2, "", msg.readInt8());
+ msg.readUInt8());
+ tempPlayer->setSprite(SPRITE_MISC2, misc2, "", msg.readUInt8());
msg.skip(5);
- character->slot = msg.readInt8(); // character slot
+ character->slot = msg.readUInt8(); // character slot
}
else
{
@@ -230,9 +228,9 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
tempPlayer->setSprite(SPRITE_HAT, hat); // head option top
tempPlayer->setSprite(SPRITE_TOPCLOTHES, topClothes);
tempPlayer->setSprite(SPRITE_MISC2, misc2);
- character->slot = msg.readInt8(); // character slot
+ character->slot = msg.readUInt8(); // character slot
}
- msg.readInt8(); // unknown
+ msg.readUInt8(); // unknown
}
void CharServerHandler::chooseCharacter(Net::Character *const character)
@@ -326,7 +324,7 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg)
if (slots > 0 && slots < 30)
loginData.characterSlots = static_cast<uint16_t>(slots);
- const bool version = msg.readInt8() == 1 && serverVersion > 0;
+ const bool version = msg.readUInt8() == 1 && serverVersion > 0;
msg.skip(17); // 0 Unused
delete_all(mCharacters);
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index bc24c8bf2..7ef237bbc 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -132,8 +132,8 @@ void GeneralHandler::handleMessage(Net::MessageIn &msg)
{
case SMSG_CONNECTION_PROBLEM:
{
- const int code = msg.readInt8();
- logger->log("Connection problem: %i", code);
+ const uint8_t code = msg.readUInt8();
+ logger->log("Connection problem: %u", static_cast<int>(code));
switch (code)
{
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index b9a1e7365..4f589bbb9 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -187,16 +187,16 @@ void LoginHandler::requestUpdateHosts()
void LoginHandler::processServerVersion(Net::MessageIn &msg)
{
- 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
+ const uint8_t b1 = msg.readUInt8(); // -1
+ const uint8_t b2 = msg.readUInt8(); // E
+ const uint8_t b3 = msg.readUInt8(); // V
+ const uint8_t b4 = msg.readUInt8(); // L
if (b1 == 255 && b2 == 'E' && b3 == 'V' && b4 == 'L')
{
- const unsigned int options = msg.readInt8();
+ const unsigned int options = msg.readUInt8();
mRegistrationEnabled = options & FLAG_REGISTRATION;
msg.skip(2); // 0 unused
- serverVersion = msg.readInt8();
+ serverVersion = msg.readUInt8();
tmwServerVersion = 0;
if (serverVersion >= 5)
requestUpdateHosts();