summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-06-17 20:13:48 +0300
committerAndrei Karas <akaras@inbox.ru>2012-06-17 20:13:48 +0300
commitc2efedab22275302f0a10cc197424d345a021d18 (patch)
tree7488abbb3655451a3f6a1621e0708f72011af5f6 /src/net/tmwa
parent79aba82be3de5b6b571e2f59f7a34ded4b03160f (diff)
downloadmanaverse-c2efedab22275302f0a10cc197424d345a021d18.tar.gz
manaverse-c2efedab22275302f0a10cc197424d345a021d18.tar.bz2
manaverse-c2efedab22275302f0a10cc197424d345a021d18.tar.xz
manaverse-c2efedab22275302f0a10cc197424d345a021d18.zip
Replace SDL int types to C++ types.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/adminhandler.cpp6
-rw-r--r--src/net/tmwa/beinghandler.cpp28
-rw-r--r--src/net/tmwa/buysellhandler.cpp2
-rw-r--r--src/net/tmwa/charserverhandler.cpp4
-rw-r--r--src/net/tmwa/chathandler.cpp2
-rw-r--r--src/net/tmwa/gamehandler.cpp2
-rw-r--r--src/net/tmwa/generalhandler.cpp2
-rw-r--r--src/net/tmwa/guildhandler.cpp4
-rw-r--r--src/net/tmwa/inventoryhandler.cpp16
-rw-r--r--src/net/tmwa/itemhandler.cpp2
-rw-r--r--src/net/tmwa/loginhandler.cpp2
-rw-r--r--src/net/tmwa/messagein.cpp18
-rw-r--r--src/net/tmwa/messagein.h2
-rw-r--r--src/net/tmwa/messageout.cpp16
-rw-r--r--src/net/tmwa/messageout.h4
-rw-r--r--src/net/tmwa/network.cpp12
-rw-r--r--src/net/tmwa/network.h4
-rw-r--r--src/net/tmwa/npchandler.cpp16
-rw-r--r--src/net/tmwa/partyhandler.cpp4
-rw-r--r--src/net/tmwa/playerhandler.cpp8
-rw-r--r--src/net/tmwa/playerhandler.h4
-rw-r--r--src/net/tmwa/specialhandler.cpp16
-rw-r--r--src/net/tmwa/tradehandler.cpp4
23 files changed, 89 insertions, 89 deletions
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<Sint16>(text.length() + 4));
+ outMsg.writeInt16(static_cast<int16_t>(text.length() + 4));
outMsg.writeString(text, static_cast<int>(text.length()));
}
void AdminHandler::localAnnounce(const std::string &text)
{
MessageOut outMsg(CMSG_ADMIN_LOCAL_ANNOUNCE);
- outMsg.writeInt16(static_cast<Sint16>(text.length() + 4));
+ outMsg.writeInt16(static_cast<int16_t>(text.length() + 4));
outMsg.writeString(text, static_cast<int>(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<Uint16>(id));
+ dstBeing->setSubtype(static_cast<uint16_t>(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<Uint32>(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<uint32_t>(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<Uint8>(d));
+ dstBeing->setDirectionDelayed(static_cast<uint8_t>(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<Uint16>(
+ dstBeing->setStatusEffectBlock(0, static_cast<uint16_t>(
(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<Uint16>(str.size() + 4));
+ msg.writeInt16(static_cast<uint16_t>(str.size() + 4));
msg.writeString(str, static_cast<int>(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<Sint16>(
+ outMsg.writeInt16(static_cast<int16_t>(
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<Sint16>(
+ outMsg.writeInt16(static_cast<int16_t>(
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<Sint16>(
+ outMsg.writeInt16(static_cast<int16_t>(
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<Sint16>(
+ outMsg.writeInt16(static_cast<int16_t>(
item->getInvIndex() + INVENTORY_OFFSET));
- outMsg.writeInt16(static_cast<Sint16>(amount));
+ outMsg.writeInt16(static_cast<int16_t>(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<Sint16>(slot + INVENTORY_OFFSET));
+ outMsg.writeInt16(static_cast<int16_t>(slot + INVENTORY_OFFSET));
outMsg.writeInt32(amount);
}
else if (source == Inventory::STORAGE
&& destination == Inventory::INVENTORY)
{
MessageOut outMsg(CSMG_MOVE_FROM_STORAGE);
- outMsg.writeInt16(static_cast<Sint16>(slot + STORAGE_OFFSET));
+ outMsg.writeInt16(static_cast<int16_t>(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<int>(bytes));
}
-void MessageOut::writeInt16(Sint16 value)
+void MessageOut::writeInt16(int16_t value)
{
DEBUGLOG("writeInt16: " + toString(static_cast<int>(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<Uint32>(500)));
+ int numReady = SDLNet_CheckSockets(set, (static_cast<uint32_t>(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<Uint16*>(mInBuffer + (pos)));
+ return (*reinterpret_cast<uint16_t*>(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<Uint16, MessageHandler*> MessageHandlers;
+ typedef std::map<uint16_t, MessageHandler*> 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<Sint16>(value.length() + 9));
+ outMsg.writeInt16(static_cast<int16_t>(value.length() + 9));
outMsg.writeInt32(npcId);
outMsg.writeString(value, static_cast<int>(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<Sint16>(amount));
- outMsg.writeInt16(static_cast<Sint16>(itemId));
+ outMsg.writeInt16(static_cast<int16_t>(amount));
+ outMsg.writeInt16(static_cast<int16_t>(itemId));
outMsg.writeInt8(color);
outMsg.writeInt8(0);
}
else
{
outMsg.writeInt16(8); // One item (length of packet)
- outMsg.writeInt16(static_cast<Sint16>(amount));
- outMsg.writeInt16(static_cast<Sint16>(itemId));
+ outMsg.writeInt16(static_cast<int16_t>(amount));
+ outMsg.writeInt16(static_cast<int16_t>(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<Sint16>(itemId + INVENTORY_OFFSET));
- outMsg.writeInt16(static_cast<Sint16>(amount));
+ outMsg.writeInt16(static_cast<int16_t>(itemId + INVENTORY_OFFSET));
+ outMsg.writeInt16(static_cast<int16_t>(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<Sint16>(text.length() + 4));
+ outMsg.writeInt16(static_cast<int16_t>(text.length() + 4));
outMsg.writeString(text, static_cast<int>(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<Sint16>(attr));
+ outMsg.writeInt16(static_cast<int16_t>(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<Sint16>(id));
- outMsg.writeInt16(static_cast<Sint16>(level));
+ outMsg.writeInt16(static_cast<int16_t>(id));
+ outMsg.writeInt16(static_cast<int16_t>(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<Sint16>(level));
- outMsg.writeInt16(static_cast<Sint16>(id));
- outMsg.writeInt16(static_cast<Sint16>(x));
- outMsg.writeInt16(static_cast<Sint16>(y));
+ outMsg.writeInt16(static_cast<int16_t>(level));
+ outMsg.writeInt16(static_cast<int16_t>(id));
+ outMsg.writeInt16(static_cast<int16_t>(x));
+ outMsg.writeInt16(static_cast<int16_t>(y));
}
void SpecialHandler::useMap(int id, const std::string &map)
{
MessageOut outMsg(CMSG_SKILL_USE_MAP);
- outMsg.writeInt16(static_cast<Sint16>(id));
+ outMsg.writeInt16(static_cast<int16_t>(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<Sint16>(
+ outMsg.writeInt16(static_cast<int16_t>(
item->getInvIndex() + INVENTORY_OFFSET));
outMsg.writeInt32(amount);
}