summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-13 12:20:19 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-13 12:20:19 +0300
commitf0b7627b7d88c1d5bb484961377114b210c8dd53 (patch)
treea978c3b8eca88759fa71b5fc34112f4bea9bbcec /src/net
parentd9be27bba8941260500066cdd43ebb016356bc67 (diff)
downloadmv-f0b7627b7d88c1d5bb484961377114b210c8dd53.tar.gz
mv-f0b7627b7d88c1d5bb484961377114b210c8dd53.tar.bz2
mv-f0b7627b7d88c1d5bb484961377114b210c8dd53.tar.xz
mv-f0b7627b7d88c1d5bb484961377114b210c8dd53.zip
Fix code style.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/beinghandler.cpp2
-rw-r--r--src/net/eathena/beinghandler.cpp5
-rw-r--r--src/net/eathena/messageout.cpp3
-rw-r--r--src/net/tmwa/beinghandler.cpp8
-rw-r--r--src/net/tmwa/buysellhandler.cpp6
-rw-r--r--src/net/tmwa/messageout.cpp3
-rw-r--r--src/net/tmwa/playerhandler.cpp2
7 files changed, 16 insertions, 13 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 002d7cb43..bffe6ef81 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -223,7 +223,7 @@ 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 int hairColor = msg.readInt8();
+ const unsigned char hairColor = msg.readInt8();
msg.readInt8(); // free
const uint16_t shoes = msg.readInt16(); // clothes color
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index a11f3bae8..e21a1d0e6 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -434,7 +434,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
const uint16_t stunMode = msg.readInt16(); // opt1
uint32_t statusEffects = msg.readInt16(); // opt2
statusEffects |= (static_cast<uint16_t>(msg.readInt16()))
- << 16; // status.options; Aethyra uses this as misc2
+ << 16U; // status.options; Aethyra uses this as misc2
const int16_t job = msg.readInt16();
int disguiseId = 0;
if (id < 110000000 && job >= 1000)
@@ -648,7 +648,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
int16_t speed = msg.readInt16();
const uint16_t stunMode = msg.readInt16(); // opt1
uint32_t statusEffects = msg.readInt16(); // opt2
- statusEffects |= (static_cast<uint16_t>(msg.readInt16())) << 16; // option
+ statusEffects |= (static_cast<uint16_t>(
+ msg.readInt16())) << 16U; // option
const int16_t job = msg.readInt16(); // class
Being *dstBeing = actorManager->findBeing(id);
diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp
index 49b67b84e..386f5b046 100644
--- a/src/net/eathena/messageout.cpp
+++ b/src/net/eathena/messageout.cpp
@@ -95,7 +95,8 @@ void MessageOut::writeCoordinates(const uint16_t x,
static_cast<unsigned>(x),
static_cast<unsigned>(y),
static_cast<unsigned>(direction)));
- char *const data = mData + mPos;
+ unsigned char *const data = reinterpret_cast<unsigned char*>(mData)
+ + static_cast<size_t>(mPos);
mNetwork->mOutSize += 3;
mPos += 3;
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index cf2c50bf7..7a86d2bd9 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -277,7 +277,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
}
const int type = msg.readInt8();
- int id = 0;
+ int16_t id = 0;
int id2 = 0;
const std::string color;
@@ -312,7 +312,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
break;
case 1: // eAthena LOOK_HAIR
{
- const uint8_t look = static_cast<uint8_t>(id / 256U);
+ const uint8_t look = static_cast<uint8_t>(id / 256);
const int hair = id % 256;
dstBeing->setHairStyle(SPRITE_HAIR, hair * -1);
dstBeing->setLook(look);
@@ -340,7 +340,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
player_node->imitateOutfit(dstBeing, SPRITE_TOPCLOTHES);
break;
case 6: // eAthena LOOK_HAIR_COLOR
- dstBeing->setHairColor(SPRITE_HAIR, id);
+ dstBeing->setHairColor(SPRITE_HAIR, static_cast<uint8_t>(id));
break;
case 7: // Clothes color
// ignoring it
@@ -520,7 +520,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
const uint16_t headTop = msg.readInt16();
const uint16_t headMid = msg.readInt16();
- const int hairColor = msg.readInt8();
+ const uint8_t hairColor = msg.readInt8();
msg.readInt8(); // free
unsigned char colors[9];
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index c44b2ebbf..a51e0c7b1 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -95,14 +95,14 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg)
void BuySellHandler::processNpcBuy(Net::MessageIn &msg)
{
msg.readInt16(); // length
- int sz = 11;
+ unsigned int sz = 11;
if (serverVersion > 0)
sz += 1;
- const int n_items = (msg.getLength() - 4) / sz;
+ const unsigned int n_items = (msg.getLength() - 4U) / sz;
mBuyDialog = new BuyDialog(mNpcId);
mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
- for (int k = 0; k < n_items; k++)
+ for (unsigned int k = 0; k < n_items; k++)
{
const int value = msg.readInt32();
msg.readInt32(); // DCvalue
diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp
index 1a3986412..31196a4a7 100644
--- a/src/net/tmwa/messageout.cpp
+++ b/src/net/tmwa/messageout.cpp
@@ -94,7 +94,8 @@ void MessageOut::writeCoordinates(const uint16_t x,
DEBUGLOG(strprintf("writeCoordinates: %u,%u %u",
static_cast<unsigned>(x), static_cast<unsigned>(y),
static_cast<unsigned>(direction)));
- char *const data = mData + static_cast<size_t>(mPos);
+ unsigned char *const data = reinterpret_cast<unsigned char*>(mData)
+ + static_cast<size_t>(mPos);
mNetwork->mOutSize += 3;
mPos += 3;
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index a555a7b71..b13fffca3 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -286,7 +286,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg)
}
buf ++;
- int gender = Gender::UNSPECIFIED;
+ unsigned char gender = Gender::UNSPECIFIED;
if (serverVersion >= 4)
{
if (config.getBoolValue("showgender"))