summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being.h4
-rw-r--r--src/client.cpp4
-rw-r--r--src/client.h4
-rw-r--r--src/emoteshortcut.h1
-rw-r--r--src/graphics.cpp48
-rw-r--r--src/graphicsvertexes.h1
-rw-r--r--src/gui/botcheckerwindow.h4
-rw-r--r--src/gui/chatwindow.h4
-rw-r--r--src/gui/sdlfont.cpp3
-rw-r--r--src/gui/serverdialog.cpp6
-rw-r--r--src/gui/textdialog.cpp4
-rw-r--r--src/guild.cpp6
-rw-r--r--src/guild.h10
-rw-r--r--src/keyboardconfig.cpp3
-rw-r--r--src/localplayer.cpp2
-rw-r--r--src/localplayer.h2
-rw-r--r--src/main.cpp2
-rw-r--r--src/mobileopenglgraphics.cpp4
-rw-r--r--src/net/ea/beinghandler.cpp6
-rw-r--r--src/net/ea/beinghandler.h2
-rw-r--r--src/net/ea/guildhandler.cpp4
-rw-r--r--src/net/ea/partyhandler.cpp4
-rw-r--r--src/net/ea/skillhandler.cpp2
-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
-rw-r--r--src/net/logindata.h18
-rw-r--r--src/net/messagein.cpp20
-rw-r--r--src/net/messagein.h6
-rw-r--r--src/net/messageout.cpp6
-rw-r--r--src/net/messageout.h2
-rw-r--r--src/net/playerhandler.h2
-rw-r--r--src/net/serverinfo.h2
-rw-r--r--src/net/tmwa/beinghandler.cpp6
-rw-r--r--src/net/tmwa/charserverhandler.cpp6
-rw-r--r--src/net/tmwa/chathandler.cpp20
-rw-r--r--src/net/tmwa/guildhandler.h4
-rw-r--r--src/net/tmwa/messagehandler.h4
-rw-r--r--src/net/tmwa/messagein.h4
-rw-r--r--src/net/tmwa/messageout.cpp10
-rw-r--r--src/net/tmwa/messageout.h10
-rw-r--r--src/net/tmwa/network.cpp4
-rw-r--r--src/net/tmwa/playerhandler.cpp6
-rw-r--r--src/net/tmwa/playerhandler.h2
-rw-r--r--src/net/worldinfo.h2
-rw-r--r--src/particle.h8
-rw-r--r--src/particleemitter.h20
-rw-r--r--src/party.cpp6
-rw-r--r--src/party.h10
-rw-r--r--src/resources/iteminfo.h4
-rw-r--r--src/resources/sdlimagehelper.cpp2
-rw-r--r--src/resources/subimage.cpp8
-rw-r--r--src/resources/wallpaper.cpp2
61 files changed, 201 insertions, 203 deletions
diff --git a/src/being.h b/src/being.h
index 1d1e01c5e..b71e17738 100644
--- a/src/being.h
+++ b/src/being.h
@@ -377,8 +377,8 @@ class Being : public ActorSprite, public ConfigListener
/**
* Get number of guilds the being belongs to.
*/
- short getNumberOfGuilds() const A_WARN_UNUSED
- { return static_cast<short>(mGuilds.size()); }
+ int16_t getNumberOfGuilds() const A_WARN_UNUSED
+ { return static_cast<int16_t>(mGuilds.size()); }
bool isInParty() const A_WARN_UNUSED
{ return mParty; }
diff --git a/src/client.cpp b/src/client.cpp
index 45d8ff2e3..6cd3967fc 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -474,7 +474,7 @@ void Client::gameInit()
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
char path[PATH_MAX];
- if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path,
+ if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (uint8_t*)path,
PATH_MAX))
{
fprintf(stderr, "Can't find Resources directory\n");
@@ -654,7 +654,7 @@ void Client::gameInit()
if (mCurrentServer.port == 0)
{
- mCurrentServer.port = static_cast<short>(branding.getValue(
+ mCurrentServer.port = static_cast<uint16_t>(branding.getValue(
"defaultPort", DEFAULT_PORT));
mCurrentServer.type = ServerInfo::parseType(
branding.getValue("defaultServerType", "tmwathena"));
diff --git a/src/client.h b/src/client.h
index b383bc0ea..d495521fc 100644
--- a/src/client.h
+++ b/src/client.h
@@ -51,7 +51,7 @@ class QuitDialog;
*/
static const int MILLISECONDS_IN_A_TICK = 10;
-static const short DEFAULT_PORT = 6901;
+static const uint16_t DEFAULT_PORT = 6901;
extern volatile int fps;
extern volatile int lps;
@@ -202,7 +202,7 @@ public:
std::string screenshotDir;
std::string test;
std::string serverName;
- short serverPort;
+ uint16_t serverPort;
bool printHelp;
bool printVersion;
bool skipUpdate;
diff --git a/src/emoteshortcut.h b/src/emoteshortcut.h
index 95cd5c6dc..989ff7faa 100644
--- a/src/emoteshortcut.h
+++ b/src/emoteshortcut.h
@@ -121,7 +121,6 @@ class EmoteShortcut final
unsigned char mEmotes[SHORTCUT_EMOTES]; // The emote stored.
unsigned char mEmoteSelected; // The emote held by cursor.
-
};
extern EmoteShortcut *emoteShortcut;
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 7e704c615..8f6b805cd 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -403,10 +403,10 @@ bool Graphics::drawRescaledImage(const Image *const image, int srcX, int srcY,
SDL_Rect dstRect;
SDL_Rect srcRect;
- dstRect.x = static_cast<short>(dstX);
- dstRect.y = static_cast<short>(dstY);
- srcRect.x = static_cast<short>(srcX);
- srcRect.y = static_cast<short>(srcY);
+ dstRect.x = static_cast<int16_t>(dstX);
+ dstRect.y = static_cast<int16_t>(dstY);
+ srcRect.x = static_cast<int16_t>(srcX);
+ srcRect.y = static_cast<int16_t>(srcY);
srcRect.w = static_cast<uint16_t>(width);
srcRect.h = static_cast<uint16_t>(height);
@@ -435,10 +435,10 @@ bool Graphics::drawImage2(const Image *const image, int srcX, int srcY,
SDL_Rect dstRect;
SDL_Rect srcRect;
- dstRect.x = static_cast<short>(dstX);
- dstRect.y = static_cast<short>(dstY);
- srcRect.x = static_cast<short>(srcX);
- srcRect.y = static_cast<short>(srcY);
+ dstRect.x = static_cast<int16_t>(dstX);
+ dstRect.y = static_cast<int16_t>(dstY);
+ srcRect.x = static_cast<int16_t>(srcX);
+ srcRect.y = static_cast<int16_t>(srcY);
srcRect.w = static_cast<uint16_t>(width);
srcRect.h = static_cast<uint16_t>(height);
@@ -485,10 +485,10 @@ void Graphics::drawImagePattern(const Image *const image,
SDL_Rect dstRect;
SDL_Rect srcRect;
- dstRect.x = static_cast<short>(dstX);
- dstRect.y = static_cast<short>(dstY);
- srcRect.x = static_cast<short>(srcX);
- srcRect.y = static_cast<short>(srcY);
+ dstRect.x = static_cast<int16_t>(dstX);
+ dstRect.y = static_cast<int16_t>(dstY);
+ srcRect.x = static_cast<int16_t>(srcX);
+ srcRect.y = static_cast<int16_t>(srcY);
srcRect.w = static_cast<uint16_t>(dw);
srcRect.h = static_cast<uint16_t>(dh);
@@ -537,10 +537,10 @@ void Graphics::drawRescaledImagePattern(const Image *const image,
SDL_Rect dstRect;
SDL_Rect srcRect;
- dstRect.x = static_cast<short>(dstX);
- dstRect.y = static_cast<short>(dstY);
- srcRect.x = static_cast<short>(srcX);
- srcRect.y = static_cast<short>(srcY);
+ dstRect.x = static_cast<int16_t>(dstX);
+ dstRect.y = static_cast<int16_t>(dstY);
+ srcRect.x = static_cast<int16_t>(srcX);
+ srcRect.y = static_cast<int16_t>(srcY);
srcRect.w = static_cast<uint16_t>(dw);
srcRect.h = static_cast<uint16_t>(dh);
@@ -702,10 +702,10 @@ void Graphics::calcImagePattern(ImageVertexes* const vert,
DoubleRect *const r = new DoubleRect();
SDL_Rect &dstRect = r->dst;
SDL_Rect &srcRect = r->src;
- dstRect.x = static_cast<short>(dstX);
- dstRect.y = static_cast<short>(dstY);
- srcRect.x = static_cast<short>(srcX);
- srcRect.y = static_cast<short>(srcY);
+ dstRect.x = static_cast<int16_t>(dstX);
+ dstRect.y = static_cast<int16_t>(dstY);
+ srcRect.x = static_cast<int16_t>(srcX);
+ srcRect.y = static_cast<int16_t>(srcY);
srcRect.w = static_cast<uint16_t>(dw);
srcRect.h = static_cast<uint16_t>(dh);
@@ -804,10 +804,10 @@ void Graphics::calcTile(ImageVertexes *const vert, int x, int y) const
DoubleRect *rect = new DoubleRect();
- rect->dst.x = static_cast<short>(x);
- rect->dst.y = static_cast<short>(y);
- rect->src.x = static_cast<short>(image->mBounds.x);
- rect->src.y = static_cast<short>(image->mBounds.y);
+ rect->dst.x = static_cast<int16_t>(x);
+ rect->dst.y = static_cast<int16_t>(y);
+ rect->src.x = static_cast<int16_t>(image->mBounds.x);
+ rect->src.y = static_cast<int16_t>(image->mBounds.y);
rect->src.w = static_cast<uint16_t>(image->mBounds.w);
rect->src.h = static_cast<uint16_t>(image->mBounds.h);
if (SDL_FakeUpperBlit(image->mSDLSurface, &rect->src,
diff --git a/src/graphicsvertexes.h b/src/graphicsvertexes.h
index 8934f5818..3fd674c66 100644
--- a/src/graphicsvertexes.h
+++ b/src/graphicsvertexes.h
@@ -146,7 +146,6 @@ class ImageVertexes final
NormalOpenGLGraphicsVertexes ogl;
#endif
DoubleRects sdl;
-
};
typedef std::vector<ImageVertexes*> ImageVertexesVector;
diff --git a/src/gui/botcheckerwindow.h b/src/gui/botcheckerwindow.h
index 36ca41a24..7bc75e2fb 100644
--- a/src/gui/botcheckerwindow.h
+++ b/src/gui/botcheckerwindow.h
@@ -33,8 +33,8 @@
struct BOTCHK final
{
- short id; /**< Index into "botchecker_db" array */
- short lv, sp;
+ int16_t id; /**< Index into "botchecker_db" array */
+ int16_t lv, sp;
};
class Button;
diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h
index 2961d7de4..f658a7757 100644
--- a/src/gui/chatwindow.h
+++ b/src/gui/chatwindow.h
@@ -354,8 +354,8 @@ class ChatWindow final : public Window,
History mCommands; /**< Command list. */
History mCustomWords;
- bool mReturnToggles; // Marks whether <Return> toggles the chat log
- // or not
+ bool mReturnToggles; // Marks whether <Return> toggles the chat log
+ // or not
StringVect mTradeFilter;
diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp
index f3d904059..1acb50720 100644
--- a/src/gui/sdlfont.cpp
+++ b/src/gui/sdlfont.cpp
@@ -245,8 +245,7 @@ void SDLFont::loadFont(std::string filename, const int size, const int style)
void SDLFont::clear()
{
- for (unsigned short f = 0; f < static_cast<unsigned short>(
- CACHES_NUMBER); f ++)
+ for (size_t f = 0; f < CACHES_NUMBER; f ++)
{
mCache[f].clear();
}
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index ee879f2a8..56ce6528a 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -86,7 +86,7 @@ static std::string serverTypeToString(const ServerInfo::Type type)
}
}
-static unsigned short defaultPortForServerType(const ServerInfo::Type type)
+static uint16_t defaultPortForServerType(const ServerInfo::Type type)
{
switch (type)
{
@@ -616,7 +616,7 @@ void ServerDialog::loadServers(const bool addNew)
if (xmlNameEqual(subNode, "connection"))
{
server.hostname = XML::getProperty(subNode, "hostname", "");
- server.port = static_cast<short unsigned>(
+ server.port = static_cast<uint16_t>(
XML::getProperty(subNode, "port", 0));
if (server.port == 0)
@@ -685,7 +685,7 @@ void ServerDialog::loadCustomServers()
server.type = ServerInfo::parseType(config.getValue(typeKey, ""));
const int defaultPort = defaultPortForServerType(server.type);
- server.port = static_cast<unsigned short>(
+ server.port = static_cast<uint16_t>(
config.getValue(portKey, defaultPort));
// skip invalid server
diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp
index d598cb37c..146bcede5 100644
--- a/src/gui/textdialog.cpp
+++ b/src/gui/textdialog.cpp
@@ -70,11 +70,11 @@ TextDialog::TextDialog(const std::string &title, const std::string &msg,
int width = font->getWidth(title);
if (width < textLabel->getWidth())
width = textLabel->getWidth();
- reflowLayout(static_cast<short>(width + 20));
+ reflowLayout(static_cast<int>(width + 20));
}
else
{
- reflowLayout(static_cast<short>(textLabel->getWidth() + 20));
+ reflowLayout(static_cast<int>(textLabel->getWidth() + 20));
}
if (getParent())
diff --git a/src/guild.cpp b/src/guild.cpp
index 5e6b5cc2e..f02d57354 100644
--- a/src/guild.cpp
+++ b/src/guild.cpp
@@ -76,7 +76,7 @@ std::string GuildMember::getAdditionString() const
Guild::GuildMap Guild::guilds;
-Guild::Guild(const short id):
+Guild::Guild(const int16_t id):
mMembers(),
mName(),
mId(id),
@@ -253,7 +253,7 @@ Avatar *Guild::getAvatarAt(const int index)
return mMembers[index];
}
-void Guild::setRights(const short rights)
+void Guild::setRights(const int16_t rights)
{
// to invite, rights must be greater than 0
if (rights > 0)
@@ -330,7 +330,7 @@ void Guild::addPos(const int id, const std::string &name)
mPositions[id] = name;
}
-Guild *Guild::getGuild(const short id)
+Guild *Guild::getGuild(const int16_t id)
{
const GuildMap::const_iterator it = guilds.find(id);
if (it != guilds.end())
diff --git a/src/guild.h b/src/guild.h
index d0dd91650..e6f237304 100644
--- a/src/guild.h
+++ b/src/guild.h
@@ -121,7 +121,7 @@ public:
* Get the id of the guild.
* @return Returns the id of the guild
*/
- short getId() const A_WARN_UNUSED
+ int16_t getId() const A_WARN_UNUSED
{ return mId; }
/**
@@ -160,7 +160,7 @@ public:
bool getInviteRights() const A_WARN_UNUSED
{ return mCanInviteUsers; }
- void setRights(const short rights);
+ void setRights(const int16_t rights);
bool isMember(const GuildMember *const member) const A_WARN_UNUSED;
@@ -176,7 +176,7 @@ public:
std::string getPos(int id) const A_WARN_UNUSED;
- static Guild *getGuild(const short id) A_WARN_UNUSED;
+ static Guild *getGuild(const int16_t id) A_WARN_UNUSED;
const PositionsMap &getPositions() const A_WARN_UNUSED
{ return mPositions; }
@@ -202,12 +202,12 @@ private:
/**
* Constructor with guild id passed to it.
*/
- explicit Guild(const short id);
+ explicit Guild(const int16_t id);
typedef std::vector<GuildMember*> MemberList;
MemberList mMembers;
std::string mName;
- short mId;
+ int16_t mId;
bool mCanInviteUsers;
int mEmblemId;
PositionsMap mPositions;
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index 02de194cb..eec43364d 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -97,7 +97,8 @@ std::string KeyboardConfig::getKeyShortString(const std::string &key)
}
else if (key == "unknown key")
{
- // TRANSLATORS: Unknown key short string. This string must be maximum 5 chars
+ // TRANSLATORS: Unknown key short string.
+ // TRANSLATORS: This string must be maximum 5 chars
return _("u key");
}
return key;
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 6546d31bd..785885ac7 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -77,7 +77,7 @@
#include "debug.h"
-static const short awayLimitTimer = 60;
+static const int16_t awayLimitTimer = 60;
static const int MAX_TICK_VALUE = INT_MAX / 2;
typedef std::map<int, Guild*>::const_iterator GuildMapCIter;
diff --git a/src/localplayer.h b/src/localplayer.h
index 96bd1146a..eaa7cdb10 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -592,7 +592,7 @@ class LocalPlayer final : public Being,
std::vector<int> mStatusEffectIcons;
- int mLocalWalkTime; // Timestamp used to control keyboard walk
+ int mLocalWalkTime; // Timestamp used to control keyboard walk
// messages flooding
typedef std::pair<std::string, int> MessagePair;
diff --git a/src/main.cpp b/src/main.cpp
index 5651a98b6..efb4c4135 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -166,7 +166,7 @@ static void parseOptions(const int argc, char *const argv[],
options.serverName = optarg;
break;
case 'p':
- options.serverPort = static_cast<short>(atoi(optarg));
+ options.serverPort = static_cast<uint16_t>(atoi(optarg));
break;
case 'u':
options.skipUpdate = true;
diff --git a/src/mobileopenglgraphics.cpp b/src/mobileopenglgraphics.cpp
index 7280e880b..4a8125e3e 100644
--- a/src/mobileopenglgraphics.cpp
+++ b/src/mobileopenglgraphics.cpp
@@ -1137,7 +1137,7 @@ bool MobileOpenGLGraphics::drawNet(const int x1, const int y1,
const GLshort ys1 = static_cast<GLshort>(y1);
const GLshort ys2 = static_cast<GLshort>(y2);
- for (short y = y1; y < y2; y += height)
+ for (int16_t y = y1; y < y2; y += height)
{
mShortVertArray[vp + 0] = xs1;
mShortVertArray[vp + 1] = y;
@@ -1153,7 +1153,7 @@ bool MobileOpenGLGraphics::drawNet(const int x1, const int y1,
}
}
- for (short x = x1; x < x2; x += width)
+ for (int16_t x = x1; x < x2; x += width)
{
mShortVertArray[vp + 0] = x;
mShortVertArray[vp + 1] = ys1;
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index ea668589c..5726f9ed0 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -65,7 +65,7 @@ BeingHandler::BeingHandler(const bool enableSync) :
{
}
-Being *BeingHandler::createBeing(const int id, const short job) const
+Being *BeingHandler::createBeing(const int id, const int16_t job) const
{
if (!actorSpriteManager)
return nullptr;
@@ -130,11 +130,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);
diff --git a/src/net/ea/beinghandler.h b/src/net/ea/beinghandler.h
index 6552e5a69..6798726bd 100644
--- a/src/net/ea/beinghandler.h
+++ b/src/net/ea/beinghandler.h
@@ -37,7 +37,7 @@ class BeingHandler : public Net::BeingHandler
A_DELETE_COPY(BeingHandler)
protected:
- virtual Being *createBeing(int id, short job) const A_WARN_UNUSED;
+ virtual Being *createBeing(int id, int16_t job) const A_WARN_UNUSED;
virtual void setSprite(Being *const being, const unsigned int slot,
const int id,
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp
index 65fa32634..3f0375fea 100644
--- a/src/net/ea/guildhandler.cpp
+++ b/src/net/ea/guildhandler.cpp
@@ -104,7 +104,7 @@ void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) const
msg.readInt8(); // Unused
std::string guildName = msg.readString(24);
- Guild *const g = Guild::getGuild(static_cast<short int>(guildId));
+ Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId));
if (!g)
return;
@@ -190,7 +190,7 @@ void GuildHandler::processGuildBasicInfo(Net::MessageIn &msg)
castle.c_str()), BY_SERVER);
}
- Guild *const g = Guild::getGuild(static_cast<short int>(guildId));
+ Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId));
if (!g)
return;
g->setName(name);
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 0909232dd..a8233bbf6 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -207,8 +207,8 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
}
// These seem to indicate the sharing mode for exp and items
- const short exp = msg.readInt16();
- const short item = msg.readInt16();
+ const int16_t exp = msg.readInt16();
+ const int16_t item = msg.readInt16();
if (!Ea::partyTab)
return;
diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp
index 0a3054527..7fe37be95 100644
--- a/src/net/ea/skillhandler.cpp
+++ b/src/net/ea/skillhandler.cpp
@@ -124,7 +124,7 @@ void SkillHandler::processSkillFailed(Net::MessageIn &msg) const
// Action failed (ex. sit because you have not reached the
// right level)
const int skillId = msg.readInt16();
- const short bskill = msg.readInt16();
+ const int16_t bskill = msg.readInt16();
msg.readInt16(); // btype
const signed char success = msg.readInt8();
const signed char reason = msg.readInt8();
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;
diff --git a/src/net/logindata.h b/src/net/logindata.h
index 6e133b267..5611a9bc8 100644
--- a/src/net/logindata.h
+++ b/src/net/logindata.h
@@ -31,16 +31,16 @@ class LoginData final
{
public:
LoginData() :
- username(""),
- password(""),
- newPassword(""),
- updateHost(""),
+ username(),
+ password(),
+ newPassword(),
+ updateHost(),
updateHosts(),
lastLogin(),
updateType(0),
- email(""),
- captchaResponse(""),
- registerUrl(""),
+ email(),
+ captchaResponse(),
+ registerUrl(),
gender(GENDER_UNSPECIFIED),
remember(false),
registerLogin(false),
@@ -75,7 +75,7 @@ class LoginData final
bool remember; // Whether to store the username.
bool registerLogin; // Whether an account is being registered.
- unsigned short characterSlots; // The number of character slots
+ uint16_t characterSlots; // The number of character slots
void clear()
{
@@ -104,7 +104,7 @@ class LoginData final
*/
void resetCharacterSlots()
{
- characterSlots = 9; // Default value, used for TmwAthena.
+ characterSlots = 9; // Default value, used for TmwAthena.
}
};
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 4ea6c7415..cca7eee01 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -30,8 +30,8 @@
#include "debug.h"
#define MAKEWORD(low, high) \
- (static_cast<unsigned short>((static_cast<unsigned char>(low)) | \
- (static_cast<unsigned short>(static_cast<unsigned char>(high))) << 8))
+ (static_cast<uint16_t>((static_cast<unsigned char>(low)) | \
+ (static_cast<uint16_t>(static_cast<unsigned char>(high))) << 8))
namespace Net
{
@@ -64,8 +64,8 @@ void MessageIn::readCoordinates(uint16_t &x, uint16_t &y)
{
const unsigned char *const p
= reinterpret_cast<unsigned char const *const>(mData + mPos);
- x = static_cast<short unsigned>(p[0] | ((p[1] & 0x07) << 8));
- y = static_cast<short unsigned>((p[1] >> 3) | ((p[2] & 0x3F) << 5));
+ x = static_cast<uint16_t>(p[0] | ((p[1] & 0x07) << 8));
+ y = static_cast<uint16_t>((p[1] >> 3) | ((p[2] & 0x3F) << 5));
}
mPos += 3;
PacketCounters::incInBytes(3);
@@ -114,9 +114,9 @@ void MessageIn::readCoordinates(uint16_t &x, uint16_t &y, uint8_t &direction)
{
const char *const data = mData + mPos;
int16_t temp = MAKEWORD(data[1] & 0x00c0, data[0] & 0x00ff);
- x = static_cast<unsigned short>(temp >> 6);
+ x = static_cast<uint16_t>(temp >> 6);
temp = MAKEWORD(data[2] & 0x00f0, data[1] & 0x003f);
- y = static_cast<unsigned short>(temp >> 4);
+ y = static_cast<uint16_t>(temp >> 4);
serverDir = static_cast<uint8_t>(data[2] & 0x000f);
direction = fromServerDirection(serverDir);
@@ -136,15 +136,15 @@ void MessageIn::readCoordinatePair(uint16_t &srcX, uint16_t &srcY,
{
const char *const data = mData + mPos;
int16_t temp = MAKEWORD(data[3], data[2] & 0x000f);
- dstX = static_cast<unsigned short>(temp >> 2);
+ dstX = static_cast<uint16_t>(temp >> 2);
dstY = MAKEWORD(data[4], data[3] & 0x0003);
temp = MAKEWORD(data[1], data[0]);
- srcX = static_cast<unsigned short>(temp >> 6);
+ srcX = static_cast<uint16_t>(temp >> 6);
temp = MAKEWORD(data[2], data[1] & 0x003f);
- srcY = static_cast<unsigned short>(temp >> 4);
+ srcY = static_cast<uint16_t>(temp >> 4);
}
mPos += 5;
DEBUGLOG(std::string("readCoordinatePair: ").append(toString(
@@ -215,7 +215,7 @@ std::string MessageIn::readRawString(int length)
if (stringEnd)
{
- const long len2 = length - (stringEnd - stringBeg) - 1;
+ const size_t len2 = length - (stringEnd - stringBeg) - 1;
const char *const stringBeg2 = stringEnd + 1;
const char *const stringEnd2
= static_cast<const char *const>(memchr(stringBeg2, '\0', len2));
diff --git a/src/net/messagein.h b/src/net/messagein.h
index ecd6e2dea..3ed723360 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -114,9 +114,9 @@ class MessageIn
*/
MessageIn(const char *data, unsigned int length);
- const char *mData; /**< The message data. */
- unsigned int mLength; /**< The length of the data. */
- unsigned short mId; /**< The message ID. */
+ const char *mData; /**< The message data. */
+ unsigned int mLength; /**< The length of the data. */
+ uint16_t mId; /**< The message ID. */
/**
* Actual position in the packet. From 0 to packet->length.
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
index 76e2085ee..cb948cdd5 100644
--- a/src/net/messageout.cpp
+++ b/src/net/messageout.cpp
@@ -36,7 +36,7 @@
namespace Net
{
-MessageOut::MessageOut(short id A_UNUSED):
+MessageOut::MessageOut(int16_t id A_UNUSED):
mData(nullptr),
mDataSize(0),
mPos(0)
@@ -60,7 +60,7 @@ void MessageOut::writeString(const std::string &string, int length)
if (length < 0)
{
// Write the length at the start if not fixed
- writeInt16(static_cast<short>(stringLength));
+ writeInt16(static_cast<int16_t>(stringLength));
length = stringLength;
}
else if (length < stringLength)
@@ -88,7 +88,7 @@ void MessageOut::writeStringNoLog(const std::string &string, int length)
if (length < 0)
{
// Write the length at the start if not fixed
- writeInt16(static_cast<short>(stringLength));
+ writeInt16(static_cast<int16_t>(stringLength));
length = stringLength;
}
else if (length < stringLength)
diff --git a/src/net/messageout.h b/src/net/messageout.h
index 4b8ef5fe3..f4b32191b 100644
--- a/src/net/messageout.h
+++ b/src/net/messageout.h
@@ -79,7 +79,7 @@ class MessageOut
/**
* Constructor.
*/
- explicit MessageOut(short id);
+ explicit MessageOut(int16_t id);
/**
* Expand the packet data to be able to hold more data.
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index ad3d50f4a..d3b9dd6c3 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -46,7 +46,7 @@ class PlayerHandler
virtual void decreaseAttribute(const int attr) const = 0;
- virtual void increaseSkill(const unsigned short skillId) const = 0;
+ virtual void increaseSkill(const uint16_t skillId) const = 0;
virtual void pickUp(const FloorItem *const floorItem) const = 0;
diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h
index 114295560..cd16a1ffb 100644
--- a/src/net/serverinfo.h
+++ b/src/net/serverinfo.h
@@ -47,7 +47,7 @@ public:
Type type;
std::string name;
std::string hostname;
- unsigned short port;
+ uint16_t port;
std::string description;
std::string registerUrl;
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index d70dfb16d..35f2ded57 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -433,12 +433,12 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
// An update about a player, potentially including movement.
const int id = msg.readInt32();
- const short speed = msg.readInt16();
+ const int16_t speed = msg.readInt16();
const uint16_t stunMode = msg.readInt16(); // opt1;
uint32_t statusEffects = msg.readInt16(); // opt2;
statusEffects |= (static_cast<uint32_t>(msg.readInt16()))
<< 16; // status.options; Aethyra uses this as misc2
- const short job = msg.readInt16();
+ const int16_t job = msg.readInt16();
Being *dstBeing = actorSpriteManager->findBeing(id);
@@ -495,7 +495,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
if (guild == 0)
dstBeing->clearGuilds();
else
- dstBeing->setGuild(Guild::getGuild(static_cast<short>(guild)));
+ dstBeing->setGuild(Guild::getGuild(static_cast<int16_t>(guild)));
}
msg.readInt16(); // emblem
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 3a72ffa03..773a9d060 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -253,8 +253,8 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot,
outMsg.writeInt8(static_cast<unsigned char>(stats[i]));
outMsg.writeInt8(static_cast<unsigned char>(slot));
- outMsg.writeInt16(static_cast<short>(hairColor));
- outMsg.writeInt16(static_cast<short>(hairstyle));
+ outMsg.writeInt16(static_cast<int16_t>(hairColor));
+ outMsg.writeInt16(static_cast<int16_t>(hairstyle));
if (serverVersion >= 2)
outMsg.writeInt8(race);
}
@@ -309,7 +309,7 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg)
msg.skip(2); // Length word
const int slots = msg.readInt16();
if (slots > 0 && slots < 30)
- loginData.characterSlots = static_cast<short unsigned int>(slots);
+ loginData.characterSlots = static_cast<uint16_t>(slots);
const bool version = msg.readInt8() == 1 && serverVersion > 0;
msg.skip(17); // 0 Unused
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 6610dec26..8c455a186 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -129,7 +129,7 @@ void ChatHandler::talk(const std::string &text,
{
MessageOut outMsg(CMSG_CHAT_MESSAGE2);
// Added + 1 in order to let eAthena parse admin commands correctly
- outMsg.writeInt16(static_cast<short>(mes.length() + 4 + 3 + 1));
+ outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 3 + 1));
outMsg.writeInt8(channel[0]);
outMsg.writeInt8(channel[1]);
outMsg.writeInt8(channel[2]);
@@ -139,7 +139,7 @@ void ChatHandler::talk(const std::string &text,
{
MessageOut outMsg(CMSG_CHAT_MESSAGE);
// Added + 1 in order to let eAthena parse admin commands correctly
- outMsg.writeInt16(static_cast<short>(mes.length() + 4 + 1));
+ outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 1));
outMsg.writeString(mes, static_cast<int>(mes.length() + 1));
}
}
@@ -148,7 +148,7 @@ void ChatHandler::talkRaw(const std::string &mes) const
{
MessageOut outMsg(CMSG_CHAT_MESSAGE);
// Added + 1 in order to let eAthena parse admin commands correctly
- outMsg.writeInt16(static_cast<short>(mes.length() + 4 + 1));
+ outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 1));
outMsg.writeString(mes, static_cast<int>(mes.length() + 1));
}
@@ -156,7 +156,7 @@ void ChatHandler::privateMessage(const std::string &recipient,
const std::string &text)
{
MessageOut outMsg(CMSG_CHAT_WHISPER);
- outMsg.writeInt16(static_cast<short>(text.length() + 28));
+ outMsg.writeInt16(static_cast<int16_t>(text.length() + 28));
outMsg.writeString(recipient, 24);
outMsg.writeString(text, static_cast<int>(text.length()));
mSentWhispers.push(recipient);
@@ -180,13 +180,13 @@ void ChatHandler::sendRaw(const std::string &args) const
if (pos != std::string::npos)
{
str = line.substr(0, pos);
- outMsg = new MessageOut(static_cast<short>(atoi(str.c_str())));
+ outMsg = new MessageOut(static_cast<int16_t>(atoi(str.c_str())));
line = line.substr(pos + 1);
pos = line.find(" ");
}
else
{
- outMsg = new MessageOut(static_cast<short>(atoi(line.c_str())));
+ outMsg = new MessageOut(static_cast<int16_t>(atoi(line.c_str())));
delete outMsg;
return;
}
@@ -212,7 +212,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line)
if (line.length() <= 3)
outMsg.writeInt8(static_cast<unsigned char>(i));
else if (line.length() <= 5)
- outMsg.writeInt16(static_cast<short>(i));
+ outMsg.writeInt16(static_cast<int16_t>(i));
else
outMsg.writeInt32(i);
}
@@ -241,7 +241,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line)
outMsg.writeInt8(static_cast<unsigned char>(i));
break;
case '2':
- outMsg.writeInt16(static_cast<short>(i));
+ outMsg.writeInt16(static_cast<int16_t>(i));
break;
case '4':
outMsg.writeInt32(i);
@@ -251,14 +251,14 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line)
pos = line.find(",");
if (pos != std::string::npos)
{
- const unsigned short x = static_cast<const unsigned short>(
+ const uint16_t x = static_cast<const uint16_t>(
atoi(data.substr(0, pos).c_str()));
data = data.substr(pos + 1);
pos = line.find(",");
if (pos == std::string::npos)
break;
- const unsigned short y = static_cast<const unsigned short>(
+ const uint16_t y = static_cast<const uint16_t>(
atoi(data.substr(0, pos).c_str()));
const int dir = atoi(data.substr(pos + 1).c_str());
outMsg.writeCoordinates(x, y,
diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h
index d084350f2..98dcff784 100644
--- a/src/net/tmwa/guildhandler.h
+++ b/src/net/tmwa/guildhandler.h
@@ -72,6 +72,6 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler
extern Ea::GuildTab *guildTab;
extern Guild *taGuild;
-}
+} // namespace TmwAthena
-#endif // namespace TmwAthena
+#endif
diff --git a/src/net/tmwa/messagehandler.h b/src/net/tmwa/messagehandler.h
index 9fd27c8ed..70d8dc3f7 100644
--- a/src/net/tmwa/messagehandler.h
+++ b/src/net/tmwa/messagehandler.h
@@ -56,6 +56,6 @@ class MessageHandler : public Net::MessageHandler
typedef const std::auto_ptr<MessageHandler> MessageHandlerPtr;
-}
+} // namespace TmwAthena
-#endif // namespace TmwAthena
+#endif
diff --git a/src/net/tmwa/messagein.h b/src/net/tmwa/messagein.h
index 6fc337ae3..8178e8aa0 100644
--- a/src/net/tmwa/messagein.h
+++ b/src/net/tmwa/messagein.h
@@ -52,6 +52,6 @@ class MessageIn final : public Net::MessageIn
int32_t readInt32(); /**< Reads a long. */
};
-}
+} // namespace TmwAthena
-#endif // namespace TmwAthena
+#endif
diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp
index b0fff0292..2fc0ff2d9 100644
--- a/src/net/tmwa/messageout.cpp
+++ b/src/net/tmwa/messageout.cpp
@@ -39,7 +39,7 @@
namespace TmwAthena
{
-MessageOut::MessageOut(const short id):
+MessageOut::MessageOut(const int16_t id):
Net::MessageOut(id),
mNetwork(TmwAthena::Network::instance())
{
@@ -85,10 +85,10 @@ void MessageOut::writeInt32(const int32_t value)
#define LOBYTE(w) (static_cast<unsigned char>(w))
#define HIBYTE(w) (static_cast<unsigned char>(( \
-static_cast<unsigned short>(w)) >> 8))
+static_cast<uint16_t>(w)) >> 8))
-void MessageOut::writeCoordinates(const unsigned short x,
- const unsigned short y,
+void MessageOut::writeCoordinates(const uint16_t x,
+ const uint16_t y,
unsigned char direction)
{
DEBUGLOG(strprintf("writeCoordinates: %u,%u %u",
@@ -98,7 +98,7 @@ void MessageOut::writeCoordinates(const unsigned short x,
mNetwork->mOutSize += 3;
mPos += 3;
- short temp = x;
+ int16_t temp = x;
temp <<= 6;
data[0] = 0;
data[1] = 1;
diff --git a/src/net/tmwa/messageout.h b/src/net/tmwa/messageout.h
index 22a6ae458..119425257 100644
--- a/src/net/tmwa/messageout.h
+++ b/src/net/tmwa/messageout.h
@@ -46,7 +46,7 @@ class MessageOut final : public Net::MessageOut
/**
* Constructor.
*/
- explicit MessageOut(const short id);
+ explicit MessageOut(const int16_t id);
A_DELETE_COPY(MessageOut)
@@ -57,8 +57,8 @@ class MessageOut final : public Net::MessageOut
/**
* Encodes coordinates and direction in 3 bytes.
*/
- void writeCoordinates(const unsigned short x,
- const unsigned short y,
+ void writeCoordinates(const uint16_t x,
+ const uint16_t y,
unsigned char direction);
void resetPos()
@@ -70,6 +70,6 @@ class MessageOut final : public Net::MessageOut
Network *mNetwork;
};
-}
+} // namespace TmwAthena
-#endif // namespace TmwAthena
+#endif
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index dd752af72..417a3633e 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -39,7 +39,7 @@ namespace TmwAthena
/** Warning: buffers and other variables are shared,
so there can be only one connection active at a time */
-short packet_lengths[] =
+int16_t packet_lengths[] =
{
10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -87,7 +87,7 @@ short packet_lengths[] =
};
static const int packet_lengths_size
- = static_cast<int>(sizeof(packet_lengths) / sizeof(short));
+ = static_cast<int>(sizeof(packet_lengths) / sizeof(int16_t));
static const int messagesSize = 0xffff;
Network *Network::mInstance = nullptr;
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index dd05e1b03..7ce018738 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -143,7 +143,7 @@ void PlayerHandler::increaseAttribute(const int attr) const
}
}
-void PlayerHandler::increaseSkill(const unsigned short skillId) const
+void PlayerHandler::increaseSkill(const uint16_t skillId) const
{
if (PlayerInfo::getAttribute(PlayerInfo::SKILL_POINTS) <= 0)
return;
@@ -176,8 +176,8 @@ void PlayerHandler::setDestination(const int x, const int y,
const int direction) const
{
MessageOut outMsg(CMSG_PLAYER_CHANGE_DEST);
- outMsg.writeCoordinates(static_cast<short unsigned int>(x),
- static_cast<short unsigned int>(y),
+ outMsg.writeCoordinates(static_cast<uint16_t>(x),
+ static_cast<uint16_t>(y),
static_cast<unsigned char>(direction));
}
diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h
index a0c355c40..5e15f5a3a 100644
--- a/src/net/tmwa/playerhandler.h
+++ b/src/net/tmwa/playerhandler.h
@@ -47,7 +47,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler
void emote(const uint8_t emoteId) const override;
void increaseAttribute(const int attr) const override;
- void increaseSkill(const unsigned short skillId) const override;
+ void increaseSkill(const uint16_t skillId) const override;
void pickUp(const FloorItem *const floorItem) const override;
void setDirection(const unsigned char direction) const override;
diff --git a/src/net/worldinfo.h b/src/net/worldinfo.h
index ebc45343a..a9a8c6b4a 100644
--- a/src/net/worldinfo.h
+++ b/src/net/worldinfo.h
@@ -39,7 +39,7 @@ struct WorldInfo final
int address;
std::string name;
- short port;
+ uint16_t port;
int online_users;
std::string updateHost;
};
diff --git a/src/particle.h b/src/particle.h
index 31f3b21f9..db6591cf8 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -316,7 +316,7 @@ class Particle : public Actor
AliveStatus mAlive;
private:
// generic properties
- // May the particle request its deletion by the parent particle?
+ // May the particle request its deletion by the parent particle?
bool mAutoDelete;
// List of child emitters.
@@ -333,7 +333,7 @@ class Particle : public Actor
// Bitfield of death conditions which trigger spawning
// of the death particle
- signed char mDeathEffectConditions;
+ signed char mDeathEffectConditions;
// dynamic particle
// Downward acceleration in pixels per game-tick.
@@ -342,7 +342,7 @@ class Particle : public Actor
// Ammount of random vector change
int mRandomness;
- // How much the particle bounces off when hitting the ground
+ // How much the particle bounces off when hitting the ground
float mBounce;
// is this particle moved when its parent particle moves?
@@ -356,7 +356,7 @@ class Particle : public Actor
// Acceleration towards the target particle in pixels per game-tick
float mAcceleration;
- // Distance in pixels from the target particle that causes
+ // Distance in pixels from the target particle that causes
// the destruction of the particle
float mInvDieDistance;
diff --git a/src/particleemitter.h b/src/particleemitter.h
index 83cd7af82..12b43ca53 100644
--- a/src/particleemitter.h
+++ b/src/particleemitter.h
@@ -123,30 +123,30 @@ class ParticleEmitter final
ParticleEmitterProp<int> mParticleFadeOut;
ParticleEmitterProp<int> mParticleFadeIn;
- // Map the particles are spawned on
+ // Map the particles are spawned on
Map *mMap;
- // Number of particles spawned per update
- ParticleEmitterProp<int> mOutput;
+ // Number of particles spawned per update
+ ParticleEmitterProp<int> mOutput;
- // Pause in frames between two spawns
- ParticleEmitterProp<int> mOutputPause;
+ // Pause in frames between two spawns
+ ParticleEmitterProp<int> mOutputPause;
int mOutputPauseLeft;
/*
* Graphical representation of the particles
*/
- // Particle image, if used
+ // Particle image, if used
Image *mParticleImage;
- // Filename of particle animation file
+ // Filename of particle animation file
Animation mParticleAnimation;
- // Filename of particle rotation file
+ // Filename of particle rotation file
Animation mParticleRotation;
- // Opacity of the graphical representation of the particles
- ParticleEmitterProp<float> mParticleAlpha;
+ // Opacity of the graphical representation of the particles
+ ParticleEmitterProp<float> mParticleAlpha;
/*
* Death effect of the particles
diff --git a/src/party.cpp b/src/party.cpp
index 48cdfed56..c9e781b00 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -59,7 +59,7 @@ PartyMember::PartyMember(Party *const party, const int id,
Party::PartyMap Party::parties;
-Party::Party(const short id) :
+Party::Party(const int16_t id) :
mMembers(),
mName(),
mId(id),
@@ -210,7 +210,7 @@ Avatar *Party::getAvatarAt(const int index)
return mMembers[index];
}
-void Party::setRights(const short rights)
+void Party::setRights(const int16_t rights)
{
// to invite, rights must be greater than 0
if (rights > 0)
@@ -296,7 +296,7 @@ void Party::getNamesSet(std::set<std::string> &names) const
}
}
-Party *Party::getParty(const short id)
+Party *Party::getParty(const int16_t id)
{
const PartyMap::const_iterator it = parties.find(id);
if (it != parties.end())
diff --git a/src/party.h b/src/party.h
index 315c9ab69..0ed4b2895 100644
--- a/src/party.h
+++ b/src/party.h
@@ -96,7 +96,7 @@ public:
* Get the id of the party.
* @return Returns the id of the party
*/
- short getId() const A_WARN_UNUSED
+ int16_t getId() const A_WARN_UNUSED
{ return mId; }
/**
@@ -135,7 +135,7 @@ public:
bool getInviteRights() const A_WARN_UNUSED
{ return mCanInviteUsers; }
- void setRights(const short rights);
+ void setRights(const int16_t rights);
bool isMember(const PartyMember *const member) const A_WARN_UNUSED;
@@ -154,7 +154,7 @@ public:
const MemberList *getMembers() const A_WARN_UNUSED
{ return &mMembers; }
- static Party *getParty(const short id) A_WARN_UNUSED;
+ static Party *getParty(const int16_t id) A_WARN_UNUSED;
static void clearParties();
@@ -165,13 +165,13 @@ private:
/**
* Constructor with party id passed to it.
*/
- explicit Party(const short id);
+ explicit Party(const int16_t id);
virtual ~Party();
MemberList mMembers;
std::string mName;
- short mId;
+ int16_t mId;
bool mCanInviteUsers;
};
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 12dbb3c03..01b5b2e6c 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -56,7 +56,7 @@ enum EquipmentSlot
EQUIP_FIGHT1_SLOT = 8,
EQUIP_FIGHT2_SLOT = 9,
// Projectile:
- // this item does not amount to one, it only
+ // this item does not amount to one, it only
// indicates the chosen projectile.
EQUIP_PROJECTILE_SLOT = 10
};
@@ -173,7 +173,7 @@ class ItemInfo final
void setAttackAction(const std::string &attackAction);
- // Handlers for seting and getting the string
+ // Handlers for seting and getting the string
// used for particles when attacking
void setMissileParticleFile(const std::string &s)
{ mMissileParticleFile = s; }
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index 0318014cd..881368fd3 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -305,7 +305,7 @@ int SDLImageHelper::useOpenGL() const
return 0;
}
-SDL_Surface *SDLImageHelper::create32BitSurface(int width,int height) const
+SDL_Surface *SDLImageHelper::create32BitSurface(int width, int height) const
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const int rmask = 0xff000000;
diff --git a/src/resources/subimage.cpp b/src/resources/subimage.cpp
index cad476f2f..c7e250b78 100644
--- a/src/resources/subimage.cpp
+++ b/src/resources/subimage.cpp
@@ -59,8 +59,8 @@ SubImage::SubImage(Image *const parent, SDL_Surface *const image,
}
// Set up the rectangle.
- mBounds.x = static_cast<short>(x);
- mBounds.y = static_cast<short>(y);
+ mBounds.x = static_cast<int16_t>(x);
+ mBounds.y = static_cast<int16_t>(y);
mBounds.w = static_cast<uint16_t>(width);
mBounds.h = static_cast<uint16_t>(height);
if (mParent)
@@ -92,8 +92,8 @@ SubImage::SubImage(Image *const parent, const GLuint image,
mParent->incRef();
// Set up the rectangle.
- mBounds.x = static_cast<short>(x);
- mBounds.y = static_cast<short>(y);
+ mBounds.x = static_cast<int16_t>(x);
+ mBounds.y = static_cast<int16_t>(y);
mBounds.w = static_cast<uint16_t>(width);
mBounds.h = static_cast<uint16_t>(height);
if (mParent)
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 6f81e99aa..58dffa131 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -108,7 +108,7 @@ void Wallpaper::loadWallpapers()
// First, get the base filename of the image:
std::string filename = *i;
- unsigned long separator = filename.rfind("_");
+ size_t separator = filename.rfind("_");
filename = filename.substr(0, separator);
// Check that the base filename doesn't have any '%' markers.