diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-13 12:20:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-13 12:20:19 +0300 |
commit | f0b7627b7d88c1d5bb484961377114b210c8dd53 (patch) | |
tree | a978c3b8eca88759fa71b5fc34112f4bea9bbcec /src/net/tmwa | |
parent | d9be27bba8941260500066cdd43ebb016356bc67 (diff) | |
download | plus-f0b7627b7d88c1d5bb484961377114b210c8dd53.tar.gz plus-f0b7627b7d88c1d5bb484961377114b210c8dd53.tar.bz2 plus-f0b7627b7d88c1d5bb484961377114b210c8dd53.tar.xz plus-f0b7627b7d88c1d5bb484961377114b210c8dd53.zip |
Fix code style.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwa/buysellhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/messageout.cpp | 3 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 2 |
4 files changed, 10 insertions, 9 deletions
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")) |