From 9fe21fcd8883b37bdc30224822e6e42afb35b8f0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 7 Feb 2016 16:18:13 +0300 Subject: Replace most static_cast to shorter versions from defines. --- src/net/tmwa/chathandler.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/net/tmwa/chathandler.cpp') diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 8ac1cf2e6..61a8054ba 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -59,24 +59,24 @@ void ChatHandler::talk(const std::string &restrict text, createOutPacket(CMSG_CHAT_MESSAGE); // Added + 1 in order to let eAthena parse admin commands correctly - outMsg.writeInt16(static_cast(mes.length() + 4 + 1), "len"); - outMsg.writeString(mes, static_cast(mes.length() + 1), "message"); + outMsg.writeInt16(CAST_S16(mes.length() + 4 + 1), "len"); + outMsg.writeString(mes, CAST_S32(mes.length() + 1), "message"); } void ChatHandler::talkRaw(const std::string &mes) const { createOutPacket(CMSG_CHAT_MESSAGE); - outMsg.writeInt16(static_cast(mes.length() + 4), "len"); - outMsg.writeString(mes, static_cast(mes.length()), "message"); + outMsg.writeInt16(CAST_S16(mes.length() + 4), "len"); + outMsg.writeString(mes, CAST_S32(mes.length()), "message"); } void ChatHandler::privateMessage(const std::string &restrict recipient, const std::string &restrict text) { createOutPacket(CMSG_CHAT_WHISPER); - outMsg.writeInt16(static_cast(text.length() + 28), "len"); + outMsg.writeInt16(CAST_S16(text.length() + 28), "len"); outMsg.writeString(recipient, 24, "recipient nick"); - outMsg.writeString(text, static_cast(text.length()), "message"); + outMsg.writeString(text, CAST_S32(text.length()), "message"); Ea::ChatRecv::mSentWhispers.push(recipient); } @@ -107,7 +107,7 @@ void ChatHandler::sendRaw(const std::string &args) const if (pos != std::string::npos) { str = line.substr(0, pos); - const int16_t id = static_cast(parseNumber(str)); + const int16_t id = CAST_S16(parseNumber(str)); outMsg = new MessageOut(id); outMsg->writeInt16(id, "packet id"); line = line.substr(pos + 1); @@ -115,7 +115,7 @@ void ChatHandler::sendRaw(const std::string &args) const } else { - const int16_t id = static_cast(parseNumber(line)); + const int16_t id = CAST_S16(parseNumber(line)); outMsg = new MessageOut(id); outMsg->writeInt16(id, "packet id"); delete outMsg; @@ -145,17 +145,17 @@ void ChatHandler::processRaw(MessageOut &restrict outMsg, { case 'b': { - outMsg.writeInt8(static_cast(i), "raw"); + outMsg.writeInt8(CAST_U8(i), "raw"); break; } case 'w': { - outMsg.writeInt16(static_cast(i), "raw"); + outMsg.writeInt16(CAST_S16(i), "raw"); break; } case 'l': { - outMsg.writeInt32(static_cast(i), "raw"); + outMsg.writeInt32(CAST_S32(i), "raw"); break; } default: -- cgit v1.2.3-60-g2f50