summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-08 00:44:17 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-08 00:44:17 +0300
commit4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe (patch)
tree714897eca03fbcb764f5b450a29cc1aef8d33433
parent9e83411f7e4147d09af5a5006888dcc187ea0ef8 (diff)
downloadmv-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.tar.gz
mv-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.tar.bz2
mv-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.tar.xz
mv-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.zip
Fix more gcc 4.7 warnings.
-rw-r--r--src/actor.cpp4
-rw-r--r--src/actorsprite.cpp16
-rw-r--r--src/actorspritemanager.cpp44
-rw-r--r--src/animatedsprite.cpp16
-rw-r--r--src/animationparticle.cpp8
-rw-r--r--src/being.cpp51
-rw-r--r--src/channel.cpp2
-rw-r--r--src/channelmanager.cpp6
-rw-r--r--src/client.cpp80
-rw-r--r--src/compoundsprite.cpp41
-rw-r--r--src/configuration.cpp6
-rw-r--r--src/event.cpp2
-rw-r--r--src/flooritem.cpp2
-rw-r--r--src/game.cpp26
-rw-r--r--src/graphicsvertexes.cpp8
-rw-r--r--src/gui/buydialog.cpp6
-rw-r--r--src/gui/buyselldialog.cpp10
-rw-r--r--src/gui/charcreatedialog.cpp10
-rw-r--r--src/gui/setup_relations.cpp8
-rw-r--r--src/gui/setup_video.cpp16
-rw-r--r--src/gui/shopwindow.cpp16
-rw-r--r--src/gui/skilldialog.cpp20
-rw-r--r--src/gui/socialwindow.cpp74
-rw-r--r--src/gui/specialswindow.cpp2
-rw-r--r--src/gui/statuswindow.cpp16
-rw-r--r--src/gui/textdialog.cpp4
-rw-r--r--src/gui/theme.cpp44
-rw-r--r--src/gui/tradewindow.cpp6
-rw-r--r--src/gui/unregisterdialog.cpp4
-rw-r--r--src/gui/updaterwindow.cpp4
-rw-r--r--src/gui/viewport.cpp28
-rw-r--r--src/gui/whoisonline.cpp12
-rw-r--r--src/gui/windowmenu.cpp12
-rw-r--r--src/gui/worldselectdialog.cpp4
-rw-r--r--src/guichan/include/guichan/widgets/checkbox.hpp3
-rw-r--r--src/guichan/include/guichan/widgets/dropdown.hpp6
-rw-r--r--src/guildmanager.cpp12
-rw-r--r--src/imageparticle.cpp4
-rw-r--r--src/imagesprite.cpp2
-rw-r--r--src/inventory.cpp12
-rw-r--r--src/item.cpp6
-rw-r--r--src/localplayer.cpp41
-rw-r--r--src/logger.cpp2
-rw-r--r--src/main.cpp2
-rw-r--r--src/map.cpp62
-rw-r--r--src/mumblemanager.cpp4
-rw-r--r--src/net/download.cpp8
-rw-r--r--src/net/ea/beinghandler.cpp4
-rw-r--r--src/net/ea/buysellhandler.cpp2
-rw-r--r--src/net/ea/charserverhandler.cpp4
-rw-r--r--src/net/ea/guildhandler.cpp12
-rw-r--r--src/net/ea/inventoryhandler.cpp24
-rw-r--r--src/net/ea/inventoryhandler.h2
-rw-r--r--src/net/ea/npchandler.cpp2
-rw-r--r--src/net/ea/partyhandler.cpp20
-rw-r--r--src/net/ea/tradehandler.cpp6
-rw-r--r--src/net/messageout.cpp2
-rw-r--r--src/net/tmwa/charserverhandler.cpp6
-rw-r--r--src/net/tmwa/chathandler.cpp2
-rw-r--r--src/net/tmwa/generalhandler.cpp6
-rw-r--r--src/net/tmwa/network.cpp19
-rw-r--r--src/net/tmwa/npchandler.cpp4
-rw-r--r--src/openglgraphics.cpp2
-rw-r--r--src/particlecontainer.cpp2
-rw-r--r--src/party.cpp2
-rw-r--r--src/playerinfo.cpp17
-rw-r--r--src/playerrelations.cpp4
-rw-r--r--src/resources/ambientlayer.cpp2
-rw-r--r--src/resources/animation.cpp6
-rw-r--r--src/resources/beinginfo.cpp6
-rw-r--r--src/resources/colordb.cpp2
-rw-r--r--src/resources/dye.cpp4
-rw-r--r--src/resources/image.cpp26
-rw-r--r--src/resources/imageloader.cpp4
-rw-r--r--src/resources/imagewriter.cpp3
-rw-r--r--src/resources/itemdb.cpp2
-rw-r--r--src/resources/iteminfo.cpp14
-rw-r--r--src/resources/mapreader.cpp12
-rw-r--r--src/resources/resourcemanager.cpp8
-rw-r--r--src/resources/spritedef.cpp4
-rw-r--r--src/resources/wallpaper.cpp2
-rw-r--r--src/rotationalparticle.cpp4
-rw-r--r--src/shopitem.cpp2
-rw-r--r--src/simpleanimation.cpp4
-rw-r--r--src/sound.cpp12
-rw-r--r--src/spellmanager.cpp2
-rw-r--r--src/text.cpp28
-rw-r--r--src/textcommand.cpp10
-rw-r--r--src/textmanager.cpp4
-rw-r--r--src/utils/base64.cpp2
-rw-r--r--src/utils/copynpaste.cpp2
-rw-r--r--src/utils/xml.cpp6
92 files changed, 549 insertions, 536 deletions
diff --git a/src/actor.cpp b/src/actor.cpp
index 147b01cb6..095f3d959 100644
--- a/src/actor.cpp
+++ b/src/actor.cpp
@@ -29,12 +29,12 @@
#include "debug.h"
Actor::Actor():
- mMap(0)
+ mMap(nullptr)
{}
Actor::~Actor()
{
- setMap(0);
+ setMap(nullptr);
}
void Actor::setMap(Map *map)
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index ea24513e1..2a92cf506 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -53,18 +53,18 @@ ActorSprite::ActorSprite(int id):
mStatusParticleEffects(&mStunParticleEffects, false),
mChildParticleEffects(&mStatusParticleEffects, false),
mMustResetParticles(false),
- mUsedTargetCursor(0)
+ mUsedTargetCursor(nullptr)
{
}
ActorSprite::~ActorSprite()
{
- setMap(0);
+ setMap(nullptr);
- mUsedTargetCursor = 0;
+ mUsedTargetCursor = nullptr;
if (player_node && player_node->getTarget() == this)
- player_node->setTarget(0);
+ player_node->setTarget(nullptr);
// Notify listeners of the destruction.
for (ActorSpriteListenerIterator iter = mActorSpriteListeners.begin(),
@@ -160,7 +160,7 @@ struct EffectDescription
std::string mSFXEffect;
};
-static EffectDescription *default_effect = 0;
+static EffectDescription *default_effect = nullptr;
static std::map<int, EffectDescription *> effects;
static bool effects_initialized = false;
@@ -462,12 +462,12 @@ void ActorSprite::cleanupTargetCursors()
if (targetCursor[type][size])
{
delete targetCursor[type][size];
- targetCursor[type][size] = 0;
+ targetCursor[type][size] = nullptr;
}
if (targetCursorImages[type][size])
{
targetCursorImages[type][size]->decRef();
- targetCursorImages[type][size] = 0;
+ targetCursorImages[type][size] = nullptr;
}
}
}
@@ -503,7 +503,7 @@ void ActorSprite::loadTargetCursor(const std::string &filename,
if (targetCursor[type][size])
{
delete targetCursor[type][size];
- targetCursor[type][size] = 0;
+ targetCursor[type][size] = nullptr;
if (targetCursorImages[type][size])
targetCursorImages[type][size]->decRef();
}
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index f964a8b00..4403738f9 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -183,7 +183,7 @@ class SortBeingFunctor
} beingSorter;
ActorSpriteManager::ActorSpriteManager() :
- mMap(0)
+ mMap(nullptr)
{
mSpellHeal1 = serverConfig.getValue("spellHeal1", "#lum");
mSpellHeal2 = serverConfig.getValue("spellHeal2", "#inma");
@@ -321,7 +321,7 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y,
if (mExtMouseTargeting)
{
- Being *tempBeing = 0;
+ Being *tempBeing = nullptr;
bool noBeing(false);
for_actors
@@ -376,7 +376,7 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y,
}
if (noBeing)
- return 0;
+ return nullptr;
return tempBeing;
}
else
@@ -402,7 +402,7 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y,
return being;
}
}
- return 0;
+ return nullptr;
}
}
@@ -526,7 +526,7 @@ bool ActorSpriteManager::pickUpAll(int x1, int y1, int x2, int y2,
}
else if (Client::checkPackets(PACKET_PICKUP))
{
- FloorItem *item = 0;
+ FloorItem *item = nullptr;
unsigned cnt = 65535;
for_actors
{
@@ -621,7 +621,7 @@ Being *ActorSpriteManager::findNearestByName(const std::string &name,
Being::Type type) const
{
if (!player_node)
- return 0;
+ return nullptr;
int dist = 0;
Being* closestBeing = nullptr;
@@ -653,7 +653,7 @@ Being *ActorSpriteManager::findNearestByName(const std::string &name,
int d = (being->getTileX() - x) * (being->getTileX() - x)
+ (being->getTileY() - y) * (being->getTileY() - y);
- if (validateBeing(0, being, type, 0, 50)
+ if (validateBeing(nullptr, being, type, nullptr, 50)
&& (d < dist || closestBeing == nullptr))
{
dist = d;
@@ -697,7 +697,7 @@ void ActorSpriteManager::logic()
if (player_node)
{
if (player_node->getTarget() == *it)
- player_node->setTarget(0);
+ player_node->setTarget(nullptr);
if (player_node->getPickUpTarget() == *it)
player_node->unSetPickUpTarget();
}
@@ -718,11 +718,11 @@ void ActorSpriteManager::logic()
void ActorSpriteManager::clear()
{
if (beingEquipmentWindow)
- beingEquipmentWindow->setBeing(0);
+ beingEquipmentWindow->setBeing(nullptr);
if (player_node)
{
- player_node->setTarget(0);
+ player_node->setTarget(nullptr);
player_node->unSetPickUpTarget();
mActors.erase(player_node);
}
@@ -753,7 +753,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
Being::Type type) const
{
if (!aroundBeing)
- return 0;
+ return nullptr;
int x = aroundBeing->getTileX();
int y = aroundBeing->getTileY();
@@ -769,9 +769,9 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
Being *excluded) const
{
if (!aroundBeing || !player_node)
- return 0;
+ return nullptr;
- Being *closestBeing = 0;
+ Being *closestBeing = nullptr;
std::set<std::string> attackMobs;
std::set<std::string> priorityMobs;
std::set<std::string> ignoreAttackMobs;
@@ -852,7 +852,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
continue;
}
}
- if (validateBeing(aroundBeing, being, type, 0, maxDist))
+ if (validateBeing(aroundBeing, being, type, nullptr, maxDist))
{
if (being != excluded)
sortedBeings.push_back(being);
@@ -861,7 +861,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
// no selectable beings
if (sortedBeings.empty())
- return 0;
+ return nullptr;
beingSorter.x = x;
beingSorter.y = y;
@@ -874,14 +874,14 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
}
else
{
- beingSorter.attackBeings = 0;
- beingSorter.priorityBeings = 0;
+ beingSorter.attackBeings = nullptr;
+ beingSorter.priorityBeings = nullptr;
}
sort(sortedBeings.begin(), sortedBeings.end(), beingSorter);
if (filtered)
{
- beingSorter.attackBeings = 0;
- beingSorter.priorityBeings = 0;
+ beingSorter.attackBeings = nullptr;
+ beingSorter.priorityBeings = nullptr;
}
if (player_node->getTarget() == nullptr)
@@ -891,7 +891,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
if (specialDistance && target->getType() == Being::MONSTER
&& target->getDistance() <= 2)
{
- return 0;
+ return nullptr;
}
// if no selected being in vector, return first nearest being
return target;
@@ -970,7 +970,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
// logger->log("index:" + toString(index));
// logger->log("d:" + toString(d));
- if (valid && !filtered && (d <= dist || closestBeing == 0))
+ if (valid && !filtered && (d <= dist || !closestBeing))
{
dist = d;
closestBeing = being;
@@ -1014,7 +1014,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
}
}
}
- return (maxDist >= dist) ? closestBeing : 0;
+ return (maxDist >= dist) ? closestBeing : nullptr;
}
}
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index fedcd8de2..c1f1cac85 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -40,9 +40,9 @@ AnimatedSprite::AnimatedSprite(SpriteDef *sprite):
mFrameIndex(0),
mFrameTime(0),
mSprite(sprite),
- mAction(0),
- mAnimation(0),
- mFrame(0)
+ mAction(nullptr),
+ mAnimation(nullptr),
+ mFrame(nullptr)
{
mAlpha = 1.0f;
@@ -59,7 +59,7 @@ AnimatedSprite *AnimatedSprite::load(const std::string &filename, int variant)
ResourceManager *resman = ResourceManager::getInstance();
SpriteDef *s = resman->getSprite(filename, variant);
if (!s)
- return 0;
+ return nullptr;
AnimatedSprite *as = new AnimatedSprite(s);
s->decRef();
return as;
@@ -70,7 +70,7 @@ AnimatedSprite::~AnimatedSprite()
if (mSprite)
{
mSprite->decRef();
- mSprite = 0;
+ mSprite = nullptr;
}
}
@@ -194,8 +194,8 @@ bool AnimatedSprite::updateCurrentAnimation(unsigned int time)
{
if (mFrame->rand == 100 || rand() % 100 <= mFrame->rand)
{
- mAnimation = 0;
- mFrame = 0;
+ mAnimation = nullptr;
+ mFrame = nullptr;
return false;
}
}
@@ -292,7 +292,7 @@ std::string AnimatedSprite::getIdPath()
const Image* AnimatedSprite::getImage() const
{
- return mFrame ? mFrame->image : 0;
+ return mFrame ? mFrame->image : nullptr;
}
void AnimatedSprite::setAlpha(float alpha)
diff --git a/src/animationparticle.cpp b/src/animationparticle.cpp
index b20625a42..ef2e0a680 100644
--- a/src/animationparticle.cpp
+++ b/src/animationparticle.cpp
@@ -28,14 +28,14 @@
#include "debug.h"
AnimationParticle::AnimationParticle(Map *map, Animation *animation):
- ImageParticle(map, 0),
+ ImageParticle(map, nullptr),
mAnimation(new SimpleAnimation(animation))
{
}
AnimationParticle::AnimationParticle(Map *map, xmlNodePtr animationNode,
const std::string& dyePalettes):
- ImageParticle(map, 0),
+ ImageParticle(map, nullptr),
mAnimation(new SimpleAnimation(animationNode, dyePalettes))
{
}
@@ -43,8 +43,8 @@ AnimationParticle::AnimationParticle(Map *map, xmlNodePtr animationNode,
AnimationParticle::~AnimationParticle()
{
delete mAnimation;
- mAnimation = 0;
- mImage = 0;
+ mAnimation = nullptr;
+ mImage = nullptr;
}
bool AnimationParticle::update()
diff --git a/src/being.cpp b/src/being.cpp
index d73684ba0..b344e9709 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -212,7 +212,8 @@ Being::Being(int id, Type type, Uint16 subtype, Map *map):
ActorSprite(id),
mInfo(BeingInfo::unknown),
mActionTime(0),
- mEmotion(0), mEmotionTime(0),
+ mEmotion(0),
+ mEmotionTime(0),
mSpeechTime(0),
mAttackType(1),
mAttackSpeed(350),
@@ -221,19 +222,21 @@ Being::Being(int id, Type type, Uint16 subtype, Map *map):
mDirection(DOWN),
mDirectionDelayed(0),
mSpriteDirection(DIRECTION_DOWN),
- mDispName(0),
+ mDispName(nullptr),
mShowName(false),
mEquippedWeapon(nullptr),
- mText(0),
+ mText(nullptr),
mLevel(0),
mGender(GENDER_UNSPECIFIED),
- mParty(0),
+ mParty(nullptr),
mIsGM(false),
mAttackRange(1),
mType(type),
- mX(0), mY(0),
+ mX(0),
+ mY(0),
mDamageTaken(0),
- mHP(0), mMaxHP(0),
+ mHP(0),
+ mMaxHP(0),
mDistance(0),
mIsReachable(REACH_UNKNOWN),
mGoodStatus(-1),
@@ -291,16 +294,16 @@ Being::~Being()
config.removeListener("visiblenames", this);
delete[] mSpriteRemap;
- mSpriteRemap = 0;
+ mSpriteRemap = nullptr;
delete[] mSpriteHide;
- mSpriteHide = 0;
+ mSpriteHide = nullptr;
delete mSpeechBubble;
- mSpeechBubble = 0;
+ mSpeechBubble = nullptr;
delete mDispName;
- mDispName = 0;
+ mDispName = nullptr;
delete mText;
- mText = 0;
+ mText = nullptr;
}
void Being::setSubtype(Uint16 subtype)
@@ -543,7 +546,7 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
if (!userPalette || !attacker)
return;
- gcn::Font *font = 0;
+ gcn::Font *font = nullptr;
std::string damage = amount ? toString(amount) : type == FLEE ?
_("dodge") : _("miss");
const gcn::Color *color;
@@ -751,7 +754,7 @@ void Being::setShowName(bool doShowName)
else
{
delete mDispName;
- mDispName = 0;
+ mDispName = nullptr;
}
}
@@ -795,7 +798,7 @@ Guild *Being::getGuild(const std::string &guildName) const
return guild;
}
- return 0;
+ return nullptr;
}
Guild *Being::getGuild(int id) const
@@ -805,7 +808,7 @@ Guild *Being::getGuild(int id) const
if (itr != mGuilds.end())
return itr->second;
- return 0;
+ return nullptr;
}
Guild *Being::getGuild() const
@@ -815,7 +818,7 @@ Guild *Being::getGuild() const
if (itr != mGuilds.end())
return itr->second;
- return 0;
+ return nullptr;
}
void Being::clearGuilds()
@@ -1157,7 +1160,7 @@ void Being::logic()
if (mSpeechTime == 0 && mText)
{
delete mText;
- mText = 0;
+ mText = nullptr;
}
int frameCount = static_cast<int>(getFrameCount());
@@ -1393,7 +1396,7 @@ void Being::drawSpeech(int offsetX, int offsetY)
const bool isShowName = (speech == NAME_IN_BUBBLE);
delete mText;
- mText = 0;
+ mText = nullptr;
mSpeechBubble->setCaption(isShowName ? mName : "", mTextColor);
@@ -1418,7 +1421,7 @@ void Being::drawSpeech(int offsetX, int offsetY)
mSpeechBubble->setVisible(false);
delete mText;
- mText = 0;
+ mText = nullptr;
}
}
@@ -1538,7 +1541,7 @@ std::string Being::getGenderSign() const
void Being::showName()
{
delete mDispName;
- mDispName = 0;
+ mDispName = nullptr;
std::string mDisplayName(mName);
if (mType != MONSTER && (mShowGender || mShowLevel))
@@ -1556,7 +1559,7 @@ void Being::showName()
mDisplayName += ", " + toString(getDamageTaken());
}
- gcn::Font *font = 0;
+ gcn::Font *font = nullptr;
if (player_node && player_node->getTarget() == this
&& mType != MONSTER)
{
@@ -1879,7 +1882,7 @@ BeingCacheEntry* Being::getCacheEntry(int id)
return *i;
}
}
- return 0;
+ return nullptr;
}
@@ -2521,7 +2524,7 @@ void BeingEquipBackend::clear()
for (int i = 0; i < EQUIPMENT_SIZE; i++)
{
delete mEquipment[i];
- mEquipment[i] = 0;
+ mEquipment[i] = nullptr;
}
}
@@ -2533,6 +2536,6 @@ void BeingEquipBackend::setEquipment(int index, Item *item)
Item *BeingEquipBackend::getEquipment(int index) const
{
if (index < 0 || index >= EQUIPMENT_SIZE)
- return 0;
+ return nullptr;
return mEquipment[index];
}
diff --git a/src/channel.cpp b/src/channel.cpp
index c9194ec6f..19859f4ef 100644
--- a/src/channel.cpp
+++ b/src/channel.cpp
@@ -39,5 +39,5 @@ Channel::Channel(short id,
Channel::~Channel()
{
delete mTab;
- mTab = 0;
+ mTab = nullptr;
}
diff --git a/src/channelmanager.cpp b/src/channelmanager.cpp
index 23c68c1f7..4ae1ebe2a 100644
--- a/src/channelmanager.cpp
+++ b/src/channelmanager.cpp
@@ -40,7 +40,7 @@ ChannelManager::~ChannelManager()
Channel *ChannelManager::findById(int id) const
{
- Channel *channel = 0;
+ Channel *channel = nullptr;
for (std::list<Channel*>::const_iterator itr = mChannels.begin(),
end = mChannels.end();
itr != end;
@@ -60,7 +60,7 @@ Channel *ChannelManager::findById(int id) const
Channel *ChannelManager::findByName(const std::string &name) const
{
- Channel *channel = 0;
+ Channel *channel = nullptr;
if (!name.empty())
{
for (std::list<Channel*>::const_iterator itr = mChannels.begin(),
@@ -90,5 +90,5 @@ void ChannelManager::removeChannel(Channel *channel)
{
mChannels.remove(channel);
delete channel;
- channel = 0;
+ channel = nullptr;
}
diff --git a/src/client.cpp b/src/client.cpp
index 966070d3a..9c7c8c9a2 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -136,15 +136,15 @@ std::string errorMessage;
ErrorListener errorListener;
LoginData loginData;
-Configuration config; /**< XML file configuration reader */
-Configuration serverConfig; /**< XML file server configuration reader */
-Configuration branding; /**< XML branding information reader */
-Configuration paths; /**< XML default paths information reader */
-Logger *logger = 0; /**< Log object */
-ChatLogger *chatLogger = 0; /**< Chat log object */
+Configuration config; /**< XML file configuration reader */
+Configuration serverConfig; /**< XML file server configuration reader */
+Configuration branding; /**< XML branding information reader */
+Configuration paths; /**< XML default paths information reader */
+Logger *logger = nullptr; /**< Log object */
+ChatLogger *chatLogger = nullptr; /**< Chat log object */
KeyboardConfig keyboard;
-UserPalette *userPalette = 0;
-Graphics *mainGraphics = 0;
+UserPalette *userPalette = nullptr;
+Graphics *mainGraphics = nullptr;
Sound sound;
@@ -239,7 +239,7 @@ class LoginListener : public gcn::ActionListener
} // anonymous namespace
-Client *Client::mInstance = 0;
+Client *Client::mInstance = nullptr;
Client::Client(const Options &options):
mOptions(options),
@@ -247,16 +247,16 @@ Client::Client(const Options &options):
mUsersDir(""),
mNpcsDir(""),
mRootDir(""),
- mCurrentDialog(0),
- mQuitDialog(0),
- mDesktop(0),
- mSetupButton(0),
- mVideoButton(0),
- mThemesButton(0),
- mPerfomanceButton(0),
+ mCurrentDialog(nullptr),
+ mQuitDialog(nullptr),
+ mDesktop(nullptr),
+ mSetupButton(nullptr),
+ mVideoButton(nullptr),
+ mThemesButton(nullptr),
+ mPerfomanceButton(nullptr),
mState(STATE_CHOOSE_SERVER),
mOldState(STATE_START),
- mIcon(0),
+ mIcon(nullptr),
mLogicCounterId(0),
mSecondsCounterId(0),
mLimitFps(false),
@@ -651,7 +651,7 @@ Client::~Client()
Net::getLoginHandler()->clearWorlds();
delete mumbleManager;
- mumbleManager = 0;
+ mumbleManager = nullptr;
PlayerInfo::deinit();
@@ -659,24 +659,24 @@ Client::~Client()
for (int f = 0; f < SHORTCUT_TABS; f ++)
{
delete itemShortcut[f];
- itemShortcut[f] = 0;
+ itemShortcut[f] = nullptr;
}
delete emoteShortcut;
- emoteShortcut = 0;
+ emoteShortcut = nullptr;
delete dropShortcut;
- dropShortcut = 0;
+ dropShortcut = nullptr;
player_relations.store();
logger->log1("Quitting2");
delete gui;
- gui = 0;
+ gui = nullptr;
logger->log1("Quitting3");
delete mainGraphics;
- mainGraphics = 0;
+ mainGraphics = nullptr;
logger->log1("Quitting4");
@@ -703,7 +703,7 @@ Client::~Client()
logger->log1("Quitting9");
delete userPalette;
- userPalette = 0;
+ userPalette = nullptr;
logger->log1("Quitting10");
@@ -716,12 +716,12 @@ Client::~Client()
logger->log1("Quitting11");
delete chatLogger;
- chatLogger = 0;
+ chatLogger = nullptr;
delete logger;
- logger = 0;
+ logger = nullptr;
- mInstance = 0;
+ mInstance = nullptr;
}
int Client::exec()
@@ -731,7 +731,7 @@ int Client::exec()
if (!mumbleManager)
mumbleManager = new MumbleManager();
- Game *game = 0;
+ Game *game = nullptr;
SDL_Event event;
while (mState != STATE_EXIT)
@@ -901,7 +901,7 @@ int Client::exec()
if (mOldState == STATE_GAME)
{
delete game;
- game = 0;
+ game = nullptr;
Game::clearInstance();
ResourceManager *resman = ResourceManager::getInstance();
if (resman)
@@ -917,13 +917,13 @@ int Client::exec()
// Get rid of the dialog of the previous state
delete mCurrentDialog;
- mCurrentDialog = 0;
+ mCurrentDialog = nullptr;
// State has changed, while the quitDialog was active, it might
// not be correct anymore
if (mQuitDialog)
{
mQuitDialog->scheduleDelete();
- mQuitDialog = 0;
+ mQuitDialog = nullptr;
}
switch (mState)
@@ -1013,7 +1013,7 @@ int Client::exec()
if (mOptions.chooseDefault)
{
static_cast<WorldSelectDialog*>(mCurrentDialog)
- ->action(gcn::ActionEvent(0, "ok"));
+ ->action(gcn::ActionEvent(nullptr, "ok"));
}
}
}
@@ -1186,15 +1186,15 @@ int Client::exec()
Theme::instance()->setMinimumOpacity(-1.0f);
delete mSetupButton;
- mSetupButton = 0;
+ mSetupButton = nullptr;
delete mVideoButton;
- mVideoButton = 0;
+ mVideoButton = nullptr;
delete mThemesButton;
- mThemesButton = 0;
+ mThemesButton = nullptr;
delete mPerfomanceButton;
- mPerfomanceButton = 0;
+ mPerfomanceButton = nullptr;
delete mDesktop;
- mDesktop = 0;
+ mDesktop = nullptr;
mCurrentDialog = nullptr;
@@ -1537,7 +1537,7 @@ void Client::initServerConfig(std::string serverName)
logger->error(strprintf(_("%s doesn't exist and can't be created! "
"Exiting."), mServerConfigDir.c_str()));
}
- FILE *configFile = 0;
+ FILE *configFile = nullptr;
std::string configPath;
configPath = mServerConfigDir + "/config.xml";
@@ -1601,7 +1601,7 @@ void Client::initConfiguration()
// Checking if the configuration file exists... otherwise create it with
// default options.
- FILE *configFile = 0;
+ FILE *configFile = nullptr;
std::string configPath;
// bool oldConfig = false;
// int emptySize = config.getSize();
@@ -1791,7 +1791,7 @@ void Client::accountLogin(LoginData *data)
bool Client::copyFile(std::string &configPath, std::string &oldConfigPath)
{
- FILE *configFile = 0;
+ FILE *configFile = nullptr;
configFile = fopen(oldConfigPath.c_str(), "r");
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp
index cda178aeb..3ee988cec 100644
--- a/src/compoundsprite.cpp
+++ b/src/compoundsprite.cpp
@@ -45,12 +45,13 @@
static const unsigned cache_max_size = 10;
static const unsigned cache_clean_part = 3;
-CompoundSprite::CompoundSprite():
- mCacheItem(0),
- mImage(0),
- mAlphaImage(0),
- mOffsetX(0), mOffsetY(0),
- mNeedsRedraw(false)
+CompoundSprite::CompoundSprite() :
+ mCacheItem(nullptr),
+ mImage(nullptr),
+ mAlphaImage(nullptr),
+ mOffsetX(0),
+ mOffsetY(0),
+ mNeedsRedraw(false)
{
mAlpha = 1.0f;
mEnableAlphaFix = config.getBoolValue("enableAlphaFix");
@@ -67,9 +68,9 @@ CompoundSprite::~CompoundSprite()
clear();
// delete mImage;
- mImage = 0;
+ mImage = nullptr;
// delete mAlphaImage;
- mAlphaImage = 0;
+ mAlphaImage = nullptr;
}
bool CompoundSprite::reset()
@@ -275,7 +276,7 @@ void CompoundSprite::removeSprite(int layer)
return;
delete at(layer);
- at(layer) = 0;
+ at(layer) = nullptr;
mNeedsRedraw = true;
}
@@ -290,7 +291,7 @@ void CompoundSprite::clear()
delete_all(imagesCache);
imagesCache.clear();
delete mCacheItem;
- mCacheItem = 0;
+ mCacheItem = nullptr;
}
void CompoundSprite::ensureSize(size_t layerCount)
@@ -381,7 +382,7 @@ void CompoundSprite::redraw() const
drawSpritesSDL(graphics, posX, posY);
delete graphics;
- graphics = 0;
+ graphics = nullptr;
SDL_Surface *surfaceA = SDL_CreateRGBSurface(SDL_HWSURFACE,
BUFFER_WIDTH, BUFFER_HEIGHT, 32, rmask, gmask, bmask, amask);
@@ -402,7 +403,7 @@ void CompoundSprite::redraw() const
}
else
{
- mAlphaImage = 0;
+ mAlphaImage = nullptr;
}
}
@@ -468,7 +469,7 @@ bool CompoundSprite::updateFromCache() const
if (mCacheItem && mCacheItem->image)
{
imagesCache.push_front(mCacheItem);
- mCacheItem = 0;
+ mCacheItem = nullptr;
if (imagesCache.size() > cache_max_size)
{
for (unsigned f = 0; f < cache_clean_part; f ++)
@@ -496,8 +497,8 @@ bool CompoundSprite::updateFromCache() const
for (; it1 != it1_end && it2 != it2_end; ++ it1, ++ it2)
{
- void *ptr1 = 0;
- void *ptr2 = 0;
+ void *ptr1 = nullptr;
+ void *ptr2 = nullptr;
if (*it1)
ptr1 = (*it1)->getHash();
if (*it2)
@@ -519,8 +520,8 @@ bool CompoundSprite::updateFromCache() const
}
}
}
- mImage = 0;
- mAlphaImage = 0;
+ mImage = nullptr;
+ mAlphaImage = nullptr;
// miss++;
return false;
}
@@ -539,14 +540,14 @@ void CompoundSprite::initCurrentCacheItem() const
if (*it)
mCacheItem->data.push_back((*it)->getHash());
else
- mCacheItem->data.push_back(0);
+ mCacheItem->data.push_back(nullptr);
}
}
CompoundItem::CompoundItem() :
// alpha(1.0f),
- image(0),
- alphaImage(0)
+ image(nullptr),
+ alphaImage(nullptr)
{
}
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 814b0ce65..b8b742f53 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -152,7 +152,7 @@ ConfigurationObject::~ConfigurationObject()
Configuration::Configuration() :
mConfigPath(""),
- mDefaultsData(0),
+ mDefaultsData(nullptr),
mDirectory("")
{
}
@@ -168,7 +168,7 @@ void Configuration::cleanDefaults()
}
mDefaultsData->clear();
delete mDefaultsData;
- mDefaultsData = 0;
+ mDefaultsData = nullptr;
}
}
@@ -470,7 +470,7 @@ void ConfigurationObject::initFromXML(xmlNodePtr parent_node)
void Configuration::init(const std::string &filename, bool useResManager)
{
- mDefaultsData = 0;
+ mDefaultsData = nullptr;
XML::Document doc(filename, useResManager);
if (useResManager)
diff --git a/src/event.cpp b/src/event.cpp
index 7eaf8aea6..9d27a081a 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -37,7 +37,7 @@ Event::~Event()
while (it != mData.end())
{
delete it->second;
- it->second = 0;
+ it->second = nullptr;
++it;
}
}
diff --git a/src/flooritem.cpp b/src/flooritem.cpp
index 9b11bdc9c..fa6cbf618 100644
--- a/src/flooritem.cpp
+++ b/src/flooritem.cpp
@@ -97,7 +97,7 @@ bool FloorItem::draw(Graphics *graphics, int offsetX, int offsetY) const
const int x = mX * mMap->getTileWidth() + offsetX;
const int y = mY * mMap->getTileHeight() + offsetY;
- gcn::Font *font = 0;
+ gcn::Font *font = nullptr;
if (mHighlight)
{
diff --git a/src/game.cpp b/src/game.cpp
index 6b595e8e1..f0964bbb4 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -206,7 +206,7 @@ static void createGuiWindows()
tradeWindow = new TradeWindow;
equipmentWindow = new EquipmentWindow(PlayerInfo::getEquipment(),
player_node);
- beingEquipmentWindow = new EquipmentWindow(0, 0, true);
+ beingEquipmentWindow = new EquipmentWindow(nullptr, nullptr, true);
beingEquipmentWindow->setVisible(false);
statusWindow = new StatusWindow;
miniStatusWindow = new MiniStatusWindow;
@@ -263,7 +263,7 @@ static void createGuiWindows()
}
else
{
- tradeChatTab = 0;
+ tradeChatTab = nullptr;
}
if (config.getBoolValue("enableBattleTab"))
@@ -273,7 +273,7 @@ static void createGuiWindows()
}
else
{
- battleChatTab = 0;
+ battleChatTab = nullptr;
}
if (config.getBoolValue("logToChat"))
@@ -288,7 +288,7 @@ static void createGuiWindows()
Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSLOADED));
}
-#define del_0(X) { delete X; X = 0; }
+#define del_0(X) { delete X; X = nullptr; }
/**
* Destroy all the globally accessible gui windows
@@ -347,11 +347,11 @@ static void destroyGuiWindows()
guildManager->reload();
}
-Game *Game::mInstance = 0;
+Game *Game::mInstance = nullptr;
Game::Game():
mLastTarget(ActorSprite::UNKNOWN),
- mCurrentMap(0),
+ mCurrentMap(nullptr),
mMapName(""),
mValidSpeed(true),
mLastAction(0),
@@ -449,7 +449,7 @@ Game::~Game()
Being::clearCache();
- mInstance = 0;
+ mInstance = nullptr;
Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_DESTRUCTED));
}
@@ -457,7 +457,7 @@ Game::~Game()
static bool saveScreenshot()
{
static unsigned int screenshotCount = 0;
- SDL_Surface *screenshot = 0;
+ SDL_Surface *screenshot = nullptr;
if (!config.getBoolValue("showip"))
{
@@ -542,7 +542,7 @@ void Game::logic()
if (mCurrentMap)
mCurrentMap->update();
- cur_time = static_cast<int>(time(0));
+ cur_time = static_cast<int>(time(nullptr));
Being::reReadConfig();
if (killStats)
killStats->recalcStats();
@@ -584,7 +584,7 @@ void Game::logic()
if (disconnectedDialog)
{
disconnectedDialog->scheduleDelete();
- disconnectedDialog = 0;
+ disconnectedDialog = nullptr;
}
}
}
@@ -1597,7 +1597,7 @@ void Game::handleInput()
if (keyboard.isKeyActive(keyboard.KEY_TARGET_ATTACK)
&& !keyboard.isKeyActive(keyboard.KEY_MOVE_TO_TARGET))
{
- Being *target = 0;
+ Being *target = nullptr;
bool newTarget = !keyboard.isKeyActive(keyboard.KEY_TARGET);
// A set target has highest priority
@@ -1717,7 +1717,7 @@ void Game::changeMap(const std::string &mapPath)
// Unset the map of the player so that its particles are cleared before
// being deleted in the next step
if (player_node)
- player_node->setMap(0);
+ player_node->setMap(nullptr);
if (particleEngine)
particleEngine->clear();
@@ -1887,6 +1887,6 @@ void Game::closeDialogs()
if (deathNotice)
{
deathNotice->scheduleDelete();
- deathNotice = 0;
+ deathNotice = nullptr;
}
}
diff --git a/src/graphicsvertexes.cpp b/src/graphicsvertexes.cpp
index 90a7bbf38..0e28c2b76 100644
--- a/src/graphicsvertexes.cpp
+++ b/src/graphicsvertexes.cpp
@@ -44,9 +44,9 @@ SDLGraphicsVertexes::~SDLGraphicsVertexes()
#ifdef USE_OPENGL
OpenGLGraphicsVertexes::OpenGLGraphicsVertexes() :
ptr(0),
- mFloatTexArray(0),
- mIntTexArray(0),
- mIntVertArray(0)
+ mFloatTexArray(nullptr),
+ mIntTexArray(nullptr),
+ mIntVertArray(nullptr)
{
mFloatTexPool.reserve(30);
mIntVertPool.reserve(30);
@@ -240,6 +240,6 @@ ImageVertexes::~ImageVertexes()
sdl.clear();
#ifdef USE_OPENGL
delete ogl;
- ogl = 0;
+ ogl = nullptr;
#endif
}
diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp
index 7fad622df..f5e556848 100644
--- a/src/gui/buydialog.cpp
+++ b/src/gui/buydialog.cpp
@@ -55,14 +55,14 @@
BuyDialog::DialogList BuyDialog::instances;
BuyDialog::BuyDialog(int npcId):
- Window(_("Buy"), false, 0, "buy.xml"),
+ Window(_("Buy"), false, nullptr, "buy.xml"),
mNpcId(npcId), mMoney(0), mAmountItems(0), mMaxItems(0), mNick("")
{
init();
}
BuyDialog::BuyDialog(std::string nick):
- Window(_("Buy"), false, 0, "buy.xml"),
+ Window(_("Buy"), false, nullptr, "buy.xml"),
mNpcId(-1), mMoney(0), mAmountItems(0), mMaxItems(0), mNick(nick)
{
init();
@@ -153,7 +153,7 @@ void BuyDialog::init()
BuyDialog::~BuyDialog()
{
delete mShopItems;
- mShopItems = 0;
+ mShopItems = nullptr;
instances.remove(this);
}
diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp
index e1063192a..2a614ed74 100644
--- a/src/gui/buyselldialog.cpp
+++ b/src/gui/buyselldialog.cpp
@@ -37,19 +37,19 @@
BuySellDialog::DialogList BuySellDialog::instances;
BuySellDialog::BuySellDialog(int npcId):
- Window(_("Shop"), false, 0, "buysell.xml"),
+ Window(_("Shop"), false, nullptr, "buysell.xml"),
mNpcId(npcId),
mNick(""),
- mBuyButton(0)
+ mBuyButton(nullptr)
{
init();
}
BuySellDialog::BuySellDialog(std::string nick):
- Window(_("Shop"), false, 0, "buysell.xml"),
+ Window(_("Shop"), false, nullptr, "buysell.xml"),
mNpcId(-1),
mNick(nick),
- mBuyButton(0)
+ mBuyButton(nullptr)
{
init();
}
@@ -62,7 +62,7 @@ void BuySellDialog::init()
static const char *buttonNames[] =
{
- N_("Buy"), N_("Sell"), N_("Cancel"), 0
+ N_("Buy"), N_("Sell"), N_("Cancel"), nullptr
};
int x = 10, y = 10;
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index 0cde69386..42435f036 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -180,10 +180,10 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot):
CharCreateDialog::~CharCreateDialog()
{
delete mPlayer;
- mPlayer = 0;
+ mPlayer = nullptr;
// Make sure the char server handler knows that we're gone
- Net::getCharHandler()->setCharCreateDialog(0);
+ Net::getCharHandler()->setCharCreateDialog(nullptr);
}
void CharCreateDialog::action(const gcn::ActionEvent &event)
@@ -335,13 +335,13 @@ void CharCreateDialog::setAttributes(const std::vector<std::string> &labels,
{
remove(mAttributeLabel[i]);
delete mAttributeLabel[i];
- mAttributeLabel[i] = 0;
+ mAttributeLabel[i] = nullptr;
remove(mAttributeSlider[i]);
delete mAttributeSlider[i];
- mAttributeSlider[i] = 0;
+ mAttributeSlider[i] = nullptr;
remove(mAttributeValue[i]);
delete mAttributeValue[i];
- mAttributeValue[i] = 0;
+ mAttributeValue[i] = nullptr;
}
mAttributeLabel.resize(labels.size());
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index 1921ee267..8ac61f90c 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -108,9 +108,9 @@ public:
{
freeWidgets();
delete mListModel;
- mListModel = 0;
+ mListModel = nullptr;
delete mPlayers;
- mPlayers = 0;
+ mPlayers = nullptr;
}
virtual int getRows() const
@@ -185,7 +185,7 @@ public:
virtual void freeWidgets()
{
delete mPlayers;
- mPlayers = 0;
+ mPlayers = nullptr;
delete_all(mWidgets);
mWidgets.clear();
@@ -310,7 +310,7 @@ Setup_Relations::~Setup_Relations()
{
player_relations.removeListener(this);
delete mIgnoreActionChoicesModel;
- mIgnoreActionChoicesModel = 0;
+ mIgnoreActionChoicesModel = nullptr;
}
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index ea181ea14..794fd3324 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -133,7 +133,7 @@ ModeListModel::ModeListModel()
SDL_Rect **modes = SDL_ListModes(nullptr, SDL_FULLSCREEN | SDL_HWSURFACE);
/* Check which modes are available */
- if (modes == static_cast<SDL_Rect **>(0))
+ if (modes == static_cast<SDL_Rect **>(nullptr))
{
logger->log1("No modes available");
}
@@ -310,7 +310,7 @@ Setup_Video::Setup_Video():
mParticleDetail(3 - config.getIntValue("particleEmitterSkip")),
mParticleDetailSlider(new Slider(0, 3)),
mParticleDetailField(new Label),
- mDialog(0)
+ mDialog(nullptr)
{
setName(_("Video"));
@@ -446,13 +446,13 @@ Setup_Video::Setup_Video():
Setup_Video::~Setup_Video()
{
delete mModeListModel;
- mModeListModel = 0;
+ mModeListModel = nullptr;
delete mModeList;
- mModeList = 0;
+ mModeList = nullptr;
delete mOpenGLListModel;
- mOpenGLListModel = 0;
+ mOpenGLListModel = nullptr;
delete mDialog;
- mDialog = 0;
+ mDialog = nullptr;
}
void Setup_Video::apply()
@@ -594,7 +594,7 @@ void Setup_Video::action(const gcn::ActionEvent &event)
if (mDialog)
{
mode = mDialog->getText();
- mDialog = 0;
+ mDialog = nullptr;
}
else
{
@@ -632,7 +632,7 @@ void Setup_Video::action(const gcn::ActionEvent &event)
}
if (id == "~videomode")
{
- mDialog = 0;
+ mDialog = nullptr;
}
else if (id == "guialpha")
{
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index 2215ce699..a50a485ec 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -72,14 +72,14 @@ extern std::string tradePartnerName;
ShopWindow::DialogList ShopWindow::instances;
ShopWindow::ShopWindow():
- Window(_("Personal Shop"), false, 0, "shop.xml"),
+ Window(_("Personal Shop"), false, nullptr, "shop.xml"),
mSelectedItem(-1),
mAnnonceTime(0),
mLastRequestTimeList(0),
mLastRequestTimeItem(0),
mRandCounter(0),
mAcceptPlayer(""),
- mTradeItem(0),
+ mTradeItem(nullptr),
mTradeNick(""),
mTradeMoney(0)
{
@@ -152,8 +152,8 @@ ShopWindow::ShopWindow():
}
else
{
- mBuyAuctionButton = 0;
- mSellAuctionButton = 0;
+ mBuyAuctionButton = nullptr;
+ mSellAuctionButton = nullptr;
}
Layout &layout = getLayout();
@@ -173,10 +173,10 @@ ShopWindow::~ShopWindow()
saveList();
delete mBuyShopItems;
- mBuyShopItems = 0;
+ mBuyShopItems = nullptr;
delete mSellShopItems;
- mSellShopItems = 0;
+ mSellShopItems = nullptr;
instances.remove(this);
}
@@ -602,8 +602,8 @@ void ShopWindow::sendMessage(const std::string &nick,
void ShopWindow::showList(const std::string &nick, std::string data)
{
- BuyDialog *buyDialog = 0;
- SellDialog *sellDialog = 0;
+ BuyDialog *buyDialog = nullptr;
+ SellDialog *sellDialog = nullptr;
if (data.find("B1") == 0)
{
data = data.substr(2);
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 8f45be5d1..072a9cb85 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -81,8 +81,8 @@ struct SkillInfo
gcn::Color color;
SkillInfo() :
- id(0), name(""), dispName(""), icon(0), modifiable(false),
- visible(false), model(0), skillLevel(""), skillLevelWidth(0),
+ id(0), name(""), dispName(""), icon(nullptr), modifiable(false),
+ visible(false), model(nullptr), skillLevel(""), skillLevelWidth(0),
skillExp(""), progress(0.0f)
{
}
@@ -92,7 +92,7 @@ struct SkillInfo
if (icon)
{
icon->decRef();
- icon = 0;
+ icon = nullptr;
}
}
@@ -161,9 +161,9 @@ public:
~SkillListBox()
{
delete mModel;
- mModel = 0;
+ mModel = nullptr;
delete mPopup;
- mPopup = 0;
+ mPopup = nullptr;
}
SkillInfo *getSelectedInfo()
@@ -172,7 +172,7 @@ public:
if (!mListModel || selected < 0
|| selected > mListModel->getNumberOfElements())
{
- return 0;
+ return nullptr;
}
return static_cast<SkillModel*>(mListModel)->getSkillAt(selected);
@@ -257,7 +257,7 @@ public:
~SkillTab()
{
delete mListBox;
- mListBox = 0;
+ mListBox = nullptr;
}
SkillInfo *getSelectedInfo()
@@ -265,7 +265,7 @@ public:
if (mListBox)
return mListBox->getSelectedInfo();
else
- return 0;
+ return nullptr;
}
private:
@@ -273,7 +273,7 @@ private:
};
SkillDialog::SkillDialog():
- Window(_("Skills"), false, 0, "skills.xml")
+ Window(_("Skills"), false, nullptr, "skills.xml")
{
setWindowName("Skills");
setCloseButton(true);
@@ -286,7 +286,7 @@ SkillDialog::SkillDialog():
mTabs = new TabbedArea();
mPointsLabel = new Label("0");
mIncreaseButton = new Button(_("Up"), "inc", this);
- mDefaultModel = 0;
+ mDefaultModel = nullptr;
place(0, 0, mTabs, 5, 5);
place(0, 5, mPointsLabel, 4);
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 6b07e109f..2bc8aba9b 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -66,10 +66,10 @@ protected:
friend class SocialWindow;
SocialTab():
- mInviteDialog(0),
- mConfirmDialog(0),
- mScroll(0),
- mList(0)
+ mInviteDialog(nullptr),
+ mConfirmDialog(nullptr),
+ mScroll(nullptr),
+ mList(nullptr)
{}
virtual ~SocialTab()
@@ -129,9 +129,9 @@ public:
~SocialGuildTab()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
}
void action(const gcn::ActionEvent &event)
@@ -147,11 +147,11 @@ public:
_("Invited user %s to guild %s."),
name.c_str(), mGuild->getName().c_str()), BY_SERVER);
}
- mInviteDialog = 0;
+ mInviteDialog = nullptr;
}
else if (event.getId() == "~do invite")
{
- mInviteDialog = 0;
+ mInviteDialog = nullptr;
}
else if (event.getId() == "yes")
{
@@ -161,11 +161,11 @@ public:
localChatTab->chatLog(strprintf(_("Guild %s quit requested."),
mGuild->getName().c_str()), BY_SERVER);
}
- mConfirmDialog = 0;
+ mConfirmDialog = nullptr;
}
else if (event.getId() == "~yes")
{
- mConfirmDialog = 0;
+ mConfirmDialog = nullptr;
}
}
@@ -227,9 +227,9 @@ public:
~SocialGuildTab2()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
}
void action(const gcn::ActionEvent &event A_UNUSED)
@@ -330,9 +330,9 @@ public:
~SocialPartyTab()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
}
void action(const gcn::ActionEvent &event)
@@ -465,11 +465,11 @@ public:
~SocialPlayersTab()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
delete mBeings;
- mBeings = 0;
+ mBeings = nullptr;
}
void updateList()
@@ -525,9 +525,9 @@ public:
{
std::vector<Avatar*> *avatars = mBeings->getMembers();
if (!avatars)
- return 0;
+ return nullptr;
- Avatar *ava = 0;
+ Avatar *ava = nullptr;
std::vector<Avatar*>::const_iterator i = avatars->begin();
while (i != avatars->end())
{
@@ -629,11 +629,11 @@ public:
~SocialNavigationTab()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
delete mBeings;
- mBeings = 0;
+ mBeings = nullptr;
}
void invite()
@@ -751,7 +751,7 @@ public:
if (!map)
return;
- Avatar *ava = 0;
+ Avatar *ava = nullptr;
std::vector<Avatar*>::const_iterator i = avatars->begin();
while (i != avatars->end())
{
@@ -785,7 +785,7 @@ public:
if (!map)
return 01;
- Avatar *ava = 0;
+ Avatar *ava = nullptr;
std::vector<Avatar*>::const_iterator i = avatars->begin();
unsigned num = 0;
while (i != avatars->end())
@@ -906,11 +906,11 @@ public:
~SocialAttackTab()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
delete mBeings;
- mBeings = 0;
+ mBeings = nullptr;
}
void invite()
@@ -1114,11 +1114,11 @@ private:
};
SocialWindow::SocialWindow() :
- Window(_("Social"), false, 0, "social.xml"),
+ Window(_("Social"), false, nullptr, "social.xml"),
mGuildInvited(0),
- mGuildAcceptDialog(0),
- mPartyAcceptDialog(0),
- mMap(0),
+ mGuildAcceptDialog(nullptr),
+ mPartyAcceptDialog(nullptr),
+ mMap(nullptr),
mLastUpdateTime(0),
mNeedUpdate(false),
mProcessedPortals(false)
@@ -1165,7 +1165,7 @@ SocialWindow::SocialWindow() :
}
else
{
- mAttackFilter = 0;
+ mAttackFilter = nullptr;
}
if (player_node && player_node->getParty())
@@ -1198,13 +1198,13 @@ SocialWindow::~SocialWindow()
mPartyInviter = "";
}
delete mCreatePopup;
- mCreatePopup = 0;
+ mCreatePopup = nullptr;
delete mPlayers;
- mPlayers = 0;
+ mPlayers = nullptr;
delete mNavigation;
- mNavigation = 0;
+ mNavigation = nullptr;
delete mAttackFilter;
- mAttackFilter = 0;
+ mAttackFilter = nullptr;
}
bool SocialWindow::addTab(Guild *guild)
@@ -1212,7 +1212,7 @@ bool SocialWindow::addTab(Guild *guild)
if (mGuilds.find(guild) != mGuilds.end())
return false;
- SocialTab *tab = 0;
+ SocialTab *tab = nullptr;
if (guild->getServerGuild())
tab = new SocialGuildTab(guild);
else
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index a52b30c62..6abff3796 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -76,7 +76,7 @@ class SpecialEntry : public Container
};
SpecialsWindow::SpecialsWindow():
- Window(_("Specials"), false, 0, "specials.xml")
+ Window(_("Specials"), false, nullptr, "specials.xml")
{
setWindowName("Specials");
setCloseButton(true);
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index bd88fad7e..37a706baf 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -123,7 +123,8 @@ class ChangeDisplay : public AttrDisplay, gcn::ActionListener
};
StatusWindow::StatusWindow():
- Window(player_node ? player_node->getName() : "?", false, 0, "status.xml")
+ Window(player_node ? player_node->getName() :
+ "?", false, nullptr, "status.xml")
{
listen(Mana::CHANNEL_ATTRIBUTES);
@@ -177,8 +178,8 @@ StatusWindow::StatusWindow():
}
else
{
- mMpLabel = 0;
- mMpBar = 0;
+ mMpLabel = nullptr;
+ mMpBar = nullptr;
}
place(0, 0, mLvlLabel, 3);
@@ -210,9 +211,9 @@ StatusWindow::StatusWindow():
}
else
{
- mJobLvlLabel = 0;
- mJobLabel = 0;
- mJobBar = 0;
+ mJobLvlLabel = nullptr;
+ mJobLabel = nullptr;
+ mJobBar = nullptr;
}
// ----------------------
@@ -963,6 +964,7 @@ AttrDisplay::AttrDisplay(int id, const std::string &name):
AttrDisplay::~AttrDisplay()
{
delete mLayout;
+ mLayout = nullptr;
}
std::string AttrDisplay::update()
@@ -1012,7 +1014,7 @@ ChangeDisplay::ChangeDisplay(int id, const std::string &name):
}
else
{
- mDec = 0;
+ mDec = nullptr;
}
update();
diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp
index c1539684c..a32b13aa4 100644
--- a/src/gui/textdialog.cpp
+++ b/src/gui/textdialog.cpp
@@ -40,8 +40,8 @@ int TextDialog::instances = 0;
TextDialog::TextDialog(const std::string &title, const std::string &msg,
Window *parent, bool isPassword):
Window(title, true, parent, "textdialog.xml"),
- mTextField(0),
- mPasswordField(0)
+ mTextField(nullptr),
+ mPasswordField(nullptr)
{
mEnabledKeyboard = keyboard.isEnabled();
keyboard.setEnabled(false);
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 0a1a930a9..0246a5b62 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -48,7 +48,7 @@ static std::string defaultThemePath;
std::string Theme::mThemePath;
std::string Theme::mThemeName;
-Theme *Theme::mInstance = 0;
+Theme *Theme::mInstance = nullptr;
// Set the theme path...
static void initDefaultThemePath()
@@ -82,18 +82,18 @@ Skin::~Skin()
for (int i = 0; i < 9; i++)
{
delete mBorder.grid[i];
- mBorder.grid[i] = 0;
+ mBorder.grid[i] = nullptr;
}
if (mCloseImage)
{
mCloseImage->decRef();
- mCloseImage = 0;
+ mCloseImage = nullptr;
}
delete mStickyImageUp;
- mStickyImageUp = 0;
+ mStickyImageUp = nullptr;
delete mStickyImageDown;
- mStickyImageDown = 0;
+ mStickyImageDown = nullptr;
}
void Skin::updateAlpha(float minimumOpacityAllowed)
@@ -182,7 +182,7 @@ Theme *Theme::instance()
void Theme::deleteInstance()
{
delete mInstance;
- mInstance = 0;
+ mInstance = nullptr;
}
gcn::Color Theme::getProgressColor(int type, float progress)
@@ -295,7 +295,7 @@ void Theme::optionChanged(const std::string &)
Skin *Theme::readSkin(const std::string &filename)
{
if (filename.empty())
- return 0;
+ return nullptr;
// std::string filename = filename0;
// ResourceManager *resman = ResourceManager::getInstance();
@@ -306,14 +306,14 @@ Skin *Theme::readSkin(const std::string &filename)
xmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "skinset"))
- return 0;
+ return nullptr;
const std::string skinSetImage = XML::getProperty(rootNode, "image", "");
if (skinSetImage.empty())
{
logger->log1("Theme::readSkin(): Skinset does not define an image!");
- return 0;
+ return nullptr;
}
logger->log("Theme::load(): <skinset> defines '%s' as a skin image.",
@@ -355,7 +355,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[0] = 0;
+ border.grid[0] = nullptr;
}
}
else if (partType == "top-edge")
@@ -367,7 +367,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[1] = 0;
+ border.grid[1] = nullptr;
}
}
else if (partType == "top-right-corner")
@@ -379,7 +379,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[2] = 0;
+ border.grid[2] = nullptr;
}
}
@@ -393,7 +393,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[3] = 0;
+ border.grid[3] = nullptr;
}
}
else if (partType == "bg-quad")
@@ -405,7 +405,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[4] = 0;
+ border.grid[4] = nullptr;
}
}
else if (partType == "right-edge")
@@ -417,7 +417,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[5] = 0;
+ border.grid[5] = nullptr;
}
}
@@ -431,7 +431,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[6] = 0;
+ border.grid[6] = nullptr;
}
}
else if (partType == "bottom-edge")
@@ -443,7 +443,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[7] = 0;
+ border.grid[7] = nullptr;
}
}
else if (partType == "bottom-right-corner")
@@ -455,7 +455,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[8] = 0;
+ border.grid[8] = nullptr;
}
}
@@ -490,8 +490,8 @@ Skin *Theme::readSkin(const std::string &filename)
// to look for window buttons
Image *closeImage = Theme::getImageFromTheme("close_button.png");
Image *sticky = Theme::getImageFromTheme("sticky_button.png");
- Image *stickyImageUp = 0;
- Image *stickyImageDown = 0;
+ Image *stickyImageUp = nullptr;
+ Image *stickyImageDown = nullptr;
if (sticky)
{
stickyImageUp = sticky->getSubImage(0, 0, 15, 15);
@@ -526,7 +526,7 @@ void Theme::fillSkinsList(std::vector<std::string> &list)
char **skins = PHYSFS_enumerateFiles(
branding.getStringValue("guiThemePath").c_str());
- for (char **i = skins; *i != 0; i++)
+ for (char **i = skins; *i; i++)
{
if (PHYSFS_isDirectory((
branding.getStringValue("guiThemePath") + *i).c_str()))
@@ -544,7 +544,7 @@ void Theme::fillFontsList(std::vector<std::string> &list)
char **fonts = PHYSFS_enumerateFiles(
branding.getStringValue("fontsPath").c_str());
- for (char **i = fonts; *i != 0; i++)
+ for (char **i = fonts; *i; i++)
{
if (!PHYSFS_isDirectory((
branding.getStringValue("fontsPath") + *i).c_str()))
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index bd7e9bb1e..506bf65c9 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -63,11 +63,11 @@
#define CAPTION_ACCEPTED _("Agreed. Waiting...")
TradeWindow::TradeWindow():
- Window(_("Trade: You"), false, 0, "trade.xml"),
+ Window(_("Trade: You"), false, nullptr, "trade.xml"),
mMyInventory(new Inventory(Inventory::TRADE)),
mPartnerInventory(new Inventory(Inventory::TRADE)),
mStatus(PROPOSING),
- mAutoAddItem(0),
+ mAutoAddItem(nullptr),
mAutoAddToNick(""),
mGotMoney(0),
mGotMaxMoney(0),
@@ -390,7 +390,7 @@ void TradeWindow::close()
void TradeWindow::clear()
{
- mAutoAddItem = 0;
+ mAutoAddItem = nullptr;
mAutoAddToNick = "";
mAutoMoney = 0;
mAutoAddAmount = 0;
diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp
index cc5caca60..c43f28400 100644
--- a/src/gui/unregisterdialog.cpp
+++ b/src/gui/unregisterdialog.cpp
@@ -47,7 +47,7 @@
#include "debug.h"
UnRegisterDialog::UnRegisterDialog(LoginData *data):
- Window(_("Unregister"), true, 0, "unregister.xml"),
+ Window(_("Unregister"), true, nullptr, "unregister.xml"),
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
@@ -92,7 +92,7 @@ UnRegisterDialog::UnRegisterDialog(LoginData *data):
UnRegisterDialog::~UnRegisterDialog()
{
delete mWrongDataNoticeListener;
- mWrongDataNoticeListener = 0;
+ mWrongDataNoticeListener = nullptr;
}
void UnRegisterDialog::action(const gcn::ActionEvent &event)
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index b605d30df..ed745aa74 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -135,7 +135,7 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
const std::string &updatesDir,
bool applyUpdates,
int updateType):
- Window(_("Updating..."), false, 0, "update.xml"),
+ Window(_("Updating..."), false, nullptr, "update.xml"),
mDownloadStatus(UPDATE_NEWS),
mUpdateHost(updateHost),
mUpdatesDir(updatesDir),
@@ -202,7 +202,7 @@ UpdaterWindow::~UpdaterWindow()
mDownload->cancel();
delete mDownload;
- mDownload = 0;
+ mDownload = nullptr;
}
free(mMemoryBuffer);
}
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 13c0a8cc0..3086a027f 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -56,7 +56,7 @@
extern volatile int tick_time;
Viewport::Viewport():
- mMap(0),
+ mMap(nullptr),
mMouseX(0),
mMouseY(0),
mPixelViewX(0.0f),
@@ -65,9 +65,9 @@ Viewport::Viewport():
mCameraMode(0),
mPlayerFollowMouse(false),
mLocalWalkTime(-1),
- mHoverBeing(0),
- mHoverItem(0),
- mHoverSign(0),
+ mHoverBeing(nullptr),
+ mHoverItem(nullptr),
+ mHoverSign(nullptr),
mCameraRelativeX(0),
mCameraRelativeY(0)
{
@@ -104,11 +104,11 @@ Viewport::~Viewport()
config.removeListener("enableLazyScrolling", this);
delete mPopupMenu;
- mPopupMenu = 0;
+ mPopupMenu = nullptr;
delete mBeingPopup;
- mBeingPopup = 0;
+ mBeingPopup = nullptr;
delete mTextPopup;
- mTextPopup = 0;
+ mTextPopup = nullptr;
}
void Viewport::setMap(Map *map)
@@ -699,7 +699,7 @@ void Viewport::showUndressPopup(int x, int y, Being *being, Item *item)
void Viewport::closePopupMenu()
{
if (mPopupMenu)
- mPopupMenu->handleLink("cancel", 0);
+ mPopupMenu->handleLink("cancel", nullptr);
}
void Viewport::optionChanged(const std::string &name A_UNUSED)
@@ -738,7 +738,7 @@ void Viewport::mouseMoved(gcn::MouseEvent &event A_UNUSED)
mBeingPopup->setVisible(false);
}
- mHoverItem = 0;
+ mHoverItem = nullptr;
if (!mHoverBeing && actorSpriteManager)
{
mHoverItem = actorSpriteManager->findItem(x / mMap->getTileWidth(),
@@ -844,17 +844,17 @@ void Viewport::hideBeingPopup()
void Viewport::clearHover(ActorSprite *actor)
{
if (mHoverBeing == actor)
- mHoverBeing = 0;
+ mHoverBeing = nullptr;
if (mHoverItem == actor)
- mHoverItem = 0;
+ mHoverItem = nullptr;
}
void Viewport::cleanHoverItems()
{
- mHoverBeing = 0;
- mHoverItem = 0;
- mHoverSign = 0;
+ mHoverBeing = nullptr;
+ mHoverItem = nullptr;
+ mHoverSign = nullptr;
}
void Viewport::moveCamera(int dx, int dy)
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index b6d67fa83..ead38f42b 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -82,7 +82,7 @@ class NameFunctuator
} nameCompare;
WhoIsOnline::WhoIsOnline():
- Window(_("Who Is Online - Updating"), false, 0, "whoisonline.xml"),
+ Window(_("Who Is Online - Updating"), false, nullptr, "whoisonline.xml"),
mThread(nullptr),
mDownloadStatus(UPDATE_LIST),
mDownloadComplete(true),
@@ -140,7 +140,7 @@ WhoIsOnline::~WhoIsOnline()
SDL_WaitThread(mThread, nullptr);
free(mMemoryBuffer);
- mMemoryBuffer = 0;
+ mMemoryBuffer = nullptr;
// Remove possibly leftover temporary download
delete[] mCurlError;
@@ -333,7 +333,7 @@ void WhoIsOnline::loadList()
// Free the memory buffer now that we don't need it anymore
free(mMemoryBuffer);
- mMemoryBuffer = 0;
+ mMemoryBuffer = nullptr;
if (mScrollArea->getVerticalMaxScroll() <
mScrollArea->getVerticalScrollAmount())
@@ -377,7 +377,7 @@ int WhoIsOnline::downloadThread(void *ptr)
if (!wio->mAllowUpdate)
{
curl_easy_cleanup(curl);
- curl = 0;
+ curl = nullptr;
break;
}
wio->mDownloadedBytes = 0;
@@ -398,7 +398,7 @@ int WhoIsOnline::downloadThread(void *ptr)
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 7);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 30);
- struct curl_slist *pHeaders = 0;
+ struct curl_slist *pHeaders = nullptr;
// Make sure the resources2.txt and news.txt aren't cached,
// in order to always get the latest version.
pHeaders = curl_slist_append(pHeaders, "pragma: no-cache");
@@ -422,7 +422,7 @@ int WhoIsOnline::downloadThread(void *ptr)
attempts++;
curl_easy_cleanup(curl);
curl_slist_free_all(pHeaders);
- curl = 0;
+ curl = nullptr;
continue;
}
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 487035350..3f41be466 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -58,7 +58,7 @@ extern Window *botCheckerWindow;
extern Window *socialWindow;
WindowMenu::WindowMenu():
- mEmotePopup(0)
+ mEmotePopup(nullptr)
{
int x = 0, h = 0;
@@ -115,7 +115,7 @@ WindowMenu::WindowMenu():
WindowMenu::~WindowMenu()
{
delete mTextPopup;
- mTextPopup = 0;
+ mTextPopup = nullptr;
mButtonNames.clear();
std::vector <gcn::Button*>::iterator it, it_end;
for (it = mButtons.begin(), it_end = mButtons.end(); it != it_end; ++it)
@@ -132,7 +132,7 @@ WindowMenu::~WindowMenu()
void WindowMenu::action(const gcn::ActionEvent &event)
{
- Window *window = 0;
+ Window *window = nullptr;
if (event.getId() == ":-)")
{
@@ -153,14 +153,14 @@ void WindowMenu::action(const gcn::ActionEvent &event)
}
else
{
- mEmotePopup = 0;
+ mEmotePopup = nullptr;
}
}
else
{
if (windowContainer)
windowContainer->scheduleDelete(mEmotePopup);
- mEmotePopup = 0;
+ mEmotePopup = nullptr;
}
}
else if (event.getId() == "STA")
@@ -238,7 +238,7 @@ void WindowMenu::valueChanged(const gcn::SelectionEvent &event)
if (windowContainer)
windowContainer->scheduleDelete(mEmotePopup);
- mEmotePopup = 0;
+ mEmotePopup = nullptr;
}
}
diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp
index 3749049fe..f7b505610 100644
--- a/src/gui/worldselectdialog.cpp
+++ b/src/gui/worldselectdialog.cpp
@@ -74,7 +74,7 @@ class WorldListModel : public gcn::ListModel
};
WorldSelectDialog::WorldSelectDialog(Worlds worlds):
- Window(_("Select World"), false, 0, "world.xml")
+ Window(_("Select World"), false, nullptr, "world.xml")
{
mWorldListModel = new WorldListModel(worlds);
mWorldList = new ListBox(mWorldListModel);
@@ -114,7 +114,7 @@ WorldSelectDialog::WorldSelectDialog(Worlds worlds):
WorldSelectDialog::~WorldSelectDialog()
{
delete mWorldListModel;
- mWorldListModel = 0;
+ mWorldListModel = nullptr;
}
void WorldSelectDialog::action(const gcn::ActionEvent &event)
diff --git a/src/guichan/include/guichan/widgets/checkbox.hpp b/src/guichan/include/guichan/widgets/checkbox.hpp
index 0ff328d72..e6e630d74 100644
--- a/src/guichan/include/guichan/widgets/checkbox.hpp
+++ b/src/guichan/include/guichan/widgets/checkbox.hpp
@@ -85,7 +85,8 @@ namespace gcn
/**
* Destructor.
*/
- virtual ~CheckBox() { }
+ virtual ~CheckBox()
+ { }
/**
* Checks if the check box is selected.
diff --git a/src/guichan/include/guichan/widgets/dropdown.hpp b/src/guichan/include/guichan/widgets/dropdown.hpp
index 600558d67..b135237a7 100644
--- a/src/guichan/include/guichan/widgets/dropdown.hpp
+++ b/src/guichan/include/guichan/widgets/dropdown.hpp
@@ -98,9 +98,9 @@ namespace gcn
* @param listBox the listBox to use.
* @see ListModel, ScrollArea, ListBox.
*/
- DropDown(ListModel *listModel = NULL,
- ScrollArea *scrollArea = NULL,
- ListBox *listBox = NULL);
+ DropDown(ListModel *listModel = nullptr,
+ ScrollArea *scrollArea = nullptr,
+ ListBox *listBox = nullptr);
/**
* Destructor.
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp
index 4620de742..16edb369a 100644
--- a/src/guildmanager.cpp
+++ b/src/guildmanager.cpp
@@ -46,7 +46,7 @@ GuildManager::GuildManager() :
mSentInfoRequest(false),
mSentNameRequest(false),
mHavePower(false),
- mTab(0),
+ mTab(nullptr),
mRequest(false)
{
}
@@ -54,7 +54,7 @@ GuildManager::GuildManager() :
GuildManager::~GuildManager()
{
delete mTab;
- mTab = 0;
+ mTab = nullptr;
}
void GuildManager::init()
@@ -79,7 +79,7 @@ void GuildManager::init()
else if (guildManager)
{
delete guildManager;
- guildManager = 0;
+ guildManager = nullptr;
}
}
@@ -100,7 +100,7 @@ void GuildManager::reload()
socialWindow->removeTab(guild);
}
delete mTab;
- mTab = 0;
+ mTab = nullptr;
}
void GuildManager::send(std::string msg)
@@ -211,7 +211,7 @@ Guild *GuildManager::createGuild()
{
Guild *guild = Guild::getGuild(1);
if (!guild)
- return 0;
+ return nullptr;
guild->setServerGuild(false);
return guild;
@@ -484,7 +484,7 @@ bool GuildManager::afterRemove()
}
SERVER_NOTICE(_("You have left the guild."))
delete mTab;
- mTab = 0;
+ mTab = nullptr;
if (socialWindow)
socialWindow->removeTab(guild);
diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp
index 6f6217d82..8634702ce 100644
--- a/src/imageparticle.cpp
+++ b/src/imageparticle.cpp
@@ -60,9 +60,9 @@ ImageParticle::~ImageParticle()
ImageParticle::imageParticleCountByName[name] --;
mImage->decRef();
- mImage = 0;
+ mImage = nullptr;
}
- setMap(0);
+ setMap(nullptr);
}
bool ImageParticle::draw(Graphics *graphics, int offsetX, int offsetY) const
diff --git a/src/imagesprite.cpp b/src/imagesprite.cpp
index 803c9c24f..6ccaeb5fc 100644
--- a/src/imagesprite.cpp
+++ b/src/imagesprite.cpp
@@ -44,7 +44,7 @@ ImageSprite::~ImageSprite()
if (mImage)
{
mImage->decRef();
- mImage = 0;
+ mImage = nullptr;
}
}
diff --git a/src/inventory.cpp b/src/inventory.cpp
index f907b2cc2..4521613ba 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -51,7 +51,7 @@ Inventory::Inventory(int type, int size):
mUsed(0)
{
mItems = new Item*[mSize];
- std::fill_n(mItems, mSize, static_cast<Item*>(0));
+ std::fill_n(mItems, mSize, static_cast<Item*>(nullptr));
}
Inventory::~Inventory()
@@ -60,7 +60,7 @@ Inventory::~Inventory()
delete mItems[i];
delete [] mItems;
- mItems = 0;
+ mItems = nullptr;
}
Item *Inventory::getItem(int index) const
@@ -68,7 +68,7 @@ Item *Inventory::getItem(int index) const
if (index < 0 || index >= static_cast<int>(mSize) || !mItems[index]
|| mItems[index]->getQuantity() <= 0)
{
- return 0;
+ return nullptr;
}
return mItems[index];
@@ -88,7 +88,7 @@ Item *Inventory::findItem(int itemId, unsigned char color) const
}
}
- return 0;
+ return nullptr;
}
void Inventory::addItem(int id, int quantity, int refine,
@@ -145,7 +145,7 @@ void Inventory::removeItem(int id)
void Inventory::removeItemAt(int index)
{
delete mItems[index];
- mItems[index] = 0;
+ mItems[index] = nullptr;
mUsed--;
if (mUsed < 0) // Already at 0, no need to distribute event
mUsed = 0;
@@ -237,7 +237,7 @@ Item *Inventory::findItemBySprite(std::string spritePath, Gender gender)
if (partialIndex != -1)
return mItems[partialIndex];
- return 0;
+ return nullptr;
}
std::string Inventory::getName()
diff --git a/src/item.cpp b/src/item.cpp
index 45a10f837..d4b41b6cb 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -33,8 +33,8 @@
Item::Item(int id, int quantity, int refine, unsigned char color,
bool equipment, bool equipped):
- mImage(0),
- mDrawImage(0),
+ mImage(nullptr),
+ mDrawImage(nullptr),
mQuantity(quantity),
mEquipment(equipment),
mEquipped(equipped),
@@ -50,7 +50,7 @@ Item::~Item()
if (mImage)
{
mImage->decRef();
- mImage = 0;
+ mImage = nullptr;
}
}
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index a6289d9bb..0739ab538 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -105,7 +105,8 @@ LocalPlayer::LocalPlayer(int id, int subtype):
mPlayerFollowed(""),
mPlayerImitated(""),
mPickUpTarget(nullptr),
- mGoingToTarget(false), mKeepAttacking(false),
+ mGoingToTarget(false),
+ mKeepAttacking(false),
mLastAction(-1),
mWalkingDir(0),
mPathSetByMouse(false),
@@ -118,11 +119,15 @@ LocalPlayer::LocalPlayer(int id, int subtype):
mShowNavigePath(false),
mDrawPath(false),
mActivityTime(0),
- mNavigateX(0), mNavigateY(0),
+ mNavigateX(0),
+ mNavigateY(0),
mNavigateId(0),
- mCrossX(0), mCrossY(0),
- mOldX(0), mOldY(0),
- mOldTileX(0), mOldTileY(0),
+ mCrossX(0),
+ mCrossY(0),
+ mOldX(0),
+ mOldY(0),
+ mOldTileX(0),
+ mOldTileY(0),
mLastHitFrom(""),
mWaitFor(""),
mAdvertTime(0),
@@ -218,9 +223,9 @@ LocalPlayer::~LocalPlayer()
config.removeListener("targetOnlyReachable", this);
delete mAwayDialog;
- mAwayDialog = 0;
+ mAwayDialog = nullptr;
delete mAwayListener;
- mAwayListener = 0;
+ mAwayListener = nullptr;
}
void LocalPlayer::logic()
@@ -264,7 +269,7 @@ void LocalPlayer::logic()
if (weightNotice && weightNoticeTime < cur_time)
{
weightNotice->scheduleDelete();
- weightNotice = 0;
+ weightNotice = nullptr;
weightNoticeTime = 0;
}
@@ -977,7 +982,7 @@ bool LocalPlayer::pickUp(FloorItem *item)
void LocalPlayer::actorSpriteDestroyed(const ActorSprite &actorSprite)
{
if (mPickUpTarget == &actorSprite)
- mPickUpTarget = 0;
+ mPickUpTarget = nullptr;
}
Being *LocalPlayer::getTarget() const
@@ -1006,7 +1011,7 @@ void LocalPlayer::setTarget(Being *target)
mTargetTime = -1;
}
- Being *oldTarget = 0;
+ Being *oldTarget = nullptr;
if (mTarget)
{
mTarget->untarget();
@@ -1141,7 +1146,7 @@ void LocalPlayer::startWalking(unsigned char dir)
if (!mMap || !dir)
return;
- mPickUpTarget = 0;
+ mPickUpTarget = nullptr;
if (mAction == MOVE && !mPath.empty())
{
// Just finish the current action, otherwise we get out of sync
@@ -1214,7 +1219,7 @@ void LocalPlayer::stopWalking(bool sendToServer)
{
mWalkingDir = 0;
mLocalWalkTime = 0;
- mPickUpTarget = 0;
+ mPickUpTarget = nullptr;
setDestination(static_cast<int>(getPosition().x),
static_cast<int>(getPosition().y));
@@ -1550,7 +1555,7 @@ void LocalPlayer::setGotoTarget(Being *target)
if (!target)
return;
- mPickUpTarget = 0;
+ mPickUpTarget = nullptr;
#ifdef MANASERV_SUPPORT
if (Net::getNetworkType() == ServerInfo::MANASERV)
{
@@ -1734,7 +1739,7 @@ void LocalPlayer::moveTo(int x, int y)
void LocalPlayer::move(int dX, int dY)
{
- mPickUpTarget = 0;
+ mPickUpTarget = nullptr;
moveTo(mX + dX, mY + dY);
}
@@ -1834,7 +1839,7 @@ void LocalPlayer::moveToTarget(unsigned int dist)
void LocalPlayer::moveToHome()
{
- mPickUpTarget = 0;
+ mPickUpTarget = nullptr;
if ((mX != mCrossX || mY != mCrossY) && mCrossX && mCrossY)
{
moveTo(mCrossX, mCrossY);
@@ -3205,7 +3210,7 @@ void LocalPlayer::changeAwayMode()
}
else
{
- mAwayDialog = 0;
+ mAwayDialog = nullptr;
sound.volumeRestore();
if (chatWindow)
{
@@ -3678,7 +3683,7 @@ void LocalPlayer::followMoveTo(Being *being, int x, int y)
if (being && !mPlayerFollowed.empty()
&& being->getName() == mPlayerFollowed)
{
- mPickUpTarget = 0;
+ mPickUpTarget = nullptr;
setDestination(x, y);
}
}
@@ -3688,7 +3693,7 @@ void LocalPlayer::followMoveTo(Being *being, int x1, int y1, int x2, int y2)
if (!being)
return;
- mPickUpTarget = 0;
+ mPickUpTarget = nullptr;
if (!mPlayerFollowed.empty() && being->getName() == mPlayerFollowed)
{
switch (mFollowMode)
diff --git a/src/logger.cpp b/src/logger.cpp
index 129a8a884..c2eb1cc46 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -143,7 +143,7 @@ void Logger::log1(const char *buf)
void Logger::log(const char *log_text, ...)
{
unsigned size = 1024;
- char* buf = 0;
+ char* buf = nullptr;
if (strlen(log_text) * 3> size)
size = static_cast<unsigned>(strlen(log_text) * 3);
diff --git a/src/main.cpp b/src/main.cpp
index 166aab2b1..b49b38300 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -107,7 +107,7 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
{ "chat-log-dir", required_argument, 0, 'L' },
{ "screenshot-dir", required_argument, 0, 'i' },
{ "safemode", no_argument, 0, 'm' },
- { 0, 0, 0, 0 }
+ { nullptr, 0, 0, 0 }
};
while (optind < argc)
diff --git a/src/map.cpp b/src/map.cpp
index 676c01a48..bcf2b22fe 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -98,7 +98,7 @@ TileAnimation::TileAnimation(Animation *ani):
TileAnimation::~TileAnimation()
{
delete mAnimation;
- mAnimation = 0;
+ mAnimation = nullptr;
}
void TileAnimation::update(int ticks)
@@ -132,7 +132,7 @@ MapLayer::MapLayer(int x, int y, int width, int height, bool fringeLayer):
const int size = mWidth * mHeight;
mTiles = new Image*[size];
- std::fill_n(mTiles, size, static_cast<Image*>(0));
+ std::fill_n(mTiles, size, static_cast<Image*>(nullptr));
config.addListener("highlightAttackRange", this);
}
@@ -258,8 +258,8 @@ void MapLayer::updateSDL(Graphics *graphics, int startX, int startY,
MapRowVertexes *row = new MapRowVertexes();
mTempRows.push_back(row);
- Image *lastImage = 0;
- ImageVertexes *imgVert = 0;
+ Image *lastImage = nullptr;
+ ImageVertexes *imgVert = nullptr;
const int yWidth = y * mWidth;
const int py0 = y * 32 + dy;
@@ -337,8 +337,8 @@ void MapLayer::updateOGL(Graphics *graphics, int startX, int startY,
MapRowVertexes *row = new MapRowVertexes();
mTempRows.push_back(row);
- Image *lastImage = 0;
- ImageVertexes *imgVert = 0;
+ Image *lastImage = nullptr;
+ ImageVertexes *imgVert = nullptr;
const int yWidth = y * mWidth;
const int py0 = y * 32 + dy;
@@ -614,11 +614,11 @@ Map::Map(int width, int height, int tileWidth, int tileHeight):
mOpacity(config.getFloatValue("guialpha")),
mPvp(0),
mTilesetsIndexed(false),
- mIndexedTilesets(0),
+ mIndexedTilesets(nullptr),
mIndexedTilesetsSize(0),
mActorFixX(0),
mActorFixY(0),
- mFringeLayer(0),
+ mFringeLayer(nullptr),
mLastX(-1),
mLastY(-1),
mLastScrollX(-1),
@@ -671,18 +671,18 @@ Map::~Map()
for (int i = 0; i < NB_BLOCKTYPES; i++)
delete[] mOccupation[i];
- mFringeLayer = 0;
+ mFringeLayer = nullptr;
delete_all(mLayers);
delete_all(mTilesets);
delete_all(mForegrounds);
delete_all(mBackgrounds);
delete_all(mTileAnimations);
delete mSpecialLayer;
- mSpecialLayer = 0;
+ mSpecialLayer = nullptr;
delete mTempLayer;
- mTempLayer = 0;
+ mTempLayer = nullptr;
delete mObjects;
- mObjects = 0;
+ mObjects = nullptr;
delete_all(mMapPortals);
}
@@ -1139,7 +1139,7 @@ Tileset *Map::getTilesetWithGid(int gid) const
if (gid >= 0 && gid < mIndexedTilesetsSize)
return mIndexedTilesets[gid];
else
- return 0;
+ return nullptr;
}
void Map::blockTile(int x, int y, BlockType type)
@@ -1797,13 +1797,13 @@ MapItem *Map::findPortalXY(int x, int y)
if (item->mX == x && item->mY == y)
return item;
}
- return 0;
+ return nullptr;
}
TileAnimation *Map::getAnimationForGid(int gid) const
{
if (mTileAnimations.empty())
- return 0;
+ return nullptr;
std::map<int, TileAnimation*>::const_iterator
i = mTileAnimations.find(gid);
@@ -1868,7 +1868,7 @@ void Map::indexTilesets()
mTilesetsIndexed = true;
- Tileset *s = 0;
+ Tileset *s = nullptr;
for (Tilesets::const_iterator it = mTilesets.begin(),
it_end = mTilesets.end(); it < it_end;
++it)
@@ -1882,14 +1882,14 @@ void Map::indexTilesets()
if (!s)
{
mIndexedTilesetsSize = 0;
- mIndexedTilesets = 0;
+ mIndexedTilesets = nullptr;
return;
}
const int size = s->getFirstGid() + s->size();
mIndexedTilesetsSize = size;
mIndexedTilesets = new Tileset*[size];
- std::fill_n(mIndexedTilesets, size, static_cast<Tileset*>(0));
+ std::fill_n(mIndexedTilesets, size, static_cast<Tileset*>(nullptr));
for (Tilesets::const_iterator it = mTilesets.begin(),
it_end = mTilesets.end(); it < it_end;
@@ -2031,7 +2031,7 @@ void Map::reduce()
img = (*ri)->mTiles[x + y * (*ri)->mWidth];
if (img)
{
- (*ri)->mTiles[x + y * (*ri)->mWidth] = 0;
+ (*ri)->mTiles[x + y * (*ri)->mWidth] = nullptr;
cnt ++;
}
++ ri;
@@ -2055,7 +2055,7 @@ SpecialLayer::SpecialLayer(int width, int height, bool drawSprites):
{
const int size = mWidth * mHeight;
mTiles = new MapItem*[size];
- std::fill_n(mTiles, size, static_cast<MapItem*>(0));
+ std::fill_n(mTiles, size, static_cast<MapItem*>(nullptr));
mDrawSprites = drawSprites;
}
@@ -2064,7 +2064,7 @@ SpecialLayer::~SpecialLayer()
for (int f = 0; f < mWidth * mHeight; f ++)
{
delete mTiles[f];
- mTiles[f] = 0;
+ mTiles[f] = nullptr;
}
delete[] mTiles;
}
@@ -2074,7 +2074,7 @@ MapItem* SpecialLayer::getTile(int x, int y) const
if (x < 0 || x >= mWidth ||
y < 0 || y >= mHeight)
{
- return 0;
+ return nullptr;
}
return mTiles[x + y * mWidth];
}
@@ -2175,25 +2175,25 @@ void SpecialLayer::itemDraw(Graphics *graphics, int x, int y,
MapItem::MapItem():
- mImage(0), mComment(""), mName(""), mX(-1), mY(-1)
+ mImage(nullptr), mComment(""), mName(""), mX(-1), mY(-1)
{
setType(EMPTY);
}
MapItem::MapItem(int type):
- mImage(0), mComment(""), mName(""), mX(-1), mY(-1)
+ mImage(nullptr), mComment(""), mName(""), mX(-1), mY(-1)
{
setType(type);
}
MapItem::MapItem(int type, std::string comment):
- mImage(0), mComment(comment), mName(""), mX(-1), mY(-1)
+ mImage(nullptr), mComment(comment), mName(""), mX(-1), mY(-1)
{
setType(type);
}
MapItem::MapItem(int type, std::string comment, int x, int y):
- mImage(0), mComment(comment), mName(""), mX(x), mY(y)
+ mImage(nullptr), mComment(comment), mName(""), mX(x), mY(y)
{
setType(type);
}
@@ -2203,7 +2203,7 @@ MapItem::~MapItem()
if (mImage)
{
mImage->decRef();
- mImage = 0;
+ mImage = nullptr;
}
}
@@ -2239,7 +2239,7 @@ void MapItem::setType(int type)
}
else
{
- mImage = 0;
+ mImage = nullptr;
}
}
@@ -2296,7 +2296,7 @@ ObjectsLayer::ObjectsLayer(unsigned width, unsigned height) :
{
const unsigned size = width * height;
mTiles = new MapObjectList*[size];
- std::fill_n(mTiles, size, static_cast<MapObjectList*>(0));
+ std::fill_n(mTiles, size, static_cast<MapObjectList*>(nullptr));
}
ObjectsLayer::~ObjectsLayer()
@@ -2306,7 +2306,7 @@ ObjectsLayer::~ObjectsLayer()
delete mTiles[f];
delete [] mTiles;
- mTiles = 0;
+ mTiles = nullptr;
}
void ObjectsLayer::addObject(std::string name, int type,
@@ -2338,7 +2338,7 @@ void ObjectsLayer::addObject(std::string name, int type,
MapObjectList *ObjectsLayer::getAt(unsigned x, unsigned y)
{
if (x >= mWidth || y >= mHeight)
- return 0;
+ return nullptr;
return mTiles[x + y * mWidth];
}
diff --git a/src/mumblemanager.cpp b/src/mumblemanager.cpp
index fd95a67f9..0757f5f96 100644
--- a/src/mumblemanager.cpp
+++ b/src/mumblemanager.cpp
@@ -29,7 +29,7 @@
#include "debug.h"
MumbleManager::MumbleManager() :
- mLinkedMem(0)
+ mLinkedMem(nullptr)
{
mMapBase[0] = mMapBase[1] = mMapBase[2] = 0.;
init();
@@ -45,7 +45,7 @@ MumbleManager::~MumbleManager()
#else
munmap(mLinkedMem, sizeof(struct LinkedMem));
#endif
- mLinkedMem = 0;
+ mLinkedMem = nullptr;
}
}
diff --git a/src/net/download.cpp b/src/net/download.cpp
index dcce218a9..5141c022e 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -72,11 +72,11 @@ Download::~Download()
if (mHeaders)
curl_slist_free_all(mHeaders);
- mHeaders = 0;
+ mHeaders = nullptr;
int status;
if (mThread && SDL_GetThreadID(mThread))
SDL_WaitThread(mThread, &status);
- mThread = 0;
+ mThread = nullptr;
free(mError);
}
@@ -281,7 +281,7 @@ int Download::downloadThread(void *ptr)
}
curl_easy_cleanup(d->mCurl);
- d->mCurl = 0;
+ d->mCurl = nullptr;
if (!d->mOptions.memoryWrite)
{
@@ -329,7 +329,7 @@ int Download::downloadThread(void *ptr)
if (d->mCurl)
{
curl_easy_cleanup(d->mCurl);
- d->mCurl = 0;
+ d->mCurl = nullptr;
}
if (d->mOptions.cancel)
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 8fca76353..5c3c694b3 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -67,7 +67,7 @@ BeingHandler::BeingHandler(bool enableSync) :
Being *BeingHandler::createBeing(int id, short job)
{
if (!actorSpriteManager)
- return 0;
+ return nullptr;
ActorSprite::Type type = ActorSprite::UNKNOWN;
if (job <= 25 || (job >= 4001 && job <= 4049))
@@ -143,7 +143,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible)
{
actorSpriteManager->destroy(dstBeing);
actorSpriteManager->erase(dstBeing);
- dstBeing = 0;
+ dstBeing = nullptr;
}
if (!dstBeing)
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp
index f38d17a59..28584d97f 100644
--- a/src/net/ea/buysellhandler.cpp
+++ b/src/net/ea/buysellhandler.cpp
@@ -51,7 +51,7 @@ namespace Ea
BuySellHandler::BuySellHandler() :
mNpcId(0),
- mBuyDialog(0)
+ mBuyDialog(nullptr)
{
}
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index 08c9a43c8..0c01959f2 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -124,7 +124,7 @@ void CharServerHandler::processCharCreate(Net::MessageIn &msg, bool withColors)
if (mCharCreateDialog)
{
mCharCreateDialog->scheduleDelete();
- mCharCreateDialog = 0;
+ mCharCreateDialog = nullptr;
}
}
@@ -160,7 +160,7 @@ void CharServerHandler::processCharDelete(Net::MessageIn &msg A_UNUSED)
{
delete mSelectedCharacter;
mCharacters.remove(mSelectedCharacter);
- mSelectedCharacter = 0;
+ mSelectedCharacter = nullptr;
updateCharSelectDialog();
unlockCharSelectDialog();
new OkDialog(_("Info"), _("Character deleted."));
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp
index 66488d5fb..907fa13db 100644
--- a/src/net/ea/guildhandler.cpp
+++ b/src/net/ea/guildhandler.cpp
@@ -35,8 +35,8 @@
namespace Ea
{
-GuildTab *guildTab = 0;
-Guild *taGuild = 0;
+GuildTab *guildTab = nullptr;
+Guild *taGuild = nullptr;
GuildHandler::GuildHandler() :
showBasicInfo(false)
@@ -46,7 +46,7 @@ GuildHandler::GuildHandler() :
GuildHandler::~GuildHandler()
{
delete guildTab;
- guildTab = 0;
+ guildTab = nullptr;
}
void GuildHandler::requestAlliance(int guildId A_UNUSED,
@@ -450,7 +450,7 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg)
}
SERVER_NOTICE(_("You have left the guild."))
delete guildTab;
- guildTab = 0;
+ guildTab = nullptr;
if (socialWindow && taGuild)
socialWindow->removeTab(taGuild);
@@ -497,7 +497,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg)
}
SERVER_NOTICE(_("You was kicked from guild."));
delete guildTab;
- guildTab = 0;
+ guildTab = nullptr;
if (socialWindow && taGuild)
socialWindow->removeTab(taGuild);
@@ -607,7 +607,7 @@ void GuildHandler::processGuildBroken(Net::MessageIn &msg)
void GuildHandler::clear()
{
- taGuild = 0;
+ taGuild = nullptr;
}
} // namespace Ea
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 788b7f0fc..d2a1fb4f0 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -78,8 +78,8 @@ namespace Ea
InventoryHandler::InventoryHandler()
{
- mStorage = 0;
- mStorageWindow = 0;
+ mStorage = nullptr;
+ mStorageWindow = nullptr;
mDebugInventory = true;
}
@@ -88,11 +88,11 @@ InventoryHandler::~InventoryHandler()
if (mStorageWindow)
{
mStorageWindow->close();
- mStorageWindow = 0;
+ mStorageWindow = nullptr;
}
delete mStorage;
- mStorage = 0;
+ mStorage = nullptr;
}
bool InventoryHandler::canSplit(const Item *item A_UNUSED) const
@@ -164,7 +164,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg,
int index, amount, itemId, arrow;
int cards[4], itemType;
unsigned char identified;
- Inventory *inventory = 0;
+ Inventory *inventory = nullptr;
if (player_node)
inventory = PlayerInfo::getInventory();
@@ -279,7 +279,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
unsigned char identified;
int floorId;
- Inventory *inventory = 0;
+ Inventory *inventory = nullptr;
if (player_node)
inventory = PlayerInfo::getInventory();
@@ -345,7 +345,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
void InventoryHandler::processPlayerInventoryRemove(Net::MessageIn &msg)
{
int index, amount;
- Inventory *inventory = 0;
+ Inventory *inventory = nullptr;
if (player_node)
inventory = PlayerInfo::getInventory();
@@ -367,7 +367,7 @@ void InventoryHandler::processPlayerInventoryRemove(Net::MessageIn &msg)
void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg)
{
int index, amount;
- Inventory *inventory = 0;
+ Inventory *inventory = nullptr;
if (player_node)
inventory = PlayerInfo::getInventory();
@@ -392,7 +392,7 @@ void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg)
void InventoryHandler::processItemUseResponse(Net::MessageIn &msg)
{
int index, amount;
- Inventory *inventory = 0;
+ Inventory *inventory = nullptr;
if (player_node)
inventory = PlayerInfo::getInventory();
@@ -499,13 +499,13 @@ void InventoryHandler::processPlayerStorageClose(Net::MessageIn &msg A_UNUSED)
{
// Storage access has been closed
// Storage window deletes itself
- mStorageWindow = 0;
+ mStorageWindow = nullptr;
if (mStorage)
mStorage->clear();
delete mStorage;
- mStorage = 0;
+ mStorage = nullptr;
}
void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
@@ -514,7 +514,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
int number;
unsigned char identified;
- Inventory *inventory = 0;
+ Inventory *inventory = nullptr;
if (player_node)
inventory = PlayerInfo::getInventory();
diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h
index 72b993c4b..d99e34fc6 100644
--- a/src/net/ea/inventoryhandler.h
+++ b/src/net/ea/inventoryhandler.h
@@ -64,7 +64,7 @@ class EquipBackend : public Equipment::Backend
if (PlayerInfo::getInventory())
return PlayerInfo::getInventory()->getItem(invyIndex);
else
- return 0;
+ return nullptr;
}
void clear()
diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp
index 9a37ccc26..e8e1014d4 100644
--- a/src/net/ea/npchandler.cpp
+++ b/src/net/ea/npchandler.cpp
@@ -33,7 +33,7 @@ namespace Ea
{
NpcHandler::NpcHandler() :
- mDialog(0)
+ mDialog(nullptr)
{
}
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 35cc77fbf..5fa0df29b 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -37,8 +37,8 @@
namespace Ea
{
-PartyTab *partyTab = 0;
-Party *taParty = 0;
+PartyTab *partyTab = nullptr;
+Party *taParty = nullptr;
PartyHandler::PartyHandler() :
mShareExp(PARTY_SHARE_UNKNOWN),
@@ -50,7 +50,7 @@ PartyHandler::PartyHandler() :
PartyHandler::~PartyHandler()
{
delete partyTab;
- partyTab = 0;
+ partyTab = nullptr;
}
void PartyHandler::join(int partyId A_UNUSED)
@@ -71,7 +71,7 @@ void PartyHandler::reload()
void PartyHandler::clear()
{
- taParty = 0;
+ taParty = nullptr;
}
void PartyHandler::processPartyCreate(Net::MessageIn &msg)
@@ -128,7 +128,7 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg)
if (Ea::taParty)
{
- PartyMember *member = 0;
+ PartyMember *member = nullptr;
if (oldParty)
{
//member = Ea::taParty->getMember(id);
@@ -314,7 +314,7 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
void PartyHandler::processPartyMove(Net::MessageIn &msg)
{
int id = msg.readInt32(); // id
- PartyMember *m = 0;
+ PartyMember *m = nullptr;
if (Ea::taParty)
m = Ea::taParty->getMember(id);
if (m)
@@ -356,7 +356,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg)
}
SERVER_NOTICE(_("You have left the party."))
delete Ea::partyTab;
- Ea::partyTab = 0;
+ Ea::partyTab = nullptr;
if (socialWindow && Ea::taParty)
socialWindow->removeTab(Ea::taParty);
@@ -375,7 +375,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg)
Being *b = actorSpriteManager->findBeing(id);
if (b && b->getType() == Being::PLAYER)
{
- b->setParty(0);
+ b->setParty(nullptr);
b->setPartyName("");
}
}
@@ -389,7 +389,7 @@ void PartyHandler::processPartyUpdateHp(Net::MessageIn &msg)
int id = msg.readInt32();
int hp = msg.readInt16();
int maxhp = msg.readInt16();
- PartyMember *m = 0;
+ PartyMember *m = nullptr;
if (Ea::taParty)
m = Ea::taParty->getMember(id);
if (m)
@@ -410,7 +410,7 @@ void PartyHandler::processPartyUpdateHp(Net::MessageIn &msg)
void PartyHandler::processPartyUpdateCoords(Net::MessageIn &msg)
{
int id = msg.readInt32(); // id
- PartyMember *m = 0;
+ PartyMember *m = nullptr;
if (Ea::taParty)
m = Ea::taParty->getMember(id);
if (m)
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp
index 19aa474e3..5aaa09f91 100644
--- a/src/net/ea/tradehandler.cpp
+++ b/src/net/ea/tradehandler.cpp
@@ -53,7 +53,7 @@ namespace
{
void action(const gcn::ActionEvent &event)
{
- confirmDlg = 0;
+ confirmDlg = nullptr;
if (event.getId() == "ignore")
player_relations.ignoreTrade(tradePartnerName);
Net::getTradeHandler()->respond(event.getId() == "yes");
@@ -66,7 +66,7 @@ namespace Ea
TradeHandler::TradeHandler()
{
- confirmDlg = 0;
+ confirmDlg = nullptr;
}
void TradeHandler::removeItem(int slotNum A_UNUSED, int amount A_UNUSED)
@@ -204,7 +204,7 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
{
// Trade: New Item add response (was 0x00ea, now 01b1)
const int index = msg.readInt16() - INVENTORY_OFFSET;
- Item *item = 0;
+ Item *item = nullptr;
if (PlayerInfo::getInventory())
item = PlayerInfo::getInventory()->getItem(index);
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
index f18f65a93..b1e0c2295 100644
--- a/src/net/messageout.cpp
+++ b/src/net/messageout.cpp
@@ -37,7 +37,7 @@ namespace Net
{
MessageOut::MessageOut(short id A_UNUSED):
- mData(0),
+ mData(nullptr),
mDataSize(0),
mPos(0)
{
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 03b63aa16..69f7165ec 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -123,7 +123,7 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg)
player_node = mSelectedCharacter->dummy;
PlayerInfo::setBackend(mSelectedCharacter->data);
- mSelectedCharacter->dummy = 0;
+ mSelectedCharacter->dummy = nullptr;
delete_all(mCharacters);
mCharacters.clear();
@@ -151,7 +151,7 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg)
if (player_node)
{
player_node->setTileCoords(x, y);
- player_node->setMap(0);
+ player_node->setMap(nullptr);
}
}
break;
@@ -271,7 +271,7 @@ void CharServerHandler::chooseCharacter(Net::Character *character)
return;
mSelectedCharacter = character;
- mCharSelectDialog = 0;
+ mCharSelectDialog = nullptr;
MessageOut outMsg(CMSG_CHAR_SELECT);
outMsg.writeInt8(static_cast<unsigned char>(mSelectedCharacter->slot));
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index fe6592d93..5af248e5c 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -145,7 +145,7 @@ void ChatHandler::sendRaw(const std::string &args)
{
std::string line = args;
std::string str;
- MessageOut *outMsg = 0;
+ MessageOut *outMsg = nullptr;
if (line == "")
return;
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 0a9541477..293986bde 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -120,7 +120,7 @@ GeneralHandler::GeneralHandler():
GeneralHandler::~GeneralHandler()
{
delete mNetwork;
- mNetwork = 0;
+ mNetwork = nullptr;
}
void GeneralHandler::handleMessage(Net::MessageIn &msg)
@@ -294,10 +294,10 @@ void GeneralHandler::processEvent(Mana::Channels channel,
}
delete Ea::guildTab;
- Ea::guildTab = 0;
+ Ea::guildTab = nullptr;
delete Ea::partyTab;
- Ea::partyTab = 0;
+ Ea::partyTab = nullptr;
}
}
}
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 6f26035be..3181ec898 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -104,16 +104,17 @@ int networkThread(void *data)
return 0;
}
-Network *Network::mInstance = 0;
+Network *Network::mInstance = nullptr;
Network::Network() :
- mSocket(0),
+ mSocket(nullptr),
mInBuffer(new char[BUFFER_SIZE]),
mOutBuffer(new char[BUFFER_SIZE]),
- mInSize(0), mOutSize(0),
+ mInSize(0),
+ mOutSize(0),
mToSkip(0),
mState(IDLE),
- mWorkerThread(0)
+ mWorkerThread(nullptr)
{
SDLNet_Init();
@@ -129,8 +130,8 @@ Network::~Network()
disconnect();
SDL_DestroyMutex(mMutex);
- mMutex = 0;
- mInstance = 0;
+ mMutex = nullptr;
+ mInstance = nullptr;
delete[] mInBuffer;
delete[] mOutBuffer;
@@ -189,7 +190,7 @@ void Network::disconnect()
{
// need call SDLNet_TCP_DelSocket?
SDLNet_TCP_Close(mSocket);
- mSocket = 0;
+ mSocket = nullptr;
}
}
@@ -212,7 +213,7 @@ void Network::unregisterHandler(MessageHandler *handler)
for (const Uint16 *i = handler->handledMessages; *i; ++i)
mMessageHandlers.erase(*i);
- handler->setNetwork(0);
+ handler->setNetwork(nullptr);
}
void Network::clearHandlers()
@@ -221,7 +222,7 @@ void Network::clearHandlers()
for (i = mMessageHandlers.begin(); i != mMessageHandlers.end(); ++i)
{
if (i->second)
- i->second->setNetwork(0);
+ i->second->setNetwork(nullptr);
}
mMessageHandlers.clear();
}
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index 1c2654087..6b6ffcbb6 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -92,7 +92,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
break;
}
- mDialog = 0;
+ mDialog = nullptr;
}
void NpcHandler::talk(int npcId)
@@ -195,7 +195,7 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength)
const int npcId = msg.readInt32();
NpcDialogs::const_iterator diag = mNpcDialogs.find(npcId);
- mDialog = 0;
+ mDialog = nullptr;
if (diag == mNpcDialogs.end())
{
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index 049556c76..f5e9f8107 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -1027,7 +1027,7 @@ SDL_Surface* OpenGLGraphics::getScreenshot()
0xff0000, 0x00ff00, 0x0000ff, 0x000000);
if (!screenshot)
- return 0;
+ return nullptr;
if (SDL_MUSTLOCK(screenshot))
SDL_LockSurface(screenshot);
diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp
index c839e3c8d..40ab68865 100644
--- a/src/particlecontainer.cpp
+++ b/src/particlecontainer.cpp
@@ -37,7 +37,7 @@ ParticleContainer::~ParticleContainer()
if (mDelParent)
{
delete mNext;
- mNext = 0;
+ mNext = nullptr;
}
}
diff --git a/src/party.cpp b/src/party.cpp
index 6546391cd..b462c94a7 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -198,7 +198,7 @@ void Party::removeFromMembers()
{
Being *b = actorSpriteManager->findBeing((*itr)->getID());
if (b)
- b->setParty(0);
+ b->setParty(nullptr);
++itr;
}
}
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp
index e0f8aa494..93e704302 100644
--- a/src/playerinfo.cpp
+++ b/src/playerinfo.cpp
@@ -41,13 +41,13 @@ namespace PlayerInfo
class PlayerInfoListener;
-PlayerInfoListener *mListener = 0;
+PlayerInfoListener *mListener = nullptr;
PlayerInfoBackend mData;
int mCharId = 0;
-Inventory *mInventory = 0;
-Equipment *mEquipment = 0;
+Inventory *mInventory = nullptr;
+Equipment *mEquipment = nullptr;
std::map<int, Special> mSpecials;
char mSpecialRechargeUpdateNeeded = 0;
@@ -210,7 +210,7 @@ Item *getEquipment(unsigned int slot)
if (mEquipment)
return mEquipment->getEquipment(slot);
else
- return 0;
+ return nullptr;
}
void setEquipmentBackend(Equipment::Backend *backend)
@@ -322,7 +322,7 @@ public:
if (newState == STATE_GAME)
{
- if (mInventory == 0)
+ if (!mInventory)
{
mInventory = new Inventory(Inventory::INVENTORY);
mEquipment = new Equipment();
@@ -335,10 +335,9 @@ public:
if (event.getName() == Mana::EVENT_DESTRUCTED)
{
delete mInventory;
+ mInventory = nullptr;
delete mEquipment;
-
- mInventory = 0;
- mEquipment = 0;
+ mEquipment = nullptr;
}
}
}
@@ -356,7 +355,7 @@ void init()
void deinit()
{
delete mListener;
- mListener = 0;
+ mListener = nullptr;
}
} // namespace PlayerInfo
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 69be97898..324dac065 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -121,7 +121,7 @@ PlayerRelation::PlayerRelation(Relation relation)
PlayerRelationsManager::PlayerRelationsManager() :
mPersistIgnores(false),
mDefaultPermissions(PlayerRelation::DEFAULT),
- mIgnoreStrategy(0)
+ mIgnoreStrategy(nullptr)
{
}
@@ -146,7 +146,7 @@ void PlayerRelationsManager::clear()
removePlayer(*it);
}
delete names;
- names = 0;
+ names = nullptr;
}
#define PERSIST_IGNORE_LIST "persistent-player-list"
diff --git a/src/resources/ambientlayer.cpp b/src/resources/ambientlayer.cpp
index 319bc5b8c..2ad25dcd0 100644
--- a/src/resources/ambientlayer.cpp
+++ b/src/resources/ambientlayer.cpp
@@ -68,7 +68,7 @@ AmbientLayer::~AmbientLayer()
if (mImage)
{
mImage->decRef();
- mImage = 0;
+ mImage = nullptr;
}
}
diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp
index 363e9b2ac..1f3336a8b 100644
--- a/src/resources/animation.cpp
+++ b/src/resources/animation.cpp
@@ -54,18 +54,18 @@ bool Animation::isTerminator(const Frame &candidate)
void Animation::addJump(std::string name, int rand)
{
- Frame frame = { 0, 0, 0, 0, rand, Frame::JUMP, name };
+ Frame frame = { nullptr, 0, 0, 0, rand, Frame::JUMP, name };
mFrames.push_back(frame);
}
void Animation::addLabel(std::string name)
{
- Frame frame = { 0, 0, 0, 0, 100, Frame::LABEL, name };
+ Frame frame = { nullptr, 0, 0, 0, 100, Frame::LABEL, name };
mFrames.push_back(frame);
}
void Animation::addGoto(std::string name, int rand)
{
- Frame frame = { 0, 0, 0, 0, rand, Frame::GOTO, name };
+ Frame frame = { nullptr, 0, 0, 0, rand, Frame::GOTO, name };
mFrames.push_back(frame);
}
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 4aa7515b1..0b2aaa8fa 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -29,7 +29,7 @@
#include "debug.h"
-BeingInfo *BeingInfo::unknown = 0;
+BeingInfo *BeingInfo::unknown = nullptr;
Attack *BeingInfo::empty = new Attack(SpriteAction::ATTACK, "", "");
BeingInfo::BeingInfo():
@@ -121,7 +121,7 @@ void BeingInfo::addAttack(int id, std::string action,
void BeingInfo::clear()
{
delete unknown;
- unknown = 0;
+ unknown = nullptr;
delete empty;
- empty = 0;
+ empty = nullptr;
}
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index ed8c934dc..225abef91 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -175,5 +175,5 @@ std::map <int, ColorDB::ItemColor> *ColorDB::getColorsList(std::string name)
if (it != mColorLists.end())
return &it->second;
- return 0;
+ return nullptr;
}
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index a782b6ec1..29b1c864e 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -208,7 +208,7 @@ void DyePalette::getColor(double intensity, int color[3]) const
Dye::Dye(const std::string &description)
{
for (int i = 0; i < 7; ++i)
- mDyePalettes[i] = 0;
+ mDyePalettes[i] = nullptr;
if (description.empty())
return;
@@ -255,7 +255,7 @@ Dye::~Dye()
for (int i = 0; i < 7; ++i)
{
delete mDyePalettes[i];
- mDyePalettes[i] = 0;
+ mDyePalettes[i] = nullptr;
}
}
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 537630a2c..df07c16a2 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -87,8 +87,8 @@ Image::Image(GLuint glimage, int width, int height,
int texWidth, int texHeight):
mAlpha(1.0f),
mHasAlphaChannel(true),
- mSDLSurface(0),
- mAlphaChannel(0),
+ mSDLSurface(nullptr),
+ mAlphaChannel(nullptr),
mUseAlphaCache(false),
mIsAlphaVisible(true),
mIsAlphaCalculated(false),
@@ -251,14 +251,14 @@ Image *Image::createTextSurface(SDL_Surface *tmpImage, float alpha)
// We also delete the alpha channel since
// it's not used.
delete[] alphaChannel;
- alphaChannel = 0;
+ alphaChannel = nullptr;
}
if (!image)
{
logger->log1("Error: Image convert failed.");
delete[] alphaChannel;
- return 0;
+ return nullptr;
}
if (converted)
@@ -279,7 +279,7 @@ void Image::SDLCleanCache()
{
if (mSDLSurface != i->second)
resman->scheduleDelete(i->second);
- i->second = 0;
+ i->second = nullptr;
}
mAlphaCache.clear();
}
@@ -339,7 +339,7 @@ SDL_Surface *Image::getByAlpha(float alpha)
std::map<float, SDL_Surface*>::const_iterator it = mAlphaCache.find(alpha);
if (it != mAlphaCache.end())
return (*it).second;
- return 0;
+ return nullptr;
}
void Image::setAlpha(float alpha)
@@ -575,7 +575,7 @@ SDL_Surface* Image::convertTo32Bit(SDL_Surface* tmpImage)
if (!tmpImage)
return nullptr;
SDL_PixelFormat RGBAFormat;
- RGBAFormat.palette = 0;
+ RGBAFormat.palette = nullptr;
RGBAFormat.colorkey = 0;
RGBAFormat.alpha = 0;
RGBAFormat.BitsPerPixel = 32;
@@ -692,14 +692,14 @@ Image *Image::_SDLload(SDL_Surface *tmpImage)
// We also delete the alpha channel since
// it's not used.
delete[] alphaChannel;
- alphaChannel = 0;
+ alphaChannel = nullptr;
}
if (!image)
{
logger->log1("Error: Image convert failed.");
delete[] alphaChannel;
- return 0;
+ return nullptr;
}
if (converted)
@@ -880,7 +880,7 @@ SubImage::SubImage(Image *parent, SDL_Surface *image,
{
mHasAlphaChannel = false;
mIsAlphaVisible = false;
- mAlphaChannel = 0;
+ mAlphaChannel = nullptr;
}
// Set up the rectangle.
@@ -921,16 +921,16 @@ SubImage::SubImage(Image *parent, GLuint image,
SubImage::~SubImage()
{
// Avoid destruction of the image
- mSDLSurface = 0;
+ mSDLSurface = nullptr;
// Avoid possible destruction of its alpha channel
- mAlphaChannel = 0;
+ mAlphaChannel = nullptr;
#ifdef USE_OPENGL
mGLImage = 0;
#endif
if (mParent)
{
mParent->decRef();
- mParent = 0;
+ mParent = nullptr;
}
}
diff --git a/src/resources/imageloader.cpp b/src/resources/imageloader.cpp
index d88e633be..a8563c679 100644
--- a/src/resources/imageloader.cpp
+++ b/src/resources/imageloader.cpp
@@ -51,12 +51,12 @@ void ProxyImage::free()
if (mSDLImage)
{
SDL_FreeSurface(mSDLImage);
- mSDLImage = 0;
+ mSDLImage = nullptr;
}
else
{
delete mImage;
- mImage = 0;
+ mImage = nullptr;
}
}
diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp
index 2498f9c31..a3a35cfd1 100644
--- a/src/resources/imagewriter.cpp
+++ b/src/resources/imagewriter.cpp
@@ -50,7 +50,8 @@ bool ImageWriter::writePNG(SDL_Surface *surface, const std::string &filename)
if (SDL_MUSTLOCK(surface))
SDL_LockSurface(surface);
- png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
+ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
+ nullptr, nullptr, nullptr);
if (!png_ptr)
{
logger->log1("Had trouble creating png_structp");
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 74474e067..3e53dd6e7 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -421,7 +421,7 @@ void ItemDB::unload()
logger->log1("Unloading item database...");
delete mUnknown;
- mUnknown = 0;
+ mUnknown = nullptr;
delete_all(mItemInfos);
mItemInfos.clear();
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 5b07724a1..dfcff3f76 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -77,14 +77,14 @@ ItemInfo::ItemInfo() :
mAttackAction(SpriteAction::INVALID),
mAttackRange(0),
mMissileParticle(""),
- mColors(0),
+ mColors(nullptr),
mColorList(""),
mHitEffectId(0),
mCriticalHitEffectId(0)
{
for (int f = 0; f < 9; f ++)
{
- mSpriteToItemReplaceMap[f] = 0;
+ mSpriteToItemReplaceMap[f] = nullptr;
mDrawBefore[f] = -1;
mDrawAfter[f] = -1;
mDrawPriority[f] = 0;
@@ -96,7 +96,7 @@ ItemInfo::~ItemInfo()
delete_all(mSpriteToItemReplaceList);
mSpriteToItemReplaceList.clear();
for (int f = 0; f < 9; f ++)
- mSpriteToItemReplaceMap[f] = 0;
+ mSpriteToItemReplaceMap[f] = nullptr;
}
const std::string &ItemInfo::getSprite(Gender gender) const
@@ -145,7 +145,7 @@ const std::string &ItemInfo::getSound(EquipmentSoundEvent event) const
std::map<int, int> *ItemInfo::addReplaceSprite(int sprite, int direction)
{
if (direction < 0 || direction >= 9)
- return 0;
+ return nullptr;
SpriteToItemMap *spMap = mSpriteToItemReplaceMap[direction];
@@ -170,7 +170,7 @@ void ItemInfo::setColorsList(std::string name)
{
if (name.empty())
{
- mColors = 0;
+ mColors = nullptr;
mColorList = "";
}
else
@@ -231,7 +231,7 @@ const std::string ItemInfo::replaceColors(std::string str,
SpriteToItemMap *ItemInfo::getSpriteToItemReplaceMap(int direction) const
{
if (direction < 0 || direction >= 9)
- return 0;
+ return nullptr;
SpriteToItemMap *spMap = mSpriteToItemReplaceMap[direction];
if (spMap)
@@ -242,7 +242,7 @@ SpriteToItemMap *ItemInfo::getSpriteToItemReplaceMap(int direction) const
if (direction == DIRECTION_DOWNLEFT || direction == DIRECTION_DOWNRIGHT)
return mSpriteToItemReplaceMap[DIRECTION_DOWN];
- return 0;
+ return nullptr;
}
void ItemInfo::setSpriteOrder(int *ptr, int direction, int n, int def)
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index a6e1074f3..68d39f0ae 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -251,7 +251,7 @@ Map *MapReader::readMap(const std::string &filename,
Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
{
if (!node)
- return 0;
+ return nullptr;
// Take the filename off the path
const std::string pathDir = path.substr(0, path.rfind("/") + 1);
@@ -270,7 +270,7 @@ Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
logger->log("MapReader: Warning: "
"Unitialized tile width or height value for map: %s",
path.c_str());
- return 0;
+ return nullptr;
}
Map *map = new Map(w, h, tilew, tileh);
@@ -405,7 +405,7 @@ inline static void setTile(Map *map, MapLayer *layer, int x, int y, int gid)
if (layer)
{
// Set regular tile on a layer
- Image * const img = set ? set->get(gid - set->getFirstGid()) : 0;
+ Image * const img = set ? set->get(gid - set->getFirstGid()) : nullptr;
layer->setTile(x, y, img);
}
else
@@ -458,7 +458,7 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
map->indexTilesets();
- MapLayer *layer = 0;
+ MapLayer *layer = nullptr;
if (!isCollisionLayer)
{
@@ -668,7 +668,7 @@ Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path,
doc = new XML::Document(filename);
node = doc->rootNode();
if (!node)
- return 0;
+ return nullptr;
// Reset path to be realtive to the tsx file
pathDir = filename.substr(0, filename.rfind("/") + 1);
@@ -760,7 +760,7 @@ Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path,
else
{
delete ani;
- ani = 0;
+ ani = nullptr;
}
}
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index af9f664d4..a99ca622e 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -94,7 +94,7 @@ ResourceManager::~ResourceManager()
continue;
}
#endif
- if (dynamic_cast<SpriteDef*>(iter->second) != 0)
+ if (dynamic_cast<SpriteDef*>(iter->second))
{
cleanUp(iter->second);
ResourceIterator toErase = iter;
@@ -118,7 +118,7 @@ ResourceManager::~ResourceManager()
continue;
}
#endif
- if (dynamic_cast<ImageSet*>(iter->second) != 0)
+ if (dynamic_cast<ImageSet*>(iter->second))
{
cleanUp(iter->second);
ResourceIterator toErase = iter;
@@ -574,7 +574,7 @@ ResourceManager *ResourceManager::getInstance()
void ResourceManager::deleteInstance()
{
delete instance;
- instance = 0;
+ instance = nullptr;
}
void *ResourceManager::loadFile(const std::string &fileName, int &fileSize)
@@ -748,7 +748,7 @@ struct RescaledLoader
Image *ResourceManager::getRescaled(Image *image, int width, int height)
{
if (!image)
- return 0;
+ return nullptr;
std::string idPath = image->getIdPath() + strprintf(
"_rescaled%dx%d", width, height);
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 2d49e8cd1..3e2aac785 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -39,7 +39,7 @@
#include "debug.h"
-SpriteReference *SpriteReference::Empty = 0;
+SpriteReference *SpriteReference::Empty = nullptr;
Action *SpriteDef::getAction(std::string action) const
{
@@ -360,7 +360,7 @@ SpriteDef::~SpriteDef()
if (i->second)
{
i->second->decRef();
- i->second = 0;
+ i->second = nullptr;
}
}
}
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 93eb8a40f..c8cd5ad60 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -157,7 +157,7 @@ std::string Wallpaper::getWallpaper(int width, int height)
{
// Return randomly a wallpaper between vector[0] and
// vector[vector.size() - 1]
- srand(static_cast<unsigned>(time(0)));
+ srand(static_cast<unsigned>(time(nullptr)));
return wallPaperVector[int(static_cast<double>(
wallPaperVector.size()) * rand() / (RAND_MAX + 1.0))];
}
diff --git a/src/rotationalparticle.cpp b/src/rotationalparticle.cpp
index c1bb6ab45..c7c0d10bf 100644
--- a/src/rotationalparticle.cpp
+++ b/src/rotationalparticle.cpp
@@ -44,8 +44,8 @@ RotationalParticle::RotationalParticle(Map *map, xmlNodePtr animationNode,
RotationalParticle::~RotationalParticle()
{
delete mAnimation;
- mAnimation = 0;
- mImage = 0;
+ mAnimation = nullptr;
+ mImage = nullptr;
}
bool RotationalParticle::update()
diff --git a/src/shopitem.cpp b/src/shopitem.cpp
index 3a9b63ca6..db84d30df 100644
--- a/src/shopitem.cpp
+++ b/src/shopitem.cpp
@@ -131,7 +131,7 @@ int ShopItem::sellCurrentDuplicate(int quantity)
if (dupl->quantity == 0)
{
delete dupl;
- dupl = 0;
+ dupl = nullptr;
mDuplicates.pop();
}
return sellCount;
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index d0c7b7e39..31f0c7af0 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -55,13 +55,13 @@ SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode,
if (mAnimation)
mCurrentFrame = mAnimation->getFrame(0);
else
- mCurrentFrame = 0;
+ mCurrentFrame = nullptr;
}
SimpleAnimation::~SimpleAnimation()
{
delete mAnimation;
- mAnimation = 0;
+ mAnimation = nullptr;
}
bool SimpleAnimation::draw(Graphics *graphics, int posX, int posY) const
diff --git a/src/sound.cpp b/src/sound.cpp
index 39c5a72aa..a573458ef 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -51,7 +51,7 @@ Sound::Sound():
mInstalled(false),
mSfxVolume(100),
mMusicVolume(60),
- mMusic(0),
+ mMusic(nullptr),
mPlayBattle(false),
mPlayGui(false),
mPlayMusic(false),
@@ -202,7 +202,7 @@ static Mix_Music *loadMusic(const std::string &filename)
if (success)
path = resman->getPath("tempMusic.ogg");
else
- return NULL;
+ return nullptr;
}
else
{
@@ -210,7 +210,7 @@ static Mix_Music *loadMusic(const std::string &filename)
}
if (path.empty())
- return 0;
+ return nullptr;
Mix_Music *music = Mix_LoadMUS(path.c_str());
@@ -247,7 +247,7 @@ void Sound::stopMusic()
{
Mix_HaltMusic();
Mix_FreeMusic(mMusic);
- mMusic = NULL;
+ mMusic = nullptr;
}
}
@@ -298,7 +298,7 @@ void Sound::logic()
if (mMusic)
{
Mix_FreeMusic(mMusic);
- mMusic = NULL;
+ mMusic = nullptr;
}
sFadingOutEnded = false;
@@ -380,7 +380,7 @@ void Sound::haltMusic()
Mix_HaltMusic();
Mix_FreeMusic(mMusic);
- mMusic = NULL;
+ mMusic = nullptr;
}
void Sound::changeAudio()
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp
index d80090396..7c4c444f0 100644
--- a/src/spellmanager.cpp
+++ b/src/spellmanager.cpp
@@ -166,7 +166,7 @@ void SpellManager::invokeSpell(TextCommand* spell) const
{
if (!chatWindow || !spell)
return;
- chatWindow->localChatInput(parseCommand(spell->getCommand(), 0));
+ chatWindow->localChatInput(parseCommand(spell->getCommand(), nullptr));
}
void SpellManager::invokeSpell(TextCommand* spell, Being* target) const
diff --git a/src/text.cpp b/src/text.cpp
index 8d930f4e2..bb480811f 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -55,7 +55,7 @@ Text::Text(const std::string &text, int x, int y,
else
mFont = font;
- if (textManager == 0)
+ if (!textManager)
{
textManager = new TextManager;
Image *sbImage = Theme::getImageFromTheme("bubble.png|W:#"
@@ -76,8 +76,8 @@ Text::Text(const std::string &text, int x, int y,
else
{
for (int f = 0; f < 9; f ++)
- mBubble.grid[f] = 0;
- mBubbleArrow = 0;
+ mBubble.grid[f] = nullptr;
+ mBubbleArrow = nullptr;
}
const float bubbleAlpha = config.getFloatValue("speechBubbleAlpha");
for (int i = 0; i < 9; i++)
@@ -121,27 +121,27 @@ Text::~Text()
if (--mInstances == 0)
{
delete textManager;
- textManager = 0;
+ textManager = nullptr;
delete mBubble.grid[0];
- mBubble.grid[0] = 0;
+ mBubble.grid[0] = nullptr;
delete mBubble.grid[1];
- mBubble.grid[1] = 0;
+ mBubble.grid[1] = nullptr;
delete mBubble.grid[2];
- mBubble.grid[2] = 0;
+ mBubble.grid[2] = nullptr;
delete mBubble.grid[3];
- mBubble.grid[3] = 0;
+ mBubble.grid[3] = nullptr;
delete mBubble.grid[4];
- mBubble.grid[4] = 0;
+ mBubble.grid[4] = nullptr;
delete mBubble.grid[5];
- mBubble.grid[5] = 0;
+ mBubble.grid[5] = nullptr;
delete mBubble.grid[6];
- mBubble.grid[6] = 0;
+ mBubble.grid[6] = nullptr;
delete mBubble.grid[7];
- mBubble.grid[7] = 0;
+ mBubble.grid[7] = nullptr;
delete mBubble.grid[8];
- mBubble.grid[8] = 0;
+ mBubble.grid[8] = nullptr;
delete mBubbleArrow;
- mBubbleArrow = 0;
+ mBubbleArrow = nullptr;
}
}
diff --git a/src/textcommand.cpp b/src/textcommand.cpp
index 30d8c2a4c..8801ef149 100644
--- a/src/textcommand.cpp
+++ b/src/textcommand.cpp
@@ -46,7 +46,7 @@ TextCommand::TextCommand(unsigned int id, std::string symbol,
mBaseLvl(basicLvl),
mSchoolLvl(schoolLvl),
mCommandType(TEXT_COMMAND_MAGIC),
- mImage(0)
+ mImage(nullptr)
{
loadImage();
}
@@ -66,7 +66,7 @@ TextCommand::TextCommand(unsigned int id, std::string symbol,
mBaseLvl(0),
mSchoolLvl(0),
mCommandType(TEXT_COMMAND_TEXT),
- mImage(0)
+ mImage(nullptr)
{
loadImage();
}
@@ -83,7 +83,7 @@ TextCommand::TextCommand(unsigned int id) :
mBaseLvl(0),
mSchoolLvl(0),
mCommandType(TEXT_COMMAND_TEXT),
- mImage(0)
+ mImage(nullptr)
{
loadImage();
}
@@ -94,7 +94,7 @@ TextCommand::~TextCommand()
if (mImage)
{
mImage->decRef();
- mImage = 0;
+ mImage = nullptr;
}
}
@@ -103,7 +103,7 @@ void TextCommand::loadImage()
if (mImage)
{
mImage->decRef();
- mImage = 0;
+ mImage = nullptr;
}
if (getIcon().empty())
diff --git a/src/textmanager.cpp b/src/textmanager.cpp
index 7c1be58cf..6c73d00b4 100644
--- a/src/textmanager.cpp
+++ b/src/textmanager.cpp
@@ -26,7 +26,7 @@
#include "debug.h"
-TextManager *textManager = 0;
+TextManager *textManager = nullptr;
TextManager::TextManager()
{
@@ -34,7 +34,7 @@ TextManager::TextManager()
void TextManager::addText(Text *text)
{
- place(text, 0, text->mX, text->mY, text->mHeight);
+ place(text, nullptr, text->mX, text->mY, text->mHeight);
mTextList.push_back(text);
}
diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp
index 3906efc76..1ea75322b 100644
--- a/src/utils/base64.cpp
+++ b/src/utils/base64.cpp
@@ -155,7 +155,7 @@ unsigned char *php3_base64_decode(const unsigned char *string,
case 0:
case 1:
free(result);
- return 0;
+ return nullptr;
case 2:
k++;
case 3:
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp
index 7bf7e59d4..98b98fbe9 100644
--- a/src/utils/copynpaste.cpp
+++ b/src/utils/copynpaste.cpp
@@ -431,7 +431,7 @@ bool sendBuffer(std::string& text)
}
close(fd[0]);
}
- execl("/usr/bin/xsel", "xsel", "-i", (char *)0);
+ execl("/usr/bin/xsel", "xsel", "-i", (char *)nullptr);
exit(1);
}
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 56aa44ce3..10436067f 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -35,7 +35,7 @@
namespace XML
{
Document::Document(const std::string &filename, bool useResman):
- mDoc(0)
+ mDoc(nullptr)
{
int size;
char *data = nullptr;
@@ -87,7 +87,7 @@ namespace XML
if (data)
mDoc = xmlParseMemory(data, size);
else
- mDoc = 0;
+ mDoc = nullptr;
}
Document::~Document()
@@ -98,7 +98,7 @@ namespace XML
xmlNodePtr Document::rootNode()
{
- return mDoc ? xmlDocGetRootElement(mDoc) : 0;
+ return mDoc ? xmlDocGetRootElement(mDoc) : nullptr;
}
int getProperty(xmlNodePtr node, const char* name, int def)