summaryrefslogtreecommitdiff
path: root/src/net
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
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')
-rw-r--r--src/net/download.cpp2
-rw-r--r--src/net/download.h2
-rw-r--r--src/net/ea/beinghandler.cpp36
-rw-r--r--src/net/ea/gamehandler.cpp2
-rw-r--r--src/net/ea/playerhandler.cpp2
-rw-r--r--src/net/manaserv/beinghandler.cpp2
-rw-r--r--src/net/manaserv/buysellhandler.cpp2
-rw-r--r--src/net/manaserv/charhandler.cpp2
-rw-r--r--src/net/manaserv/chathandler.cpp2
-rw-r--r--src/net/manaserv/effecthandler.cpp6
-rw-r--r--src/net/manaserv/gamehandler.cpp2
-rw-r--r--src/net/manaserv/guildhandler.cpp2
-rw-r--r--src/net/manaserv/inventoryhandler.cpp2
-rw-r--r--src/net/manaserv/itemhandler.cpp2
-rw-r--r--src/net/manaserv/loginhandler.cpp2
-rw-r--r--src/net/manaserv/messagein.cpp4
-rw-r--r--src/net/manaserv/messagein.h2
-rw-r--r--src/net/manaserv/messageout.cpp4
-rw-r--r--src/net/manaserv/messageout.h4
-rw-r--r--src/net/manaserv/network.cpp4
-rw-r--r--src/net/manaserv/npchandler.cpp2
-rw-r--r--src/net/manaserv/partyhandler.cpp2
-rw-r--r--src/net/manaserv/playerhandler.cpp8
-rw-r--r--src/net/manaserv/playerhandler.h4
-rw-r--r--src/net/manaserv/tradehandler.cpp2
-rw-r--r--src/net/messagehandler.h2
-rw-r--r--src/net/messagein.cpp14
-rw-r--r--src/net/messagein.h10
-rw-r--r--src/net/messageout.cpp2
-rw-r--r--src/net/messageout.h6
-rw-r--r--src/net/playerhandler.h4
-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
54 files changed, 160 insertions, 160 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp
index a4eb31603..77ca69fa2 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -117,7 +117,7 @@ void Download::noCache()
addHeader("Cache-Control: no-cache");
}
-void Download::setFile(const std::string &filename, Sint64 adler32)
+void Download::setFile(const std::string &filename, int64_t adler32)
{
mOptions.memoryWrite = 0;
mFileName = filename;
diff --git a/src/net/download.h b/src/net/download.h
index 90e9777ae..021daae32 100644
--- a/src/net/download.h
+++ b/src/net/download.h
@@ -66,7 +66,7 @@ class Download
*/
void noCache();
- void setFile(const std::string &filename, Sint64 adler32 = -1);
+ void setFile(const std::string &filename, int64_t adler32 = -1);
void setWriteFunction(WriteFunction write);
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 1e73f5670..c5d722db5 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -117,11 +117,11 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible)
int id;
short job, speed, gender;
- Uint16 headTop, headMid, headBottom;
- Uint16 shoes, gloves;
- Uint16 weapon, shield;
- Uint16 stunMode;
- Uint32 statusEffects;
+ uint16_t headTop, headMid, headBottom;
+ uint16_t shoes, gloves;
+ uint16_t weapon, shield;
+ uint16_t stunMode;
+ uint32_t statusEffects;
Being *dstBeing;
int hairStyle, hairColor;
int spawnId;
@@ -136,7 +136,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible)
speed = msg.readInt16();
stunMode = msg.readInt16(); // opt1
statusEffects = msg.readInt16(); // opt2
- statusEffects |= (static_cast<Uint32>(msg.readInt16())) << 16; // option
+ statusEffects |= (static_cast<uint32_t>(msg.readInt16())) << 16; // option
job = msg.readInt16(); // class
dstBeing = actorSpriteManager->findBeing(id);
@@ -297,7 +297,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible)
if (!visible)
{
- Uint16 srcX, srcY, dstX, dstY;
+ uint16_t srcX, srcY, dstX, dstY;
msg.readCoordinatePair(srcX, srcY, dstX, dstY);
dstBeing->setAction(Being::STAND);
dstBeing->setTileCoords(srcX, srcY);
@@ -305,8 +305,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible)
}
else
{
- Uint8 dir;
- Uint16 x, y;
+ uint8_t dir;
+ uint16_t x, y;
msg.readCoordinates(x, y, dir);
dstBeing->setTileCoords(x, y);
@@ -333,7 +333,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible)
msg.readInt16();
dstBeing->setStunMode(stunMode);
- dstBeing->setStatusEffectBlock(0, static_cast<Uint16>(
+ dstBeing->setStatusEffectBlock(0, static_cast<uint16_t>(
(statusEffects >> 16) & 0xffff));
dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff);
@@ -360,7 +360,7 @@ void BeingHandler::processBeingMove2(Net::MessageIn &msg)
if (!dstBeing)
return;
- Uint16 srcX, srcY, dstX, dstY;
+ uint16_t srcX, srcY, dstX, dstY;
msg.readCoordinatePair(srcX, srcY, dstX, dstY);
msg.readInt32(); // Server tick
@@ -565,7 +565,7 @@ void BeingHandler::processBeingSelfEffect(Net::MessageIn &msg)
int id;
- id = static_cast<Uint32>(msg.readInt32());
+ id = static_cast<uint32_t>(msg.readInt32());
Being* being = actorSpriteManager->findBeing(id);
if (!being)
return;
@@ -719,7 +719,7 @@ void BeingHandler::processPlayerStop(Net::MessageIn &msg)
Being *dstBeing = actorSpriteManager->findBeing(id);
if (dstBeing)
{
- Uint16 x, y;
+ uint16_t x, y;
x = msg.readInt16();
y = msg.readInt16();
dstBeing->setTileCoords(x, y);
@@ -753,13 +753,13 @@ void BeingHandler::processPlaterStatusChange(Net::MessageIn &msg)
if (!dstBeing)
return;
- Uint16 stunMode = msg.readInt16();
- Uint32 statusEffects = msg.readInt16();
- statusEffects |= (static_cast<Uint32>(msg.readInt16())) << 16;
+ uint16_t stunMode = msg.readInt16();
+ uint32_t statusEffects = msg.readInt16();
+ statusEffects |= (static_cast<uint32_t>(msg.readInt16())) << 16;
msg.readInt8(); // Unused?
dstBeing->setStunMode(stunMode);
- dstBeing->setStatusEffectBlock(0, static_cast<Uint16>(
+ dstBeing->setStatusEffectBlock(0, static_cast<uint16_t>(
(statusEffects >> 16) & 0xffff));
dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff);
}
@@ -770,7 +770,7 @@ void BeingHandler::processBeingStatusChange(Net::MessageIn &msg)
return;
// Status change
- Uint16 status = msg.readInt16();
+ uint16_t status = msg.readInt16();
int id = msg.readInt32();
int flag = msg.readInt8(); // 0: stop, 1: start
diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp
index fe6c39645..69f4089ad 100644
--- a/src/net/ea/gamehandler.cpp
+++ b/src/net/ea/gamehandler.cpp
@@ -74,7 +74,7 @@ void GameHandler::setMap(const std::string map)
void GameHandler::processMapLogin(Net::MessageIn &msg)
{
unsigned char direction;
- Uint16 x, y;
+ uint16_t x, y;
msg.readInt32(); // server tick
msg.readCoordinates(x, y, direction);
msg.skip(2); // 0x0505
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 8f4cfd411..b31f9aa2f 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -182,7 +182,7 @@ void PlayerHandler::processWalkResponse(Net::MessageIn &msg)
* and that the server will send a correction notice
* otherwise.
*/
- Uint16 srcX, srcY, dstX, dstY;
+ uint16_t srcX, srcY, dstX, dstY;
msg.readInt32(); //tick
msg.readCoordinatePair(srcX, srcY, dstX, dstY);
if (player_node)
diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp
index 93f9c0835..ec09a81b8 100644
--- a/src/net/manaserv/beinghandler.cpp
+++ b/src/net/manaserv/beinghandler.cpp
@@ -51,7 +51,7 @@ namespace ManaServ
BeingHandler::BeingHandler()
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
GPMSG_BEING_ATTACK,
GPMSG_BEING_ENTER,
diff --git a/src/net/manaserv/buysellhandler.cpp b/src/net/manaserv/buysellhandler.cpp
index e9be139f6..f0cd860b6 100644
--- a/src/net/manaserv/buysellhandler.cpp
+++ b/src/net/manaserv/buysellhandler.cpp
@@ -45,7 +45,7 @@ namespace ManaServ
BuySellHandler::BuySellHandler()
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
GPMSG_NPC_BUY,
GPMSG_NPC_SELL,
diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp
index db2d03247..f1af32354 100644
--- a/src/net/manaserv/charhandler.cpp
+++ b/src/net/manaserv/charhandler.cpp
@@ -62,7 +62,7 @@ extern ServerInfo chatServer;
CharHandler::CharHandler()
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
APMSG_CHAR_CREATE_RESPONSE,
APMSG_CHAR_DELETE_RESPONSE,
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp
index 12451e6f6..c978dee36 100644
--- a/src/net/manaserv/chathandler.cpp
+++ b/src/net/manaserv/chathandler.cpp
@@ -57,7 +57,7 @@ extern ServerInfo chatServer;
ChatHandler::ChatHandler()
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
GPMSG_SAY,
CPMSG_ENTER_CHANNEL_RESPONSE,
diff --git a/src/net/manaserv/effecthandler.cpp b/src/net/manaserv/effecthandler.cpp
index 59fb1e4f5..03e9002eb 100644
--- a/src/net/manaserv/effecthandler.cpp
+++ b/src/net/manaserv/effecthandler.cpp
@@ -35,7 +35,7 @@ namespace ManaServ
EffectHandler::EffectHandler()
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
GPMSG_CREATE_EFFECT_POS,
GPMSG_CREATE_EFFECT_BEING,
@@ -62,8 +62,8 @@ void EffectHandler::handleMessage(Net::MessageIn &msg)
void EffectHandler::handleCreateEffectPos(Net::MessageIn &msg)
{
int id = msg.readInt16();
- Uint16 x = msg.readInt16();
- Uint16 y = msg.readInt16();
+ uint16_t x = msg.readInt16();
+ uint16_t y = msg.readInt16();
effectManager->trigger(id, x, y);
}
diff --git a/src/net/manaserv/gamehandler.cpp b/src/net/manaserv/gamehandler.cpp
index 4a03dff0f..83e9a96b5 100644
--- a/src/net/manaserv/gamehandler.cpp
+++ b/src/net/manaserv/gamehandler.cpp
@@ -45,7 +45,7 @@ extern ServerInfo chatServer;
GameHandler::GameHandler()
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
GPMSG_DISCONNECT_RESPONSE,
0
diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp
index be8a9609a..82dcea569 100644
--- a/src/net/manaserv/guildhandler.cpp
+++ b/src/net/manaserv/guildhandler.cpp
@@ -55,7 +55,7 @@ extern Connection *chatServerConnection;
GuildHandler::GuildHandler()
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
CPMSG_GUILD_CREATE_RESPONSE,
CPMSG_GUILD_INVITE_RESPONSE,
diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp
index 2c9c84c76..130c0c457 100644
--- a/src/net/manaserv/inventoryhandler.cpp
+++ b/src/net/manaserv/inventoryhandler.cpp
@@ -49,7 +49,7 @@ extern Connection *gameServerConnection;
InventoryHandler::InventoryHandler()
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
GPMSG_INVENTORY_FULL,
GPMSG_INVENTORY,
diff --git a/src/net/manaserv/itemhandler.cpp b/src/net/manaserv/itemhandler.cpp
index 8ebe965ec..5a2cf9ebd 100644
--- a/src/net/manaserv/itemhandler.cpp
+++ b/src/net/manaserv/itemhandler.cpp
@@ -36,7 +36,7 @@ namespace ManaServ
ItemHandler::ItemHandler()
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
GPMSG_ITEMS,
GPMSG_ITEM_APPEAR,
diff --git a/src/net/manaserv/loginhandler.cpp b/src/net/manaserv/loginhandler.cpp
index dc8f37d36..d470dc00c 100644
--- a/src/net/manaserv/loginhandler.cpp
+++ b/src/net/manaserv/loginhandler.cpp
@@ -49,7 +49,7 @@ LoginHandler::LoginHandler() :
mMinUserNameLength(4),
mMaxUserNameLength(10)
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
APMSG_LOGIN_RESPONSE,
APMSG_REGISTER_RESPONSE,
diff --git a/src/net/manaserv/messagein.cpp b/src/net/manaserv/messagein.cpp
index bc97155a9..b1f551145 100644
--- a/src/net/manaserv/messagein.cpp
+++ b/src/net/manaserv/messagein.cpp
@@ -34,9 +34,9 @@ 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)
{
uint16_t t;
diff --git a/src/net/manaserv/messagein.h b/src/net/manaserv/messagein.h
index f22cdabca..21afd4544 100644
--- a/src/net/manaserv/messagein.h
+++ b/src/net/manaserv/messagein.h
@@ -41,7 +41,7 @@ class MessageIn : public Net::MessageIn
*/
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/manaserv/messageout.cpp b/src/net/manaserv/messageout.cpp
index 0bb1c0f77..1fdc161c2 100644
--- a/src/net/manaserv/messageout.cpp
+++ b/src/net/manaserv/messageout.cpp
@@ -47,7 +47,7 @@ void MessageOut::expand(size_t bytes)
mDataSize = mPos + bytes;
}
-void MessageOut::writeInt16(Sint16 value)
+void MessageOut::writeInt16(int16_t value)
{
expand(2);
uint16_t t = ENET_HOST_TO_NET_16(value);
@@ -55,7 +55,7 @@ void MessageOut::writeInt16(Sint16 value)
mPos += 2;
}
-void MessageOut::writeInt32(Sint32 value)
+void MessageOut::writeInt32(int32_t value)
{
expand(4);
uint32_t t = ENET_HOST_TO_NET_32(value);
diff --git a/src/net/manaserv/messageout.h b/src/net/manaserv/messageout.h
index dc583ab3d..f0bb2978c 100644
--- a/src/net/manaserv/messageout.h
+++ b/src/net/manaserv/messageout.h
@@ -41,8 +41,8 @@ class MessageOut : public Net::MessageOut
*/
~MessageOut();
- void writeInt16(Sint16 value); /**< Writes a short. */
- void writeInt32(Sint32 value); /**< Writes a long. */
+ void writeInt16(int16_t value); /**< Writes a short. */
+ void writeInt32(int32_t value); /**< Writes a long. */
protected:
/**
diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp
index 05041c56a..348905e50 100644
--- a/src/net/manaserv/network.cpp
+++ b/src/net/manaserv/network.cpp
@@ -97,13 +97,13 @@ Connection *getConnection()
void registerHandler(MessageHandler *handler)
{
- for (const Uint16 *i = handler->handledMessages; *i; i++)
+ for (const uint16_t *i = handler->handledMessages; *i; i++)
mMessageHandlers[*i] = handler;
}
void unregisterHandler(MessageHandler *handler)
{
- for (const Uint16 *i = handler->handledMessages; *i; i++)
+ for (const uint16_t *i = handler->handledMessages; *i; i++)
mMessageHandlers.erase(*i);
}
diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp
index 24a58ebd8..72f21ec1a 100644
--- a/src/net/manaserv/npchandler.cpp
+++ b/src/net/manaserv/npchandler.cpp
@@ -41,7 +41,7 @@ extern Connection *gameServerConnection;
NpcHandler::NpcHandler()
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
GPMSG_NPC_CHOICE,
GPMSG_NPC_POST,
diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp
index 34fb2e954..e2b0fabd9 100644
--- a/src/net/manaserv/partyhandler.cpp
+++ b/src/net/manaserv/partyhandler.cpp
@@ -50,7 +50,7 @@ extern Connection *chatServerConnection;
PartyHandler::PartyHandler():
mParty(Party::getParty(PARTY_ID))
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
CPMSG_PARTY_INVITE_RESPONSE,
CPMSG_PARTY_INVITED,
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index eeb597908..b42aa383e 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -73,7 +73,7 @@ extern Connection *gameServerConnection;
PlayerHandler::PlayerHandler()
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
GPMSG_PLAYER_MAP_CHANGE,
GPMSG_PLAYER_SERVER_CHANGE,
@@ -271,7 +271,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
/*
case SMSG_PLAYER_ARROW_MESSAGE:
{
- Sint16 type = msg.readInt16();
+ int16_t type = msg.readInt16();
switch (type)
{
@@ -338,7 +338,7 @@ void PlayerHandler::stopAttack()
}
-void PlayerHandler::emote(Uint8 emoteId A_UNUSED)
+void PlayerHandler::emote(uint8_t emoteId A_UNUSED)
{
// TODO
}
@@ -446,7 +446,7 @@ void PlayerHandler::requestOnlineList()
}
-void PlayerHandler::updateStatus(Uint8 status)
+void PlayerHandler::updateStatus(uint8_t status)
{
}
diff --git a/src/net/manaserv/playerhandler.h b/src/net/manaserv/playerhandler.h
index 23d2f5e32..131960b32 100644
--- a/src/net/manaserv/playerhandler.h
+++ b/src/net/manaserv/playerhandler.h
@@ -48,7 +48,7 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler
void attack(int id, bool keep = false);
void stopAttack();
- void emote(Uint8 emoteId);
+ void emote(uint8_t emoteId);
void increaseAttribute(int attr);
void decreaseAttribute(int attr);
@@ -74,7 +74,7 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler
Vector getDefaultWalkSpeed() const;
- void updateStatus(Uint8 status);
+ void updateStatus(uint8_t status);
private:
void handleMapChangeMessage(Net::MessageIn &msg);
diff --git a/src/net/manaserv/tradehandler.cpp b/src/net/manaserv/tradehandler.cpp
index 72dbf9a9d..e13c134c6 100644
--- a/src/net/manaserv/tradehandler.cpp
+++ b/src/net/manaserv/tradehandler.cpp
@@ -83,7 +83,7 @@ namespace
TradeHandler::TradeHandler():
mAcceptTradeRequests(true)
{
- static const Uint16 _messages[] =
+ static const uint16_t _messages[] =
{
GPMSG_TRADE_REQUEST,
GPMSG_TRADE_CANCEL,
diff --git a/src/net/messagehandler.h b/src/net/messagehandler.h
index 9867ffd65..a487e6ed2 100644
--- a/src/net/messagehandler.h
+++ b/src/net/messagehandler.h
@@ -38,7 +38,7 @@ namespace Net
class MessageHandler
{
public:
- const Uint16 *handledMessages;
+ const uint16_t *handledMessages;
virtual void handleMessage(MessageIn &msg) = 0;
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 5848c8b18..445b43d3f 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -60,7 +60,7 @@ unsigned char MessageIn::readInt8()
return value;
}
-void MessageIn::readCoordinates(Uint16 &x, Uint16 &y)
+void MessageIn::readCoordinates(uint16_t &x, uint16_t &y)
{
if (mPos + 3 <= mLength)
{
@@ -75,13 +75,13 @@ void MessageIn::readCoordinates(Uint16 &x, Uint16 &y)
+ toString(static_cast<int>(y)));
}
-void MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction)
+void MessageIn::readCoordinates(uint16_t &x, uint16_t &y, uint8_t &direction)
{
- Uint8 serverDir = 0;
+ uint8_t serverDir = 0;
if (mPos + 3 <= mLength)
{
const char *data = mData + mPos;
- Sint16 temp;
+ int16_t temp;
temp = MAKEWORD(data[1] & 0x00c0, data[0] & 0x00ff);
x = static_cast<unsigned short>(temp >> 6);
@@ -139,13 +139,13 @@ void MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction)
static_cast<int>(serverDir)));
}
-void MessageIn::readCoordinatePair(Uint16 &srcX, Uint16 &srcY,
- Uint16 &dstX, Uint16 &dstY)
+void MessageIn::readCoordinatePair(uint16_t &srcX, uint16_t &srcY,
+ uint16_t &dstX, uint16_t &dstY)
{
if (mPos + 5 <= mLength)
{
const char *data = mData + mPos;
- Sint16 temp;
+ int16_t temp;
temp = MAKEWORD(data[3], data[2] & 0x000f);
dstX = static_cast<unsigned short>(temp >> 2);
diff --git a/src/net/messagein.h b/src/net/messagein.h
index 1eb5bf232..8672a0771 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -58,7 +58,7 @@ class MessageIn
virtual unsigned char readInt8(); /**< Reads a byte. */
- virtual Sint16 readInt16() = 0; /**< Reads a short. */
+ virtual int16_t readInt16() = 0; /**< Reads a short. */
virtual int readInt32() = 0; /**< Reads a long. */
@@ -66,20 +66,20 @@ class MessageIn
* Reads a 3-byte block containing tile-based coordinates. Used by
* manaserv.
*/
- virtual void readCoordinates(Uint16 &x, Uint16 &y);
+ virtual void readCoordinates(uint16_t &x, uint16_t &y);
/**
* Reads a special 3 byte block used by eAthena, containing x and y
* coordinates and direction.
*/
- virtual void readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction);
+ virtual void readCoordinates(uint16_t &x, uint16_t &y, uint8_t &direction);
/**
* Reads a special 5 byte block used by eAthena, containing a source
* and destination coordinate pair.
*/
- virtual void readCoordinatePair(Uint16 &srcX, Uint16 &srcY,
- Uint16 &dstX, Uint16 &dstY);
+ virtual void readCoordinatePair(uint16_t &srcX, uint16_t &srcY,
+ uint16_t &dstX, uint16_t &dstY);
/**
* Skips a given number of bytes.
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
index 9ec45c7cc..865b8bc0b 100644
--- a/src/net/messageout.cpp
+++ b/src/net/messageout.cpp
@@ -45,7 +45,7 @@ MessageOut::MessageOut(short id A_UNUSED):
DEBUGLOG("MessageOut");
}
-void MessageOut::writeInt8(Sint8 value)
+void MessageOut::writeInt8(int8_t value)
{
DEBUGLOG("writeInt8: " + toString(static_cast<int>(value)));
expand(1);
diff --git a/src/net/messageout.h b/src/net/messageout.h
index 6ac6f81e2..b3347bc3f 100644
--- a/src/net/messageout.h
+++ b/src/net/messageout.h
@@ -38,11 +38,11 @@ namespace Net
class MessageOut
{
public:
- virtual void writeInt8(Sint8 value); /**< Writes a byte. */
+ virtual void writeInt8(int8_t value); /**< Writes a byte. */
- virtual void writeInt16(Sint16 value) = 0; /**< Writes a short. */
+ virtual void writeInt16(int16_t value) = 0; /**< Writes a short. */
- virtual void writeInt32(Sint32 value) = 0; /**< Writes a long. */
+ virtual void writeInt32(int32_t value) = 0; /**< Writes a long. */
/**
* Writes a string. If a fixed length is not given (-1), it is stored
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index aa5d2b793..187059c02 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -39,7 +39,7 @@ class PlayerHandler
virtual void stopAttack() = 0;
- virtual void emote(Uint8 emoteId) = 0;
+ virtual void emote(uint8_t emoteId) = 0;
virtual void increaseAttribute(int attr) = 0;
@@ -73,7 +73,7 @@ class PlayerHandler
virtual void requestOnlineList() = 0;
- virtual void updateStatus(Uint8 status) = 0;
+ virtual void updateStatus(uint8_t status) = 0;
};
} // namespace Net
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);
}