summaryrefslogtreecommitdiff
path: root/src/net
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
parent72938b640199d03d6092366224d3927d5d2a33b9 (diff)
downloadmanaverse-e1841e31c606f1d97ea54c3f00f3380db814f3d2.tar.gz
manaverse-e1841e31c606f1d97ea54c3f00f3380db814f3d2.tar.bz2
manaverse-e1841e31c606f1d97ea54c3f00f3380db814f3d2.tar.xz
manaverse-e1841e31c606f1d97ea54c3f00f3380db814f3d2.zip
Rename readInt8 into readUInt8 because it really read uint8_t.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/character.h4
-rw-r--r--src/net/ea/beinghandler.cpp37
-rw-r--r--src/net/ea/buysellhandler.cpp2
-rw-r--r--src/net/ea/charserverhandler.cpp4
-rw-r--r--src/net/ea/chathandler.cpp18
-rw-r--r--src/net/ea/gamehandler.cpp4
-rw-r--r--src/net/ea/guildhandler.cpp12
-rw-r--r--src/net/ea/inventoryhandler.cpp48
-rw-r--r--src/net/ea/itemhandler.cpp12
-rw-r--r--src/net/ea/loginhandler.cpp9
-rw-r--r--src/net/ea/partyhandler.cpp14
-rw-r--r--src/net/ea/playerhandler.cpp52
-rw-r--r--src/net/ea/skillhandler.cpp8
-rw-r--r--src/net/ea/tradehandler.cpp20
-rw-r--r--src/net/eathena/beinghandler.cpp38
-rw-r--r--src/net/eathena/buysellhandler.cpp4
-rw-r--r--src/net/eathena/charserverhandler.cpp6
-rw-r--r--src/net/eathena/generalhandler.cpp5
-rw-r--r--src/net/eathena/loginhandler.cpp8
-rw-r--r--src/net/eathena/npchandler.cpp4
-rw-r--r--src/net/eathena/playerhandler.cpp4
-rw-r--r--src/net/messagein.cpp2
-rw-r--r--src/net/messagein.h4
-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
28 files changed, 208 insertions, 209 deletions
diff --git a/src/net/character.h b/src/net/character.h
index 1b5113627..bab115b7f 100644
--- a/src/net/character.h
+++ b/src/net/character.h
@@ -42,7 +42,7 @@ namespace Net
struct Character final
{
Character() :
- slot(0),
+ slot(0U),
dummy(nullptr),
data()
{
@@ -55,7 +55,7 @@ struct Character final
delete2(dummy);
}
- int slot; /**< The index in the list of characters */
+ uint8_t slot; /**< The index in the list of characters */
LocalPlayer *dummy; /**< A dummy representing this character */
PlayerInfoBackend data;
};
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index bffe6ef81..b7e9a0467 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -208,8 +208,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
if (speed == 0)
speed = 150;
- 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);
if (dstBeing->getType() == ActorType::MONSTER && player_node)
player_node->checkNewName(dstBeing);
@@ -223,8 +223,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
const uint16_t shield = msg.readInt16();
const uint16_t headTop = msg.readInt16();
const uint16_t headMid = msg.readInt16();
- const unsigned char hairColor = msg.readInt8();
- msg.readInt8(); // free
+ const uint8_t hairColor = msg.readUInt8();
+ msg.readUInt8(); // free
const uint16_t shoes = msg.readInt16(); // clothes color
uint16_t gloves;
@@ -261,14 +261,14 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3
if (serverVersion > 0 && dstBeing->getType() == ActorType::MONSTER)
{
- const int attackRange = msg.readInt8(); // karma
+ const int attackRange = static_cast<int>(msg.readUInt8()); // karma
dstBeing->setAttackRange(attackRange);
}
else
{
- msg.readInt8(); // karma
+ msg.readUInt8(); // karma
}
- uint8_t gender = msg.readInt8();
+ uint8_t gender = msg.readUInt8();
if (!disguiseId && dstBeing->getType() == ActorType::PLAYER)
{
@@ -343,8 +343,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
dstBeing->setDirection(dir);
}
- msg.readInt8(); // unknown
- msg.readInt8(); // unknown
+ msg.readUInt8(); // unknown
+ msg.readUInt8(); // unknown
msg.readInt16();
dstBeing->setStunMode(stunMode);
@@ -434,7 +434,7 @@ void BeingHandler::processBeingRemove(Net::MessageIn &msg) const
if (dstBeing == player_node->getTarget())
player_node->stopAttack(true);
- if (msg.readInt8() == 1)
+ if (msg.readUInt8() == 1U)
{
if (dstBeing->getCurrentAction() != BeingAction::DEAD)
{
@@ -481,7 +481,7 @@ void BeingHandler::processBeingResurrect(Net::MessageIn &msg) const
if (dstBeing == player_node->getTarget())
player_node->stopAttack();
- if (msg.readInt8() == 1)
+ if (msg.readUInt8() == 1U)
dstBeing->setAction(BeingAction::STAND, 0);
BLOCK_END("BeingHandler::processBeingResurrect")
}
@@ -504,7 +504,7 @@ void BeingHandler::processSkillDamage(Net::MessageIn &msg) const
const int param1 = msg.readInt32(); // Damage
const int level = msg.readInt16(); // Skill level
msg.readInt16(); // Div
- msg.readInt8(); // Skill hit/type (?)
+ msg.readUInt8(); // Skill hit/type (?)
if (srcBeing)
srcBeing->handleSkill(dstBeing, param1, id, level);
if (dstBeing)
@@ -529,7 +529,7 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) const
msg.readInt32(); // dst speed
const int param1 = msg.readInt16();
msg.readInt16(); // param 2
- const int type = msg.readInt8();
+ const uint8_t type = msg.readUInt8();
msg.readInt16(); // param 3
switch (type)
@@ -650,7 +650,7 @@ void BeingHandler::processBeingEmotion(Net::MessageIn &msg) const
if (player_relations.hasPermission(dstBeing, PlayerRelation::EMOTE))
{
- const unsigned char emote = msg.readInt8();
+ const uint8_t emote = msg.readUInt8();
if (emote)
{
dstBeing->setEmote(emote, 0);
@@ -770,8 +770,7 @@ void BeingHandler::processBeingChangeDirection(Net::MessageIn &msg) const
msg.readInt16(); // unused
- const unsigned char dir = static_cast<unsigned char>(
- msg.readInt8() & 0x0f);
+ const uint8_t dir = static_cast<uint8_t>(msg.readUInt8() & 0x0FU);
dstBeing->setDirection(dir);
if (player_node)
player_node->imitateDirection(dstBeing, dir);
@@ -837,7 +836,7 @@ void BeingHandler::processPlaterStatusChange(Net::MessageIn &msg) const
const uint16_t stunMode = msg.readInt16();
uint32_t statusEffects = msg.readInt16();
statusEffects |= (static_cast<uint32_t>(msg.readInt16())) << 16;
- msg.readInt8(); // Unused?
+ msg.readUInt8(); // Unused?
dstBeing->setStunMode(stunMode);
dstBeing->setStatusEffectBlock(0, static_cast<uint16_t>(
@@ -859,7 +858,7 @@ void BeingHandler::processBeingStatusChange(Net::MessageIn &msg) const
// Status change
const uint16_t status = msg.readInt16();
const int id = msg.readInt32();
- const int flag = msg.readInt8(); // 0: stop, 1: start
+ const bool flag = msg.readUInt8(); // 0: stop, 1: start
Being *const dstBeing = actorManager->findBeing(id);
if (dstBeing)
@@ -884,7 +883,7 @@ void BeingHandler::processSkillNoDamage(Net::MessageIn &msg) const
msg.readInt16(); // heal
msg.readInt32(); // dst id
msg.readInt32(); // src id
- msg.readInt8(); // fail
+ msg.readUInt8(); // fail
}
void BeingHandler::processPvpMapMode(Net::MessageIn &msg) const
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp
index f8871748f..f8a6651ef 100644
--- a/src/net/ea/buysellhandler.cpp
+++ b/src/net/ea/buysellhandler.cpp
@@ -169,7 +169,7 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg,
void BuySellHandler::processNpcBuyResponse(Net::MessageIn &msg) const
{
- if (msg.readInt8() == 0)
+ if (msg.readUInt8() == 0U)
{
NotifyManager::notify(NotifyTypes::BUY_DONE);
}
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index d7ad9fd11..a0358dbb4 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -124,7 +124,7 @@ unsigned int CharServerHandler::maxSprite() const
void CharServerHandler::processCharLoginError(Net::MessageIn &msg) const
{
BLOCK_START("CharServerHandler::processCharLoginError")
- switch (msg.readInt8())
+ switch (msg.readUInt8())
{
case 0:
// TRANSLATORS: error message
@@ -166,7 +166,7 @@ void CharServerHandler::processCharCreate(Net::MessageIn &msg,
void CharServerHandler::processCharCreateFailed(Net::MessageIn &msg)
{
BLOCK_START("CharServerHandler::processCharCreateFailed")
- switch (msg.readInt8())
+ switch (msg.readUInt8())
{
case 1:
case 0:
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 5c972db6b..4bbff5081 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -96,7 +96,7 @@ void ChatHandler::processWhisperResponse(Net::MessageIn &msg)
mSentWhispers.pop();
}
- const int type = msg.readInt8();
+ const uint8_t type = msg.readUInt8();
switch (type)
{
case 0x00:
@@ -283,9 +283,9 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg,
if (channels)
{
chatMsgLength -= 3;
- channel = msg.readInt8();
- channel += msg.readInt8();
- channel += msg.readInt8();
+ channel = msg.readUInt8();
+ channel += msg.readUInt8();
+ channel += msg.readUInt8();
}
if (chatMsgLength <= 0)
@@ -352,9 +352,9 @@ void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat,
if (channels)
{
chatMsgLength -= 3;
- channel = msg.readInt8();
- channel += msg.readInt8();
- channel += msg.readInt8();
+ channel = msg.readUInt8();
+ channel += msg.readUInt8();
+ channel += msg.readUInt8();
}
if (chatMsgLength <= 0)
{
@@ -434,8 +434,8 @@ void ChatHandler::processMVP(Net::MessageIn &msg) const
void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) const
{
BLOCK_START("ChatHandler::processIgnoreAllResponse")
- const int action = msg.readInt8();
- const int fail = msg.readInt8();
+ const uint8_t action = msg.readUInt8();
+ const uint8_t fail = msg.readUInt8();
if (!localChatTab)
{
BLOCK_END("ChatHandler::processIgnoreAllResponse")
diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp
index afebc93a1..028ad8937 100644
--- a/src/net/ea/gamehandler.cpp
+++ b/src/net/ea/gamehandler.cpp
@@ -81,13 +81,13 @@ void GameHandler::processWhoAnswer(Net::MessageIn &msg) const
void GameHandler::processCharSwitchResponse(Net::MessageIn &msg) const
{
- if (msg.readInt8())
+ if (msg.readUInt8())
client->setState(STATE_SWITCH_CHARACTER);
}
void GameHandler::processMapQuitResponse(Net::MessageIn &msg) const
{
- if (msg.readInt8())
+ if (msg.readUInt8())
{
new OkDialog(_("Game"), _("Request to quit denied!"),
DialogType::ERROR);
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp
index 68d6a774b..42c6b0ec5 100644
--- a/src/net/ea/guildhandler.cpp
+++ b/src/net/ea/guildhandler.cpp
@@ -74,7 +74,7 @@ void GuildHandler::endAlliance(const int guildId A_UNUSED,
void GuildHandler::processGuildCreateResponse(Net::MessageIn &msg) const
{
- const int flag = msg.readInt8();
+ const uint8_t flag = msg.readUInt8();
switch (flag)
{
@@ -111,7 +111,7 @@ void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) const
const int emblem = msg.readInt32();
const int posMode = msg.readInt32();
msg.readInt32(); // Unused
- msg.readInt8(); // Unused
+ msg.readUInt8(); // Unused
std::string guildName = msg.readString(24);
Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId));
@@ -395,7 +395,7 @@ void GuildHandler::processGuildSkillInfo(Net::MessageIn &msg) const
msg.readInt16(); // SP
msg.readInt16(); // 'Range'
msg.skip(24); // 0 unused
- msg.readInt8(); // Can be increased
+ msg.readUInt8(); // Can be increased
}
}
@@ -421,7 +421,7 @@ void GuildHandler::processGuildInvite(Net::MessageIn &msg) const
void GuildHandler::processGuildInviteAck(Net::MessageIn &msg) const
{
- const int flag = msg.readInt8();
+ const uint8_t flag = msg.readUInt8();
if (!guildTab)
return;
@@ -580,7 +580,7 @@ void GuildHandler::processGuildSkillUp(Net::MessageIn &msg) const
msg.readInt16(); // Level
msg.readInt16(); // SP
msg.readInt16(); // 'Range'
- msg.readInt8(); // unused? (always 1)
+ msg.readUInt8(); // unused? (always 1)
}
void GuildHandler::processGuildReqAlliance(Net::MessageIn &msg) const
@@ -602,7 +602,7 @@ void GuildHandler::processGuildDelAlliance(Net::MessageIn &msg) const
void GuildHandler::processGuildOppositionAck(Net::MessageIn &msg) const
{
- msg.readInt8(); // Flag
+ msg.readUInt8(); // Flag
}
void GuildHandler::processGuildBroken(Net::MessageIn &msg) const
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 09b8b6bad..6788784b2 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -205,8 +205,8 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg,
const int index = msg.readInt16() - (playerInvintory
? INVENTORY_OFFSET : STORAGE_OFFSET);
const int itemId = msg.readInt16();
- const int itemType = msg.readInt8();
- unsigned char identified = msg.readInt8();
+ const uint8_t itemType = msg.readUInt8();
+ uint8_t identified = msg.readUInt8();
const int amount = msg.readInt16();
const int arrow = msg.readInt16();
for (int i = 0; i < 4; i++)
@@ -254,13 +254,13 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
int cards[4];
const int index = msg.readInt16() - STORAGE_OFFSET;
const int itemId = msg.readInt16();
- const int itemType = msg.readInt8();
- unsigned char identified = msg.readInt8();
+ const uint8_t itemType = msg.readUInt8();
+ uint8_t identified = msg.readUInt8();
const int amount = 1;
msg.readInt16(); // Equip Point?
msg.readInt16(); // Another Equip Point?
- msg.readInt8(); // Attribute (broken)
- const int refine = msg.readInt8();
+ msg.readUInt8(); // Attribute (broken)
+ const uint8_t refine = msg.readUInt8();
for (int i = 0; i < 4; i++)
cards[i] = msg.readInt16();
@@ -273,8 +273,8 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
refine);
}
- if (serverVersion < 1 && identified > 1)
- identified = 1;
+ if (serverVersion < 1 && identified > 1U)
+ identified = 1U;
mInventoryItems.push_back(Ea::InventoryItem(index,
itemId, amount, refine, identified, false));
@@ -297,16 +297,16 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
const int index = msg.readInt16() - INVENTORY_OFFSET;
int amount = msg.readInt16();
const int itemId = msg.readInt16();
- unsigned char identified = msg.readInt8();
- msg.readInt8(); // attribute
- const int refine = msg.readInt8();
+ uint8_t identified = msg.readUInt8();
+ msg.readUInt8(); // attribute
+ const int refine = msg.readUInt8();
for (int i = 0; i < 4; i++)
msg.readInt16(); // cards[i]
const int equipType = msg.readInt16();
- msg.readInt8(); // itemType
+ msg.readUInt8(); // itemType
const ItemInfo &itemInfo = ItemDB::get(itemId);
- const unsigned char err = msg.readInt8();
+ const unsigned char err = msg.readUInt8();
int floorId;
if (mSentPickups.empty())
{
@@ -380,7 +380,7 @@ void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg)
msg.readInt16(); // item id
msg.readInt32(); // id
const int amount = msg.readInt16();
- msg.readInt8(); // type
+ msg.readUInt8(); // type
if (inventory)
{
@@ -404,7 +404,7 @@ void InventoryHandler::processItemUseResponse(Net::MessageIn &msg)
const int index = msg.readInt16() - INVENTORY_OFFSET;
const int amount = msg.readInt16();
- if (msg.readInt8() == 0)
+ if (msg.readUInt8() == 0)
{
NotifyManager::notify(NotifyTypes::USE_FAILED);
}
@@ -460,9 +460,9 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
const int index = msg.readInt16() - STORAGE_OFFSET;
const int amount = msg.readInt32();
const int itemId = msg.readInt16();
- unsigned char identified = msg.readInt8();
- msg.readInt8(); // attribute
- const int refine = msg.readInt8();
+ unsigned char identified = msg.readUInt8();
+ msg.readUInt8(); // attribute
+ const uint8_t refine = msg.readUInt8();
for (int i = 0; i < 4; i++)
msg.readInt16(); // card i
@@ -541,13 +541,13 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
{
const int index = msg.readInt16() - INVENTORY_OFFSET;
const int itemId = msg.readInt16();
- const int itemType = msg.readInt8(); // type
- unsigned char identified = msg.readInt8(); // identify flag
+ const uint8_t itemType = msg.readUInt8(); // type
+ uint8_t identified = msg.readUInt8(); // identify flag
msg.readInt16(); // equip type
const int equipType = msg.readInt16();
- msg.readInt8(); // attribute
- const int refine = msg.readInt8();
+ msg.readUInt8(); // attribute
+ const uint8_t refine = msg.readUInt8();
msg.skip(8); // card
if (mDebugInventory)
@@ -576,7 +576,7 @@ void InventoryHandler::processPlayerEquip(Net::MessageIn &msg)
BLOCK_START("InventoryHandler::processPlayerEquip")
const int index = msg.readInt16() - INVENTORY_OFFSET;
const int equipType = msg.readInt16();
- const int flag = msg.readInt8();
+ const uint8_t flag = msg.readUInt8();
if (!flag)
NotifyManager::notify(NotifyTypes::EQUIP_FAILED);
@@ -590,7 +590,7 @@ void InventoryHandler::processPlayerUnEquip(Net::MessageIn &msg)
BLOCK_START("InventoryHandler::processPlayerUnEquip")
msg.readInt16(); // inder val - INVENTORY_OFFSET;
const int equipType = msg.readInt16();
- const int flag = msg.readInt8();
+ const uint8_t flag = msg.readUInt8();
if (flag)
mEquips.setEquipment(getSlot(equipType), -1);
diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp
index 383ba2753..8719c6256 100644
--- a/src/net/ea/itemhandler.cpp
+++ b/src/net/ea/itemhandler.cpp
@@ -43,12 +43,12 @@ void ItemHandler::processItemVisible(Net::MessageIn &msg)
{
const int id = msg.readInt32();
const int itemId = msg.readInt16();
- const unsigned char identify = msg.readInt8(); // identify flag
+ const uint8_t identify = msg.readUInt8(); // identify flag
const int x = msg.readInt16();
const int y = msg.readInt16();
const int amount = msg.readInt16();
- const int subX = msg.readInt8();
- const int subY = msg.readInt8();
+ const int subX = msg.readUInt8();
+ const int subY = msg.readUInt8();
if (actorManager)
{
@@ -61,11 +61,11 @@ void ItemHandler::processItemDropped(Net::MessageIn &msg)
{
const int id = msg.readInt32();
const int itemId = msg.readInt16();
- const unsigned char identify = msg.readInt8(); // identify flag
+ const uint8_t identify = msg.readUInt8(); // identify flag
const int x = msg.readInt16();
const int y = msg.readInt16();
- const int subX = msg.readInt8();
- const int subY = msg.readInt8();
+ const int subX = static_cast<int>(msg.readUInt8());
+ const int subY = static_cast<int>(msg.readUInt8());
const int amount = msg.readInt16();
if (actorManager)
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index 451850430..ece10c725 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -136,7 +136,7 @@ void LoginHandler::clearWorlds()
void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) const
{
// 0: acc not found, 1: success, 2: password mismatch, 3: pass too short
- const int errMsg = msg.readInt8();
+ const uint8_t errMsg = msg.readUInt8();
// Successful pass change
if (errMsg == 1)
{
@@ -203,7 +203,8 @@ void LoginHandler::processLoginData(Net::MessageIn &msg)
// msg.skip(30); // unknown
// reserve bits for future usage
- mToken.sex = Being::intToGender(static_cast<uint8_t>(msg.readInt8() & 3));
+ mToken.sex = Being::intToGender(static_cast<uint8_t>(
+ msg.readUInt8() & 3U));
for (int i = 0; i < worldCount; i++)
{
@@ -228,8 +229,8 @@ void LoginHandler::processLoginData(Net::MessageIn &msg)
void LoginHandler::processLoginError(Net::MessageIn &msg) const
{
- const int code = msg.readInt8();
- logger->log("Login::error code: %i", code);
+ const uint8_t code = msg.readUInt8();
+ logger->log("Login::error code: %u", static_cast<unsigned int>(code));
switch (code)
{
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 8ba78cd91..2b83d9eb8 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -75,7 +75,7 @@ void PartyHandler::clear() const
void PartyHandler::processPartyCreate(Net::MessageIn &msg) const
{
- if (msg.readInt8())
+ if (msg.readUInt8())
NotifyManager::notify(NotifyTypes::PARTY_CREATE_FAILED);
else
NotifyManager::notify(NotifyTypes::PARTY_CREATED);
@@ -129,8 +129,8 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg) const
const int id = msg.readInt32();
std::string nick = msg.readString(24);
std::string map = msg.readString(16);
- const bool leader = msg.readInt8() == 0;
- const bool online = msg.readInt8() == 0;
+ const bool leader = msg.readUInt8() == 0U;
+ const bool online = msg.readUInt8() == 0U;
if (Ea::taParty)
{
@@ -191,7 +191,7 @@ void PartyHandler::processPartyInviteResponse(Net::MessageIn &msg) const
const std::string nick = msg.readString(24);
- switch (msg.readInt8())
+ switch (msg.readUInt8())
{
case 0:
NotifyManager::notify(NotifyTypes::PARTY_INVITE_ALREADY_MEMBER,
@@ -314,7 +314,7 @@ void PartyHandler::processPartyMove(Net::MessageIn &msg) const
msg.skip(4); // 0
m->setX(msg.readInt16()); // x
m->setY(msg.readInt16()); // y
- const int online = msg.readInt8();
+ const bool online = msg.readUInt8() != 0;
if (m->getOnline() != online)
Ea::partyTab->showOnline(m->getName(), online);
m->setOnline(online); // online (if 0)
@@ -327,7 +327,7 @@ void PartyHandler::processPartyMove(Net::MessageIn &msg) const
msg.skip(4); // 0
msg.readInt16(); // x
msg.readInt16(); // y
- msg.readInt8(); // online (if 0)
+ msg.readUInt8(); // online (if 0)
msg.readString(24); // party
msg.readString(24); // nick
msg.readString(16); // map
@@ -338,7 +338,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg) const
{
const int id = msg.readInt32();
const std::string nick = msg.readString(24);
- msg.readInt8(); // fail
+ msg.readUInt8(); // fail
if (!player_node)
return;
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 9e2a0dfb3..31e298fdc 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -442,8 +442,8 @@ void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg)
{
BLOCK_START("PlayerHandler::processPlayerStatUpdate4")
const int type = msg.readInt16();
- const int ok = msg.readInt8();
- const int value = msg.readInt8();
+ const uint8_t ok = msg.readUInt8();
+ const int value = msg.readUInt8();
if (ok != 1)
{
@@ -463,47 +463,47 @@ void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg)
BLOCK_START("PlayerHandler::processPlayerStatUpdate5")
PlayerInfo::setAttribute(Attributes::CHAR_POINTS, msg.readInt16());
- int val = msg.readInt8();
+ unsigned int val = msg.readUInt8();
PlayerInfo::setStatBase(EA_STR, val);
if (statusWindow)
- statusWindow->setPointsNeeded(EA_STR, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_STR, msg.readUInt8());
else
- msg.readInt8();
+ msg.readUInt8();
- val = msg.readInt8();
+ val = msg.readUInt8();
PlayerInfo::setStatBase(EA_AGI, val);
if (statusWindow)
- statusWindow->setPointsNeeded(EA_AGI, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_AGI, msg.readUInt8());
else
- msg.readInt8();
+ msg.readUInt8();
- val = msg.readInt8();
+ val = msg.readUInt8();
PlayerInfo::setStatBase(EA_VIT, val);
if (statusWindow)
- statusWindow->setPointsNeeded(EA_VIT, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_VIT, msg.readUInt8());
else
- msg.readInt8();
+ msg.readUInt8();
- val = msg.readInt8();
+ val = msg.readUInt8();
PlayerInfo::setStatBase(EA_INT, val);
if (statusWindow)
- statusWindow->setPointsNeeded(EA_INT, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_INT, msg.readUInt8());
else
- msg.readInt8();
+ msg.readUInt8();
- val = msg.readInt8();
+ val = msg.readUInt8();
PlayerInfo::setStatBase(EA_DEX, val);
if (statusWindow)
- statusWindow->setPointsNeeded(EA_DEX, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_DEX, msg.readUInt8());
else
- msg.readInt8();
+ msg.readUInt8();
- val = msg.readInt8();
+ val = msg.readUInt8();
PlayerInfo::setStatBase(EA_LUK, val);
if (statusWindow)
- statusWindow->setPointsNeeded(EA_LUK, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_LUK, msg.readUInt8());
else
- msg.readInt8();
+ msg.readUInt8();
PlayerInfo::setStatBase(EA_ATK, msg.readInt16(), false);
PlayerInfo::setStatMod(EA_ATK, msg.readInt16());
@@ -541,22 +541,22 @@ void PlayerHandler::processPlayerStatUpdate6(Net::MessageIn &msg)
switch (type)
{
case 0x0020:
- statusWindow->setPointsNeeded(EA_STR, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_STR, msg.readUInt8());
break;
case 0x0021:
- statusWindow->setPointsNeeded(EA_AGI, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_AGI, msg.readUInt8());
break;
case 0x0022:
- statusWindow->setPointsNeeded(EA_VIT, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_VIT, msg.readUInt8());
break;
case 0x0023:
- statusWindow->setPointsNeeded(EA_INT, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_INT, msg.readUInt8());
break;
case 0x0024:
- statusWindow->setPointsNeeded(EA_DEX, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_DEX, msg.readUInt8());
break;
case 0x0025:
- statusWindow->setPointsNeeded(EA_LUK, msg.readInt8());
+ statusWindow->setPointsNeeded(EA_LUK, msg.readUInt8());
break;
default:
logger->log("QQQQ PLAYER_STAT_UPDATE_6 "
diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp
index 002309de4..e7ac66d7a 100644
--- a/src/net/ea/skillhandler.cpp
+++ b/src/net/ea/skillhandler.cpp
@@ -90,7 +90,7 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg)
msg.readInt16(); // sp
const int range = msg.readInt16();
msg.skip(24); // 0 unused
- const int up = msg.readInt8();
+ const int up = msg.readUInt8();
const int oldLevel = PlayerInfo::getSkillLevel(skillId);
if (oldLevel && oldLevel != level)
updateSkill = skillId;
@@ -111,7 +111,7 @@ void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg)
const int level = msg.readInt16();
msg.readInt16(); // sp
const int range = msg.readInt16();
- const int up = msg.readInt8();
+ const int up = msg.readUInt8();
if (skillDialog && PlayerInfo::getSkillLevel(skillId) != level)
skillDialog->playUpdateEffect(skillId);
@@ -130,8 +130,8 @@ void SkillHandler::processSkillFailed(Net::MessageIn &msg)
const int skillId = msg.readInt16();
const int16_t bskill = msg.readInt16();
msg.readInt16(); // btype
- const signed char success = msg.readInt8();
- const signed char reason = msg.readInt8();
+ const signed char success = msg.readUInt8();
+ const signed char reason = msg.readUInt8();
if (success != static_cast<int>(SKILL_FAILED)
&& bskill == static_cast<int>(BSKILL_EMOTE))
{
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp
index b328086fc..0d0fd05da 100644
--- a/src/net/ea/tradehandler.cpp
+++ b/src/net/ea/tradehandler.cpp
@@ -128,7 +128,7 @@ void TradeHandler::processTradeResponse(Net::MessageIn &msg) const
return;
}
- switch (msg.readInt8())
+ switch (msg.readUInt8())
{
case 0: // Too far away
NotifyManager::notify(NotifyTypes::TRADE_FAIL_FAR_AWAY,
@@ -181,10 +181,10 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
{
const int amount = msg.readInt32();
const int type = msg.readInt16();
- const int identify = msg.readInt8(); // identified flag
- msg.readInt8(); // attribute
- const int refine = msg.readInt8(); // refine
- msg.skip(8); // card (4 shorts)
+ const uint8_t identify = msg.readUInt8(); // identified flag
+ msg.readUInt8(); // attribute
+ const int refine = msg.readUInt8(); // refine
+ msg.skip(8); // card (4 shorts)
if (tradeWindow)
{
@@ -194,8 +194,8 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
}
else
{
- tradeWindow->addItem2(type, false, amount, refine,
- static_cast<unsigned char>(identify), false);
+ tradeWindow->addItem2(type, false, amount,
+ refine, identify, false);
}
}
}
@@ -216,7 +216,7 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
}
const int quantity = msg.readInt16();
- const int res = msg.readInt8();
+ const uint8_t res = msg.readUInt8();
switch (res)
{
case 0:
@@ -254,9 +254,9 @@ void TradeHandler::processTradeOk(Net::MessageIn &msg)
{
// 0 means ok from myself, 1 means ok from other;
if (tradeWindow)
- tradeWindow->receivedOk(msg.readInt8() == 0);
+ tradeWindow->receivedOk(msg.readUInt8() == 0U);
else
- msg.readInt8();
+ msg.readUInt8();
}
void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED)
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index e21a1d0e6..d44b2508b 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -267,15 +267,15 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
if (!dstBeing)
return;
- const int type = msg.readInt8();
+ const uint8_t type = msg.readUInt8();
int id = 0;
- int id2 = 0;
+ unsigned int id2 = 0U;
const std::string color;
if (!look2)
{
- id = msg.readInt8();
- id2 = 1; // default color
+ id = static_cast<int>(msg.readUInt8());
+ id2 = 1U; // default color
}
else
{ // SMSG_BEING_CHANGE_LOOKS2
@@ -487,10 +487,10 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
const uint16_t headMid = msg.readInt16();
const int hairColor = msg.readInt16();
- msg.readInt8();
- msg.readInt8();
- msg.readInt8();
- msg.readInt8(); // unused
+ msg.readUInt8();
+ msg.readUInt8();
+ msg.readUInt8();
+ msg.readUInt8(); // unused
const int guild = msg.readInt32(); // guild
@@ -505,10 +505,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() & 3U)));
if (!disguiseId)
{
@@ -570,7 +570,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:
@@ -602,15 +602,15 @@ 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)
@@ -635,7 +635,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
return;
if (visible)
- msg.readInt8(); // padding?
+ msg.readUInt8(); // padding?
// Information about a being in range
const int id = msg.readInt32();
@@ -736,8 +736,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
msg.readInt16(); // manner
dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3
- msg.readInt8(); // karma
- uint8_t gender = msg.readInt8();
+ msg.readUInt8(); // karma
+ uint8_t gender = msg.readUInt8();
if (dstBeing->getType() == ActorType::PLAYER)
{
@@ -806,8 +806,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
dstBeing->setDirection(dir);
}
- msg.readInt8(); // unknown
- msg.readInt8(); // state / sit
+ msg.readUInt8(); // unknown
+ msg.readUInt8(); // state / sit
msg.readInt16(); // level
dstBeing->setStunMode(stunMode);
diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp
index 30fb8beae..a3d5dca23 100644
--- a/src/net/eathena/buysellhandler.cpp
+++ b/src/net/eathena/buysellhandler.cpp
@@ -101,7 +101,7 @@ 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();
const unsigned char color = 1;
mBuyDialog->addItem(itemId, color, 0, value);
@@ -111,7 +111,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/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index 47629c3dc..a7c77f122 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -183,7 +183,7 @@ 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();
tempPlayer->setSprite(SPRITE_SHOE, shoes);
tempPlayer->setSprite(SPRITE_GLOVES, gloves);
@@ -197,9 +197,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)
diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp
index 2b54be9cb..dcc4bc15c 100644
--- a/src/net/eathena/generalhandler.cpp
+++ b/src/net/eathena/generalhandler.cpp
@@ -120,8 +120,9 @@ 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<unsigned int>(code));
switch (code)
{
diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp
index 8ca8bd1b7..99017dfdc 100644
--- a/src/net/eathena/loginhandler.cpp
+++ b/src/net/eathena/loginhandler.cpp
@@ -162,10 +162,10 @@ void LoginHandler::requestUpdateHosts()
void LoginHandler::processServerVersion(Net::MessageIn &msg)
{
- msg.readInt8();
- msg.readInt8();
- msg.readInt8();
- msg.readInt8();
+ msg.readUInt8();
+ msg.readUInt8();
+ msg.readUInt8();
+ msg.readUInt8();
msg.readInt32();
mRegistrationEnabled = true;
serverVersion = 0;
diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp
index 75db7396b..297e333cf 100644
--- a/src/net/eathena/npchandler.cpp
+++ b/src/net/eathena/npchandler.cpp
@@ -245,7 +245,7 @@ void NpcHandler::processNpcCutin(Net::MessageIn &msg A_UNUSED,
const int npcId A_UNUSED)
{
msg.readString(64); // image name
- msg.readInt8(); // type
+ msg.readUInt8(); // type
}
void NpcHandler::processNpcViewPoint(Net::MessageIn &msg A_UNUSED,
@@ -254,7 +254,7 @@ void NpcHandler::processNpcViewPoint(Net::MessageIn &msg A_UNUSED,
msg.readInt32(); // type
msg.readInt32(); // x
msg.readInt32(); // y
- msg.readInt8(); // byte
+ msg.readUInt8(); // byte
msg.readInt32(); // color
}
diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp
index 2aad363c0..150e86d6c 100644
--- a/src/net/eathena/playerhandler.cpp
+++ b/src/net/eathena/playerhandler.cpp
@@ -230,7 +230,7 @@ void PlayerHandler::processPlayerShortcuts(Net::MessageIn &msg)
{
for (int f = 0; f < 27; f ++)
{
- msg.readInt8(); // type 0: item, 1: skill
+ msg.readUInt8(); // type 0: item, 1: skill
msg.readInt32(); // item or skill id
msg.readInt16(); // lvl
}
@@ -238,7 +238,7 @@ void PlayerHandler::processPlayerShortcuts(Net::MessageIn &msg)
void PlayerHandler::processPlayerShowEquip(Net::MessageIn &msg)
{
- msg.readInt8(); // show equip
+ msg.readUInt8(); // show equip
}
} // namespace EAthena
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index ffda37e9c..301d51ad9 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -47,7 +47,7 @@ MessageIn::MessageIn(const char *const data, const unsigned int length) :
DEBUGLOG("MessageIn");
}
-unsigned char MessageIn::readInt8()
+unsigned char MessageIn::readUInt8()
{
unsigned char value = static_cast<unsigned char>(-1);
if (mPos < mLength)
diff --git a/src/net/messagein.h b/src/net/messagein.h
index 7b7df919b..f9f2aceb0 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -58,9 +58,9 @@ class MessageIn notfinal
unsigned int getUnreadLength() const A_WARN_UNUSED
{ return mLength > mPos ? mLength - mPos : 0; }
- virtual unsigned char readInt8(); /**< Reads a byte. */
+ virtual unsigned char readUInt8(); /**< Reads a byte. */
- virtual int16_t readInt16() = 0; /**< Reads a short. */
+ virtual int16_t readInt16() = 0; /**< Reads a short. */
virtual int readInt32() = 0; /**< Reads a long. */
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();