summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/actorsprite.cpp2
-rw-r--r--src/actorsprite.h6
-rw-r--r--src/actorspritemanager.cpp18
-rw-r--r--src/actorspritemanager.h10
-rw-r--r--src/being.cpp26
-rw-r--r--src/being.h30
-rw-r--r--src/client.cpp8
-rw-r--r--src/commandhandler.cpp2
-rw-r--r--src/graphics.cpp56
-rw-r--r--src/graphics.h2
-rw-r--r--src/gui/gui.cpp2
-rw-r--r--src/gui/npcdialog.cpp1
-rw-r--r--src/gui/sdlfont.cpp6
-rw-r--r--src/gui/viewport.cpp4
-rw-r--r--src/guichan/sdl/sdlgraphics.cpp20
-rw-r--r--src/guichan/sdl/sdlimage.cpp2
-rw-r--r--src/joystick.cpp2
-rw-r--r--src/keyboardconfig.cpp2
-rw-r--r--src/keyboardconfig.h4
-rw-r--r--src/localplayer.cpp16
-rw-r--r--src/localplayer.h2
-rw-r--r--src/map.cpp4
-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
-rw-r--r--src/playerrelations.cpp4
-rw-r--r--src/resources/dye.cpp4
-rw-r--r--src/resources/dye.h4
-rw-r--r--src/resources/image.cpp18
-rw-r--r--src/resources/image.h6
-rw-r--r--src/resources/imagewriter.cpp2
-rw-r--r--src/resources/openglimagehelper.cpp12
-rw-r--r--src/resources/sdlimagehelper.cpp26
-rw-r--r--src/resources/subimage.cpp8
-rw-r--r--src/sound.cpp2
86 files changed, 316 insertions, 315 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 2b1fccc23..7bd496d30 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -238,7 +238,7 @@ void ActorSprite::setStatusEffect(int index, bool active)
}
}
-void ActorSprite::setStatusEffectBlock(int offset, Uint16 newEffects)
+void ActorSprite::setStatusEffectBlock(int offset, uint16_t newEffects)
{
for (int i = 0; i < STATUS_EFFECTS; i++)
{
diff --git a/src/actorsprite.h b/src/actorsprite.h
index 29df6954c..21ed0ae12 100644
--- a/src/actorsprite.h
+++ b/src/actorsprite.h
@@ -139,7 +139,7 @@ public:
* Sets the actor's stun mode. If zero, the being is `normal', otherwise it
* is `stunned' in some fashion.
*/
- void setStunMode(Uint16 stunMode)
+ void setStunMode(uint16_t stunMode)
{
if (mStunMode != stunMode)
updateStunMode(mStunMode, stunMode);
@@ -154,7 +154,7 @@ public:
*
* These are NOT the same as the status effect indices.
*/
- void setStatusEffectBlock(int offset, Uint16 flags);
+ void setStatusEffectBlock(int offset, uint16_t flags);
virtual void setAlpha(float alpha)
{ CompoundSprite::setAlpha(alpha); }
@@ -217,7 +217,7 @@ protected:
std::string color = "");
int mId;
- Uint16 mStunMode; /**< Stun mode; zero if not stunned */
+ uint16_t mStunMode; /**< Stun mode; zero if not stunned */
std::set<int> mStatusEffects; /**< set of active status effects */
ParticleList mStunParticleEffects;
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index 525204008..ecadc4b67 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -76,7 +76,7 @@ class FindBeingFunctor
|| b->getType() == type));
}
- Uint16 x, y;
+ uint16_t x, y;
ActorSprite::Type type;
} beingFinder;
@@ -228,7 +228,7 @@ void ActorSpriteManager::setPlayer(LocalPlayer *player)
}
Being *ActorSpriteManager::createBeing(int id, ActorSprite::Type type,
- Uint16 subtype)
+ uint16_t subtype)
{
Being *being = new Being(id, type, subtype, mMap);
@@ -301,8 +301,8 @@ Being *ActorSpriteManager::findBeing(int id) const
Being *ActorSpriteManager::findBeing(int x, int y,
ActorSprite::Type type) const
{
- beingFinder.x = static_cast<Uint16>(x);
- beingFinder.y = static_cast<Uint16>(y);
+ beingFinder.x = static_cast<uint16_t>(x);
+ beingFinder.y = static_cast<uint16_t>(y);
beingFinder.type = type;
ActorSpritesConstIterator it = find_if(mActors.begin(), mActors.end(),
@@ -1217,7 +1217,7 @@ bool ActorSpriteManager::hasActorSprite(ActorSprite *actor) const
return false;
}
-void ActorSpriteManager::addBlock(Uint32 id)
+void ActorSpriteManager::addBlock(uint32_t id)
{
bool alreadyBlocked(false);
for (int i = 0; i < static_cast<int>(blockedBeings.size()); ++i)
@@ -1232,10 +1232,10 @@ void ActorSpriteManager::addBlock(Uint32 id)
blockedBeings.push_back(id);
}
-void ActorSpriteManager::deleteBlock(Uint32 id)
+void ActorSpriteManager::deleteBlock(uint32_t id)
{
- std::vector<Uint32>::iterator iter = blockedBeings.begin();
- std::vector<Uint32>::iterator iter_end = blockedBeings.end();
+ std::vector<uint32_t>::iterator iter = blockedBeings.begin();
+ std::vector<uint32_t>::iterator iter_end = blockedBeings.end();
while (iter != iter_end)
{
if (*iter == id)
@@ -1246,7 +1246,7 @@ void ActorSpriteManager::deleteBlock(Uint32 id)
}
}
-bool ActorSpriteManager::isBlocked(Uint32 id)
+bool ActorSpriteManager::isBlocked(uint32_t id)
{
bool blocked(false);
for (int i = 0; i < static_cast<int>(blockedBeings.size()); ++i)
diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h
index 7ce00dd68..1491ca6d4 100644
--- a/src/actorspritemanager.h
+++ b/src/actorspritemanager.h
@@ -57,7 +57,7 @@ class ActorSpriteManager: public ConfigListener
/**
* Create a Being and add it to the list of ActorSprites.
*/
- Being *createBeing(int id, ActorSprite::Type type, Uint16 subtype);
+ Being *createBeing(int id, ActorSprite::Type type, uint16_t subtype);
/**
* Create a FloorItem and add it to the list of ActorSprites.
@@ -189,13 +189,13 @@ class ActorSpriteManager: public ConfigListener
*/
void clear();
- std::vector<Uint32> blockedBeings;
+ std::vector<uint32_t> blockedBeings;
- void addBlock(Uint32 id);
+ void addBlock(uint32_t id);
- void deleteBlock(Uint32 id);
+ void deleteBlock(uint32_t id);
- bool isBlocked(Uint32 id);
+ bool isBlocked(uint32_t id);
void printAllToChat() const;
diff --git a/src/being.cpp b/src/being.cpp
index 13874335d..89aa5275d 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -209,7 +209,7 @@ std::list<BeingCacheEntry*> beingInfoCache;
// TODO: mWalkTime used by eAthena only
-Being::Being(int id, Type type, Uint16 subtype, Map *map):
+Being::Being(int id, Type type, uint16_t subtype, Map *map):
ActorSprite(id),
mInfo(BeingInfo::unknown),
mActionTime(0),
@@ -309,7 +309,7 @@ Being::~Being()
mText = nullptr;
}
-void Being::setSubtype(Uint16 subtype)
+void Being::setSubtype(uint16_t subtype)
{
if (!mInfo)
return;
@@ -736,7 +736,7 @@ void Being::handleAttack(Being *victim, int damage,
if (this != player_node)
{
- Uint8 dir = calcDirection(victim->getTileX(), victim->getTileY());
+ uint8_t dir = calcDirection(victim->getTileX(), victim->getTileY());
if (dir)
setDirection(dir);
}
@@ -769,7 +769,7 @@ void Being::handleSkill(Being *victim, int damage, int skillId)
if (this != player_node)
{
- Uint8 dir = calcDirection(victim->getTileX(), victim->getTileY());
+ uint8_t dir = calcDirection(victim->getTileX(), victim->getTileY());
if (dir)
setDirection(dir);
}
@@ -1125,7 +1125,7 @@ void Being::setAction(Action action, int attackType A_UNUSED)
mActionTime = tick_time;
}
-void Being::setDirection(Uint8 direction)
+void Being::setDirection(uint8_t direction)
{
if (mDirection == direction)
return;
@@ -1172,9 +1172,9 @@ void Being::setDirection(Uint8 direction)
recalcSpritesOrder();
}
-Uint8 Being::calcDirection() const
+uint8_t Being::calcDirection() const
{
- Uint8 dir = 0;
+ uint8_t dir = 0;
if (mDest.x > mX)
dir |= RIGHT;
else if (mDest.x < mX)
@@ -1186,9 +1186,9 @@ Uint8 Being::calcDirection() const
return dir;
}
-Uint8 Being::calcDirection(int dstX, int dstY) const
+uint8_t Being::calcDirection(int dstX, int dstY) const
{
- Uint8 dir = 0;
+ uint8_t dir = 0;
if (dstX > mX)
dir |= RIGHT;
else if (dstX < mX)
@@ -1211,7 +1211,7 @@ void Being::nextTile()
Position pos = mPath.front();
mPath.pop_front();
- Uint8 dir = calcDirection(pos.x, pos.y);
+ uint8_t dir = calcDirection(pos.x, pos.y);
if (dir)
setDirection(dir);
@@ -1315,7 +1315,7 @@ void Being::logic()
else
direction |= (dir.y > 0) ? DOWN : UP;
- setDirection(static_cast<Uint8>(direction));
+ setDirection(static_cast<uint8_t>(direction));
}
}
else if (!mPath.empty())
@@ -2599,7 +2599,7 @@ void Being::saveComment(const std::string &name,
resman->saveTextFile(dir, "comment.txt", name + "\n" + comment);
}
-void Being::setState(Uint8 state)
+void Being::setState(uint8_t state)
{
bool shop = (state & FLAG_SHOP);
bool away = (state & FLAG_AWAY);
@@ -2618,7 +2618,7 @@ void Being::setState(Uint8 state)
}
}
-void Being::setEmote(Uint8 emotion, int emote_time)
+void Being::setEmote(uint8_t emotion, int emote_time)
{
if ((emotion & FLAG_SPECIAL) == FLAG_SPECIAL)
{
diff --git a/src/being.h b/src/being.h
index f366a37c5..f678e7f1d 100644
--- a/src/being.h
+++ b/src/being.h
@@ -165,7 +165,7 @@ class Being : public ActorSprite, public ConfigListener
* @param subtype partly determines the type of the being
* @param map the map the being is on
*/
- Being(int id, Type type, Uint16 subtype, Map *map);
+ Being(int id, Type type, uint16_t subtype, Map *map);
virtual ~Being();
@@ -406,13 +406,13 @@ class Being : public ActorSprite, public ConfigListener
*/
void drawEmotion(Graphics *graphics, int offsetX, int offsetY);
- Uint16 getSubType() const
+ uint16_t getSubType() const
{ return mSubType; }
/**
* Set Being's subtype (mostly for view for monsters and NPCs)
*/
- void setSubtype(Uint16 subtype);
+ void setSubtype(uint16_t subtype);
const BeingInfo *getInfo() const
{ return mInfo; }
@@ -483,18 +483,18 @@ class Being : public ActorSprite, public ConfigListener
/**
* Returns the current direction.
*/
- Uint8 getDirection() const
+ uint8_t getDirection() const
{ return mDirection; }
/**
* Sets the current direction.
*/
- virtual void setDirection(Uint8 direction);
+ virtual void setDirection(uint8_t direction);
- virtual void setDirectionDelayed(Uint8 direction)
+ virtual void setDirectionDelayed(uint8_t direction)
{ mDirectionDelayed = direction; }
- Uint8 getDirectionDelayed() const
+ uint8_t getDirectionDelayed() const
{ return mDirectionDelayed; }
/**
@@ -550,9 +550,9 @@ class Being : public ActorSprite, public ConfigListener
* Set the Emoticon type and time displayed above
* the being.
*/
- void setEmote(Uint8 emotion, int emote_time);
+ void setEmote(uint8_t emotion, int emote_time);
- void setState(Uint8 state);
+ void setState(uint8_t state);
/**
* Get the current Emoticon type displayed above
@@ -694,9 +694,9 @@ class Being : public ActorSprite, public ConfigListener
int getHP() const
{ return mHP; }
- Uint8 calcDirection(int dstX, int dstY) const;
+ uint8_t calcDirection(int dstX, int dstY) const;
- Uint8 calcDirection() const;
+ uint8_t calcDirection() const;
void setAttackDelay(int n)
{ mAttackDelay = n; }
@@ -819,12 +819,12 @@ class Being : public ActorSprite, public ConfigListener
int mAttackSpeed; /**< Attack speed */
Action mAction; /**< Action the being is performing */
- Uint16 mSubType; /**< Subtype (graphical view, basically) */
+ uint16_t mSubType; /**< Subtype (graphical view, basically) */
- Uint8 mDirection; /**< Facing direction */
- Uint8 mDirectionDelayed; /**< Facing direction */
+ uint8_t mDirection; /**< Facing direction */
+ uint8_t mDirectionDelayed; /**< Facing direction */
- Uint8 mSpriteDirection; /**< Facing direction */
+ uint8_t mSpriteDirection; /**< Facing direction */
std::string mName; /**< Name of character */
std::string mRaceName;
std::string mPartyName;
diff --git a/src/client.cpp b/src/client.cpp
index b782ce3a1..f9398281f 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -156,8 +156,8 @@ Graphics *mainGraphics = nullptr;
Sound sound;
-Uint32 nextTick(Uint32 interval, void *param A_UNUSED);
-Uint32 nextSecond(Uint32 interval, void *param A_UNUSED);
+uint32_t nextTick(uint32_t interval, void *param A_UNUSED);
+uint32_t nextSecond(uint32_t interval, void *param A_UNUSED);
void ErrorListener::action(const gcn::ActionEvent &)
{
@@ -186,7 +186,7 @@ extern "C" char const *_nl_locale_name_default(void);
* Called every 10 milliseconds by SDL_AddTimer()
* @see MILLISECONDS_IN_A_TICK value
*/
-Uint32 nextTick(Uint32 interval, void *param A_UNUSED)
+uint32_t nextTick(uint32_t interval, void *param A_UNUSED)
{
tick_time++;
if (tick_time == MAX_TICK_VALUE)
@@ -198,7 +198,7 @@ Uint32 nextTick(Uint32 interval, void *param A_UNUSED)
* Updates fps.
* Called every seconds by SDL_AddTimer()
*/
-Uint32 nextSecond(Uint32 interval, void *param A_UNUSED)
+uint32_t nextSecond(uint32_t interval, void *param A_UNUSED)
{
fps = frame_count;
lps = logic_count;
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 0e0ec4cff..5d69b2de3 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -747,7 +747,7 @@ void CommandHandler::handleEmote(const std::string &args,
ChatTab *tab A_UNUSED)
{
if (player_node)
- player_node->emote(static_cast<Uint8>(atoi(args.c_str())));
+ player_node->emote(static_cast<uint8_t>(atoi(args.c_str())));
}
void CommandHandler::handleAway(const std::string &args, ChatTab *tab A_UNUSED)
diff --git a/src/graphics.cpp b/src/graphics.cpp
index a082c5e4b..3693666ea 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -408,8 +408,8 @@ bool Graphics::drawRescaledImage(Image *image, int srcX, int srcY,
dstRect.y = static_cast<short>(dstY);
srcRect.x = static_cast<short>(srcX);
srcRect.y = static_cast<short>(srcY);
- srcRect.w = static_cast<Uint16>(width);
- srcRect.h = static_cast<Uint16>(height);
+ srcRect.w = static_cast<uint16_t>(width);
+ srcRect.h = static_cast<uint16_t>(height);
returnValue = !(SDL_BlitSurface(tmpImage->mSDLSurface,
&srcRect, mTarget, &dstRect) < 0);
@@ -438,8 +438,8 @@ bool Graphics::drawImage(const Image *image, int srcX, int srcY,
dstRect.y = static_cast<short>(dstY);
srcRect.x = static_cast<short>(srcX);
srcRect.y = static_cast<short>(srcY);
- srcRect.w = static_cast<Uint16>(width);
- srcRect.h = static_cast<Uint16>(height);
+ srcRect.w = static_cast<uint16_t>(width);
+ srcRect.h = static_cast<uint16_t>(height);
if (mBlitMode == BLIT_NORMAL)
{
@@ -485,8 +485,8 @@ void Graphics::drawImagePattern(const Image *image, int x, int y, int w, int h)
dstRect.y = static_cast<short>(dstY);
srcRect.x = static_cast<short>(srcX);
srcRect.y = static_cast<short>(srcY);
- srcRect.w = static_cast<Uint16>(dw);
- srcRect.h = static_cast<Uint16>(dh);
+ srcRect.w = static_cast<uint16_t>(dw);
+ srcRect.h = static_cast<uint16_t>(dh);
SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect);
}
@@ -534,8 +534,8 @@ void Graphics::drawRescaledImagePattern(Image *image, int x, int y,
dstRect.y = static_cast<short>(dstY);
srcRect.x = static_cast<short>(srcX);
srcRect.y = static_cast<short>(srcY);
- srcRect.w = static_cast<Uint16>(dw);
- srcRect.h = static_cast<Uint16>(dh);
+ srcRect.w = static_cast<uint16_t>(dw);
+ srcRect.h = static_cast<uint16_t>(dh);
SDL_BlitSurface(tmpImage->mSDLSurface, &srcRect,
mTarget, &dstRect);
@@ -760,8 +760,8 @@ void Graphics::calcImagePattern(GraphicsVertexes* vert,
dstRect.y = static_cast<short>(dstY);
srcRect.x = static_cast<short>(srcX);
srcRect.y = static_cast<short>(srcY);
- srcRect.w = static_cast<Uint16>(dw);
- srcRect.h = static_cast<Uint16>(dh);
+ srcRect.w = static_cast<uint16_t>(dw);
+ srcRect.h = static_cast<uint16_t>(dh);
if (SDL_FakeUpperBlit(image->mSDLSurface, &srcRect,
mTarget, &dstRect) == 1)
@@ -790,8 +790,8 @@ void Graphics::calcTile(ImageVertexes *vert, int x, int y)
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->src.w = static_cast<Uint16>(image->mBounds.w);
- rect->src.h = static_cast<Uint16>(image->mBounds.h);
+ 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,
mTarget, &rect->dst) == 1)
{
@@ -1000,7 +1000,7 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle)
SDL_LockSurface(mTarget);
const int bpp = mTarget->format->BytesPerPixel;
- Uint32 pixel = SDL_MapRGB(mTarget->format,
+ uint32_t pixel = SDL_MapRGB(mTarget->format,
mColor.r, mColor.g, mColor.b);
switch (bpp)
@@ -1008,7 +1008,7 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle)
case 1:
for (y = y1; y < y2; y++)
{
- Uint8 *p = static_cast<Uint8 *>(mTarget->pixels)
+ uint8_t *p = static_cast<uint8_t *>(mTarget->pixels)
+ y * mTarget->pitch;
for (x = x1; x < x2; x++)
*(p + x) = pixel;
@@ -1017,13 +1017,13 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle)
case 2:
for (y = y1; y < y2; y++)
{
- Uint8 *p0 = static_cast<Uint8 *>(mTarget->pixels)
+ uint8_t *p0 = static_cast<uint8_t *>(mTarget->pixels)
+ y * mTarget->pitch;
for (x = x1; x < x2; x++)
{
- Uint8 *p = p0 + x * 2;
- *reinterpret_cast<Uint16 *>(p) = gcn::SDLAlpha16(
- pixel, *reinterpret_cast<Uint32 *>(p),
+ uint8_t *p = p0 + x * 2;
+ *reinterpret_cast<uint16_t *>(p) = gcn::SDLAlpha16(
+ pixel, *reinterpret_cast<uint32_t *>(p),
mColor.a, mTarget->format);
}
}
@@ -1037,11 +1037,11 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle)
for (y = y1; y < y2; y++)
{
- Uint8 *p0 = static_cast<Uint8 *>(mTarget->pixels)
+ uint8_t *p0 = static_cast<uint8_t *>(mTarget->pixels)
+ y * mTarget->pitch;
for (x = x1; x < x2; x++)
{
- Uint8 *p = p0 + x * 3;
+ uint8_t *p = p0 + x * 3;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
p[2] = (p[2] * ca + cb) >> 8;
p[1] = (p[1] * ca + cg) >> 8;
@@ -1065,18 +1065,18 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle)
for (y = y1; y < y2; y++)
{
- Uint8 *p0 = static_cast<Uint8 *>(mTarget->pixels)
+ uint8_t *p0 = static_cast<uint8_t *>(mTarget->pixels)
+ y * mTarget->pitch;
for (x = x1; x < x2; x++)
{
- Uint8 *p = p0 + x * 4;
- Uint32 dst = *reinterpret_cast<Uint32 *>(p);
+ uint8_t *p = p0 + x * 4;
+ uint32_t dst = *reinterpret_cast<uint32_t *>(p);
const unsigned int b = (pb + (dst & 0xff) * a1) >> 8;
const unsigned int g = (pg + (dst & 0xff00) * a1) >> 8;
const unsigned int r = (pr
+ (dst & 0xff0000) * a1) >> 8;
- *reinterpret_cast<Uint32 *>(p) = ((b & 0xff)
+ *reinterpret_cast<uint32_t *>(p) = ((b & 0xff)
| (g & 0xff00) | (r & 0xff0000));
}
}
@@ -1113,12 +1113,12 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle)
for (y = y1; y < y2; y++)
{
- Uint32 *p0 = reinterpret_cast<Uint32*>(static_cast<Uint8*>(
+ uint32_t *p0 = reinterpret_cast<uint32_t*>(static_cast<uint8_t*>(
mTarget->pixels) + y * mTarget->pitch);
for (x = x1; x < x2; x++)
{
- Uint32 *p = p0 + x;
- const Uint32 dst = *p;
+ uint32_t *p = p0 + x;
+ const uint32_t dst = *p;
*p = cB[dst & 0xff] | cG[(dst & 0xff00) >> 8]
| cR[(dst & 0xff0000) >> 16];
}
@@ -1140,7 +1140,7 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle)
rect.w = area.width;
rect.h = area.height;
- Uint32 color = SDL_MapRGBA(mTarget->format,
+ uint32_t color = SDL_MapRGBA(mTarget->format,
mColor.r, mColor.g, mColor.b, mColor.a);
SDL_FillRect(mTarget, &rect, color);
}
diff --git a/src/graphics.h b/src/graphics.h
index 96e5555b7..ffa9a3c73 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -333,7 +333,7 @@ class Graphics : public gcn::SDLGraphics
int mOpenGL;
bool mEnableResize;
bool mNoFrame;
- Uint32 mOldPixel;
+ uint32_t mOldPixel;
int mOldAlpha;
std::string mName;
int mStartFreeMem;
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index feabd79d5..f513c31a1 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -368,7 +368,7 @@ void Gui::draw()
getTop()->draw(mGraphics);
int mouseX, mouseY;
- Uint8 button = SDL_GetMouseState(&mouseX, &mouseY);
+ uint8_t button = SDL_GetMouseState(&mouseX, &mouseY);
if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1))
&& mMouseCursors && mCustomCursor && mMouseCursorAlpha > 0.0f)
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index c5143a136..e67213bd8 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -220,6 +220,7 @@ void NpcDialog::showCloseButton()
void NpcDialog::action(const gcn::ActionEvent &event)
{
+ logger->log(event.getId());
if (event.getId() == "ok")
{
if (mActionState == NPC_ACTION_NEXT)
diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp
index b623337eb..e1310ef2e 100644
--- a/src/gui/sdlfont.cpp
+++ b/src/gui/sdlfont.cpp
@@ -69,9 +69,9 @@ class SDLTextChunk
void generate(TTF_Font *font, float alpha)
{
SDL_Color sdlCol;
- sdlCol.b = static_cast<Uint8>(color.b);
- sdlCol.r = static_cast<Uint8>(color.r);
- sdlCol.g = static_cast<Uint8>(color.g);
+ sdlCol.b = static_cast<uint8_t>(color.b);
+ sdlCol.r = static_cast<uint8_t>(color.r);
+ sdlCol.g = static_cast<uint8_t>(color.g);
getSafeUtf8String(text, strBuf);
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 2a69428b4..c2429c550 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -284,12 +284,12 @@ void Viewport::logic()
void Viewport::_followMouse()
{
- Uint8 button = SDL_GetMouseState(&mMouseX, &mMouseY);
+ uint8_t button = SDL_GetMouseState(&mMouseX, &mMouseY);
// If the left button is dragged
if (mPlayerFollowMouse && button & SDL_BUTTON(1))
{
// We create a mouse event and send it to mouseDragged.
- Uint8 *keys = SDL_GetKeyState(nullptr);
+ uint8_t *keys = SDL_GetKeyState(nullptr);
gcn::MouseEvent mouseEvent(nullptr,
(keys[SDLK_LSHIFT] || keys[SDLK_RSHIFT]),
false,
diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp
index 63ed8bbc2..e50017c38 100644
--- a/src/guichan/sdl/sdlgraphics.cpp
+++ b/src/guichan/sdl/sdlgraphics.cpp
@@ -209,10 +209,10 @@ namespace gcn
SDL_LockSurface(mTarget);
- Uint8 *p = static_cast<Uint8*>(mTarget->pixels)
+ uint8_t *p = static_cast<uint8_t*>(mTarget->pixels)
+ y * mTarget->pitch + x1 * bpp;
- Uint32 pixel = SDL_MapRGB(mTarget->format,
+ uint32_t pixel = SDL_MapRGB(mTarget->format,
mColor.r,
mColor.g,
mColor.b);
@@ -225,7 +225,7 @@ namespace gcn
case 2:
{
- Uint16* q = reinterpret_cast<Uint16*>(p);
+ uint16_t* q = reinterpret_cast<uint16_t*>(p);
for (; x1 <= x2; ++x1)
*(q++) = pixel;
break;
@@ -256,7 +256,7 @@ namespace gcn
case 4:
{
- Uint32 *q = reinterpret_cast<Uint32*>(p);
+ uint32_t *q = reinterpret_cast<uint32_t*>(p);
for (; x1 <= x2; ++x1)
{
if (mAlpha)
@@ -322,10 +322,10 @@ namespace gcn
SDL_LockSurface(mTarget);
- Uint8 *p = static_cast<Uint8*>(mTarget->pixels)
+ uint8_t *p = static_cast<uint8_t*>(mTarget->pixels)
+ y1 * mTarget->pitch + x * bpp;
- Uint32 pixel = SDL_MapRGB(mTarget->format, mColor.r,
+ uint32_t pixel = SDL_MapRGB(mTarget->format, mColor.r,
mColor.g, mColor.b);
switch (bpp)
@@ -341,7 +341,7 @@ namespace gcn
case 2:
for (; y1 <= y2; ++ y1)
{
- *reinterpret_cast<Uint16*>(p) = pixel;
+ *reinterpret_cast<uint16_t*>(p) = pixel;
p += mTarget->pitch;
}
break;
@@ -374,12 +374,12 @@ namespace gcn
{
if (mAlpha)
{
- *reinterpret_cast<Uint32*>(p) = SDLAlpha32(pixel,
- *reinterpret_cast<Uint32*>(p), mColor.a);
+ *reinterpret_cast<uint32_t*>(p) = SDLAlpha32(pixel,
+ *reinterpret_cast<uint32_t*>(p), mColor.a);
}
else
{
- *reinterpret_cast<Uint32*>(p) = pixel;
+ *reinterpret_cast<uint32_t*>(p) = pixel;
}
p += mTarget->pitch;
}
diff --git a/src/guichan/sdl/sdlimage.cpp b/src/guichan/sdl/sdlimage.cpp
index f00db27f9..5bb7041ff 100644
--- a/src/guichan/sdl/sdlimage.cpp
+++ b/src/guichan/sdl/sdlimage.cpp
@@ -140,7 +140,7 @@ namespace gcn
for (i = 0; i < mSurface->w * mSurface->h; ++i)
{
- Uint8 r, g, b, a;
+ uint8_t r, g, b, a;
SDL_GetRGBA((static_cast<unsigned int*>(mSurface->pixels)[i]),
mSurface->format, &r, &g, &b, &a);
diff --git a/src/joystick.cpp b/src/joystick.cpp
index cb3fa7fe1..86279c99d 100644
--- a/src/joystick.cpp
+++ b/src/joystick.cpp
@@ -180,7 +180,7 @@ void Joystick::logic()
if (!mDirection && mHaveHats)
{
// reading only hat 0
- Uint8 hat = SDL_JoystickGetHat(mJoystick, 0);
+ uint8_t hat = SDL_JoystickGetHat(mJoystick, 0);
if (hat & SDL_HAT_RIGHT)
mDirection |= RIGHT;
else if (hat & SDL_HAT_LEFT)
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index fe794cc02..390634b3c 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -49,7 +49,7 @@ void KeyboardConfig::init()
mEnabled = true;
if (mActiveKeys2)
delete mActiveKeys2;
- mActiveKeys2 = new Uint8[500];
+ mActiveKeys2 = new uint8_t[500];
}
int KeyboardConfig::getKeyValueFromEvent(const SDL_Event &event) const
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h
index 4fc1bdc51..fec264da0 100644
--- a/src/keyboardconfig.h
+++ b/src/keyboardconfig.h
@@ -96,9 +96,9 @@ class KeyboardConfig
private:
bool mEnabled; /**< Flag to respond to key input */
- Uint8 *mActiveKeys; /**< Stores a list of all the keys */
+ uint8_t *mActiveKeys; /**< Stores a list of all the keys */
- Uint8 *mActiveKeys2; /**< Stores a list of all the keys */
+ uint8_t *mActiveKeys2; /**< Stores a list of all the keys */
KeyToActionMap mKeyToAction;
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 09613a717..69e2572e1 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -358,7 +358,7 @@ void LocalPlayer::slowLogic()
if (serverVersion < 4 && mEnableAdvert && !mBlockAdvert
&& mAdvertTime < cur_time)
{
- Uint8 smile = FLAG_SPECIAL;
+ uint8_t smile = FLAG_SPECIAL;
if (mTradebot && shopWindow && !shopWindow->isShopEmpty())
smile += FLAG_SHOP;
@@ -1049,7 +1049,7 @@ void LocalPlayer::setDestination(int x, int y)
}
else if (mInvertDirection == 1)
{
- Uint8 newDir = 0;
+ uint8_t newDir = 0;
if (mDirection & UP)
newDir |= DOWN;
if (mDirection & LEFT)
@@ -1270,7 +1270,7 @@ bool LocalPlayer::updateSit()
return true;
}
-bool LocalPlayer::emote(Uint8 emotion)
+bool LocalPlayer::emote(uint8_t emotion)
{
if (!Client::limitPackets(PACKET_EMOTE))
return false;
@@ -2850,7 +2850,7 @@ void LocalPlayer::crazyMoveA()
case 'L':
// if (Client::limitPackets(PACKET_DIRECTION))
{
- Uint8 dir = 0;
+ uint8_t dir = 0;
switch (mDirection)
{
case UP : dir = Being::LEFT; break;
@@ -2866,7 +2866,7 @@ void LocalPlayer::crazyMoveA()
case 'R':
// if (Client::limitPackets(PACKET_DIRECTION))
{
- Uint8 dir = 0;
+ uint8_t dir = 0;
switch (mDirection)
{
case UP : dir = Being::RIGHT; break;
@@ -2882,7 +2882,7 @@ void LocalPlayer::crazyMoveA()
case 'b':
// if (Client::limitPackets(PACKET_DIRECTION))
{
- Uint8 dir = 0;
+ uint8_t dir = 0;
switch (mDirection)
{
case UP : dir = Being::DOWN; break;
@@ -3847,7 +3847,7 @@ void LocalPlayer::imitateDirection(Being *being, unsigned char dir)
if (mFollowMode == 2)
{
- Uint8 dir2 = 0;
+ uint8_t dir2 = 0;
if (dir & Being::LEFT)
dir2 |= Being::RIGHT;
else if (dir & Being::RIGHT)
@@ -4244,7 +4244,7 @@ void LocalPlayer::updateStatus()
{
if (serverVersion >= 4 && mEnableAdvert)
{
- Uint8 status = 0;
+ uint8_t status = 0;
if (mTradebot && shopWindow && !shopWindow->isShopEmpty())
status += FLAG_SHOP;
diff --git a/src/localplayer.h b/src/localplayer.h
index 708c40231..af54fa6b7 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -193,7 +193,7 @@ class LocalPlayer : public Being, public ActorSpriteListener,
bool toggleSit();
bool updateSit();
- bool emote(Uint8 emotion);
+ bool emote(uint8_t emotion);
/**
* Shows item pickup notifications.
diff --git a/src/map.cpp b/src/map.cpp
index 505830db8..bb35a53f1 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1442,7 +1442,7 @@ void Map::reduce()
}
else if (img->hasAlphaChannel())
{
- Uint8 *arr = img->SDLgetAlphaChannel();
+ uint8_t *arr = img->SDLgetAlphaChannel();
if (!arr)
continue;
@@ -1461,7 +1461,7 @@ void Map::reduce()
for (int d = img->mBounds.y;
d < img->mBounds.y + img->mBounds.h; d ++)
{
- Uint8 chan = arr[f + d * width];
+ uint8_t chan = arr[f + d * width];
if (chan != 255)
{
bad = true;
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);
}
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index d4a72ceab..602ceb7ad 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -516,7 +516,7 @@ public:
class PIS_emote : public PlayerIgnoreStrategy
{
public:
- PIS_emote(Uint8 emote_nr, const std::string &description,
+ PIS_emote(uint8_t emote_nr, const std::string &description,
const std::string &shortname) :
mEmotion(emote_nr)
{
@@ -531,7 +531,7 @@ public:
being->setEmote(mEmotion, IGNORE_EMOTE_TIME);
}
- Uint8 mEmotion;
+ uint8_t mEmotion;
};
std::vector<PlayerIgnoreStrategy *> *
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index 78ad8137a..59d8f18df 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -205,7 +205,7 @@ void DyePalette::getColor(double intensity, int color[3]) const
color[2] = static_cast<int>(rest * b1 + intensity * b2);
}
-void DyePalette::replaceColor(Uint8 *color) const
+void DyePalette::replaceColor(uint8_t *color) const
{
std::vector<Color>::const_iterator it = mColors.begin();
std::vector<Color>::const_iterator it_end = mColors.end();
@@ -228,7 +228,7 @@ void DyePalette::replaceColor(Uint8 *color) const
}
}
-void DyePalette::replaceOGLColor(Uint8 *color) const
+void DyePalette::replaceOGLColor(uint8_t *color) const
{
std::vector<Color>::const_iterator it = mColors.begin();
std::vector<Color>::const_iterator it_end = mColors.end();
diff --git a/src/resources/dye.h b/src/resources/dye.h
index b238f65fb..26135d82e 100644
--- a/src/resources/dye.h
+++ b/src/resources/dye.h
@@ -61,9 +61,9 @@ class DyePalette
*/
void getColor(double intensity, int color[3]) const;
- void replaceColor(Uint8 *color) const;
+ void replaceColor(uint8_t *color) const;
- void replaceOGLColor(Uint8 *color) const;
+ void replaceOGLColor(uint8_t *color) const;
private:
struct Color
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 3c5a2a97e..a4be43e4e 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -46,7 +46,7 @@
#include "debug.h"
-Image::Image(SDL_Surface *image, bool hasAlphaChannel0, Uint8 *alphaChannel):
+Image::Image(SDL_Surface *image, bool hasAlphaChannel0, uint8_t *alphaChannel):
mAlpha(1.0f),
mHasAlphaChannel(hasAlphaChannel0),
mSDLSurface(image),
@@ -67,8 +67,8 @@ Image::Image(SDL_Surface *image, bool hasAlphaChannel0, Uint8 *alphaChannel):
if (mSDLSurface)
{
- mBounds.w = static_cast<Uint16>(mSDLSurface->w);
- mBounds.h = static_cast<Uint16>(mSDLSurface->h);
+ mBounds.w = static_cast<uint16_t>(mSDLSurface->w);
+ mBounds.h = static_cast<uint16_t>(mSDLSurface->h);
mLoaded = true;
}
@@ -97,8 +97,8 @@ Image::Image(GLuint glimage, int width, int height,
{
mBounds.x = 0;
mBounds.y = 0;
- mBounds.w = static_cast<Uint16>(width);
- mBounds.h = static_cast<Uint16>(height);
+ mBounds.w = static_cast<uint16_t>(width);
+ mBounds.h = static_cast<uint16_t>(height);
if (mGLImage)
{
@@ -265,16 +265,16 @@ void Image::setAlpha(float alpha)
for (int i = i1; i <= i2; i++)
{
// Only change the pixel if it was visible at load time...
- Uint8 sourceAlpha = mAlphaChannel[i];
+ uint8_t sourceAlpha = mAlphaChannel[i];
if (sourceAlpha > 0)
{
- Uint8 a = static_cast<Uint8>(
+ uint8_t a = static_cast<uint8_t>(
static_cast<float>(sourceAlpha) * mAlpha);
- Uint32 c = (static_cast<Uint32*>(mSDLSurface->pixels))[i];
+ uint32_t c = (static_cast<uint32_t*>(mSDLSurface->pixels))[i];
c &= ~fmt->Amask;
c |= ((a >> fmt->Aloss) << fmt->Ashift & fmt->Amask);
- (static_cast<Uint32*>(mSDLSurface->pixels))[i] = c;
+ (static_cast<uint32_t*>(mSDLSurface->pixels))[i] = c;
}
}
diff --git a/src/resources/image.h b/src/resources/image.h
index c7d2657bd..59178cca6 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -133,7 +133,7 @@ class Image : public Resource
/**
* Get the alpha Channel of a SDL surface.
*/
- Uint8 *SDLgetAlphaChannel() const
+ uint8_t *SDLgetAlphaChannel() const
{ return mAlphaChannel; }
void SDLCleanCache();
@@ -183,14 +183,14 @@ class Image : public Resource
/** SDL Constructor */
Image(SDL_Surface *image, bool hasAlphaChannel = false,
- Uint8 *alphaChannel = nullptr);
+ uint8_t *alphaChannel = nullptr);
SDL_Surface *getByAlpha(float alpha);
SDL_Surface *mSDLSurface;
/** Alpha Channel pointer used for 32bit based SDL surfaces */
- Uint8 *mAlphaChannel;
+ uint8_t *mAlphaChannel;
std::map<float, SDL_Surface*> mAlphaCache;
diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp
index 9501c98a5..f452a9050 100644
--- a/src/resources/imagewriter.cpp
+++ b/src/resources/imagewriter.cpp
@@ -103,7 +103,7 @@ bool ImageWriter::writePNG(SDL_Surface *surface, const std::string &filename)
for (int i = 0; i < surface->h; i++)
{
- row_pointers[i] = static_cast<png_bytep>(static_cast<Uint8 *>(
+ row_pointers[i] = static_cast<png_bytep>(static_cast<uint8_t *>(
surface->pixels)) + i * surface->pitch;
}
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index db75a7b0c..7606b9ec8 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -61,15 +61,15 @@ Resource *OpenGLImageHelper::load(SDL_RWops *rw, Dye const &dye)
SDL_Surface *surf = convertTo32Bit(tmpImage);
SDL_FreeSurface(tmpImage);
- Uint32 *pixels = static_cast<Uint32 *>(surf->pixels);
+ uint32_t *pixels = static_cast<uint32_t *>(surf->pixels);
DyePalette *pal = dye.getSPalete();
if (pal)
{
- for (Uint32 *p_end = pixels + surf->w * surf->h;
+ for (uint32_t *p_end = pixels + surf->w * surf->h;
pixels != p_end; ++pixels)
{
- Uint8 *p = reinterpret_cast<Uint8 *>(pixels);
+ uint8_t *p = reinterpret_cast<uint8_t *>(pixels);
const int alpha = *p & 255;
if (!alpha)
continue;
@@ -78,10 +78,10 @@ Resource *OpenGLImageHelper::load(SDL_RWops *rw, Dye const &dye)
}
else
{
- for (Uint32 *p_end = pixels + surf->w * surf->h;
+ for (uint32_t *p_end = pixels + surf->w * surf->h;
pixels != p_end; ++pixels)
{
- const Uint32 p = *pixels;
+ const uint32_t p = *pixels;
const int alpha = (p >> 24) & 255;
if (!alpha)
continue;
@@ -154,7 +154,7 @@ Image *OpenGLImageHelper::_GLload(SDL_Surface *tmpImage)
SDL_SetAlpha(tmpImage, 0, SDL_ALPHA_OPAQUE);
// Determine 32-bit masks based on byte order
- Uint32 rmask, gmask, bmask, amask;
+ uint32_t rmask, gmask, bmask, amask;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
rmask = 0xff000000;
gmask = 0x00ff0000;
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index a416a35d2..6c281514e 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -65,15 +65,15 @@ Resource *SDLImageHelper::load(SDL_RWops *rw, Dye const &dye)
surf = SDL_ConvertSurface(tmpImage, &rgba, SDL_SWSURFACE);
SDL_FreeSurface(tmpImage);
- Uint32 *pixels = static_cast<Uint32 *>(surf->pixels);
+ uint32_t *pixels = static_cast<uint32_t *>(surf->pixels);
DyePalette *pal = dye.getSPalete();
if (pal)
{
- for (Uint32 *p_end = pixels + surf->w * surf->h;
+ for (uint32_t *p_end = pixels + surf->w * surf->h;
pixels != p_end; ++pixels)
{
- Uint8 *p = reinterpret_cast<Uint8 *>(pixels);
+ uint8_t *p = reinterpret_cast<uint8_t *>(pixels);
const int alpha = *p & 255;
if (!alpha)
continue;
@@ -82,10 +82,10 @@ Resource *SDLImageHelper::load(SDL_RWops *rw, Dye const &dye)
}
else
{
- for (Uint32 *p_end = pixels + surf->w * surf->h;
+ for (uint32_t *p_end = pixels + surf->w * surf->h;
pixels != p_end; ++pixels)
{
- const Uint32 p = *pixels;
+ const uint32_t p = *pixels;
const int alpha = p & 255;
if (!alpha)
continue;
@@ -121,23 +121,23 @@ Image *SDLImageHelper::createTextSurface(SDL_Surface *tmpImage, float alpha)
const int sz = tmpImage->w * tmpImage->h;
// The alpha channel to be filled with alpha values
- Uint8 *alphaChannel = new Uint8[sz];
+ uint8_t *alphaChannel = new uint8_t[sz];
const SDL_PixelFormat * const fmt = tmpImage->format;
if (fmt->Amask)
{
for (int i = 0; i < sz; ++ i)
{
- Uint32 c = (static_cast<Uint32*>(tmpImage->pixels))[i];
+ uint32_t c = (static_cast<uint32_t*>(tmpImage->pixels))[i];
unsigned v = (c & fmt->Amask) >> fmt->Ashift;
- Uint8 a = (v << fmt->Aloss) + (v >> (8 - (fmt->Aloss << 1)));
+ uint8_t a = (v << fmt->Aloss) + (v >> (8 - (fmt->Aloss << 1)));
- Uint8 a2 = static_cast<Uint8>(static_cast<float>(a) * alpha);
+ uint8_t a2 = static_cast<uint8_t>(static_cast<float>(a) * alpha);
c &= ~fmt->Amask;
c |= ((a2 >> fmt->Aloss) << fmt->Ashift & fmt->Amask);
- (static_cast<Uint32*>(tmpImage->pixels))[i] = c;
+ (static_cast<uint32_t*>(tmpImage->pixels))[i] = c;
if (a != 255)
hasAlpha = true;
@@ -206,7 +206,7 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage)
const int sz = tmpImage->w * tmpImage->h;
// The alpha channel to be filled with alpha values
- Uint8 *alphaChannel = new Uint8[sz];
+ uint8_t *alphaChannel = new uint8_t[sz];
// Figure out whether the image uses its alpha layer
if (!tmpImage->format->palette)
@@ -216,9 +216,9 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage)
{
for (int i = 0; i < sz; ++ i)
{
- unsigned v = ((static_cast<Uint32*>(tmpImage->pixels))[i]
+ unsigned v = ((static_cast<uint32_t*>(tmpImage->pixels))[i]
& fmt->Amask) >> fmt->Ashift;
- Uint8 a = (v << fmt->Aloss) + (v >> (8 - (fmt->Aloss << 1)));
+ uint8_t a = (v << fmt->Aloss) + (v >> (8 - (fmt->Aloss << 1)));
if (a != 255)
hasAlpha = true;
diff --git a/src/resources/subimage.cpp b/src/resources/subimage.cpp
index 895bdc9a7..bc9b0794f 100644
--- a/src/resources/subimage.cpp
+++ b/src/resources/subimage.cpp
@@ -57,8 +57,8 @@ SubImage::SubImage(Image *parent, SDL_Surface *image,
// Set up the rectangle.
mBounds.x = static_cast<short>(x);
mBounds.y = static_cast<short>(y);
- mBounds.w = static_cast<Uint16>(width);
- mBounds.h = static_cast<Uint16>(height);
+ mBounds.w = static_cast<uint16_t>(width);
+ mBounds.h = static_cast<uint16_t>(height);
if (mParent)
{
mInternalBounds.x = mParent->mBounds.x;
@@ -89,8 +89,8 @@ SubImage::SubImage(Image *parent, GLuint image,
// Set up the rectangle.
mBounds.x = static_cast<short>(x);
mBounds.y = static_cast<short>(y);
- mBounds.w = static_cast<Uint16>(width);
- mBounds.h = static_cast<Uint16>(height);
+ mBounds.w = static_cast<uint16_t>(width);
+ mBounds.h = static_cast<uint16_t>(height);
if (mParent)
{
mInternalBounds.x = mParent->mBounds.x;
diff --git a/src/sound.cpp b/src/sound.cpp
index bc3953127..8777625df 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -152,7 +152,7 @@ void Sound::info()
char driver[40] = "Unknown";
const char *format = "Unknown";
int rate = 0;
- Uint16 audioFormat = 0;
+ uint16_t audioFormat = 0;
int channels = 0;
MIX_VERSION(&compiledVersion);