From c2efedab22275302f0a10cc197424d345a021d18 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 17 Jun 2012 20:13:48 +0300 Subject: Replace SDL int types to C++ types. --- src/net/tmwa/adminhandler.cpp | 6 +++--- src/net/tmwa/beinghandler.cpp | 28 ++++++++++++++-------------- src/net/tmwa/buysellhandler.cpp | 2 +- src/net/tmwa/charserverhandler.cpp | 4 ++-- src/net/tmwa/chathandler.cpp | 2 +- src/net/tmwa/gamehandler.cpp | 2 +- src/net/tmwa/generalhandler.cpp | 2 +- src/net/tmwa/guildhandler.cpp | 4 ++-- src/net/tmwa/inventoryhandler.cpp | 16 ++++++++-------- src/net/tmwa/itemhandler.cpp | 2 +- src/net/tmwa/loginhandler.cpp | 2 +- src/net/tmwa/messagein.cpp | 18 +++++++++--------- src/net/tmwa/messagein.h | 2 +- src/net/tmwa/messageout.cpp | 16 ++++++++-------- src/net/tmwa/messageout.h | 4 ++-- src/net/tmwa/network.cpp | 12 ++++++------ src/net/tmwa/network.h | 4 ++-- src/net/tmwa/npchandler.cpp | 16 ++++++++-------- src/net/tmwa/partyhandler.cpp | 4 ++-- src/net/tmwa/playerhandler.cpp | 8 ++++---- src/net/tmwa/playerhandler.h | 4 ++-- src/net/tmwa/specialhandler.cpp | 16 ++++++++-------- src/net/tmwa/tradehandler.cpp | 4 ++-- 23 files changed, 89 insertions(+), 89 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index acf869f25..3b7ed813f 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -50,7 +50,7 @@ namespace TmwAthena AdminHandler::AdminHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_ADMIN_KICK_ACK, 0 @@ -78,14 +78,14 @@ void AdminHandler::handleMessage(Net::MessageIn &msg) void AdminHandler::announce(const std::string &text) { MessageOut outMsg(CMSG_ADMIN_ANNOUNCE); - outMsg.writeInt16(static_cast(text.length() + 4)); + outMsg.writeInt16(static_cast(text.length() + 4)); outMsg.writeString(text, static_cast(text.length())); } void AdminHandler::localAnnounce(const std::string &text) { MessageOut outMsg(CMSG_ADMIN_LOCAL_ANNOUNCE); - outMsg.writeInt16(static_cast(text.length() + 4)); + outMsg.writeInt16(static_cast(text.length() + 4)); outMsg.writeString(text, static_cast(text.length())); } diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 61924f1f4..1096f9d39 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -64,7 +64,7 @@ namespace TmwAthena BeingHandler::BeingHandler(bool enableSync): Ea::BeingHandler(enableSync) { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_BEING_VISIBLE, SMSG_BEING_MOVE, @@ -300,7 +300,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg, bool look2) switch (type) { case 0: // change race - dstBeing->setSubtype(static_cast(id)); + dstBeing->setSubtype(static_cast(id)); break; case 1: // eAthena LOOK_HAIR dstBeing->setSpriteID(SPRITE_HAIR, id *-1); @@ -435,9 +435,9 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) if (!actorSpriteManager || !player_node) return; - Uint16 headTop, headMid, headBottom; - Uint16 weapon, shield; - Uint16 gmstatus; + uint16_t headTop, headMid, headBottom; + uint16_t weapon, shield; + uint16_t gmstatus; int level; int guild; Being *dstBeing; @@ -448,9 +448,9 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) // An update about a player, potentially including movement. int id = msg.readInt32(); short speed = msg.readInt16(); - Uint16 stunMode = msg.readInt16(); // opt1; Aethyra use this as cape - Uint32 statusEffects = msg.readInt16(); // opt2; Aethyra use this as misc1 - statusEffects |= (static_cast(msg.readInt16())) + uint16_t stunMode = msg.readInt16(); // opt1; Aethyra use this as cape + uint32_t statusEffects = msg.readInt16(); // opt2; Aethyra use this as misc1 + statusEffects |= (static_cast(msg.readInt16())) << 16; // status.options; Aethyra uses this as misc2 short job = msg.readInt16(); @@ -467,7 +467,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) return; } - Uint8 dir = dstBeing->getDirectionDelayed(); + uint8_t dir = dstBeing->getDirectionDelayed(); if (dir) { if (dir != dstBeing->getDirection()) @@ -548,7 +548,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) if (msgType == 3) { - Uint16 srcX, srcY, dstX, dstY; + uint16_t srcX, srcY, dstX, dstY; msg.readCoordinatePair(srcX, srcY, dstX, dstY); player_node->followMoveTo(dstBeing, srcX, srcY, dstX, dstY); @@ -564,7 +564,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) int d = dstBeing->calcDirection(dstX, dstY); if (d && dstBeing->getDirection() != d) - dstBeing->setDirectionDelayed(static_cast(d)); + dstBeing->setDirectionDelayed(static_cast(d)); } if (player_node->getCurrentAction() != Being::STAND) @@ -577,8 +577,8 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) } else { -// Uint8 dir; - Uint16 x, y; +// uint8_t dir; + uint16_t x, y; msg.readCoordinates(x, y, dir); dstBeing->setTileCoords(x, y); dstBeing->setDirection(dir); @@ -644,7 +644,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) } dstBeing->setStunMode(stunMode); - dstBeing->setStatusEffectBlock(0, static_cast( + dstBeing->setStatusEffectBlock(0, static_cast( (statusEffects >> 16) & 0xffff)); dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff); diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index c3e489350..664953e4e 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -58,7 +58,7 @@ namespace TmwAthena BuySellHandler::BuySellHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_NPC_BUY_SELL_CHOICE, SMSG_NPC_BUY, diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index e18c33a5a..3146c994f 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -55,7 +55,7 @@ extern ServerInfo mapServer; CharServerHandler::CharServerHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_CHAR_LOGIN, SMSG_CHAR_LOGIN_ERROR, @@ -203,7 +203,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, msg.readInt16(); // speed tempPlayer->setSubtype(msg.readInt16()); // class (used for race) int hairStyle = msg.readInt16(); - Uint16 weapon = msg.readInt16(); // server not used it. may be need use? + uint16_t weapon = msg.readInt16(); // server not used it. may be need use? tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true); data.mAttributes[LEVEL] = msg.readInt16(); diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index b3bf8b536..81c7ea5b6 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -52,7 +52,7 @@ namespace TmwAthena ChatHandler::ChatHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_BEING_CHAT, SMSG_PLAYER_CHAT, diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 12bfe24cf..a6096d4d9 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -46,7 +46,7 @@ extern ServerInfo mapServer; GameHandler::GameHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_MAP_LOGIN_SUCCESS, SMSG_SERVER_PING, diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 466d382fc..9839dfe10 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -96,7 +96,7 @@ GeneralHandler::GeneralHandler(): mSpecialHandler(new SpecialHandler), mTradeHandler(new TradeHandler) { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_CONNECTION_PROBLEM, 0 diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 5e2ac528f..8bd8e9754 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -38,7 +38,7 @@ namespace TmwAthena GuildHandler::GuildHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_GUILD_CREATE_RESPONSE, SMSG_GUILD_POSITION_INFO, @@ -264,7 +264,7 @@ void GuildHandler::chat(int guildId A_UNUSED, const std::string &text) std::string str = player_node->getName() + " : " + text; MessageOut msg(CMSG_GUILD_MESSAGE); - msg.writeInt16(static_cast(str.size() + 4)); + msg.writeInt16(static_cast(str.size() + 4)); msg.writeString(str, static_cast(str.length())); } diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index db670a17b..9977df34d 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -39,7 +39,7 @@ namespace TmwAthena InventoryHandler::InventoryHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_PLAYER_INVENTORY, SMSG_PLAYER_INVENTORY_ADD, @@ -143,7 +143,7 @@ void InventoryHandler::equipItem(const Item *item) return; MessageOut outMsg(CMSG_PLAYER_EQUIP); - outMsg.writeInt16(static_cast( + outMsg.writeInt16(static_cast( item->getInvIndex() + INVENTORY_OFFSET)); outMsg.writeInt16(0); } @@ -154,7 +154,7 @@ void InventoryHandler::unequipItem(const Item *item) return; MessageOut outMsg(CMSG_PLAYER_UNEQUIP); - outMsg.writeInt16(static_cast( + outMsg.writeInt16(static_cast( item->getInvIndex() + INVENTORY_OFFSET)); } @@ -164,7 +164,7 @@ void InventoryHandler::useItem(const Item *item) return; MessageOut outMsg(CMSG_PLAYER_INVENTORY_USE); - outMsg.writeInt16(static_cast( + outMsg.writeInt16(static_cast( item->getInvIndex() + INVENTORY_OFFSET)); outMsg.writeInt32(item->getId()); // unused } @@ -176,9 +176,9 @@ void InventoryHandler::dropItem(const Item *item, int amount) // TODO: Fix wrong coordinates of drops, serverside? (what's wrong here?) MessageOut outMsg(CMSG_PLAYER_INVENTORY_DROP); - outMsg.writeInt16(static_cast( + outMsg.writeInt16(static_cast( item->getInvIndex() + INVENTORY_OFFSET)); - outMsg.writeInt16(static_cast(amount)); + outMsg.writeInt16(static_cast(amount)); } void InventoryHandler::closeStorage(int type A_UNUSED) @@ -192,14 +192,14 @@ void InventoryHandler::moveItem2(int source, int slot, int amount, if (source == Inventory::INVENTORY && destination == Inventory::STORAGE) { MessageOut outMsg(CMSG_MOVE_TO_STORAGE); - outMsg.writeInt16(static_cast(slot + INVENTORY_OFFSET)); + outMsg.writeInt16(static_cast(slot + INVENTORY_OFFSET)); outMsg.writeInt32(amount); } else if (source == Inventory::STORAGE && destination == Inventory::INVENTORY) { MessageOut outMsg(CSMG_MOVE_FROM_STORAGE); - outMsg.writeInt16(static_cast(slot + STORAGE_OFFSET)); + outMsg.writeInt16(static_cast(slot + STORAGE_OFFSET)); outMsg.writeInt32(amount); } } diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp index d84d2f38d..58c564d77 100644 --- a/src/net/tmwa/itemhandler.cpp +++ b/src/net/tmwa/itemhandler.cpp @@ -33,7 +33,7 @@ namespace TmwAthena ItemHandler::ItemHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_ITEM_VISIBLE, SMSG_ITEM_DROPPED, diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index e7fcc9cc6..67c6aa932 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -45,7 +45,7 @@ extern ServerInfo charServer; LoginHandler::LoginHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_UPDATE_HOST, SMSG_UPDATE_HOST2, diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp index b8bba342f..698d7211c 100644 --- a/src/net/tmwa/messagein.cpp +++ b/src/net/tmwa/messagein.cpp @@ -43,17 +43,17 @@ MessageIn::MessageIn(const char *data, unsigned int length): mId = readInt16(); } -Sint16 MessageIn::readInt16() +int16_t MessageIn::readInt16() { - Sint16 value = -1; + int16_t value = -1; if (mPos + 2 <= mLength) { #if SDL_BYTEORDER == SDL_BIG_ENDIAN - Sint16 swap; - memcpy(&swap, mData + mPos, sizeof(Sint16)); + int16_t swap; + memcpy(&swap, mData + mPos, sizeof(int16_t)); value = SDL_Swap16(swap); #else - memcpy(&value, mData + mPos, sizeof(Sint16)); + memcpy(&value, mData + mPos, sizeof(int16_t)); #endif } mPos += 2; @@ -64,15 +64,15 @@ Sint16 MessageIn::readInt16() int MessageIn::readInt32() { - Sint32 value = -1; + int32_t value = -1; if (mPos + 4 <= mLength) { #if SDL_BYTEORDER == SDL_BIG_ENDIAN - Sint32 swap; - memcpy(&swap, mData + mPos, sizeof(Sint32)); + int32_t swap; + memcpy(&swap, mData + mPos, sizeof(int32_t)); value = SDL_Swap32(swap); #else - memcpy(&value, mData + mPos, sizeof(Sint32)); + memcpy(&value, mData + mPos, sizeof(int32_t)); #endif } mPos += 4; diff --git a/src/net/tmwa/messagein.h b/src/net/tmwa/messagein.h index 29b17d8ba..c8dfb5bff 100644 --- a/src/net/tmwa/messagein.h +++ b/src/net/tmwa/messagein.h @@ -44,7 +44,7 @@ namespace TmwAthena */ MessageIn(const char *data, unsigned int length); - Sint16 readInt16(); /**< Reads a short. */ + int16_t readInt16(); /**< Reads a short. */ int readInt32(); /**< Reads a long. */ }; diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index 790611381..9e9e264eb 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -56,29 +56,29 @@ void MessageOut::expand(size_t bytes) PacketCounters::incOutBytes(static_cast(bytes)); } -void MessageOut::writeInt16(Sint16 value) +void MessageOut::writeInt16(int16_t value) { DEBUGLOG("writeInt16: " + toString(static_cast(value))); expand(2); #if SDL_BYTEORDER == SDL_BIG_ENDIAN - Sint16 swap = SDL_Swap16(value); - memcpy(mData + mPos, &swap, sizeof(Sint16)); + int16_t swap = SDL_Swap16(value); + memcpy(mData + mPos, &swap, sizeof(int16_t)); #else - memcpy(mData + mPos, &value, sizeof(Sint16)); + memcpy(mData + mPos, &value, sizeof(int16_t)); #endif mPos += 2; PacketCounters::incOutBytes(2); } -void MessageOut::writeInt32(Sint32 value) +void MessageOut::writeInt32(int32_t value) { DEBUGLOG("writeInt32: " + toString(value)); expand(4); #if SDL_BYTEORDER == SDL_BIG_ENDIAN - Sint32 swap = SDL_Swap32(value); - memcpy(mData + mPos, &swap, sizeof(Sint32)); + int32_t swap = SDL_Swap32(value); + memcpy(mData + mPos, &swap, sizeof(int32_t)); #else - memcpy(mData + mPos, &value, sizeof(Sint32)); + memcpy(mData + mPos, &value, sizeof(int32_t)); #endif mPos += 4; PacketCounters::incOutBytes(4); diff --git a/src/net/tmwa/messageout.h b/src/net/tmwa/messageout.h index 5d1e911b6..d283de4ca 100644 --- a/src/net/tmwa/messageout.h +++ b/src/net/tmwa/messageout.h @@ -46,9 +46,9 @@ class MessageOut : public Net::MessageOut */ MessageOut(short id); - void writeInt16(Sint16 value); /**< Writes a short. */ + void writeInt16(int16_t value); /**< Writes a short. */ - void writeInt32(Sint32 value); /**< Writes a long. */ + void writeInt32(int32_t value); /**< Writes a long. */ /** * Encodes coordinates and direction in 3 bytes. diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index c54972253..c25774d9b 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -203,7 +203,7 @@ void Network::registerHandler(MessageHandler *handler) if (!handler) return; - for (const Uint16 *i = handler->handledMessages; *i; ++i) + for (const uint16_t *i = handler->handledMessages; *i; ++i) mMessageHandlers[*i] = handler; handler->setNetwork(this); @@ -214,7 +214,7 @@ void Network::unregisterHandler(MessageHandler *handler) if (!handler) return; - for (const Uint16 *i = handler->handledMessages; *i; ++i) + for (const uint16_t *i = handler->handledMessages; *i; ++i) mMessageHandlers.erase(*i); handler->setNetwork(nullptr); @@ -408,7 +408,7 @@ void Network::receive() { // TODO Try to get this to block all the time while still being able // to escape the loop - int numReady = SDLNet_CheckSockets(set, (static_cast(500))); + int numReady = SDLNet_CheckSockets(set, (static_cast(500))); int ret; switch (numReady) { @@ -486,12 +486,12 @@ void Network::setError(const std::string &error) mState = NET_ERROR; } -Uint16 Network::readWord(int pos) +uint16_t Network::readWord(int pos) { #if SDL_BYTEORDER == SDL_BIG_ENDIAN - return SDL_Swap16((*(Uint16*)(mInBuffer + (pos)))); + return SDL_Swap16((*(uint16_t*)(mInBuffer + (pos)))); #else - return (*reinterpret_cast(mInBuffer + (pos))); + return (*reinterpret_cast(mInBuffer + (pos))); #endif } diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index c0ec6ef3c..2dc91e509 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -105,7 +105,7 @@ class Network void setError(const std::string &error); - Uint16 readWord(int pos); + uint16_t readWord(int pos); bool realConnect(); @@ -126,7 +126,7 @@ class Network SDL_Thread *mWorkerThread; SDL_mutex *mMutex; - typedef std::map MessageHandlers; + typedef std::map MessageHandlers; typedef MessageHandlers::iterator MessageHandlerIterator; MessageHandlers mMessageHandlers; diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 378d92dfe..ec3ef48b8 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -47,7 +47,7 @@ namespace TmwAthena NpcHandler::NpcHandler() : mRequestLang(false) { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_NPC_CHOICE, SMSG_NPC_MESSAGE, @@ -156,7 +156,7 @@ void NpcHandler::integerInput(int npcId, int value) void NpcHandler::stringInput(int npcId, const std::string &value) { MessageOut outMsg(CMSG_NPC_STR_RESPONSE); - outMsg.writeInt16(static_cast(value.length() + 9)); + outMsg.writeInt16(static_cast(value.length() + 9)); outMsg.writeInt32(npcId); outMsg.writeString(value, static_cast(value.length())); outMsg.writeInt8(0); // Prevent problems with string reading @@ -183,16 +183,16 @@ void NpcHandler::buyItem(int beingId A_UNUSED, int itemId, if (serverVersion > 0) { outMsg.writeInt16(10); // One item (length of packet) - outMsg.writeInt16(static_cast(amount)); - outMsg.writeInt16(static_cast(itemId)); + outMsg.writeInt16(static_cast(amount)); + outMsg.writeInt16(static_cast(itemId)); outMsg.writeInt8(color); outMsg.writeInt8(0); } else { outMsg.writeInt16(8); // One item (length of packet) - outMsg.writeInt16(static_cast(amount)); - outMsg.writeInt16(static_cast(itemId)); + outMsg.writeInt16(static_cast(amount)); + outMsg.writeInt16(static_cast(itemId)); } } @@ -200,8 +200,8 @@ void NpcHandler::sellItem(int beingId A_UNUSED, int itemId, int amount) { MessageOut outMsg(CMSG_NPC_SELL_REQUEST); outMsg.writeInt16(8); // One item (length of packet) - outMsg.writeInt16(static_cast(itemId + INVENTORY_OFFSET)); - outMsg.writeInt16(static_cast(amount)); + outMsg.writeInt16(static_cast(itemId + INVENTORY_OFFSET)); + outMsg.writeInt16(static_cast(amount)); } int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength) diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index b8f3a07e1..d1429a815 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -43,7 +43,7 @@ namespace TmwAthena PartyHandler::PartyHandler() : Ea::PartyHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_PARTY_CREATE, SMSG_PARTY_INFO, @@ -183,7 +183,7 @@ void PartyHandler::kick(const std::string &name) void PartyHandler::chat(const std::string &text) { MessageOut outMsg(CMSG_PARTY_MESSAGE); - outMsg.writeInt16(static_cast(text.length() + 4)); + outMsg.writeInt16(static_cast(text.length() + 4)); outMsg.writeString(text, static_cast(text.length())); } diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index eb9dac6f0..5c0b8d950 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -43,7 +43,7 @@ namespace TmwAthena PlayerHandler::PlayerHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_WALK_RESPONSE, SMSG_PLAYER_WARP, @@ -125,7 +125,7 @@ void PlayerHandler::stopAttack() MessageOut outMsg(CMSG_PLAYER_STOP_ATTACK); } -void PlayerHandler::emote(Uint8 emoteId) +void PlayerHandler::emote(uint8_t emoteId) { MessageOut outMsg(CMSG_PLAYER_EMOTE); outMsg.writeInt8(emoteId); @@ -136,7 +136,7 @@ void PlayerHandler::increaseAttribute(int attr) if (attr >= STR && attr <= LUK) { MessageOut outMsg(CMSG_STAT_UPDATE_REQUEST); - outMsg.writeInt16(static_cast(attr)); + outMsg.writeInt16(static_cast(attr)); outMsg.writeInt8(1); } } @@ -277,7 +277,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) delete [] start; } -void PlayerHandler::updateStatus(Uint8 status) +void PlayerHandler::updateStatus(uint8_t status) { MessageOut outMsg(CMSG_SET_STATUS); outMsg.writeInt8(status); diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h index 14aa191f6..702436d28 100644 --- a/src/net/tmwa/playerhandler.h +++ b/src/net/tmwa/playerhandler.h @@ -42,7 +42,7 @@ class PlayerHandler : public MessageHandler, public Ea::PlayerHandler void attack(int id, bool keep = false); void stopAttack(); - void emote(Uint8 emoteId); + void emote(uint8_t emoteId); void increaseAttribute(int attr); void increaseSkill(unsigned short skillId); @@ -53,7 +53,7 @@ class PlayerHandler : public MessageHandler, public Ea::PlayerHandler void changeAction(Being::Action action); void processOnlineList(Net::MessageIn &msg); void requestOnlineList(); - void updateStatus(Uint8 status); + void updateStatus(uint8_t status); void respawn(); }; diff --git a/src/net/tmwa/specialhandler.cpp b/src/net/tmwa/specialhandler.cpp index 2941422d0..8033d7a1d 100644 --- a/src/net/tmwa/specialhandler.cpp +++ b/src/net/tmwa/specialhandler.cpp @@ -37,7 +37,7 @@ namespace TmwAthena SpecialHandler::SpecialHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_PLAYER_SKILLS, SMSG_SKILL_FAILED, @@ -72,24 +72,24 @@ void SpecialHandler::handleMessage(Net::MessageIn &msg) void SpecialHandler::useBeing(int id, int level, int beingId) { MessageOut outMsg(CMSG_SKILL_USE_BEING); - outMsg.writeInt16(static_cast(id)); - outMsg.writeInt16(static_cast(level)); + outMsg.writeInt16(static_cast(id)); + outMsg.writeInt16(static_cast(level)); outMsg.writeInt32(beingId); } void SpecialHandler::usePos(int id, int level, int x, int y) { MessageOut outMsg(CMSG_SKILL_USE_POSITION); - outMsg.writeInt16(static_cast(level)); - outMsg.writeInt16(static_cast(id)); - outMsg.writeInt16(static_cast(x)); - outMsg.writeInt16(static_cast(y)); + outMsg.writeInt16(static_cast(level)); + outMsg.writeInt16(static_cast(id)); + outMsg.writeInt16(static_cast(x)); + outMsg.writeInt16(static_cast(y)); } void SpecialHandler::useMap(int id, const std::string &map) { MessageOut outMsg(CMSG_SKILL_USE_MAP); - outMsg.writeInt16(static_cast(id)); + outMsg.writeInt16(static_cast(id)); outMsg.writeString(map, 16); } diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 1a44e4956..d4c1e1e08 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -41,7 +41,7 @@ namespace TmwAthena TradeHandler::TradeHandler() { - static const Uint16 _messages[] = + static const uint16_t _messages[] = { SMSG_TRADE_REQUEST, SMSG_TRADE_RESPONSE, @@ -118,7 +118,7 @@ void TradeHandler::addItem(Item *item, int amount) return; MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST); - outMsg.writeInt16(static_cast( + outMsg.writeInt16(static_cast( item->getInvIndex() + INVENTORY_OFFSET)); outMsg.writeInt32(amount); } -- cgit v1.2.3-60-g2f50