diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-07 16:18:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-07 16:18:13 +0300 |
commit | 9fe21fcd8883b37bdc30224822e6e42afb35b8f0 (patch) | |
tree | 798117abd4dc7e610997d59d530a96ddc1509f53 /src/net/ea | |
parent | 4429cb14e9e187edef27aba692a4266733f79c17 (diff) | |
download | manaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.gz manaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.bz2 manaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.xz manaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.zip |
Replace most static_cast<Type> to shorter versions from defines.
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/guildrecv.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/inventoryrecv.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/loginhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/loginrecv.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/network.cpp | 14 | ||||
-rw-r--r-- | src/net/ea/npcrecv.cpp | 2 |
6 files changed, 14 insertions, 14 deletions
diff --git a/src/net/ea/guildrecv.cpp b/src/net/ea/guildrecv.cpp index af215876c..f952ae2d2 100644 --- a/src/net/ea/guildrecv.cpp +++ b/src/net/ea/guildrecv.cpp @@ -141,7 +141,7 @@ void GuildRecv::processGuildBasicInfo(Net::MessageIn &msg) castle.c_str()), ChatMsgType::BY_SERVER); } - Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId)); + Guild *const g = Guild::getGuild(CAST_S16(guildId)); if (!g) return; g->setName(name); @@ -200,7 +200,7 @@ void GuildRecv::processGuildMemberList(Net::MessageIn &msg) m->setOnline(online); m->setID(id); m->setCharId(charId); - m->setGender(Being::intToGender(static_cast<uint8_t>(gender))); + m->setGender(Being::intToGender(CAST_U8(gender))); m->setLevel(level); m->setExp(exp); m->setPos(pos); diff --git a/src/net/ea/inventoryrecv.cpp b/src/net/ea/inventoryrecv.cpp index d1f43d0bb..f1593bf51 100644 --- a/src/net/ea/inventoryrecv.cpp +++ b/src/net/ea/inventoryrecv.cpp @@ -232,7 +232,7 @@ int InventoryRecv::getSlot(const int eAthenaSlot) mask <<= 1; position++; } - return static_cast<int>(EQUIP_POINTS[position]); + return CAST_S32(EQUIP_POINTS[position]); } } // namespace Ea diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 3119b0ab6..20034f9f8 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -76,7 +76,7 @@ void LoginHandler::loginAccount(LoginData *const loginData1) const void LoginHandler::chooseServer(const unsigned int server, const bool persistentIp) const { - if (static_cast<size_t>(server) >= LoginRecv::mWorlds.size() || + if (CAST_SIZE(server) >= LoginRecv::mWorlds.size() || !LoginRecv::mWorlds[server]) { return; diff --git a/src/net/ea/loginrecv.cpp b/src/net/ea/loginrecv.cpp index 4b25c80d6..84899476b 100644 --- a/src/net/ea/loginrecv.cpp +++ b/src/net/ea/loginrecv.cpp @@ -82,7 +82,7 @@ void LoginRecv::processLoginData(Net::MessageIn &msg) msg.readInt16("unused"); // reserve bits for future usage - mToken.sex = Being::intToGender(static_cast<uint8_t>( + mToken.sex = Being::intToGender(CAST_U8( msg.readUInt8("gender") & 3U)); for (int i = 0; i < worldCount; i++) @@ -109,7 +109,7 @@ void LoginRecv::processLoginData(Net::MessageIn &msg) void LoginRecv::processLoginError(Net::MessageIn &msg) { const uint8_t code = msg.readUInt8("error"); - logger->log("Login::error code: %u", static_cast<unsigned int>(code)); + logger->log("Login::error code: %u", CAST_U32(code)); std::string date = msg.readString(20, "date"); switch (code) diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp index 66115b789..9efc807c7 100644 --- a/src/net/ea/network.cpp +++ b/src/net/ea/network.cpp @@ -165,7 +165,7 @@ void Network::flush() toString(mOutSize)).append(" bytes")); } */ - if (ret < static_cast<int>(mOutSize)) + if (ret < CAST_S32(mOutSize)) { SDL_mutexV(mMutexOut); setError("Error in TcpNet::send(): " + @@ -188,7 +188,7 @@ void Network::skip(const int len) if (mInSize >= mToSkip) { mInSize -= mToSkip; - memmove(mInBuffer, mInBuffer + static_cast<size_t>(mToSkip), mInSize); + memmove(mInBuffer, mInBuffer + CAST_SIZE(mToSkip), mInSize); mToSkip = 0; } else @@ -258,7 +258,7 @@ void Network::receive() while (mState == CONNECTED) { const int numReady = TcpNet::checkSockets( - set, (static_cast<uint32_t>(500))); + set, (CAST_U32(500))); switch (numReady) { case -1: @@ -280,7 +280,7 @@ void Network::receive() } const int ret = TcpNet::recv(mSocket, - mInBuffer + static_cast<size_t>(mInSize), + mInBuffer + CAST_SIZE(mInSize), BUFFER_SIZE - mInSize); if (!ret) @@ -305,7 +305,7 @@ void Network::receive() { mInSize -= mToSkip; memmove(mInBuffer, - mInBuffer + static_cast<size_t>(mToSkip), + mInBuffer + CAST_SIZE(mToSkip), mInSize); mToSkip = 0; } @@ -348,10 +348,10 @@ uint16_t Network::readWord(const int pos) const { #if SDL_BYTEORDER == SDL_BIG_ENDIAN return SDL_Swap16(*reinterpret_cast<uint16_t*>( - mInBuffer + static_cast<size_t>(pos))); + mInBuffer + CAST_SIZE(pos))); #else return (*reinterpret_cast<uint16_t*>( - mInBuffer + static_cast<size_t>(pos))); + mInBuffer + CAST_SIZE(pos))); #endif } diff --git a/src/net/ea/npcrecv.cpp b/src/net/ea/npcrecv.cpp index c447fd5c5..89bacfd2d 100644 --- a/src/net/ea/npcrecv.cpp +++ b/src/net/ea/npcrecv.cpp @@ -173,7 +173,7 @@ void NpcRecv::processNpcCommand(Net::MessageIn &msg) { mDialog->setAvatarDirection( Net::MessageIn::fromServerDirection( - static_cast<uint8_t>(id))); + CAST_U8(id))); } break; case 8: // set avatar action |