diff options
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.cpp | 20 | ||||
-rw-r--r-- | src/net/tmwa/guildhandler.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/messagehandler.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/messagein.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/messageout.cpp | 10 | ||||
-rw-r--r-- | src/net/tmwa/messageout.h | 10 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.h | 2 |
11 files changed, 38 insertions, 38 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index d70dfb16d..35f2ded57 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -433,12 +433,12 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, // An update about a player, potentially including movement. const int id = msg.readInt32(); - const short speed = msg.readInt16(); + const int16_t speed = msg.readInt16(); const uint16_t stunMode = msg.readInt16(); // opt1; uint32_t statusEffects = msg.readInt16(); // opt2; statusEffects |= (static_cast<uint32_t>(msg.readInt16())) << 16; // status.options; Aethyra uses this as misc2 - const short job = msg.readInt16(); + const int16_t job = msg.readInt16(); Being *dstBeing = actorSpriteManager->findBeing(id); @@ -495,7 +495,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, if (guild == 0) dstBeing->clearGuilds(); else - dstBeing->setGuild(Guild::getGuild(static_cast<short>(guild))); + dstBeing->setGuild(Guild::getGuild(static_cast<int16_t>(guild))); } msg.readInt16(); // emblem diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 3a72ffa03..773a9d060 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -253,8 +253,8 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot, outMsg.writeInt8(static_cast<unsigned char>(stats[i])); outMsg.writeInt8(static_cast<unsigned char>(slot)); - outMsg.writeInt16(static_cast<short>(hairColor)); - outMsg.writeInt16(static_cast<short>(hairstyle)); + outMsg.writeInt16(static_cast<int16_t>(hairColor)); + outMsg.writeInt16(static_cast<int16_t>(hairstyle)); if (serverVersion >= 2) outMsg.writeInt8(race); } @@ -309,7 +309,7 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg) msg.skip(2); // Length word const int slots = msg.readInt16(); if (slots > 0 && slots < 30) - loginData.characterSlots = static_cast<short unsigned int>(slots); + loginData.characterSlots = static_cast<uint16_t>(slots); const bool version = msg.readInt8() == 1 && serverVersion > 0; msg.skip(17); // 0 Unused diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 6610dec26..8c455a186 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -129,7 +129,7 @@ void ChatHandler::talk(const std::string &text, { MessageOut outMsg(CMSG_CHAT_MESSAGE2); // Added + 1 in order to let eAthena parse admin commands correctly - outMsg.writeInt16(static_cast<short>(mes.length() + 4 + 3 + 1)); + outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 3 + 1)); outMsg.writeInt8(channel[0]); outMsg.writeInt8(channel[1]); outMsg.writeInt8(channel[2]); @@ -139,7 +139,7 @@ void ChatHandler::talk(const std::string &text, { MessageOut outMsg(CMSG_CHAT_MESSAGE); // Added + 1 in order to let eAthena parse admin commands correctly - outMsg.writeInt16(static_cast<short>(mes.length() + 4 + 1)); + outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 1)); outMsg.writeString(mes, static_cast<int>(mes.length() + 1)); } } @@ -148,7 +148,7 @@ void ChatHandler::talkRaw(const std::string &mes) const { MessageOut outMsg(CMSG_CHAT_MESSAGE); // Added + 1 in order to let eAthena parse admin commands correctly - outMsg.writeInt16(static_cast<short>(mes.length() + 4 + 1)); + outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 1)); outMsg.writeString(mes, static_cast<int>(mes.length() + 1)); } @@ -156,7 +156,7 @@ void ChatHandler::privateMessage(const std::string &recipient, const std::string &text) { MessageOut outMsg(CMSG_CHAT_WHISPER); - outMsg.writeInt16(static_cast<short>(text.length() + 28)); + outMsg.writeInt16(static_cast<int16_t>(text.length() + 28)); outMsg.writeString(recipient, 24); outMsg.writeString(text, static_cast<int>(text.length())); mSentWhispers.push(recipient); @@ -180,13 +180,13 @@ void ChatHandler::sendRaw(const std::string &args) const if (pos != std::string::npos) { str = line.substr(0, pos); - outMsg = new MessageOut(static_cast<short>(atoi(str.c_str()))); + outMsg = new MessageOut(static_cast<int16_t>(atoi(str.c_str()))); line = line.substr(pos + 1); pos = line.find(" "); } else { - outMsg = new MessageOut(static_cast<short>(atoi(line.c_str()))); + outMsg = new MessageOut(static_cast<int16_t>(atoi(line.c_str()))); delete outMsg; return; } @@ -212,7 +212,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line) if (line.length() <= 3) outMsg.writeInt8(static_cast<unsigned char>(i)); else if (line.length() <= 5) - outMsg.writeInt16(static_cast<short>(i)); + outMsg.writeInt16(static_cast<int16_t>(i)); else outMsg.writeInt32(i); } @@ -241,7 +241,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line) outMsg.writeInt8(static_cast<unsigned char>(i)); break; case '2': - outMsg.writeInt16(static_cast<short>(i)); + outMsg.writeInt16(static_cast<int16_t>(i)); break; case '4': outMsg.writeInt32(i); @@ -251,14 +251,14 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line) pos = line.find(","); if (pos != std::string::npos) { - const unsigned short x = static_cast<const unsigned short>( + const uint16_t x = static_cast<const uint16_t>( atoi(data.substr(0, pos).c_str())); data = data.substr(pos + 1); pos = line.find(","); if (pos == std::string::npos) break; - const unsigned short y = static_cast<const unsigned short>( + const uint16_t y = static_cast<const uint16_t>( atoi(data.substr(0, pos).c_str())); const int dir = atoi(data.substr(pos + 1).c_str()); outMsg.writeCoordinates(x, y, diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h index d084350f2..98dcff784 100644 --- a/src/net/tmwa/guildhandler.h +++ b/src/net/tmwa/guildhandler.h @@ -72,6 +72,6 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler extern Ea::GuildTab *guildTab; extern Guild *taGuild; -} +} // namespace TmwAthena -#endif // namespace TmwAthena +#endif diff --git a/src/net/tmwa/messagehandler.h b/src/net/tmwa/messagehandler.h index 9fd27c8ed..70d8dc3f7 100644 --- a/src/net/tmwa/messagehandler.h +++ b/src/net/tmwa/messagehandler.h @@ -56,6 +56,6 @@ class MessageHandler : public Net::MessageHandler typedef const std::auto_ptr<MessageHandler> MessageHandlerPtr; -} +} // namespace TmwAthena -#endif // namespace TmwAthena +#endif diff --git a/src/net/tmwa/messagein.h b/src/net/tmwa/messagein.h index 6fc337ae3..8178e8aa0 100644 --- a/src/net/tmwa/messagein.h +++ b/src/net/tmwa/messagein.h @@ -52,6 +52,6 @@ class MessageIn final : public Net::MessageIn int32_t readInt32(); /**< Reads a long. */ }; -} +} // namespace TmwAthena -#endif // namespace TmwAthena +#endif diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index b0fff0292..2fc0ff2d9 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -39,7 +39,7 @@ namespace TmwAthena { -MessageOut::MessageOut(const short id): +MessageOut::MessageOut(const int16_t id): Net::MessageOut(id), mNetwork(TmwAthena::Network::instance()) { @@ -85,10 +85,10 @@ void MessageOut::writeInt32(const int32_t value) #define LOBYTE(w) (static_cast<unsigned char>(w)) #define HIBYTE(w) (static_cast<unsigned char>(( \ -static_cast<unsigned short>(w)) >> 8)) +static_cast<uint16_t>(w)) >> 8)) -void MessageOut::writeCoordinates(const unsigned short x, - const unsigned short y, +void MessageOut::writeCoordinates(const uint16_t x, + const uint16_t y, unsigned char direction) { DEBUGLOG(strprintf("writeCoordinates: %u,%u %u", @@ -98,7 +98,7 @@ void MessageOut::writeCoordinates(const unsigned short x, mNetwork->mOutSize += 3; mPos += 3; - short temp = x; + int16_t temp = x; temp <<= 6; data[0] = 0; data[1] = 1; diff --git a/src/net/tmwa/messageout.h b/src/net/tmwa/messageout.h index 22a6ae458..119425257 100644 --- a/src/net/tmwa/messageout.h +++ b/src/net/tmwa/messageout.h @@ -46,7 +46,7 @@ class MessageOut final : public Net::MessageOut /** * Constructor. */ - explicit MessageOut(const short id); + explicit MessageOut(const int16_t id); A_DELETE_COPY(MessageOut) @@ -57,8 +57,8 @@ class MessageOut final : public Net::MessageOut /** * Encodes coordinates and direction in 3 bytes. */ - void writeCoordinates(const unsigned short x, - const unsigned short y, + void writeCoordinates(const uint16_t x, + const uint16_t y, unsigned char direction); void resetPos() @@ -70,6 +70,6 @@ class MessageOut final : public Net::MessageOut Network *mNetwork; }; -} +} // namespace TmwAthena -#endif // namespace TmwAthena +#endif diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index dd752af72..417a3633e 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -39,7 +39,7 @@ namespace TmwAthena /** Warning: buffers and other variables are shared, so there can be only one connection active at a time */ -short packet_lengths[] = +int16_t packet_lengths[] = { 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -87,7 +87,7 @@ short packet_lengths[] = }; static const int packet_lengths_size - = static_cast<int>(sizeof(packet_lengths) / sizeof(short)); + = static_cast<int>(sizeof(packet_lengths) / sizeof(int16_t)); static const int messagesSize = 0xffff; Network *Network::mInstance = nullptr; diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index dd05e1b03..7ce018738 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -143,7 +143,7 @@ void PlayerHandler::increaseAttribute(const int attr) const } } -void PlayerHandler::increaseSkill(const unsigned short skillId) const +void PlayerHandler::increaseSkill(const uint16_t skillId) const { if (PlayerInfo::getAttribute(PlayerInfo::SKILL_POINTS) <= 0) return; @@ -176,8 +176,8 @@ void PlayerHandler::setDestination(const int x, const int y, const int direction) const { MessageOut outMsg(CMSG_PLAYER_CHANGE_DEST); - outMsg.writeCoordinates(static_cast<short unsigned int>(x), - static_cast<short unsigned int>(y), + outMsg.writeCoordinates(static_cast<uint16_t>(x), + static_cast<uint16_t>(y), static_cast<unsigned char>(direction)); } diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h index a0c355c40..5e15f5a3a 100644 --- a/src/net/tmwa/playerhandler.h +++ b/src/net/tmwa/playerhandler.h @@ -47,7 +47,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler void emote(const uint8_t emoteId) const override; void increaseAttribute(const int attr) const override; - void increaseSkill(const unsigned short skillId) const override; + void increaseSkill(const uint16_t skillId) const override; void pickUp(const FloorItem *const floorItem) const override; void setDirection(const unsigned char direction) const override; |