summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-21 18:57:48 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-21 18:57:48 +0300
commit35cfd460655878c9a615abc8ea1cb2f7577a7f3b (patch)
tree2b4cb899f7f442912f89de30f4a5ab0add0727ce /src/net/eathena
parentcfe4c893ba4ba30379919636d3c508ebf1594e23 (diff)
downloadplus-35cfd460655878c9a615abc8ea1cb2f7577a7f3b.tar.gz
plus-35cfd460655878c9a615abc8ea1cb2f7577a7f3b.tar.bz2
plus-35cfd460655878c9a615abc8ea1cb2f7577a7f3b.tar.xz
plus-35cfd460655878c9a615abc8ea1cb2f7577a7f3b.zip
some other fixes from cpplint.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/beinghandler.cpp12
-rw-r--r--src/net/eathena/charserverhandler.cpp6
-rw-r--r--src/net/eathena/chathandler.cpp18
-rw-r--r--src/net/eathena/guildhandler.h4
-rw-r--r--src/net/eathena/messagehandler.h4
-rw-r--r--src/net/eathena/messagein.h4
-rw-r--r--src/net/eathena/messageout.cpp10
-rw-r--r--src/net/eathena/messageout.h10
-rw-r--r--src/net/eathena/network.cpp4
-rw-r--r--src/net/eathena/playerhandler.cpp6
-rw-r--r--src/net/eathena/playerhandler.h2
11 files changed, 40 insertions, 40 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 76f2cd7cc..71a098510 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -432,12 +432,12 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
// An update about a player, potentially including movement.
const int id = msg.readInt32();
- const short speed = msg.readInt16();
+ const int16_t speed = msg.readInt16();
const uint16_t stunMode = msg.readInt16(); // opt1
uint32_t statusEffects = msg.readInt16(); // opt2
statusEffects |= (static_cast<uint32_t>(msg.readInt16()))
<< 16; // status.options; Aethyra uses this as misc2
- const short job = msg.readInt16();
+ const int16_t job = msg.readInt16();
Being *dstBeing = actorSpriteManager->findBeing(id);
@@ -492,7 +492,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
if (guild == 0)
dstBeing->clearGuilds();
else
- dstBeing->setGuild(Guild::getGuild(static_cast<short>(guild)));
+ dstBeing->setGuild(Guild::getGuild(static_cast<int16_t>(guild)));
}
msg.readInt16(); // emblem
@@ -634,11 +634,11 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
else
spawnId = 0;
mSpawnId = 0;
- short speed = msg.readInt16();
+ int16_t speed = msg.readInt16();
const uint16_t stunMode = msg.readInt16(); // opt1
uint32_t statusEffects = msg.readInt16(); // opt2
statusEffects |= (static_cast<uint32_t>(msg.readInt16())) << 16; // option
- const short job = msg.readInt16(); // class
+ const int16_t job = msg.readInt16(); // class
Being *dstBeing = actorSpriteManager->findBeing(id);
@@ -725,7 +725,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
msg.readInt16(); // manner
dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3
msg.readInt8(); // karma
- short gender = msg.readInt8();
+ int16_t gender = msg.readInt8();
if (dstBeing->getType() == ActorSprite::PLAYER)
{
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index ffb83ea73..6fafb3aa0 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -222,8 +222,8 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot,
outMsg.writeInt8(static_cast<unsigned char>(stats[i]));
outMsg.writeInt8(static_cast<unsigned char>(slot));
- outMsg.writeInt16(static_cast<short>(hairColor));
- outMsg.writeInt16(static_cast<short>(hairstyle));
+ outMsg.writeInt16(static_cast<int16_t>(hairColor));
+ outMsg.writeInt16(static_cast<int16_t>(hairstyle));
}
void CharServerHandler::deleteCharacter(Net::Character *const character)
@@ -271,7 +271,7 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg)
msg.skip(2); // Length word
const int slots = msg.readInt16();
if (slots > 0 && slots < 30)
- loginData.characterSlots = static_cast<short unsigned int>(slots);
+ loginData.characterSlots = static_cast<uint16_t>(slots);
msg.skip(18); // 0 Unused
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index 940227b3c..eae8e7ffc 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -113,7 +113,7 @@ void ChatHandler::talk(const std::string &text,
MessageOut outMsg(CMSG_CHAT_MESSAGE);
// Added + 1 in order to let eAthena parse admin commands correctly
- outMsg.writeInt16(static_cast<short>(mes.length() + 4 + 1));
+ outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 1));
outMsg.writeString(mes, static_cast<int>(mes.length() + 1));
}
@@ -121,7 +121,7 @@ void ChatHandler::talkRaw(const std::string &mes) const
{
MessageOut outMsg(CMSG_CHAT_MESSAGE);
// Added + 1 in order to let eAthena parse admin commands correctly
- outMsg.writeInt16(static_cast<short>(mes.length() + 4 + 1));
+ outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 1));
outMsg.writeString(mes, static_cast<int>(mes.length() + 1));
}
@@ -129,7 +129,7 @@ void ChatHandler::privateMessage(const std::string &recipient,
const std::string &text)
{
MessageOut outMsg(CMSG_CHAT_WHISPER);
- outMsg.writeInt16(static_cast<short>(text.length() + 28));
+ outMsg.writeInt16(static_cast<int16_t>(text.length() + 28));
outMsg.writeString(recipient, 24);
outMsg.writeString(text, static_cast<int>(text.length()));
mSentWhispers.push(recipient);
@@ -153,13 +153,13 @@ void ChatHandler::sendRaw(const std::string &args) const
if (pos != std::string::npos)
{
str = line.substr(0, pos);
- outMsg = new MessageOut(static_cast<short>(atoi(str.c_str())));
+ outMsg = new MessageOut(static_cast<int16_t>(atoi(str.c_str())));
line = line.substr(pos + 1);
pos = line.find(" ");
}
else
{
- outMsg = new MessageOut(static_cast<short>(atoi(line.c_str())));
+ outMsg = new MessageOut(static_cast<int16_t>(atoi(line.c_str())));
delete outMsg;
return;
}
@@ -185,7 +185,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line)
if (line.length() <= 3)
outMsg.writeInt8(static_cast<unsigned char>(i));
else if (line.length() <= 5)
- outMsg.writeInt16(static_cast<short>(i));
+ outMsg.writeInt16(static_cast<int16_t>(i));
else
outMsg.writeInt32(i);
}
@@ -215,7 +215,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line)
outMsg.writeInt8(static_cast<unsigned char>(i));
break;
case '2':
- outMsg.writeInt16(static_cast<short>(i));
+ outMsg.writeInt16(static_cast<int16_t>(i));
break;
case '4':
outMsg.writeInt32(i);
@@ -225,14 +225,14 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line)
pos = line.find(",");
if (pos != std::string::npos)
{
- const unsigned short x = static_cast<unsigned short>(
+ const uint16_t x = static_cast<uint16_t>(
atoi(data.substr(0, pos).c_str()));
data = data.substr(pos + 1);
pos = line.find(",");
if (pos == std::string::npos)
break;
- const unsigned short y = static_cast<unsigned short>(
+ const uint16_t y = static_cast<uint16_t>(
atoi(data.substr(0, pos).c_str()));
const int dir = atoi(data.substr(pos + 1).c_str());
outMsg.writeCoordinates(x, y,
diff --git a/src/net/eathena/guildhandler.h b/src/net/eathena/guildhandler.h
index ad6a12aee..9d612c474 100644
--- a/src/net/eathena/guildhandler.h
+++ b/src/net/eathena/guildhandler.h
@@ -72,6 +72,6 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler
extern Ea::GuildTab *guildTab;
extern Guild *taGuild;
-}
+} // namespace EAthena
-#endif // namespace EAthena
+#endif
diff --git a/src/net/eathena/messagehandler.h b/src/net/eathena/messagehandler.h
index 0139f0ee2..33216dca7 100644
--- a/src/net/eathena/messagehandler.h
+++ b/src/net/eathena/messagehandler.h
@@ -56,6 +56,6 @@ class MessageHandler : public Net::MessageHandler
typedef const std::auto_ptr<MessageHandler> MessageHandlerPtr;
-}
+} // namespace EAthena
-#endif // namespace EAthena
+#endif
diff --git a/src/net/eathena/messagein.h b/src/net/eathena/messagein.h
index 59faa7750..8c465a90b 100644
--- a/src/net/eathena/messagein.h
+++ b/src/net/eathena/messagein.h
@@ -52,6 +52,6 @@ class MessageIn final : public Net::MessageIn
int32_t readInt32(); /**< Reads a long. */
};
-}
+} // namespace EAthena
-#endif // namespace EAthena
+#endif
diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp
index 210717503..6dc2e00f4 100644
--- a/src/net/eathena/messageout.cpp
+++ b/src/net/eathena/messageout.cpp
@@ -39,7 +39,7 @@
namespace EAthena
{
-MessageOut::MessageOut(const short id):
+MessageOut::MessageOut(const int16_t id):
Net::MessageOut(id),
mNetwork(EAthena::Network::instance())
{
@@ -85,10 +85,10 @@ void MessageOut::writeInt32(const int32_t value)
#define LOBYTE(w) (static_cast<unsigned char>(w))
#define HIBYTE(w) (static_cast<unsigned char>(( \
-static_cast<unsigned short>(w)) >> 8))
+static_cast<uint16_t>(w)) >> 8))
-void MessageOut::writeCoordinates(const unsigned short x,
- const unsigned short y,
+void MessageOut::writeCoordinates(const uint16_t x,
+ const uint16_t y,
unsigned char direction)
{
DEBUGLOG(strprintf("writeCoordinates: %u,%u %u", x, y, direction));
@@ -96,7 +96,7 @@ void MessageOut::writeCoordinates(const unsigned short x,
mNetwork->mOutSize += 3;
mPos += 3;
- short temp = x;
+ int16_t temp = x;
temp <<= 6;
data[0] = 0;
data[1] = 1;
diff --git a/src/net/eathena/messageout.h b/src/net/eathena/messageout.h
index ad1a9bfde..c76eae4c1 100644
--- a/src/net/eathena/messageout.h
+++ b/src/net/eathena/messageout.h
@@ -46,7 +46,7 @@ class MessageOut final : public Net::MessageOut
/**
* Constructor.
*/
- explicit MessageOut(const short id);
+ explicit MessageOut(const int16_t id);
A_DELETE_COPY(MessageOut)
@@ -57,8 +57,8 @@ class MessageOut final : public Net::MessageOut
/**
* Encodes coordinates and direction in 3 bytes.
*/
- void writeCoordinates(const unsigned short x,
- const unsigned short y,
+ void writeCoordinates(const uint16_t x,
+ const uint16_t y,
unsigned char direction);
void resetPos()
@@ -70,6 +70,6 @@ class MessageOut final : public Net::MessageOut
Network *mNetwork;
};
-}
+} // namespace EAthena
-#endif // namespace EAthena
+#endif
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp
index 1b234a13c..198c61bd4 100644
--- a/src/net/eathena/network.cpp
+++ b/src/net/eathena/network.cpp
@@ -40,7 +40,7 @@ namespace EAthena
/** Warning: buffers and other variables are shared,
so there can be only one connection active at a time */
-short packet_lengths[] =
+int16_t packet_lengths[] =
{
10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -109,7 +109,7 @@ short packet_lengths[] =
};
static const int packet_lengths_size
- = static_cast<int>(sizeof(packet_lengths) / sizeof(short));
+ = static_cast<int>(sizeof(packet_lengths) / sizeof(int16_t));
static const int messagesSize = 0xffff;
Network *Network::mInstance = nullptr;
diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp
index c5f3c3a0f..4897e6b70 100644
--- a/src/net/eathena/playerhandler.cpp
+++ b/src/net/eathena/playerhandler.cpp
@@ -146,7 +146,7 @@ void PlayerHandler::increaseAttribute(const int attr) const
}
}
-void PlayerHandler::increaseSkill(const unsigned short skillId) const
+void PlayerHandler::increaseSkill(const uint16_t skillId) const
{
if (PlayerInfo::getAttribute(PlayerInfo::SKILL_POINTS) <= 0)
return;
@@ -179,8 +179,8 @@ void PlayerHandler::setDestination(const int x, const int y,
const int direction) const
{
MessageOut outMsg(CMSG_PLAYER_CHANGE_DEST);
- outMsg.writeCoordinates(static_cast<short unsigned int>(x),
- static_cast<short unsigned int>(y),
+ outMsg.writeCoordinates(static_cast<uint16_t>(x),
+ static_cast<uint16_t>(y),
static_cast<unsigned char>(direction));
}
diff --git a/src/net/eathena/playerhandler.h b/src/net/eathena/playerhandler.h
index 6cea52890..4ea630a60 100644
--- a/src/net/eathena/playerhandler.h
+++ b/src/net/eathena/playerhandler.h
@@ -47,7 +47,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler
void emote(const uint8_t emoteId) const override;
void increaseAttribute(const int attr) const override;
- void increaseSkill(const unsigned short skillId) const override;
+ void increaseSkill(const uint16_t skillId) const override;
void pickUp(const FloorItem *const floorItem) const override;
void setDirection(const unsigned char direction) const override;