summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-07 19:34:52 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-07 19:34:52 +0300
commit9e83411f7e4147d09af5a5006888dcc187ea0ef8 (patch)
treec084bdf8afabc6220779645dcb5dbf71af6a151f
parentbc7d91cc0c9c0f6dcad01d612932c6899afb5514 (diff)
downloadmv-9e83411f7e4147d09af5a5006888dcc187ea0ef8.tar.gz
mv-9e83411f7e4147d09af5a5006888dcc187ea0ef8.tar.bz2
mv-9e83411f7e4147d09af5a5006888dcc187ea0ef8.tar.xz
mv-9e83411f7e4147d09af5a5006888dcc187ea0ef8.zip
Fix some warnings under gcc 4.7.
-rw-r--r--src/actorsprite.cpp2
-rw-r--r--src/actorsprite.h4
-rw-r--r--src/actorspritemanager.cpp26
-rw-r--r--src/being.cpp6
-rw-r--r--src/being.h6
-rw-r--r--src/client.cpp33
-rw-r--r--src/compoundsprite.cpp10
-rw-r--r--src/configuration.cpp4
-rw-r--r--src/debug.h2
-rw-r--r--src/equipment.h8
-rw-r--r--src/game.cpp104
-rw-r--r--src/game.h4
-rw-r--r--src/graphics.cpp6
-rw-r--r--src/graphicsvertexes.h3
-rw-r--r--src/gui/beingpopup.cpp8
-rw-r--r--src/gui/botcheckerwindow.cpp2
-rw-r--r--src/gui/changeemaildialog.cpp4
-rw-r--r--src/gui/changepassworddialog.cpp4
-rw-r--r--src/gui/charcreatedialog.cpp2
-rw-r--r--src/gui/charselectdialog.cpp16
-rw-r--r--src/gui/chatwindow.cpp30
-rw-r--r--src/gui/confirmdialog.cpp2
-rw-r--r--src/gui/confirmdialog.h4
-rw-r--r--src/gui/debugwindow.cpp10
-rw-r--r--src/gui/didyouknowwindow.cpp2
-rw-r--r--src/gui/editdialog.h4
-rw-r--r--src/gui/emotepopup.cpp2
-rw-r--r--src/gui/equipmentwindow.cpp16
-rw-r--r--src/gui/focushandler.cpp2
-rw-r--r--src/gui/gui.cpp36
-rw-r--r--src/gui/helpwindow.cpp2
-rw-r--r--src/gui/inventorywindow.cpp8
-rw-r--r--src/gui/itemamountwindow.cpp10
-rw-r--r--src/gui/itempopup.cpp8
-rw-r--r--src/gui/killstats.cpp2
-rw-r--r--src/gui/logindialog.cpp8
-rw-r--r--src/gui/minimap.cpp8
-rw-r--r--src/gui/ministatuswindow.cpp10
-rw-r--r--src/gui/npcdialog.cpp42
-rw-r--r--src/gui/npcpostdialog.cpp2
-rw-r--r--src/gui/okdialog.h4
-rw-r--r--src/gui/outfitwindow.cpp10
-rw-r--r--src/gui/popupmenu.cpp46
-rw-r--r--src/gui/quitdialog.cpp16
-rw-r--r--src/gui/register.cpp12
-rw-r--r--src/gui/sdlfont.cpp8
-rw-r--r--src/gui/selldialog.cpp8
-rw-r--r--src/gui/serverdialog.cpp16
-rw-r--r--src/gui/setup.cpp4
-rw-r--r--src/gui/setup_colors.cpp8
-rw-r--r--src/gui/setup_keyboard.cpp10
-rw-r--r--src/gui/setup_relations.cpp2
-rw-r--r--src/gui/setup_theme.cpp10
-rw-r--r--src/gui/setup_video.cpp2
-rw-r--r--src/gui/shortcutwindow.cpp12
-rw-r--r--src/gui/socialwindow.cpp30
-rw-r--r--src/gui/specialswindow.cpp8
-rw-r--r--src/gui/textcommandeditor.cpp8
-rw-r--r--src/gui/updaterwindow.cpp18
-rw-r--r--src/gui/viewport.cpp4
-rw-r--r--src/gui/whoisonline.cpp18
-rw-r--r--src/gui/widgets/avatarlistbox.cpp8
-rw-r--r--src/gui/widgets/browserbox.cpp7
-rw-r--r--src/gui/widgets/browserbox.h4
-rw-r--r--src/gui/widgets/button.cpp2
-rw-r--r--src/gui/widgets/chattab.cpp4
-rw-r--r--src/gui/widgets/checkbox.cpp24
-rw-r--r--src/gui/widgets/checkbox.h4
-rw-r--r--src/gui/widgets/desktop.cpp4
-rw-r--r--src/gui/widgets/dropdown.cpp2
-rw-r--r--src/gui/widgets/dropdown.h4
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp10
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/flowcontainer.cpp2
-rw-r--r--src/gui/widgets/guitable.cpp16
-rw-r--r--src/gui/widgets/guitable.h4
-rw-r--r--src/gui/widgets/icon.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp8
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp12
-rw-r--r--src/gui/widgets/layout.cpp4
-rw-r--r--src/gui/widgets/layout.h6
-rw-r--r--src/gui/widgets/playerbox.cpp4
-rw-r--r--src/gui/widgets/playerbox.h3
-rw-r--r--src/gui/widgets/popup.cpp6
-rw-r--r--src/gui/widgets/progressbar.cpp4
-rw-r--r--src/gui/widgets/radiobutton.cpp2
-rw-r--r--src/gui/widgets/resizegrip.cpp4
-rw-r--r--src/gui/widgets/scrollarea.cpp8
-rw-r--r--src/gui/widgets/setupitem.cpp98
-rw-r--r--src/gui/widgets/setuptabscroll.cpp4
-rw-r--r--src/gui/widgets/shopitems.cpp6
-rw-r--r--src/gui/widgets/shoplistbox.cpp2
-rw-r--r--src/gui/widgets/shortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/slider.cpp32
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp8
-rw-r--r--src/gui/widgets/tab.cpp2
-rw-r--r--src/gui/widgets/tabbedarea.cpp22
-rw-r--r--src/gui/widgets/tablemodel.cpp4
-rw-r--r--src/gui/widgets/textfield.cpp2
-rw-r--r--src/gui/widgets/textfield.h4
-rw-r--r--src/gui/widgets/textpreview.cpp2
-rw-r--r--src/gui/widgets/window.cpp16
-rw-r--r--src/gui/widgets/window.h3
-rw-r--r--src/gui/widgets/windowcontainer.cpp2
-rw-r--r--src/gui/worldselectdialog.cpp4
-rw-r--r--src/guichan/basiccontainer.cpp24
-rw-r--r--src/guichan/focushandler.cpp68
-rw-r--r--src/guichan/graphics.cpp4
-rw-r--r--src/guichan/gui.cpp100
-rw-r--r--src/guichan/image.cpp4
-rw-r--r--src/guichan/sdl/sdlgraphics.cpp4
-rw-r--r--src/guichan/sdl/sdlimage.cpp18
-rw-r--r--src/guichan/widget.cpp36
-rw-r--r--src/guichan/widgets/dropdown.cpp16
-rw-r--r--src/guichan/widgets/icon.cpp8
-rw-r--r--src/guichan/widgets/imagebutton.cpp8
-rw-r--r--src/guichan/widgets/listbox.cpp8
-rw-r--r--src/guichan/widgets/scrollarea.cpp14
-rw-r--r--src/guichan/widgets/tab.cpp6
-rw-r--r--src/guichan/widgets/tabbedarea.cpp16
-rw-r--r--src/guichan/widgets/textbox.cpp4
-rw-r--r--src/guichan/widgets/window.cpp2
-rw-r--r--src/guild.cpp6
-rw-r--r--src/keyboardconfig.cpp2
-rw-r--r--src/localconsts.h24
-rw-r--r--src/localplayer.cpp16
-rw-r--r--src/localplayer.h7
-rw-r--r--src/logger.cpp14
-rw-r--r--src/main.cpp4
-rw-r--r--src/map.cpp4
-rw-r--r--src/mumblemanager.cpp10
-rw-r--r--src/net/download.cpp20
-rw-r--r--src/net/ea/gamehandler.cpp2
-rw-r--r--src/net/ea/inventoryhandler.h3
-rw-r--r--src/net/ea/playerhandler.cpp4
-rw-r--r--src/net/manaserv/network.cpp4
-rw-r--r--src/net/manaserv/partyhandler.cpp2
-rw-r--r--src/net/net.cpp34
-rw-r--r--src/net/tmwa/messagehandler.cpp2
-rw-r--r--src/net/tmwa/network.cpp4
-rw-r--r--src/particle.cpp6
-rw-r--r--src/particle.h2
-rw-r--r--src/particlecontainer.cpp6
-rw-r--r--src/particlecontainer.h8
-rw-r--r--src/party.cpp4
-rw-r--r--src/playerrelations.cpp2
-rw-r--r--src/playerrelations.h2
-rw-r--r--src/resources/action.cpp2
-rw-r--r--src/resources/animation.cpp4
-rw-r--r--src/resources/emotedb.cpp6
-rw-r--r--src/resources/image.cpp42
-rw-r--r--src/resources/image.h3
-rw-r--r--src/resources/imageloader.cpp5
-rw-r--r--src/resources/imageset.cpp2
-rw-r--r--src/resources/imagewriter.cpp6
-rw-r--r--src/resources/mapreader.cpp24
-rw-r--r--src/resources/music.cpp2
-rw-r--r--src/resources/resourcemanager.cpp42
-rw-r--r--src/resources/soundeffect.cpp4
-rw-r--r--src/resources/specialdb.cpp4
-rw-r--r--src/resources/spritedef.cpp4
-rw-r--r--src/resources/wallpaper.cpp2
-rw-r--r--src/rotationalparticle.cpp2
-rw-r--r--src/simpleanimation.cpp2
-rw-r--r--src/sound.cpp2
-rw-r--r--src/spellmanager.cpp6
-rw-r--r--src/sprite.h4
-rw-r--r--src/statuseffect.cpp6
-rw-r--r--src/utils/base64.cpp4
-rw-r--r--src/utils/copynpaste.cpp24
-rw-r--r--src/utils/dtor.h6
-rw-r--r--src/utils/paths.cpp2
-rw-r--r--src/utils/specialfolder.cpp2
-rw-r--r--src/utils/xml.cpp4
175 files changed, 946 insertions, 893 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 6155bb7af..ea24513e1 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -186,7 +186,7 @@ static EffectDescription *getEffectDescription(int effectId)
{
logger->log1("Error loading being effects file: "
EFFECTS_FILE);
- return NULL;
+ return nullptr;
}
for_each_xml_child_node(node, root)
diff --git a/src/actorsprite.h b/src/actorsprite.h
index 7ec5cc391..e130269bf 100644
--- a/src/actorsprite.h
+++ b/src/actorsprite.h
@@ -24,6 +24,7 @@
#include "actor.h"
#include "compoundsprite.h"
+#include "localconsts.h"
#include "map.h"
#include "particlecontainer.h"
@@ -122,7 +123,8 @@ public:
/**
* Untargets the actor.
*/
- void untarget() { mUsedTargetCursor = NULL; }
+ void untarget()
+ { mUsedTargetCursor = nullptr; }
/**
* Triggers a visual effect, such as `level up'. Only draws the visual
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index cc18cfbee..f964a8b00 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -295,7 +295,7 @@ Being *ActorSpriteManager::findBeing(int id) const
}
}
- return NULL;
+ return nullptr;
}
Being *ActorSpriteManager::findBeing(int x, int y,
@@ -308,14 +308,14 @@ Being *ActorSpriteManager::findBeing(int x, int y,
ActorSpritesConstIterator it = find_if(mActors.begin(), mActors.end(),
beingFinder);
- return (it == mActors.end()) ? NULL : static_cast<Being*>(*it);
+ return (it == mActors.end()) ? nullptr : static_cast<Being*>(*it);
}
Being *ActorSpriteManager::findBeingByPixel(int x, int y,
bool allPlayers) const
{
if (!mMap)
- return NULL;
+ return nullptr;
bool targetDead = mTargetDeadPlayers;
@@ -448,7 +448,7 @@ void ActorSpriteManager::findBeingsByPixel(std::vector<Being*> &beings,
Being *ActorSpriteManager::findPortalByTile(int x, int y) const
{
if (!mMap)
- return NULL;
+ return nullptr;
for_actors
{
@@ -464,7 +464,7 @@ Being *ActorSpriteManager::findPortalByTile(int x, int y) const
return being;
}
- return NULL;
+ return nullptr;
}
FloorItem *ActorSpriteManager::findItem(int id) const
@@ -481,7 +481,7 @@ FloorItem *ActorSpriteManager::findItem(int id) const
}
}
- return NULL;
+ return nullptr;
}
FloorItem *ActorSpriteManager::findItem(int x, int y) const
@@ -498,7 +498,7 @@ FloorItem *ActorSpriteManager::findItem(int x, int y) const
}
}
- return NULL;
+ return nullptr;
}
bool ActorSpriteManager::pickUpAll(int x1, int y1, int x2, int y2,
@@ -563,7 +563,7 @@ bool ActorSpriteManager::pickUpNearest(int x, int y, int maxdist)
return false;
maxdist = maxdist * maxdist;
- FloorItem *closestItem = NULL;
+ FloorItem *closestItem = nullptr;
int dist = 0;
for_actors
@@ -614,7 +614,7 @@ Being *ActorSpriteManager::findBeingByName(const std::string &name,
return being;
}
}
- return NULL;
+ return nullptr;
}
Being *ActorSpriteManager::findNearestByName(const std::string &name,
@@ -624,7 +624,7 @@ Being *ActorSpriteManager::findNearestByName(const std::string &name,
return 0;
int dist = 0;
- Being* closestBeing = NULL;
+ Being* closestBeing = nullptr;
int x, y;
x = player_node->getTileX();
@@ -654,7 +654,7 @@ Being *ActorSpriteManager::findNearestByName(const std::string &name,
+ (being->getTileY() - y) * (being->getTileY() - y);
if (validateBeing(0, being, type, 0, 50)
- && (d < dist || closestBeing == NULL))
+ && (d < dist || closestBeing == nullptr))
{
dist = d;
closestBeing = being;
@@ -745,7 +745,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(int x, int y,
{
const int maxDist = maxTileDist * 32;
- return findNearestLivingBeing(NULL, maxDist, type, x, y, excluded);
+ return findNearestLivingBeing(nullptr, maxDist, type, x, y, excluded);
}
Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
@@ -884,7 +884,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
beingSorter.priorityBeings = 0;
}
- if (player_node->getTarget() == NULL)
+ if (player_node->getTarget() == nullptr)
{
Being *target = sortedBeings.at(0);
diff --git a/src/being.cpp b/src/being.cpp
index 5e8d68041..d73684ba0 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -223,7 +223,7 @@ Being::Being(int id, Type type, Uint16 subtype, Map *map):
mSpriteDirection(DIRECTION_DOWN),
mDispName(0),
mShowName(false),
- mEquippedWeapon(NULL),
+ mEquippedWeapon(nullptr),
mText(0),
mLevel(0),
mGender(GENDER_UNSPECIFIED),
@@ -1678,13 +1678,13 @@ void Being::setSprite(unsigned int slot, int id, std::string color,
removeSprite(slot);
if (isWeapon)
- mEquippedWeapon = NULL;
+ mEquippedWeapon = nullptr;
}
else
{
const ItemInfo &info = ItemDB::get(id);
std::string filename = info.getSprite(mGender);
- AnimatedSprite *equipmentSprite = NULL;
+ AnimatedSprite *equipmentSprite = nullptr;
if (!filename.empty())
{
diff --git a/src/being.h b/src/being.h
index 9b38e1479..9ee60fcdf 100644
--- a/src/being.h
+++ b/src/being.h
@@ -354,7 +354,7 @@ class Being : public ActorSprite, public ConfigListener
{ return static_cast<short>(mGuilds.size()); }
bool isInParty() const
- { return mParty != NULL; }
+ { return mParty; }
void setParty(Party *party);
@@ -761,10 +761,10 @@ class Being : public ActorSprite, public ConfigListener
void setAttackRange(int range)
{ mAttackRange = range; }
- void attack(Being *target = NULL, bool keep = false,
+ void attack(Being *target = nullptr, bool keep = false,
bool dontChangeEquipment = false);
- void attack2(Being *target = NULL, bool keep = false,
+ void attack2(Being *target = nullptr, bool keep = false,
bool dontChangeEquipment = false);
protected:
diff --git a/src/client.cpp b/src/client.cpp
index 642b967b1..966070d3a 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -341,7 +341,7 @@ Client::Client(const Options &options):
SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
- SDL_WM_SetCaption(branding.getValue("appName", "ManaPlus").c_str(), NULL);
+ SDL_WM_SetCaption(branding.getValue("appName", "ManaPlus").c_str(), nullptr);
ResourceManager *resman = ResourceManager::getInstance();
@@ -440,12 +440,11 @@ Client::Client(const Options &options):
static SDL_SysWMinfo pInfo;
SDL_GetWMInfo(&pInfo);
// Attempt to load icon from .ico file
- HICON icon = (HICON) LoadImage(NULL,
- iconFile.c_str(),
- IMAGE_ICON, 64, 64, LR_LOADFROMFILE);
+ HICON icon = (HICON) LoadImage(nullptr, iconFile.c_str(),
+ IMAGE_ICON, 64, 64, LR_LOADFROMFILE);
// If it's failing, we load the default resource file.
if (!icon)
- icon = LoadIcon(GetModuleHandle(NULL), "A");
+ icon = LoadIcon(GetModuleHandle(nullptr), "A");
if (icon)
SetClassLong(pInfo.window, GCL_HICON, (LONG) icon);
@@ -454,7 +453,7 @@ Client::Client(const Options &options):
if (mIcon)
{
SDL_SetAlpha(mIcon, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);
- SDL_WM_SetIcon(mIcon, NULL);
+ SDL_WM_SetIcon(mIcon, nullptr);
}
#endif
@@ -601,8 +600,8 @@ Client::Client(const Options &options):
// Initialize logic and seconds counters
tick_time = 0;
- mLogicCounterId = SDL_AddTimer(MILLISECONDS_IN_A_TICK, nextTick, NULL);
- mSecondsCounterId = SDL_AddTimer(1000, nextSecond, NULL);
+ mLogicCounterId = SDL_AddTimer(MILLISECONDS_IN_A_TICK, nextTick, nullptr);
+ mSecondsCounterId = SDL_AddTimer(1000, nextSecond, nullptr);
const int fpsLimit = config.getIntValue("fpslimit");
mLimitFps = fpsLimit > 0;
@@ -625,7 +624,7 @@ Client::Client(const Options &options):
optionChanged("fpslimit");
- start_time = static_cast<int>(time(NULL));
+ start_time = static_cast<int>(time(nullptr));
// Initialize PlayerInfo
PlayerInfo::init();
@@ -1197,7 +1196,7 @@ int Client::exec()
delete mDesktop;
mDesktop = 0;
- mCurrentDialog = NULL;
+ mCurrentDialog = nullptr;
logger->log1("State: GAME");
if (Net::getGeneralHandler())
@@ -1209,14 +1208,14 @@ int Client::exec()
logger->log1("State: LOGIN ERROR");
mCurrentDialog = new OkDialog(_("Error"), errorMessage);
mCurrentDialog->addActionListener(&loginListener);
- mCurrentDialog = NULL; // OkDialog deletes itself
+ mCurrentDialog = nullptr; // OkDialog deletes itself
break;
case STATE_ACCOUNTCHANGE_ERROR:
logger->log1("State: ACCOUNT CHANGE ERROR");
mCurrentDialog = new OkDialog(_("Error"), errorMessage);
mCurrentDialog->addActionListener(&accountListener);
- mCurrentDialog = NULL; // OkDialog deletes itself
+ mCurrentDialog = nullptr; // OkDialog deletes itself
break;
case STATE_REGISTER_PREP:
@@ -1252,7 +1251,7 @@ int Client::exec()
mCurrentDialog = new OkDialog(_("Password Change"),
_("Password changed successfully!"));
mCurrentDialog->addActionListener(&accountListener);
- mCurrentDialog = NULL; // OkDialog deletes itself
+ mCurrentDialog = nullptr; // OkDialog deletes itself
loginData.password = loginData.newPassword;
loginData.newPassword = "";
break;
@@ -1272,7 +1271,7 @@ int Client::exec()
mCurrentDialog = new OkDialog(_("Email Change"),
_("Email changed successfully!"));
mCurrentDialog->addActionListener(&accountListener);
- mCurrentDialog = NULL; // OkDialog deletes itself
+ mCurrentDialog = nullptr; // OkDialog deletes itself
break;
case STATE_UNREGISTER:
@@ -1295,7 +1294,7 @@ int Client::exec()
loginData.clear();
//The errorlistener sets the state to STATE_CHOOSE_SERVER
mCurrentDialog->addActionListener(&errorListener);
- mCurrentDialog = NULL; // OkDialog deletes itself
+ mCurrentDialog = nullptr; // OkDialog deletes itself
break;
case STATE_SWITCH_SERVER:
@@ -1350,7 +1349,7 @@ int Client::exec()
logger->log("Error: %s\n", errorMessage.c_str());
mCurrentDialog = new OkDialog(_("Error"), errorMessage);
mCurrentDialog->addActionListener(&errorListener);
- mCurrentDialog = NULL; // OkDialog deletes itself
+ mCurrentDialog = nullptr; // OkDialog deletes itself
Net::getGameHandler()->disconnect();
break;
@@ -1796,7 +1795,7 @@ bool Client::copyFile(std::string &configPath, std::string &oldConfigPath)
configFile = fopen(oldConfigPath.c_str(), "r");
- if (configFile != NULL)
+ if (configFile)
{
fclose(configFile);
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp
index ceab9a149..cda178aeb 100644
--- a/src/compoundsprite.cpp
+++ b/src/compoundsprite.cpp
@@ -166,7 +166,7 @@ void CompoundSprite::drawSpritesSDL(Graphics* graphics,
int CompoundSprite::getWidth() const
{
- Sprite *base = NULL;
+ Sprite *base = nullptr;
SpriteConstIterator it, it_end;
for (it = begin(), it_end = end(); it != it_end; ++it)
@@ -183,7 +183,7 @@ int CompoundSprite::getWidth() const
int CompoundSprite::getHeight() const
{
- Sprite *base = NULL;
+ Sprite *base = nullptr;
SpriteConstIterator it, it_end;
for (it = begin(), it_end = end(); it != it_end; ++it)
@@ -271,7 +271,7 @@ void CompoundSprite::setSprite(int layer, Sprite* sprite)
void CompoundSprite::removeSprite(int layer)
{
// Skip if it won't change anything
- if (at(layer) == NULL)
+ if (at(layer) == nullptr)
return;
delete at(layer);
@@ -299,7 +299,7 @@ void CompoundSprite::ensureSize(size_t layerCount)
if (size() >= layerCount)
return;
- resize(layerCount, NULL);
+ resize(layerCount, nullptr);
}
/**
@@ -387,7 +387,7 @@ void CompoundSprite::redraw() const
BUFFER_WIDTH, BUFFER_HEIGHT, 32, rmask, gmask, bmask, amask);
SDL_SetAlpha(surface, 0, SDL_ALPHA_OPAQUE);
- SDL_BlitSurface(surface, NULL, surfaceA, NULL);
+ SDL_BlitSurface(surface, nullptr, surfaceA, nullptr);
delete mImage;
delete mAlphaImage;
diff --git a/src/configuration.cpp b/src/configuration.cpp
index a0167b9b0..814b0ce65 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -565,8 +565,8 @@ void Configuration::write()
logger->log1("Configuration::write() writing configuration...");
xmlTextWriterSetIndent(writer, 1);
- xmlTextWriterStartDocument(writer, NULL, NULL, NULL);
-// xmlTextWriterStartDocument(writer, NULL, "utf8", NULL);
+ xmlTextWriterStartDocument(writer, nullptr, nullptr, nullptr);
+// xmlTextWriterStartDocument(writer, nullptr, "utf8", nullptr);
xmlTextWriterStartElement(writer, BAD_CAST "configuration");
writeToXML(writer);
diff --git a/src/debug.h b/src/debug.h
index 81a2e0526..3c509152d 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -18,6 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "localconsts.h"
+
#ifdef ENABLE_MEM_DEBUG
//define _DEBUG_NEW_EMULATE_MALLOC 1
#include "debug/debug_new.h"
diff --git a/src/equipment.h b/src/equipment.h
index 71b4b8593..2b6dae3ce 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -25,6 +25,8 @@
#define EQUIPMENT_SIZE 13
+#include "localconsts.h"
+
class Item;
class Equipment
@@ -33,14 +35,14 @@ class Equipment
/**
* Constructor.
*/
- Equipment(): mBackend(0)
+ Equipment(): mBackend(nullptr)
{ }
/**
* Destructor.
*/
~Equipment()
- { mBackend = 0; }
+ { mBackend = nullptr; }
enum Slot
{
@@ -72,7 +74,7 @@ class Equipment
* Get equipment at the given slot.
*/
Item *getEquipment(int index) const
- { return mBackend ? mBackend->getEquipment(index) : 0; }
+ { return mBackend ? mBackend->getEquipment(index) : nullptr; }
/**
* Clears equipment.
diff --git a/src/game.cpp b/src/game.cpp
index a9fa318f7..6b595e8e1 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -117,54 +117,54 @@
#include "debug.h"
-Joystick *joystick = NULL;
+Joystick *joystick = nullptr;
-OkDialog *weightNotice = NULL;
+OkDialog *weightNotice = nullptr;
int weightNoticeTime = 0;
-OkDialog *deathNotice = NULL;
-QuitDialog *quitDialog = NULL;
-OkDialog *disconnectedDialog = NULL;
-
-ChatWindow *chatWindow = NULL;
-StatusWindow *statusWindow = NULL;
-MiniStatusWindow *miniStatusWindow = NULL;
-InventoryWindow *inventoryWindow = NULL;
-ShopWindow *shopWindow = NULL;
-SkillDialog *skillDialog = NULL;
-Minimap *minimap = NULL;
-EquipmentWindow *equipmentWindow = NULL;
-EquipmentWindow *beingEquipmentWindow = NULL;
-TradeWindow *tradeWindow = NULL;
-HelpWindow *helpWindow = NULL;
-DebugWindow *debugWindow = NULL;
-ShortcutWindow *itemShortcutWindow = NULL;
-ShortcutWindow *emoteShortcutWindow = NULL;
-OutfitWindow *outfitWindow = NULL;
-SpecialsWindow *specialsWindow = NULL;
-ShortcutWindow *dropShortcutWindow = NULL;
-ShortcutWindow *spellShortcutWindow = NULL;
-WhoIsOnline *whoIsOnline = NULL;
-DidYouKnowWindow *didYouKnowWindow = NULL;
-KillStats *killStats = NULL;
-BotCheckerWindow *botCheckerWindow = NULL;
-SocialWindow *socialWindow = NULL;
-WindowMenu *windowMenu = NULL;
-
-ActorSpriteManager *actorSpriteManager = NULL;
-ChannelManager *channelManager = NULL;
-CommandHandler *commandHandler = NULL;
-MumbleManager *mumbleManager = NULL;
-Particle *particleEngine = NULL;
-EffectManager *effectManager = NULL;
-SpellManager *spellManager = NULL;
-Viewport *viewport = NULL; /**< Viewport on the map. */
-GuildManager *guildManager = NULL;
-AuctionManager *auctionManager = NULL;
-
-ChatTab *localChatTab = NULL;
-ChatTab *debugChatTab = NULL;
-TradeTab *tradeChatTab = NULL;
-BattleTab *battleChatTab = NULL;
+OkDialog *deathNotice = nullptr;
+QuitDialog *quitDialog = nullptr;
+OkDialog *disconnectedDialog = nullptr;
+
+ChatWindow *chatWindow = nullptr;
+StatusWindow *statusWindow = nullptr;
+MiniStatusWindow *miniStatusWindow = nullptr;
+InventoryWindow *inventoryWindow = nullptr;
+ShopWindow *shopWindow = nullptr;
+SkillDialog *skillDialog = nullptr;
+Minimap *minimap = nullptr;
+EquipmentWindow *equipmentWindow = nullptr;
+EquipmentWindow *beingEquipmentWindow = nullptr;
+TradeWindow *tradeWindow = nullptr;
+HelpWindow *helpWindow = nullptr;
+DebugWindow *debugWindow = nullptr;
+ShortcutWindow *itemShortcutWindow = nullptr;
+ShortcutWindow *emoteShortcutWindow = nullptr;
+OutfitWindow *outfitWindow = nullptr;
+SpecialsWindow *specialsWindow = nullptr;
+ShortcutWindow *dropShortcutWindow = nullptr;
+ShortcutWindow *spellShortcutWindow = nullptr;
+WhoIsOnline *whoIsOnline = nullptr;
+DidYouKnowWindow *didYouKnowWindow = nullptr;
+KillStats *killStats = nullptr;
+BotCheckerWindow *botCheckerWindow = nullptr;
+SocialWindow *socialWindow = nullptr;
+WindowMenu *windowMenu = nullptr;
+
+ActorSpriteManager *actorSpriteManager = nullptr;
+ChannelManager *channelManager = nullptr;
+CommandHandler *commandHandler = nullptr;
+MumbleManager *mumbleManager = nullptr;
+Particle *particleEngine = nullptr;
+EffectManager *effectManager = nullptr;
+SpellManager *spellManager = nullptr;
+Viewport *viewport = nullptr; /**< Viewport on the map. */
+GuildManager *guildManager = nullptr;
+AuctionManager *auctionManager = nullptr;
+
+ChatTab *localChatTab = nullptr;
+ChatTab *debugChatTab = nullptr;
+TradeTab *tradeChatTab = nullptr;
+BattleTab *battleChatTab = nullptr;
const unsigned adjustDelay = 10;
@@ -182,7 +182,7 @@ static void initEngines()
AuctionManager::init();
GuildManager::init();
- particleEngine = new Particle(NULL);
+ particleEngine = new Particle(nullptr);
particleEngine->setupEngine();
Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_ENGINESINITALIZED));
@@ -297,7 +297,7 @@ static void destroyGuiWindows()
{
Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSUNLOADING));
- logger->setChatWindow(NULL);
+ logger->setChatWindow(nullptr);
if (whoIsOnline)
whoIsOnline->setAllowUpdate(false);
@@ -365,7 +365,7 @@ Game::Game():
assert(!mInstance);
mInstance = this;
- disconnectedDialog = NULL;
+ disconnectedDialog = nullptr;
mAdjustPerfomance = config.getBoolValue("adjustPerfomance");
@@ -729,7 +729,7 @@ void Game::handleInput()
// Keyboard events (for discontinuous keys)
if (event.type == SDL_KEYDOWN)
{
- gcn::Window *requestedWindow = NULL;
+ gcn::Window *requestedWindow = nullptr;
if (setupWindow && setupWindow->isVisible() &&
keyboard.getNewKeyIndex() > keyboard.KEY_NO_VALUE)
@@ -846,9 +846,9 @@ void Game::handleInput()
helpWindow->setVisible(false);
// Close the config window, cancelling changes if opened
else if (setupWindow->isVisible())
- setupWindow->action(gcn::ActionEvent(NULL, "cancel"));
+ setupWindow->action(gcn::ActionEvent(nullptr, "cancel"));
else if (dialog)
- dialog->action(gcn::ActionEvent(NULL, "ok"));
+ dialog->action(gcn::ActionEvent(nullptr, "ok"));
}
if (chatWindow && keyboard.isKeyActive(
keyboard.KEY_TOGGLE_CHAT))
diff --git a/src/game.h b/src/game.h
index 24ca7f0fc..2205e30de 100644
--- a/src/game.h
+++ b/src/game.h
@@ -26,6 +26,8 @@
#include <string>
#include "gui/sdlinput.h"
+#include "localconsts.h"
+
#define MAX_LASTKEYS 10
extern volatile int cur_time;
@@ -66,7 +68,7 @@ class Game
{ return mInstance; }
static void clearInstance()
- { mInstance = 0; }
+ { mInstance = nullptr; }
/**
* This method takes the game a small step further. It is called 100
diff --git a/src/graphics.cpp b/src/graphics.cpp
index d914b0b00..47b0cae3d 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -645,7 +645,7 @@ SDL_Surface *Graphics::getScreenshot()
mTarget->h, 24, rmask, gmask, bmask, amask);
if (screenshot)
- SDL_BlitSurface(mTarget, NULL, screenshot, NULL);
+ SDL_BlitSurface(mTarget, nullptr, screenshot, nullptr);
return screenshot;
}
@@ -684,8 +684,8 @@ int Graphics::SDL_FakeUpperBlit(SDL_Surface *src, SDL_Rect *srcrect,
if (src->locked || dst->locked)
return(-1);
- /* If the destination rectangle is NULL, use the entire dest surface */
- if (dstrect == NULL)
+ /* If the destination rectangle is nullptr, use the entire dest surface */
+ if (!dstrect)
{
fulldst.x = 0;
fulldst.y = 0;
diff --git a/src/graphicsvertexes.h b/src/graphicsvertexes.h
index 5b39dfb08..13b7bf0c8 100644
--- a/src/graphicsvertexes.h
+++ b/src/graphicsvertexes.h
@@ -25,6 +25,7 @@
#include "main.h"
#include "graphics.h"
+#include "localconsts.h"
#ifdef USE_OPENGL
#define NO_SDL_GLEXT
@@ -122,7 +123,7 @@ class ImageVertexes
{
public:
ImageVertexes() :
- image(0)
+ image(nullptr)
{
sdl.reserve(30);
#ifdef USE_OPENGL
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp
index 98df1ca9a..759d4c245 100644
--- a/src/gui/beingpopup.cpp
+++ b/src/gui/beingpopup.cpp
@@ -130,7 +130,7 @@ void BeingPopup::show(int x, int y, Being *b)
label4 = label3;
label3 = label2;
label2 = label1;
- label1 = 0;
+ label1 = nullptr;
}
if (!(b->getGuildName().empty()))
@@ -143,7 +143,7 @@ void BeingPopup::show(int x, int y, Being *b)
{
label4 = label3;
label3 = label2;
- label2 = 0;
+ label2 = nullptr;
}
if (b->getPvpRank() > 0)
@@ -154,7 +154,7 @@ void BeingPopup::show(int x, int y, Being *b)
else
{
label4 = label3;
- label3 = 0;
+ label3 = nullptr;
}
if (!b->getComment().empty())
@@ -165,7 +165,7 @@ void BeingPopup::show(int x, int y, Being *b)
}
else
{
- label4 = 0;
+ label4 = nullptr;
}
int minWidth = mBeingName->getWidth();
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp
index 88bc65a78..bff9ad31a 100644
--- a/src/gui/botcheckerwindow.cpp
+++ b/src/gui/botcheckerwindow.cpp
@@ -263,7 +263,7 @@ protected:
BotCheckerWindow::BotCheckerWindow():
- Window(_("Bot Checker"), false, 0, "botchecker.xml"),
+ Window(_("Bot Checker"), false, nullptr, "botchecker.xml"),
mEnabled(false)
{
int w = 500;
diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp
index 384ebf07f..3c412b424 100644
--- a/src/gui/changeemaildialog.cpp
+++ b/src/gui/changeemaildialog.cpp
@@ -45,7 +45,7 @@
#include "debug.h"
ChangeEmailDialog::ChangeEmailDialog(LoginData *data):
- Window(_("Change Email Address"), true, 0, "changeemail.xml"),
+ Window(_("Change Email Address"), true, nullptr, "changeemail.xml"),
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
@@ -102,7 +102,7 @@ ChangeEmailDialog::ChangeEmailDialog(LoginData *data):
ChangeEmailDialog::~ChangeEmailDialog()
{
delete mWrongDataNoticeListener;
- mWrongDataNoticeListener = 0;
+ mWrongDataNoticeListener = nullptr;
}
void ChangeEmailDialog::action(const gcn::ActionEvent &event)
diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp
index 7a67279b6..a7ebaebca 100644
--- a/src/gui/changepassworddialog.cpp
+++ b/src/gui/changepassworddialog.cpp
@@ -47,7 +47,7 @@
#include "debug.h"
ChangePasswordDialog::ChangePasswordDialog(LoginData *data):
- Window(_("Change Password"), true, 0, "changepassword.xml"),
+ Window(_("Change Password"), true, nullptr, "changepassword.xml"),
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
@@ -82,7 +82,7 @@ ChangePasswordDialog::ChangePasswordDialog(LoginData *data):
ChangePasswordDialog::~ChangePasswordDialog()
{
delete mWrongDataNoticeListener;
- mWrongDataNoticeListener = 0;
+ mWrongDataNoticeListener = nullptr;
}
void ChangePasswordDialog::action(const gcn::ActionEvent &event)
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index efe7e804f..0cde69386 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -63,7 +63,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot):
setStickyButtonLock(true);
setSticky(true);
- mPlayer = new Being(0, ActorSprite::PLAYER, mRace, NULL);
+ mPlayer = new Being(0, ActorSprite::PLAYER, mRace, nullptr);
mPlayer->setGender(GENDER_MALE);
int numberOfHairColors = ColorDB::getHairSize();
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index 00cae41e6..93302e0ff 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -122,14 +122,14 @@ class CharacterDisplay : public Container
};
CharSelectDialog::CharSelectDialog(LoginData *data):
- Window(_("Account and Character Management"), false, 0, "char.xml"),
+ Window(_("Account and Character Management"), false, nullptr, "char.xml"),
mLocked(false),
- mUnregisterButton(0),
- mChangeEmailButton(0),
+ mUnregisterButton(nullptr),
+ mChangeEmailButton(nullptr),
mCharacterEntries(0),
mLoginData(data),
mCharHandler(Net::getCharHandler()),
- mDeleteDialog(0),
+ mDeleteDialog(nullptr),
mDeleteIndex(-1)
{
setCloseButton(false);
@@ -246,7 +246,7 @@ void CharSelectDialog::action(const gcn::ActionEvent &event)
== LoginDialog::savedPassword)
{
attemptCharacterDelete(mDeleteIndex);
- mDeleteDialog = 0;
+ mDeleteDialog = nullptr;
}
else
{
@@ -313,7 +313,7 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters)
for (iter = mCharacterEntries.begin(), iter_end = mCharacterEntries.end();
iter != iter_end; ++iter)
{
- (*iter)->setCharacter(0);
+ (*iter)->setCharacter(nullptr);
}
Net::Characters::const_iterator i, i_end = characters.end();
@@ -399,7 +399,7 @@ bool CharSelectDialog::selectByName(const std::string &name,
CharacterDisplay::CharacterDisplay(CharSelectDialog *charSelectDialog):
- mCharacter(0),
+ mCharacter(nullptr),
mPlayerBox(new PlayerBox)
{
mButton = new Button("wwwwwwwww", "go", charSelectDialog);
@@ -445,7 +445,7 @@ void CharacterDisplay::setCharacter(Net::Character *character)
return;
mCharacter = character;
- mPlayerBox->setPlayer(character ? character->dummy : 0);
+ mPlayerBox->setPlayer(character ? character->dummy : nullptr);
update();
}
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index cdcd02bc3..35b89b839 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -149,7 +149,7 @@ public:
ChatWindow::ChatWindow():
- Window(_("Chat"), false, 0, "chat.xml"),
+ Window(_("Chat"), false, nullptr, "chat.xml"),
mTmpVisible(false),
mChatHistoryIndex(0)
{
@@ -222,11 +222,11 @@ ChatWindow::~ChatWindow()
config.setValue("ReturnToggles", mReturnToggles);
removeAllWhispers();
delete mItemLinkHandler;
- mItemLinkHandler = 0;
+ mItemLinkHandler = nullptr;
delete mColorPicker;
- mColorPicker = 0;
+ mColorPicker = nullptr;
delete mColorListModel;
- mColorListModel = 0;
+ mColorListModel = nullptr;
}
void ChatWindow::fillCommands()
@@ -557,13 +557,13 @@ void ChatWindow::ignoreAllWhispers()
}
delete(iter->second);
- iter->second = 0;
+ iter->second = nullptr;
}
}
void ChatWindow::chatInput(const std::string &message)
{
- ChatTab *tab = NULL;
+ ChatTab *tab = nullptr;
std::string msg = message;
trim(msg);
@@ -939,7 +939,7 @@ void ChatWindow::addWhisper(const std::string &nick,
if (tempNick.compare(playerName) == 0)
return;
- ChatTab *tab = 0;
+ ChatTab *tab = nullptr;
TabMap::const_iterator i = mWhispers.find(tempNick);
if (i != mWhispers.end())
@@ -1006,7 +1006,7 @@ void ChatWindow::addWhisper(const std::string &nick,
{
localChatTab->chatLog(nick + " : " + mes, ACT_WHISPER, false);
if (player_node)
- player_node->afkRespond(0, nick);
+ player_node->afkRespond(nullptr, nick);
}
}
}
@@ -1014,7 +1014,7 @@ void ChatWindow::addWhisper(const std::string &nick,
ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo)
{
if (!player_node)
- return NULL;
+ return nullptr;
std::string playerName = player_node->getName();
std::string tempNick = nick;
@@ -1026,7 +1026,7 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo)
ChatTab *ret;
if (tempNick.compare(playerName) == 0)
- return NULL;
+ return nullptr;
if (i != mWhispers.end())
{
@@ -1051,7 +1051,7 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo)
ChatTab *ChatWindow::getWhisperTab(const std::string &nick) const
{
if (!player_node)
- return NULL;
+ return nullptr;
std::string playerName = player_node->getName();
std::string tempNick = nick;
@@ -1060,10 +1060,10 @@ ChatTab *ChatWindow::getWhisperTab(const std::string &nick) const
toLower(tempNick);
TabMap::const_iterator i = mWhispers.find(tempNick);
- ChatTab *ret = 0;
+ ChatTab *ret = nullptr;
if (tempNick.compare(playerName) == 0)
- return NULL;
+ return nullptr;
if (i != mWhispers.end())
ret = i->second;
@@ -1350,8 +1350,8 @@ void ChatWindow::initTradeFilter()
void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers)
{
TabMap::const_iterator iter;
- const Party *party = 0;
- const Guild *guild = 0;
+ const Party *party = nullptr;
+ const Guild *guild = nullptr;
if (player_node)
{
party = player_node->getParty();
diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp
index f7f81bd2f..298855563 100644
--- a/src/gui/confirmdialog.cpp
+++ b/src/gui/confirmdialog.cpp
@@ -46,7 +46,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
gcn::Button *yesButton = new Button(_("Yes"), "yes", this);
gcn::Button *noButton = new Button(_("No"), "no", this);
- gcn::Button *ignoreButton = NULL;
+ gcn::Button *ignoreButton = nullptr;
if (ignore)
ignoreButton = new Button(_("Ignore"), "ignore", this);
diff --git a/src/gui/confirmdialog.h b/src/gui/confirmdialog.h
index 214aaba60..2b5febed0 100644
--- a/src/gui/confirmdialog.h
+++ b/src/gui/confirmdialog.h
@@ -23,6 +23,8 @@
#ifndef OPTION_DIALOG_H
#define OPTION_DIALOG_H
+#include "localconsts.h"
+
#include "gui/widgets/window.h"
#include <guichan/actionlistener.hpp>
@@ -44,7 +46,7 @@ class ConfirmDialog : public Window, public gcn::ActionListener
*/
ConfirmDialog(const std::string &title, const std::string &msg,
bool ignore = false, bool modal = false,
- Window *parent = NULL);
+ Window *parent = nullptr);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 83e9791ef..56a63c72d 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -51,7 +51,7 @@
#include "debug.h"
DebugWindow::DebugWindow():
- Window(_("Debug"), false, 0, "debug.xml")
+ Window(_("Debug"), false, nullptr, "debug.xml")
{
setWindowName("Debug");
if (setupWindow)
@@ -85,11 +85,11 @@ DebugWindow::DebugWindow():
DebugWindow::~DebugWindow()
{
delete mMapWidget;
- mMapWidget = 0;
+ mMapWidget = nullptr;
delete mTargetWidget;
- mTargetWidget = 0;
+ mTargetWidget = nullptr;
delete mNetWidget;
- mNetWidget = 0;
+ mNetWidget = nullptr;
}
void DebugWindow::logic()
@@ -139,7 +139,7 @@ void DebugWindow::widgetResized(const gcn::Event &event)
}
MapDebugTab::MapDebugTab() :
- mTexturesLabel(0)
+ mTexturesLabel(nullptr)
{
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp
index df15e6ebd..9a913a305 100644
--- a/src/gui/didyouknowwindow.cpp
+++ b/src/gui/didyouknowwindow.cpp
@@ -44,7 +44,7 @@ static const int minTip = 1;
static const int maxTip = 14;
DidYouKnowWindow::DidYouKnowWindow():
- Window(_("Did You Know?"), false, 0, "didyouknow.xml")
+ Window(_("Did You Know?"), false, nullptr, "didyouknow.xml")
{
setMinWidth(300);
setMinHeight(250);
diff --git a/src/gui/editdialog.h b/src/gui/editdialog.h
index dc0d1cc63..69f86edca 100644
--- a/src/gui/editdialog.h
+++ b/src/gui/editdialog.h
@@ -24,6 +24,8 @@
#ifndef EDIT_DIALOG_H
#define EDIT_DIALOG_H
+#include "localconsts.h"
+
#include "gui/widgets/window.h"
#include "gui/widgets/textfield.h"
@@ -48,7 +50,7 @@ class EditDialog : public Window, public gcn::ActionListener
*/
EditDialog(const std::string &title, const std::string &msg,
std::string eventOk = ACTION_EDIT_OK, int width = 300,
- Window *parent = NULL, bool modal = true);
+ Window *parent = nullptr, bool modal = true);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp
index 6d2bf7be2..a8c92ed47 100644
--- a/src/gui/emotepopup.cpp
+++ b/src/gui/emotepopup.cpp
@@ -80,7 +80,7 @@ EmotePopup::~EmotePopup()
if (mSelectionImage)
{
mSelectionImage->decRef();
- mSelectionImage = 0;
+ mSelectionImage = nullptr;
}
}
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index f423cddf0..d3d230922 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -58,7 +58,7 @@ static const int BOX_HEIGHT = 36;
EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being,
bool foring):
- Window(_("Equipment"), false, 0, "equipment.xml"),
+ Window(_("Equipment"), false, nullptr, "equipment.xml"),
mEquipment(equipment),
mSelected(-1),
mForing(foring)
@@ -86,7 +86,7 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being,
mBoxes.reserve(13);
for (int f = 0; f < 13; f ++)
- mBoxes.push_back(0);
+ mBoxes.push_back(nullptr);
fillBoxes();
@@ -109,13 +109,13 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being,
EquipmentWindow::~EquipmentWindow()
{
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
if (this == beingEquipmentWindow)
{
if (mEquipment)
delete mEquipment->getBackend();
delete mEquipment;
- mEquipment = 0;
+ mEquipment = nullptr;
}
delete_all(mBoxes);
mBoxes.clear();
@@ -198,7 +198,7 @@ void EquipmentWindow::action(const gcn::ActionEvent &event)
Item *EquipmentWindow::getItem(int x, int y) const
{
if (!mEquipment)
- return 0;
+ return nullptr;
std::vector<std::pair<int, int>*>::const_iterator it;
std::vector<std::pair<int, int>*>::const_iterator it_end = mBoxes.end();
@@ -215,7 +215,7 @@ Item *EquipmentWindow::getItem(int x, int y) const
if (tRect.isPointInRect(x, y))
return mEquipment->getEquipment(i);
}
- return NULL;
+ return nullptr;
}
void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent)
@@ -322,7 +322,7 @@ void EquipmentWindow::setBeing(Being *being)
delete mEquipment;
if (!being)
{
- mEquipment = 0;
+ mEquipment = nullptr;
return;
}
mEquipment = being->getEquipment();
@@ -337,7 +337,7 @@ void EquipmentWindow::updateBeing(Being *being)
void EquipmentWindow::resetBeing(Being *being)
{
if (being == mBeing)
- setBeing(0);
+ setBeing(nullptr);
}
void EquipmentWindow::fillBoxes()
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index ec854cf87..40fa2f4ed 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -34,7 +34,7 @@ void FocusHandler::requestModalFocus(gcn::Widget *widget)
if (mModalFocusedWidget && mModalFocusedWidget != widget)
{
mModalStack.push_front(mModalFocusedWidget);
- mModalFocusedWidget = NULL;
+ mModalFocusedWidget = nullptr;
}
gcn::FocusHandler::requestModalFocus(widget);
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 658d65769..b3154fb25 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -48,11 +48,11 @@
#include "debug.h"
// Guichan stuff
-Gui *gui = 0;
-SDLInput *guiInput = 0;
+Gui *gui = nullptr;
+SDLInput *guiInput = nullptr;
// Bolded font
-gcn::Font *boldFont = 0;
+gcn::Font *boldFont = nullptr;
class GuiConfigListener : public ConfigListener
{
@@ -75,7 +75,7 @@ class GuiConfigListener : public ConfigListener
Gui::Gui(Graphics *graphics):
mCustomCursor(false),
- mMouseCursors(NULL),
+ mMouseCursors(nullptr),
mMouseCursorAlpha(1.0f),
mMouseInactivityTimer(0),
mCursorType(CURSOR_POINTER)
@@ -205,28 +205,28 @@ Gui::~Gui()
{
config.removeListener("customcursor", mConfigListener);
delete mConfigListener;
- mConfigListener = 0;
+ mConfigListener = nullptr;
if (mMouseCursors)
{
mMouseCursors->decRef();
- mMouseCursors = 0;
+ mMouseCursors = nullptr;
}
delete mGuiFont;
- mGuiFont = 0;
+ mGuiFont = nullptr;
delete boldFont;
- boldFont = 0;
+ boldFont = nullptr;
delete mHelpFont;
- mHelpFont = 0;
+ mHelpFont = nullptr;
delete mSecureFont;
- mSecureFont = 0;
+ mSecureFont = nullptr;
delete mInfoParticleFont;
- mInfoParticleFont = 0;
+ mInfoParticleFont = nullptr;
delete getTop();
delete guiInput;
- guiInput = 0;
+ guiInput = nullptr;
Theme::deleteInstance();
}
@@ -306,7 +306,7 @@ void Gui::setUseCustomCursor(bool customCursor)
if (mMouseCursors)
{
mMouseCursors->decRef();
- mMouseCursors = NULL;
+ mMouseCursors = nullptr;
}
}
}
@@ -357,13 +357,13 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
gcn::Widget* parent = source;
gcn::Widget* widget = source;
- if (!force && mFocusHandler->getModalFocused() != NULL
+ if (!force && mFocusHandler->getModalFocused() != nullptr
&& !widget->isModalFocused())
{
return;
}
- if (!force && mFocusHandler->getModalMouseInputFocused() != NULL
+ if (!force && mFocusHandler->getModalMouseInputFocused() != nullptr
&& !widget->isModalMouseInputFocused())
{
return;
@@ -373,7 +373,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
mAltPressed, mMetaPressed, type, button,
x, y, mClickCount);
- while (parent != NULL)
+ while (parent)
{
// If the widget has been removed due to input
// cancel the distribution.
@@ -443,7 +443,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
// If a non modal focused widget has been reach
// and we have modal focus cancel the distribution.
- if (mFocusHandler->getModalFocused() != NULL
+ if (mFocusHandler->getModalFocused()
&& !widget->isModalFocused())
{
break;
@@ -451,7 +451,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
// If a non modal mouse input focused widget has been reach
// and we have modal mouse input focus cancel the distribution.
- if (mFocusHandler->getModalMouseInputFocused() != NULL
+ if (mFocusHandler->getModalMouseInputFocused()
&& !widget->isModalMouseInputFocused())
{
break;
diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp
index 019baf503..49f309bca 100644
--- a/src/gui/helpwindow.cpp
+++ b/src/gui/helpwindow.cpp
@@ -40,7 +40,7 @@
#include "debug.h"
HelpWindow::HelpWindow():
- Window(_("Help"), false, 0, "help.xml")
+ Window(_("Help"), false, nullptr, "help.xml")
{
setMinWidth(300);
setMinHeight(250);
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index f52151698..8ffebebff 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -96,7 +96,7 @@ public:
InventoryWindow::WindowList InventoryWindow::instances;
InventoryWindow::InventoryWindow(Inventory *inventory):
- Window("Inventory", false, 0, "inventory.xml"),
+ Window("Inventory", false, nullptr, "inventory.xml"),
mInventory(inventory),
mDropButton(0),
mSplit(false),
@@ -238,7 +238,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory):
loadWindowState();
slotsChanged(mInventory);
- widgetResized(0);
+ widgetResized(nullptr);
if (!isMainInventory())
setVisible(true);
}
@@ -250,7 +250,7 @@ InventoryWindow::~InventoryWindow()
if (!instances.empty())
instances.front()->updateDropButton();
delete mSortModel;
- mSortModel = 0;
+ mSortModel = nullptr;
}
void InventoryWindow::action(const gcn::ActionEvent &event)
@@ -644,7 +644,7 @@ void InventoryWindow::updateDropButton()
}
else
{
- Item *item = 0;
+ Item *item = nullptr;
if (mItems)
item = mItems->getSelectedItem();
diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp
index 7c5b19415..a80434ac0 100644
--- a/src/gui/itemamountwindow.cpp
+++ b/src/gui/itemamountwindow.cpp
@@ -138,13 +138,13 @@ void ItemAmountWindow::finish(Item *item, int amount, int price, Usage usage)
ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
int maxRange):
Window("", true, parent, "amount.xml"),
- mItemPriceTextField(0),
- mGPLabel(0),
+ mItemPriceTextField(nullptr),
+ mGPLabel(nullptr),
mItem(item),
mMax(maxRange),
mUsage(usage),
- mItemPriceSlide(0),
- mItemsModal(0),
+ mItemPriceSlide(nullptr),
+ mItemsModal(nullptr),
mPrice(0)
{
if (!mItem)
@@ -293,7 +293,7 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
ItemAmountWindow::~ItemAmountWindow()
{
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
}
// Show ItemTooltip
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index b05d7fe28..2e87cd544 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -50,7 +50,7 @@
ItemPopup::ItemPopup():
Popup("ItemPopup", "itempopup.xml"),
- mIcon(0),
+ mIcon(nullptr),
mLastName(""),
mLastColor(1)
{
@@ -76,7 +76,7 @@ ItemPopup::ItemPopup():
mItemWeight->setEditable(false);
mItemWeight->setPosition(getPadding(), 3 * fontHeight + 4 * getPadding());
- mIcon = new Icon(0);
+ mIcon = new Icon(nullptr);
add(mItemName);
add(mItemDesc);
@@ -95,7 +95,7 @@ ItemPopup::~ItemPopup()
if (image)
{
image->decRef();
- image = 0;
+ image = nullptr;
}
}
}
@@ -164,7 +164,7 @@ void ItemPopup::setItem(const ItemInfo &item, unsigned char color,
}
else
{
- mIcon->setImage(0);
+ mIcon->setImage(nullptr);
}
mItemType = item.getType();
diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp
index 4bcab0a09..fa6241ef6 100644
--- a/src/gui/killstats.cpp
+++ b/src/gui/killstats.cpp
@@ -43,7 +43,7 @@
#include "debug.h"
KillStats::KillStats():
- Window(_("Kill stats"), false, 0, "killstats.xml"),
+ Window(_("Kill stats"), false, nullptr, "killstats.xml"),
mKillCounter(0), mExpCounter(0),
mKillTCounter(0), mExpTCounter(0), mKillTimer(0),
m1minExpTime(0), m1minExpNum(0), m1minSpeed(0),
diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp
index 136a01b37..86b3dc28b 100644
--- a/src/gui/logindialog.cpp
+++ b/src/gui/logindialog.cpp
@@ -83,7 +83,7 @@ public:
LoginDialog::LoginDialog(LoginData *data, std::string serverName,
std::string *updateHost):
- Window(_("Login"), false, 0, "login.xml"),
+ Window(_("Login"), false, nullptr, "login.xml"),
mLoginData(data),
mUpdateHost(updateHost),
mServerName(serverName)
@@ -166,7 +166,7 @@ LoginDialog::LoginDialog(LoginData *data, std::string serverName,
LoginDialog::~LoginDialog()
{
delete mUpdateTypeModel;
- mUpdateTypeModel = 0;
+ mUpdateTypeModel = nullptr;
}
void LoginDialog::action(const gcn::ActionEvent &event)
@@ -226,9 +226,9 @@ void LoginDialog::keyPressed(gcn::KeyEvent &keyEvent)
gcn::Key key = keyEvent.getKey();
if (key.getValue() == Key::ESCAPE)
- action(gcn::ActionEvent(NULL, mServerButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mServerButton->getActionEventId()));
else if (key.getValue() == Key::ENTER)
- action(gcn::ActionEvent(NULL, mLoginButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mLoginButton->getActionEventId()));
else
mLoginButton->setEnabled(canSubmit());
}
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index e42f12336..d890a462f 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -47,8 +47,8 @@
bool Minimap::mShow = true;
Minimap::Minimap():
- Window(_("Map"), false, 0, "map.xml"),
- mMapImage(0),
+ Window(_("Map"), false, nullptr, "map.xml"),
+ mMapImage(nullptr),
mWidthProportion(0.5),
mHeightProportion(0.5),
mCustomMapImage(false),
@@ -83,7 +83,7 @@ Minimap::~Minimap()
delete mMapImage;
else
mMapImage->decRef();
- mMapImage = 0;
+ mMapImage = nullptr;
}
}
@@ -107,7 +107,7 @@ void Minimap::setMap(Map *map)
delete mMapImage;
else
mMapImage->decRef();
- mMapImage = 0;
+ mMapImage = nullptr;
}
if (map)
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp
index d307dfed0..665d2b61b 100644
--- a/src/gui/ministatuswindow.cpp
+++ b/src/gui/ministatuswindow.cpp
@@ -67,7 +67,7 @@ MiniStatusWindow::MiniStatusWindow():
}
else
{
- mMpBar = 0;
+ mMpBar = nullptr;
}
int job = Net::getPlayerHandler()->getJobLocation()
@@ -85,7 +85,7 @@ MiniStatusWindow::MiniStatusWindow():
}
else
{
- mJobBar = 0;
+ mJobBar = nullptr;
}
mWeightBar = createBar(0, 140, 20, Theme::PROG_WEIGHT,
@@ -124,9 +124,9 @@ MiniStatusWindow::MiniStatusWindow():
MiniStatusWindow::~MiniStatusWindow()
{
delete mTextPopup;
- mTextPopup = 0;
+ mTextPopup = nullptr;
delete mStatusPopup;
- mStatusPopup = 0;
+ mStatusPopup = nullptr;
delete_all(mIcons);
mIcons.clear();
@@ -161,7 +161,7 @@ void MiniStatusWindow::updateBars()
{
int x = 0;
std::vector <ProgressBar*>::const_iterator it, it_end;
- ProgressBar* lastBar = 0;
+ ProgressBar* lastBar = nullptr;
for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it)
safeRemove(*it);
for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it)
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index b926d260e..66a30c8a7 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -55,14 +55,14 @@
NpcDialog::DialogList NpcDialog::instances;
-NpcDialog::NpcDialog(int npcId)
- : Window(_("NPC"), false, 0, "npc.xml"),
- mNpcId(npcId),
- mLogInteraction(config.getBoolValue("logNpcInGui")),
- mDefaultInt(0),
- mInputState(NPC_INPUT_NONE),
- mActionState(NPC_ACTION_WAIT),
- mLastNextTime(0)
+NpcDialog::NpcDialog(int npcId) :
+ Window(_("NPC"), false, nullptr, "npc.xml"),
+ mNpcId(npcId),
+ mLogInteraction(config.getBoolValue("logNpcInGui")),
+ mDefaultInt(0),
+ mInputState(NPC_INPUT_NONE),
+ mActionState(NPC_ACTION_WAIT),
+ mLastNextTime(0)
{
// Basic Window Setup
setWindowName("NpcText");
@@ -143,32 +143,32 @@ NpcDialog::~NpcDialog()
clearLayout();
delete mTextBox;
- mTextBox = 0;
+ mTextBox = nullptr;
delete mClearButton;
- mClearButton = 0;
+ mClearButton = nullptr;
delete mButton;
- mButton = 0;
+ mButton = nullptr;
// These might not actually be in the layout, so lets be safe
delete mScrollArea;
- mScrollArea = 0;
+ mScrollArea = nullptr;
delete mItemList;
- mItemList = 0;
+ mItemList = nullptr;
delete mTextField;
- mTextField = 0;
+ mTextField = nullptr;
delete mIntField;
- mIntField = 0;
+ mIntField = nullptr;
delete mResetButton;
- mResetButton = 0;
+ mResetButton = nullptr;
delete mPlusButton;
- mPlusButton = 0;
+ mPlusButton = nullptr;
delete mMinusButton;
- mMinusButton = 0;
+ mMinusButton = nullptr;
delete mItemLinkHandler;
- mItemLinkHandler = 0;
+ mItemLinkHandler = nullptr;
delete mListScrollArea;
- mListScrollArea = 0;
+ mListScrollArea = nullptr;
instances.remove(this);
}
@@ -432,7 +432,7 @@ NpcDialog *NpcDialog::getActive()
return (*it);
}
- return 0;
+ return nullptr;
}
void NpcDialog::closeAll()
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index 67fc57ba9..ada48e832 100644
--- a/src/gui/npcpostdialog.cpp
+++ b/src/gui/npcpostdialog.cpp
@@ -39,7 +39,7 @@
NpcPostDialog::DialogList NpcPostDialog::instances;
NpcPostDialog::NpcPostDialog(int npcId):
- Window(_("NPC"), false, 0, "npcpost.xml"),
+ Window(_("NPC"), false, nullptr, "npcpost.xml"),
mNpcId(npcId)
{
setContentSize(400, 180);
diff --git a/src/gui/okdialog.h b/src/gui/okdialog.h
index 2ee8653ec..2f32d0d65 100644
--- a/src/gui/okdialog.h
+++ b/src/gui/okdialog.h
@@ -23,6 +23,8 @@
#ifndef OK_DIALOG_H
#define OK_DIALOG_H
+#include "localconsts.h"
+
#include "gui/widgets/window.h"
#include <guichan/actionlistener.hpp>
@@ -44,7 +46,7 @@ class OkDialog : public Window, public gcn::ActionListener
*/
OkDialog(const std::string &title, const std::string &msg,
bool modal = true, bool showCenter = true,
- Window *parent = NULL);
+ Window *parent = nullptr);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 8e0791af1..c33c753bc 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -57,13 +57,13 @@
float OutfitWindow::mAlpha = 1.0;
OutfitWindow::OutfitWindow():
- Window(_("Outfits"), false, 0, "outfits.xml"),
+ Window(_("Outfits"), false, nullptr, "outfits.xml"),
mBoxWidth(33),
mBoxHeight(33),
mGridWidth(4),
mGridHeight(3),
mItemClicked(false),
- mItemMoved(NULL),
+ mItemMoved(nullptr),
mItemSelected(-1),
mItemColorSelected(1),
mCurrentOutfit(0),
@@ -383,7 +383,7 @@ void OutfitWindow::mouseDragged(gcn::MouseEvent &event)
if (item)
mItemMoved = item;
else
- mItemMoved = 0;
+ mItemMoved = nullptr;
mItems[mCurrentOutfit][index] = -1;
}
}
@@ -433,7 +433,7 @@ void OutfitWindow::mouseReleased(gcn::MouseEvent &event)
const int index = getIndexFromGrid(event.getX(), event.getY());
if (index == -1)
{
- mItemMoved = NULL;
+ mItemMoved = nullptr;
Window::mouseReleased(event);
return;
}
@@ -443,7 +443,7 @@ void OutfitWindow::mouseReleased(gcn::MouseEvent &event)
{
mItems[mCurrentOutfit][index] = mItemMoved->getId();
mItemColors[mCurrentOutfit][index] = mItemMoved->getColor();
- mItemMoved = NULL;
+ mItemMoved = nullptr;
}
if (mItemClicked)
mItemClicked = false;
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index a457573ce..b133f66fc 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -85,15 +85,15 @@ std::string tradePartnerName("");
PopupMenu::PopupMenu():
Popup("PopupMenu", "popupmenu.xml"),
mBeingId(0),
- mFloorItem(0),
- mItem(0),
+ mFloorItem(nullptr),
+ mItem(nullptr),
mItemId(0),
mItemColor(1),
- mMapItem(0),
- mTab(0),
- mSpell(0),
- mDialog(0),
- mButton(0),
+ mMapItem(nullptr),
+ mTab(nullptr),
+ mSpell(nullptr),
+ mDialog(nullptr),
+ mButton(nullptr),
mNick(""),
mType(Being::UNKNOWN)
{
@@ -102,10 +102,10 @@ PopupMenu::PopupMenu():
mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND);
mBrowserBox->setOpaque(false);
mBrowserBox->setLinkHandler(this);
- mRenameListener.setMapItem(0);
- mRenameListener.setDialog(0);
+ mRenameListener.setMapItem(nullptr);
+ mRenameListener.setDialog(nullptr);
mPlayerListener.setNick("");
- mPlayerListener.setDialog(0);
+ mPlayerListener.setDialog(nullptr);
mPlayerListener.setType(Being::UNKNOWN);
add(mBrowserBox);
@@ -833,9 +833,9 @@ void PopupMenu::showChangePos(int x, int y)
else
{
mBeingId = 0;
- mFloorItem = 0;
- mItem = 0;
- mMapItem = 0;
+ mFloorItem = nullptr;
+ mItem = nullptr;
+ mMapItem = nullptr;
mNick = "";
mType = Being::UNKNOWN;
setVisible(false);
@@ -1683,11 +1683,11 @@ void PopupMenu::handleLink(const std::string &link,
setVisible(false);
mBeingId = 0;
- mFloorItem = 0;
- mItem = 0;
+ mFloorItem = nullptr;
+ mItem = nullptr;
mItemId = 0;
mItemColor = 1;
- mMapItem = 0;
+ mMapItem = nullptr;
mNick = "";
mType = Being::UNKNOWN;
}
@@ -1790,7 +1790,7 @@ void PopupMenu::showItemPopup(int x, int y, int itemId, unsigned char color)
}
else
{
- mItem = 0;
+ mItem = nullptr;
mItemId = itemId;
mItemColor = color;
mBrowserBox->clearRows();
@@ -2066,8 +2066,8 @@ void PopupMenu::showPopup(int x, int y)
}
RenameListener::RenameListener() :
- mMapItem(0),
- mDialog(0)
+ mMapItem(nullptr),
+ mDialog(nullptr)
{
}
@@ -2080,7 +2080,7 @@ void RenameListener::action(const gcn::ActionEvent &event)
return;
SpecialLayer *sl = map->getSpecialLayer();
- MapItem *item = 0;
+ MapItem *item = nullptr;
if (sl)
{
item = sl->getTile(mMapItem->getX(), mMapItem->getY());
@@ -2099,12 +2099,12 @@ void RenameListener::action(const gcn::ActionEvent &event)
if (socialWindow)
socialWindow->updatePortalNames();
}
- mDialog = 0;
+ mDialog = nullptr;
}
PlayerListener::PlayerListener() :
mNick(""),
- mDialog(0),
+ mDialog(nullptr),
mType(Being::UNKNOWN)
{
}
@@ -2120,5 +2120,5 @@ void PlayerListener::action(const gcn::ActionEvent &event)
being->setComment(comment);
Being::saveComment(mNick, comment, mType);
}
- mDialog = 0;
+ mDialog = nullptr;
}
diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp
index 1307e198f..0f4d7f6f7 100644
--- a/src/gui/quitdialog.cpp
+++ b/src/gui/quitdialog.cpp
@@ -44,7 +44,7 @@
#include "debug.h"
QuitDialog::QuitDialog(QuitDialog** pointerToMe):
- Window(_("Quit"), true, 0, "quit.xml"),
+ Window(_("Quit"), true, nullptr, "quit.xml"),
mMyPointer(pointerToMe)
{
mForceQuit = new RadioButton(_("Quit"), "quitdialog");
@@ -98,16 +98,16 @@ QuitDialog::QuitDialog(QuitDialog** pointerToMe):
QuitDialog::~QuitDialog()
{
if (mMyPointer)
- *mMyPointer = 0;
+ *mMyPointer = nullptr;
// Optional widgets, so delete them by hand.
delete mForceQuit;
- mForceQuit = 0;
+ mForceQuit = nullptr;
delete mLogoutQuit;
- mLogoutQuit = 0;
+ mLogoutQuit = nullptr;
delete mSwitchAccountServer;
- mSwitchAccountServer = 0;
+ mSwitchAccountServer = nullptr;
delete mSwitchCharacter;
- mSwitchCharacter = 0;
+ mSwitchCharacter = nullptr;
}
void QuitDialog::placeOption(ContainerPlacer &placer, gcn::RadioButton *option)
@@ -162,10 +162,10 @@ void QuitDialog::keyPressed(gcn::KeyEvent &keyEvent)
switch (key.getValue())
{
case Key::ENTER:
- action(gcn::ActionEvent(NULL, mOkButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mOkButton->getActionEventId()));
break;
case Key::ESCAPE:
- action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId()));
break;
case Key::UP:
dir = -1;
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 062275b80..29030aa72 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -47,7 +47,7 @@
#include "debug.h"
WrongDataNoticeListener::WrongDataNoticeListener():
- mTarget(0)
+ mTarget(nullptr)
{
}
@@ -63,10 +63,10 @@ void WrongDataNoticeListener::action(const gcn::ActionEvent &event)
}
RegisterDialog::RegisterDialog(LoginData *data):
- Window(_("Register"), false, 0, "register.xml"),
- mEmailField(0),
- mMaleButton(0),
- mFemaleButton(0),
+ Window(_("Register"), false, nullptr, "register.xml"),
+ mEmailField(nullptr),
+ mMaleButton(nullptr),
+ mFemaleButton(nullptr),
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
@@ -147,7 +147,7 @@ RegisterDialog::RegisterDialog(LoginData *data):
RegisterDialog::~RegisterDialog()
{
delete mWrongDataNoticeListener;
- mWrongDataNoticeListener = 0;
+ mWrongDataNoticeListener = nullptr;
}
void RegisterDialog::action(const gcn::ActionEvent &event)
diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp
index b196ae4e4..001a8671a 100644
--- a/src/gui/sdlfont.cpp
+++ b/src/gui/sdlfont.cpp
@@ -49,14 +49,14 @@ class SDLTextChunk
{
public:
SDLTextChunk(const std::string &text0, const gcn::Color &color0) :
- img(0), text(text0), color(color0)
+ img(nullptr), text(text0), color(color0)
{
}
~SDLTextChunk()
{
delete img;
- img = 0;
+ img = nullptr;
}
bool operator==(const SDLTextChunk &chunk) const
@@ -79,7 +79,7 @@ class SDLTextChunk
if (!surface)
{
- img = 0;
+ img = nullptr;
return;
}
@@ -138,7 +138,7 @@ SDLFont::SDLFont(const std::string &filename, int size, int style) :
SDLFont::~SDLFont()
{
TTF_CloseFont(mFont);
- mFont = 0;
+ mFont = nullptr;
--fontCounter;
if (fontCounter == 0)
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index bbd0a71c1..e1a77f6c9 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -50,14 +50,14 @@
SellDialog::DialogList SellDialog::instances;
SellDialog::SellDialog(int npcId):
- Window(_("Sell"), false, 0, "sell.xml"),
+ Window(_("Sell"), false, nullptr, "sell.xml"),
mNpcId(npcId), mMaxItems(0), mAmountItems(0), mNick("")
{
init();
}
SellDialog::SellDialog(std::string nick):
- Window(_("Sell"), false, 0, "sell.xml"),
+ Window(_("Sell"), false, nullptr, "sell.xml"),
mNpcId(-1), mMaxItems(0), mAmountItems(0), mNick(nick)
{
init();
@@ -133,7 +133,7 @@ void SellDialog::init()
SellDialog::~SellDialog()
{
delete mShopItems;
- mShopItems = 0;
+ mShopItems = nullptr;
instances.remove(this);
}
@@ -290,7 +290,7 @@ void SellDialog::updateButtonsAndLabels()
{
int selectedItem = mShopItemList->getSelected();
int income = 0;
- ShopItem *item = 0;
+ ShopItem *item = nullptr;
if (selectedItem > -1 && mShopItems->at(selectedItem))
{
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 5a00d4a76..3fd298159 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -234,15 +234,15 @@ private:
ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
- Window(_("Choose Your Server"), false, 0, "server.xml"),
+ Window(_("Choose Your Server"), false, nullptr, "server.xml"),
mDir(dir),
// mDownloadStatus(DOWNLOADING_PREPARING),
mDownloadStatus(DOWNLOADING_UNKNOWN),
- mDownload(0),
+ mDownload(nullptr),
mDownloadProgress(-1.0f),
mServers(ServerInfos()),
mServerInfo(serverInfo),
- mPersistentIPCheckBox(0)
+ mPersistentIPCheckBox(nullptr)
{
if (isSafeMode)
setCaption(_("Choose Your Server *** SAFE MODE ***"));
@@ -377,12 +377,12 @@ ServerDialog::~ServerDialog()
{
mDownload->cancel();
delete mDownload;
- mDownload = 0;
+ mDownload = nullptr;
}
delete mServersListModel;
- mServersListModel = 0;
+ mServersListModel = nullptr;
delete mTypeListModel;
- mTypeListModel = 0;
+ mTypeListModel = nullptr;
}
void ServerDialog::action(const gcn::ActionEvent &event)
@@ -489,7 +489,7 @@ void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent)
if (key.getValue() == Key::ESCAPE)
Client::setState(STATE_EXIT);
else if (key.getValue() == Key::ENTER)
- action(gcn::ActionEvent(NULL, mConnectButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mConnectButton->getActionEventId()));
}
void ServerDialog::valueChanged(const gcn::SelectionEvent &)
@@ -617,7 +617,7 @@ void ServerDialog::downloadServerList()
{
mDownload->cancel();
delete mDownload;
- mDownload = 0;
+ mDownload = nullptr;
}
mDownload = new Net::Download(this, listFile, &downloadUpdate);
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index ae7a3109c..d305824d5 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -51,7 +51,7 @@
extern Window *statusWindow;
Setup::Setup():
- Window(_("Setup"), false, 0, "setup.xml")
+ Window(_("Setup"), false, nullptr, "setup.xml")
{
setCloseButton(true);
setResizable(true);
@@ -72,7 +72,7 @@ Setup::Setup():
N_("Cancel"),
N_("Store"),
N_("Reset Windows"),
- 0
+ nullptr
};
int x = width;
for (const char **curBtn = buttonNames; *curBtn; ++curBtn)
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 7c0306f8f..6f1a4afce 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -65,7 +65,7 @@ Setup_Colors::Setup_Colors() :
mPreview->setOpaque(false);
// don't do anything with links
- mPreview->setLinkHandler(NULL);
+ mPreview->setLinkHandler(nullptr);
mPreviewBox = new ScrollArea(mPreview);
mPreviewBox->setHeight(20);
@@ -188,12 +188,12 @@ Setup_Colors::~Setup_Colors()
if (mPreviewBox && mPreviewBox->getContent() == mPreview)
{
delete mTextPreview;
- mTextPreview = 0;
+ mTextPreview = nullptr;
}
else
{
delete mPreview;
- mPreview = 0;
+ mPreview = nullptr;
}
}
@@ -251,7 +251,7 @@ void Setup_Colors::valueChanged(const gcn::SelectionEvent &event A_UNUSED)
mPreviewBox->setContent(mTextPreview);
mTextPreview->setFont(boldFont);
mTextPreview->setTextColor(col);
- mTextPreview->setTextBGColor(NULL);
+ mTextPreview->setTextBGColor(nullptr);
mTextPreview->setOpaque(false);
mTextPreview->setShadow(true);
mTextPreview->setOutline(true);
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 922d9797b..fa7a63b8c 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -112,16 +112,16 @@ Setup_Keyboard::Setup_Keyboard():
Setup_Keyboard::~Setup_Keyboard()
{
delete mKeyList;
- mKeyList = 0;
+ mKeyList = nullptr;
delete mKeyListModel;
- mKeyListModel = 0;
+ mKeyListModel = nullptr;
delete mAssignKeyButton;
- mAssignKeyButton = 0;
+ mAssignKeyButton = nullptr;
delete mUnassignKeyButton;
- mUnassignKeyButton = 0;
+ mUnassignKeyButton = nullptr;
delete mMakeDefaultButton;
- mMakeDefaultButton = 0;
+ mMakeDefaultButton = nullptr;
}
void Setup_Keyboard::apply()
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index 73fd34e27..1921ee267 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -98,7 +98,7 @@ class PlayerTableModel : public TableModel
{
public:
PlayerTableModel() :
- mPlayers(NULL),
+ mPlayers(nullptr),
mListModel(new PlayerRelationListModel)
{
playerRelationsUpdated();
diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp
index 04d4c5412..3b1c1d932 100644
--- a/src/gui/setup_theme.cpp
+++ b/src/gui/setup_theme.cpp
@@ -155,7 +155,7 @@ const Language LANG_NAME[langs_count] =
{N_("Portuguese"), "pt_PT"},
{N_("Portuguese (Brazilian)"), "pt_BR"},
{N_("Russian"), "ru_RU"},
- {N_("Spanish (Castilian)"), "es_ES"},
+ {N_("Spanish (Castilian)"), "es_ES"}
};
class LangListModel : public gcn::ListModel
@@ -302,16 +302,16 @@ Setup_Theme::Setup_Theme():
Setup_Theme::~Setup_Theme()
{
delete mThemesModel;
- mThemesModel = 0;
+ mThemesModel = nullptr;
delete mFontsModel;
- mFontsModel = 0;
+ mFontsModel = nullptr;
delete mFontSizeListModel;
- mFontSizeListModel = 0;
+ mFontSizeListModel = nullptr;
delete mLangListModel;
- mLangListModel = 0;
+ mLangListModel = nullptr;
}
void Setup_Theme::action(const gcn::ActionEvent &event)
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index d3c1163dc..ea181ea14 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -130,7 +130,7 @@ bool modeSorter(std::string mode1, std::string mode2)
ModeListModel::ModeListModel()
{
/* Get available fullscreen/hardware modes */
- SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE);
+ SDL_Rect **modes = SDL_ListModes(nullptr, SDL_FULLSCREEN | SDL_HWSURFACE);
/* Check which modes are available */
if (modes == static_cast<SDL_Rect **>(0))
diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp
index 6d48da197..eff28def7 100644
--- a/src/gui/shortcutwindow.cpp
+++ b/src/gui/shortcutwindow.cpp
@@ -54,7 +54,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title,
ShortcutContainer *content,
std::string skinFile,
int width, int height) :
- Window("Window", false, 0, skinFile)
+ Window("Window", false, nullptr, skinFile)
{
setWindowName(title);
// no title presented, title bar is padding so window can be moved.
@@ -66,7 +66,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title,
setupWindow->registerWindowForReset(this);
- mTabs = 0;
+ mTabs = nullptr;
mItems = content;
const int border = SCROLL_PADDING * 2 + getPadding() * 2;
@@ -100,7 +100,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title,
ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile,
int width, int height) :
- Window("Window", false, 0, skinFile)
+ Window("Window", false, nullptr, skinFile)
{
setWindowName(title);
// no title presented, title bar is padding so window can be moved.
@@ -114,7 +114,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile,
mTabs = new TabbedArea;
- mItems = 0;
+ mItems = nullptr;
const int border = SCROLL_PADDING * 2 + getPadding() * 2;
@@ -138,9 +138,9 @@ ShortcutWindow::~ShortcutWindow()
if (mTabs)
mTabs->removeAll();
delete mTabs;
- mTabs = 0;
+ mTabs = nullptr;
delete mItems;
- mItems = 0;
+ mItems = nullptr;
}
void ShortcutWindow::addTab(std::string name, ShortcutContainer *content)
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index a728d4051..6b07e109f 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -79,14 +79,14 @@ protected:
{
mInviteDialog->close();
mInviteDialog->scheduleDelete();
- mInviteDialog = NULL;
+ mInviteDialog = nullptr;
}
if (mConfirmDialog)
{
mConfirmDialog->close();
mConfirmDialog->scheduleDelete();
- mConfirmDialog = NULL;
+ mConfirmDialog = nullptr;
}
}
@@ -347,11 +347,11 @@ public:
localChatTab->chatLog(strprintf(_("Invited user %s to party."),
name.c_str()), BY_SERVER);
}
- mInviteDialog = NULL;
+ mInviteDialog = nullptr;
}
else if (event.getId() == "~do invite")
{
- mInviteDialog = NULL;
+ mInviteDialog = nullptr;
}
else if (event.getId() == "yes")
{
@@ -361,11 +361,11 @@ public:
localChatTab->chatLog(strprintf(_("Party %s quit requested."),
mParty->getName().c_str()), BY_SERVER);
}
- mConfirmDialog = NULL;
+ mConfirmDialog = nullptr;
}
else if (event.getId() == "~yes")
{
- mConfirmDialog = NULL;
+ mConfirmDialog = nullptr;
}
}
@@ -1146,7 +1146,7 @@ SocialWindow::SocialWindow() :
place(2, 0, mLeaveButton);
place(0, 1, mTabs, 4, 4);
- widgetResized(NULL);
+ widgetResized(nullptr);
mCreatePopup = new CreatePopup();
@@ -1184,7 +1184,7 @@ SocialWindow::~SocialWindow()
{
mGuildAcceptDialog->close();
mGuildAcceptDialog->scheduleDelete();
- mGuildAcceptDialog = NULL;
+ mGuildAcceptDialog = nullptr;
mGuildInvited = 0;
}
@@ -1193,7 +1193,7 @@ SocialWindow::~SocialWindow()
{
mPartyAcceptDialog->close();
mPartyAcceptDialog->scheduleDelete();
- mPartyAcceptDialog = NULL;
+ mPartyAcceptDialog = nullptr;
mPartyInviter = "";
}
@@ -1300,7 +1300,7 @@ void SocialWindow::action(const gcn::ActionEvent &event)
}
mPartyInviter = "";
- mPartyAcceptDialog = NULL;
+ mPartyAcceptDialog = nullptr;
}
else if (event.getSource() == mGuildAcceptDialog)
{
@@ -1333,7 +1333,7 @@ void SocialWindow::action(const gcn::ActionEvent &event)
}
mGuildInvited = 0;
- mGuildAcceptDialog = NULL;
+ mGuildAcceptDialog = nullptr;
}
else if (event.getId() == "create")
{
@@ -1374,11 +1374,11 @@ void SocialWindow::action(const gcn::ActionEvent &event)
name.c_str()), BY_SERVER);
}
- mGuildCreateDialog = NULL;
+ mGuildCreateDialog = nullptr;
}
else if (event.getId() == "~create guild")
{
- mGuildCreateDialog = NULL;
+ mGuildCreateDialog = nullptr;
}
else if (event.getId() == "create party")
{
@@ -1397,11 +1397,11 @@ void SocialWindow::action(const gcn::ActionEvent &event)
name.c_str()), BY_SERVER);
}
- mPartyCreateDialog = NULL;
+ mPartyCreateDialog = nullptr;
}
else if (event.getId() == "~create party")
{
- mPartyCreateDialog = NULL;
+ mPartyCreateDialog = nullptr;
}
}
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index c464b83b5..a52b30c62 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -194,10 +194,10 @@ void SpecialsWindow::rebuild(const std::map<int, Special> &specialData)
SpecialEntry::SpecialEntry(SpecialInfo *info) :
mInfo(info),
- mIcon(NULL),
- mLevelLabel(NULL),
- mUse(NULL),
- mRechargeBar(NULL)
+ mIcon(nullptr),
+ mLevelLabel(nullptr),
+ mUse(nullptr),
+ mRechargeBar(nullptr)
{
setFrameSize(1);
setOpaque(false);
diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp
index 6512f8465..7d97549f3 100644
--- a/src/gui/textcommandeditor.cpp
+++ b/src/gui/textcommandeditor.cpp
@@ -165,7 +165,7 @@ public:
TextCommandEditor::TextCommandEditor(TextCommand *command):
- Window(_("Command Editor"), false, 0, "commandeditor.xml")
+ Window(_("Command Editor"), false, nullptr, "commandeditor.xml")
{
int w = 350;
int h = 370;
@@ -302,11 +302,11 @@ TextCommandEditor::TextCommandEditor(TextCommand *command):
TextCommandEditor::~TextCommandEditor()
{
delete mIconsModal;
- mIconsModal = 0;
+ mIconsModal = nullptr;
delete mTargetTypeModel;
- mTargetTypeModel = 0;
+ mTargetTypeModel = nullptr;
delete mMagicSchoolModel;
- mMagicSchoolModel = 0;
+ mMagicSchoolModel = nullptr;
}
void TextCommandEditor::action(const gcn::ActionEvent &event)
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index 2efe82199..b605d30df 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -147,8 +147,8 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
mDownloadComplete(true),
mUserCancel(false),
mDownloadedBytes(0),
- mMemoryBuffer(NULL),
- mDownload(NULL),
+ mMemoryBuffer(nullptr),
+ mDownload(nullptr),
mUpdateIndex(0),
mUpdateIndexOffset(0),
mLoadUpdates(applyUpdates),
@@ -256,7 +256,7 @@ void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent)
if (key.getValue() == Key::ESCAPE)
{
- action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId()));
Client::setState(STATE_WORLD_SELECT);
}
else if (key.getValue() == Key::ENTER)
@@ -264,11 +264,11 @@ void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent)
if (mDownloadStatus == UPDATE_COMPLETE ||
mDownloadStatus == UPDATE_ERROR)
{
- action(gcn::ActionEvent(NULL, mPlayButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mPlayButton->getActionEventId()));
}
else
{
- action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId()));
}
}
}
@@ -294,12 +294,12 @@ void UpdaterWindow::loadNews()
while (line)
{
mBrowserBox->addRow(line);
- line = strtok(NULL, "\n");
+ line = strtok(nullptr, "\n");
}
// Free the memory buffer now that we don't need it anymore
free(mMemoryBuffer);
- mMemoryBuffer = NULL;
+ mMemoryBuffer = nullptr;
mDownloadedBytes = 0;
mScrollArea->setVerticalScrollAmount(0);
@@ -340,7 +340,7 @@ void UpdaterWindow::loadPatch()
// Free the memory buffer now that we don't need it anymore
free(mMemoryBuffer);
- mMemoryBuffer = NULL;
+ mMemoryBuffer = nullptr;
mDownloadedBytes = 0;
mScrollArea->setVerticalScrollAmount(0);
@@ -365,7 +365,7 @@ int UpdaterWindow::updateProgress(void *ptr, DownloadStatus status,
uw->mDownloadStatus = UPDATE_COMPLETE;
uw->mDownloadComplete = true;
free(uw->mMemoryBuffer);
- uw->mMemoryBuffer = NULL;
+ uw->mMemoryBuffer = nullptr;
}
else
{
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 97a467add..13c0a8cc0 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -298,8 +298,8 @@ void Viewport::_followMouse()
if (mPlayerFollowMouse && button & SDL_BUTTON(1))
{
// We create a mouse event and send it to mouseDragged.
- Uint8 *keys = SDL_GetKeyState(NULL);
- gcn::MouseEvent mouseEvent(NULL,
+ Uint8 *keys = SDL_GetKeyState(nullptr);
+ gcn::MouseEvent mouseEvent(nullptr,
(keys[SDLK_LSHIFT] || keys[SDLK_RSHIFT]),
false,
false,
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index 3fb63a105..b6d67fa83 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -83,11 +83,11 @@ class NameFunctuator
WhoIsOnline::WhoIsOnline():
Window(_("Who Is Online - Updating"), false, 0, "whoisonline.xml"),
- mThread(NULL),
+ mThread(nullptr),
mDownloadStatus(UPDATE_LIST),
mDownloadComplete(true),
mDownloadedBytes(0),
- mMemoryBuffer(NULL),
+ mMemoryBuffer(nullptr),
mCurlError(new char[CURL_ERROR_SIZE]),
mAllowUpdate(true),
mShowLevel(false)
@@ -137,7 +137,7 @@ WhoIsOnline::~WhoIsOnline()
config.removeListener("updateOnlineList", this);
if (mThread && SDL_GetThreadID(mThread))
- SDL_WaitThread(mThread, NULL);
+ SDL_WaitThread(mThread, nullptr);
free(mMemoryBuffer);
mMemoryBuffer = 0;
@@ -206,7 +206,7 @@ void WhoIsOnline::loadList()
mShowLevel = config.getBoolValue("showlevel");
- while (line != NULL)
+ while (line)
{
std::string nick;
lineStr = line;
@@ -295,7 +295,7 @@ void WhoIsOnline::loadList()
{
listStarted = true;
}
- line = strtok(NULL, "\n");
+ line = strtok(nullptr, "\n");
}
//Set window caption
@@ -448,12 +448,12 @@ void WhoIsOnline::download()
{
mDownloadComplete = true;
if (mThread && SDL_GetThreadID(mThread))
- SDL_WaitThread(mThread, NULL);
+ SDL_WaitThread(mThread, nullptr);
mDownloadComplete = false;
mThread = SDL_CreateThread(WhoIsOnline::downloadThread, this);
- if (mThread == NULL)
+ if (mThread == nullptr)
mDownloadStatus = UPDATE_ERROR;
}
@@ -525,8 +525,8 @@ void WhoIsOnline::action(const gcn::ActionEvent &event)
setCaption(_("Who Is Online - Update"));
if (mThread && SDL_GetThreadID(mThread))
{
- SDL_WaitThread(mThread, NULL);
- mThread = NULL;
+ SDL_WaitThread(mThread, nullptr);
+ mThread = nullptr;
}
mDownloadComplete = true;
}
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 18dc48417..8264f0fb9 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -43,8 +43,8 @@
#include "debug.h"
int AvatarListBox::instances = 0;
-Image *AvatarListBox::onlineIcon = 0;
-Image *AvatarListBox::offlineIcon = 0;
+Image *AvatarListBox::onlineIcon = nullptr;
+Image *AvatarListBox::offlineIcon = nullptr;
AvatarListBox::AvatarListBox(AvatarListModel *model):
ListBox(model),
@@ -83,12 +83,12 @@ AvatarListBox::~AvatarListBox()
if (onlineIcon)
{
onlineIcon->decRef();
- onlineIcon = 0;
+ onlineIcon = nullptr;
}
if (offlineIcon)
{
offlineIcon->decRef();
- offlineIcon = 0;
+ offlineIcon = nullptr;
}
}
}
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 5b862d16c..5ded29c55 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -49,8 +49,9 @@
BrowserBox::BrowserBox(unsigned int mode, bool opaque):
gcn::Widget(),
- mLinkHandler(0),
- mMode(mode), mHighMode(UNDERLINE | BACKGROUND),
+ mLinkHandler(nullptr),
+ mMode(mode),
+ mHighMode(UNDERLINE | BACKGROUND),
mOpaque(opaque),
mUseLinksAndUserColors(true),
mSelectedLink(-1),
@@ -648,5 +649,5 @@ LinePart::~LinePart()
{
if (mImage)
mImage->decRef();
- mImage = 0;
+ mImage = nullptr;
}
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index cf2f9c1f1..06609b318 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -30,6 +30,8 @@
#include <list>
#include <vector>
+#include "localconsts.h"
+
class Image;
class Resource;
class LinkHandler;
@@ -46,7 +48,7 @@ class LinePart
public:
LinePart(int x, int y, gcn::Color color, std::string text, bool bold) :
mX(x), mY(y), mColor(color), mText(text), mType(0),
- mImage(0), mBold(bold)
+ mImage(nullptr), mBold(bold)
{
}
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 7c46ae9df..85e4eca17 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -146,7 +146,7 @@ Button::~Button()
mInstances--;
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
if (mInstances == 0)
{
for (int mode = 0; mode < BUTTON_COUNT; mode++)
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 9a29ae204..0a224605a 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -82,9 +82,9 @@ ChatTab::~ChatTab()
chatWindow->removeTab(this);
delete mTextOutput;
- mTextOutput = 0;
+ mTextOutput = nullptr;
delete mScrollArea;
- mScrollArea = 0;
+ mScrollArea = nullptr;
}
void ChatTab::chatLog(std::string line, Own own,
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 65d26e196..dcedc8951 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -70,12 +70,12 @@ CheckBox::CheckBox(const std::string &caption, bool selected,
}
else
{
- checkBoxNormal = 0;
- checkBoxChecked = 0;
- checkBoxDisabled = 0;
- checkBoxDisabledChecked = 0;
- checkBoxNormalHi = 0;
- checkBoxCheckedHi = 0;
+ checkBoxNormal = nullptr;
+ checkBoxChecked = nullptr;
+ checkBoxDisabled = nullptr;
+ checkBoxDisabledChecked = nullptr;
+ checkBoxNormalHi = nullptr;
+ checkBoxCheckedHi = nullptr;
}
}
@@ -97,17 +97,17 @@ CheckBox::~CheckBox()
if (instances == 0)
{
delete checkBoxNormal;
- checkBoxNormal = 0;
+ checkBoxNormal = nullptr;
delete checkBoxChecked;
- checkBoxChecked = 0;
+ checkBoxChecked = nullptr;
delete checkBoxDisabled;
- checkBoxDisabled = 0;
+ checkBoxDisabled = nullptr;
delete checkBoxDisabledChecked;
- checkBoxDisabledChecked = 0;
+ checkBoxDisabledChecked = nullptr;
delete checkBoxNormalHi;
- checkBoxNormalHi = 0;
+ checkBoxNormalHi = nullptr;
delete checkBoxCheckedHi;
- checkBoxCheckedHi = 0;
+ checkBoxCheckedHi = nullptr;
}
}
diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h
index a16ab242c..4e293aad6 100644
--- a/src/gui/widgets/checkbox.h
+++ b/src/gui/widgets/checkbox.h
@@ -25,6 +25,8 @@
#include <guichan/widgets/checkbox.hpp>
+#include "localconsts.h"
+
#ifdef __GNUC__
#define A_UNUSED __attribute__ ((unused))
#else
@@ -45,7 +47,7 @@ class CheckBox : public gcn::CheckBox
* Constructor.
*/
CheckBox(const std::string &caption, bool selected = false,
- gcn::ActionListener* listener = NULL,
+ gcn::ActionListener* listener = nullptr,
std::string eventId = "");
/**
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 46240f76d..beb232fb2 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -39,7 +39,7 @@
#include "debug.h"
Desktop::Desktop() :
- mWallpaper(0)
+ mWallpaper(nullptr)
{
addWidgetListener(this);
@@ -66,7 +66,7 @@ Desktop::~Desktop()
if (mWallpaper)
{
mWallpaper->decRef();
- mWallpaper = 0;
+ mWallpaper = nullptr;
}
}
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 687d7dc6d..2a17320de 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -133,7 +133,7 @@ DropDown::~DropDown()
}
delete mScrollArea;
- mScrollArea = 0;
+ mScrollArea = nullptr;
}
void DropDown::updateAlpha()
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index 4cbd23314..3559b634a 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -25,6 +25,8 @@
#include <guichan/widgets/dropdown.hpp>
+#include "localconsts.h"
+
class Image;
class ImageRect;
@@ -47,7 +49,7 @@ class DropDown : public gcn::DropDown
* @see ListModel, ScrollArea, ListBox.
*/
DropDown(gcn::ListModel *listModel = 0,
- gcn::ActionListener* listener = NULL,
+ gcn::ActionListener* listener = nullptr,
std::string eventId = "");
~DropDown();
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index 1fa272448..8335a61bc 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -49,7 +49,7 @@
DropShortcutContainer::DropShortcutContainer():
ShortcutContainer(),
mItemClicked(false),
- mItemMoved(NULL)
+ mItemMoved(nullptr)
{
addMouseListener(this);
addWidgetListener(this);
@@ -82,10 +82,10 @@ DropShortcutContainer::~DropShortcutContainer()
if (mBackgroundImg)
{
mBackgroundImg->decRef();
- mBackgroundImg = 0;
+ mBackgroundImg = nullptr;
}
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
}
void DropShortcutContainer::draw(gcn::Graphics *graphics)
@@ -254,14 +254,14 @@ void DropShortcutContainer::mouseReleased(gcn::MouseEvent &event)
const int index = getIndexFromGrid(event.getX(), event.getY());
if (index == -1)
{
- mItemMoved = NULL;
+ mItemMoved = nullptr;
return;
}
if (mItemMoved)
{
dropShortcut->setItems(index, mItemMoved->getId(),
mItemMoved->getColor());
- mItemMoved = NULL;
+ mItemMoved = nullptr;
}
if (mItemClicked)
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index cc9e8badf..e8d7bb7e3 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -90,7 +90,7 @@ EmoteShortcutContainer::~EmoteShortcutContainer()
if (mBackgroundImg)
{
mBackgroundImg->decRef();
- mBackgroundImg = 0;
+ mBackgroundImg = nullptr;
}
}
diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp
index 0a64a7142..7d3ddc0b4 100644
--- a/src/gui/widgets/flowcontainer.cpp
+++ b/src/gui/widgets/flowcontainer.cpp
@@ -87,5 +87,5 @@ void FlowContainer::add(gcn::Widget *widget)
Container::add(widget);
widget->setSize(mBoxWidth, mBoxHeight);
- widgetResized(NULL);
+ widgetResized(nullptr);
}
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index e02eda88c..78ce14e56 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -76,7 +76,7 @@ GuiTableActionListener::~GuiTableActionListener()
if (mWidget)
{
mWidget->removeActionListener(this);
- mWidget->_setParent(NULL);
+ mWidget->_setParent(nullptr);
}
}
@@ -92,10 +92,10 @@ GuiTable::GuiTable(TableModel *initial_model, bool opacity) :
mLinewiseMode(false),
mWrappingEnabled(false),
mOpaque(opacity),
- mModel(NULL),
+ mModel(nullptr),
mSelectedRow(0),
mSelectedColumn(0),
- mTopWidget(NULL)
+ mTopWidget(nullptr)
{
mBackgroundColor = Theme::getThemeColor(Theme::BACKGROUND);
mHighlightColor = Theme::getThemeColor(Theme::HIGHLIGHT);
@@ -110,7 +110,7 @@ GuiTable::~GuiTable()
{
uninstallActionListeners();
delete mModel;
- mModel = 0;
+ mModel = nullptr;
}
TableModel *GuiTable::getModel() const
@@ -391,7 +391,7 @@ void GuiTable::moveToBottom(gcn::Widget *widget)
{
gcn::Widget::moveToBottom(widget);
if (widget == mTopWidget)
- mTopWidget = NULL;
+ mTopWidget = nullptr;
}
gcn::Rectangle GuiTable::getChildrenArea()
@@ -512,7 +512,7 @@ void GuiTable::modelUpdated(bool completed)
}
else
{ // before the update?
- mTopWidget = NULL; // No longer valid in general
+ mTopWidget = nullptr; // No longer valid in general
uninstallActionListeners();
}
}
@@ -531,10 +531,10 @@ gcn::Widget *GuiTable::getWidgetAt(int x, int y)
if (w && w->isFocusable())
return w;
else
- return NULL; // Grab the event locally
+ return nullptr; // Grab the event locally
}
else
- return NULL;
+ return nullptr;
}
int GuiTable::getRowForY(int y) const
diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h
index d248c4820..cf3cb8ad8 100644
--- a/src/gui/widgets/guitable.h
+++ b/src/gui/widgets/guitable.h
@@ -23,6 +23,8 @@
#ifndef TABLE_H
#define TABLE_H
+#include "localconsts.h"
+
#include "gui/widgets/tablemodel.h"
#include <guichan/keylistener.hpp>
@@ -57,7 +59,7 @@ class GuiTable : public gcn::Widget,
friend class GuiTableActionListener;
public:
- GuiTable(TableModel * initial_model = NULL,
+ GuiTable(TableModel * initial_model = nullptr,
bool opacity = true);
virtual ~GuiTable();
diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp
index 3e9c7dd24..b8cc2ac3a 100644
--- a/src/gui/widgets/icon.cpp
+++ b/src/gui/widgets/icon.cpp
@@ -30,7 +30,7 @@
#include "debug.h"
Icon::Icon(const std::string &file)
- : mImage(0)
+ : mImage(nullptr)
{
mImage = ResourceManager::getInstance()->getImage(file);
if (mImage)
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 9a17d81cd..57c64093b 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -166,7 +166,7 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity):
mDescItems(false),
mTag(0),
mSortType(0),
- mShowMatrix(0)
+ mShowMatrix(nullptr)
{
mItemPopup = new ItemPopup;
setFocusable(true);
@@ -188,10 +188,10 @@ ItemContainer::~ItemContainer()
if (mSelImg)
{
mSelImg->decRef();
- mSelImg = 0;
+ mSelImg = nullptr;
}
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
delete []mShowMatrix;
}
@@ -309,7 +309,7 @@ Item *ItemContainer::getSelectedItem() const
if (mInventory)
return mInventory->getItem(mSelectedIndex);
else
- return 0;
+ return nullptr;
}
void ItemContainer::distributeValueChangedEvent()
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 6ae0f6b5b..549aa1616 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -42,7 +42,7 @@ ItemLinkHandler::ItemLinkHandler()
ItemLinkHandler::~ItemLinkHandler()
{
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
}
void ItemLinkHandler::handleLink(const std::string &link,
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 560045a29..3682ec448 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -51,7 +51,7 @@
ItemShortcutContainer::ItemShortcutContainer(unsigned number):
ShortcutContainer(),
mItemClicked(false),
- mItemMoved(NULL),
+ mItemMoved(nullptr),
mNumber(number)
{
addMouseListener(this);
@@ -87,12 +87,12 @@ ItemShortcutContainer::~ItemShortcutContainer()
if (mBackgroundImg)
{
mBackgroundImg->decRef();
- mBackgroundImg = 0;
+ mBackgroundImg = nullptr;
}
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
delete mSpellPopup;
- mSpellPopup = 0;
+ mSpellPopup = nullptr;
}
void ItemShortcutContainer::draw(gcn::Graphics *graphics)
@@ -304,14 +304,14 @@ void ItemShortcutContainer::mouseReleased(gcn::MouseEvent &event)
const int index = getIndexFromGrid(event.getX(), event.getY());
if (index == -1)
{
- mItemMoved = NULL;
+ mItemMoved = nullptr;
return;
}
if (mItemMoved)
{
itemShortcut[mNumber]->setItems(index,
mItemMoved->getId(), mItemMoved->getColor());
- mItemMoved = NULL;
+ mItemMoved = nullptr;
}
else if (itemShortcut[mNumber]->getItem(index) && mItemClicked)
{
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index 52b92d0bc..7f2f1f621 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -45,7 +45,7 @@ LayoutCell::~LayoutCell()
if (mType == ARRAY)
{
delete mArray;
- mArray = 0;
+ mArray = nullptr;
}
}
@@ -159,7 +159,7 @@ void LayoutArray::resizeGrid(int w, int h)
i = mCells.begin();
while (i != mCells.end())
{
- i->resize(w, 0);
+ i->resize(w, nullptr);
++i;
}
}
diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h
index 5e3ac4532..c4c703644 100644
--- a/src/gui/widgets/layout.h
+++ b/src/gui/widgets/layout.h
@@ -23,6 +23,8 @@
#ifndef WIDGET_LAYOUT_H
#define WIDGET_LAYOUT_H
+#include "localconsts.h"
+
#include <guichan/widgets/container.hpp>
#include <vector>
@@ -35,7 +37,7 @@ class LayoutCell;
class ContainerPlacer
{
public:
- ContainerPlacer(gcn::Container *c = NULL, LayoutCell *l = NULL):
+ ContainerPlacer(gcn::Container *c = nullptr, LayoutCell *l = nullptr):
mContainer(c), mCell(l)
{}
@@ -172,7 +174,7 @@ class LayoutCell
};
LayoutCell():
- mWidget(0),
+ mWidget(nullptr),
mHPadding(0),
mVPadding(0),
mType(NONE)
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 2efaa2088..fb72176bd 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -68,7 +68,7 @@ PlayerBox::PlayerBox(const Being *being):
}
else
{
- background.grid[a] = 0;
+ background.grid[a] = nullptr;
}
a++;
}
@@ -85,7 +85,7 @@ PlayerBox::~PlayerBox()
{
instances--;
- mBeing = 0;
+ mBeing = nullptr;
if (instances == 0)
for_each(background.grid, background.grid + 9, dtor<Image*>());
diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h
index 1b1a237d8..2bf010618 100644
--- a/src/gui/widgets/playerbox.h
+++ b/src/gui/widgets/playerbox.h
@@ -52,7 +52,8 @@ class PlayerBox : public gcn::ScrollArea
* player to <code>NULL</code> causes the box not to draw any
* character.
*/
- void setPlayer(const Being *being) { mBeing = being; }
+ void setPlayer(const Being *being)
+ { mBeing = being; }
/**
* Draws the scroll area.
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index ac282b088..78557d481 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -70,7 +70,7 @@ Popup::Popup(const std::string &name, std::string skin):
}
else
{
- mSkin = 0;
+ mSkin = nullptr;
}
// Add this window to the window container
@@ -85,13 +85,13 @@ Popup::~Popup()
logger->log("Popup::~Popup(\"%s\")", mPopupName.c_str());
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
if (mSkin)
{
if (Theme::instance())
Theme::instance()->unload(mSkin);
- mSkin = 0;
+ mSkin = nullptr;
}
}
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 7324fc9ad..f9b6da153 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -93,7 +93,7 @@ ProgressBar::ProgressBar(float progress,
else
{
for (int f = 0; f < 9; f ++)
- mBorder.grid[f] = 0;
+ mBorder.grid[f] = nullptr;
}
}
@@ -108,7 +108,7 @@ ProgressBar::~ProgressBar()
if (mInstances == 0)
for_each(mBorder.grid, mBorder.grid + 9, dtor<Image*>());
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
}
void ProgressBar::logic()
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index feedeae7b..7d344b09d 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -112,7 +112,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics)
radioCheckedHi->setAlpha(mAlpha);
}
- Image *box = NULL;
+ Image *box = nullptr;
if (isEnabled())
{
diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp
index 861dde29e..c8822eea9 100644
--- a/src/gui/widgets/resizegrip.cpp
+++ b/src/gui/widgets/resizegrip.cpp
@@ -34,7 +34,7 @@
#include "debug.h"
-Image *ResizeGrip::gripImage = 0;
+Image *ResizeGrip::gripImage = nullptr;
int ResizeGrip::mInstances = 0;
float ResizeGrip::mAlpha = 1.0;
@@ -69,7 +69,7 @@ ResizeGrip::~ResizeGrip()
if (mInstances == 0 && gripImage)
{
gripImage->decRef();
- gripImage = 0;
+ gripImage = nullptr;
}
}
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 3204028dc..0ec4a2027 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -111,7 +111,7 @@ ScrollArea::~ScrollArea()
buttons[RIGHT][1]->decRef();
}
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
}
void ScrollArea::init()
@@ -147,7 +147,7 @@ void ScrollArea::init()
}
else
{
- background.grid[a] = 0;
+ background.grid[a] = nullptr;
}
a++;
}
@@ -179,7 +179,7 @@ void ScrollArea::init()
}
else
{
- vMarker.grid[a] = 0;
+ vMarker.grid[a] = nullptr;
}
if (vscrollHi)
{
@@ -192,7 +192,7 @@ void ScrollArea::init()
}
else
{
- vMarkerHi.grid[a] = 0;
+ vMarkerHi.grid[a] = nullptr;
}
a++;
}
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 698e133dd..8081f5d7b 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -53,7 +53,7 @@ SetupItem::SetupItem(std::string text, std::string description,
mUseDefault(false),
mValue(""),
mDefault(""),
- mWidget(0),
+ mWidget(nullptr),
mValueType(VBOOL)
{
}
@@ -70,7 +70,7 @@ SetupItem::SetupItem(std::string text, std::string description,
mUseDefault(true),
mValue(""),
mDefault(def),
- mWidget(0),
+ mWidget(nullptr),
mValueType(VBOOL)
{
}
@@ -184,7 +184,7 @@ SetupItemCheckBox::SetupItemCheckBox(std::string text, std::string description,
SetupItemCheckBox::~SetupItemCheckBox()
{
- mWidget = 0;
+ mWidget = nullptr;
}
void SetupItemCheckBox::createControls()
@@ -225,11 +225,11 @@ SetupItemTextField::SetupItemTextField(std::string text,
std::string eventName,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
- mHorizont(0),
- mLabel(0),
- mTextField(0),
- mButton(0),
- mEditDialog(0)
+ mHorizont(nullptr),
+ mLabel(nullptr),
+ mTextField(nullptr),
+ mButton(nullptr),
+ mEditDialog(nullptr)
{
mValueType = VSTR;
createControls();
@@ -242,11 +242,11 @@ SetupItemTextField::SetupItemTextField(std::string text,
std::string eventName, std::string def,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
- mHorizont(0),
- mLabel(0),
- mTextField(0),
- mButton(0),
- mEditDialog(0)
+ mHorizont(nullptr),
+ mLabel(nullptr),
+ mTextField(nullptr),
+ mButton(nullptr),
+ mEditDialog(nullptr)
{
mValueType = VSTR;
createControls();
@@ -254,11 +254,11 @@ SetupItemTextField::SetupItemTextField(std::string text,
SetupItemTextField::~SetupItemTextField()
{
- mHorizont = 0;
- mWidget = 0;
- mTextField = 0;
- mLabel = 0;
- mButton = 0;
+ mHorizont = nullptr;
+ mWidget = nullptr;
+ mTextField = nullptr;
+ mLabel = nullptr;
+ mButton = nullptr;
}
void SetupItemTextField::createControls()
@@ -318,7 +318,7 @@ void SetupItemTextField::action(const gcn::ActionEvent &event)
else if (event.getId() == mEventName + "_EDIT_OK")
{
mTextField->setText(mEditDialog->getMsg());
- mEditDialog = 0;
+ mEditDialog = nullptr;
}
}
@@ -339,13 +339,13 @@ SetupItemIntTextField::SetupItemIntTextField(std::string text,
int min, int max,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
- mHorizont(0),
- mLabel(0),
- mTextField(0),
- mButton(0),
+ mHorizont(nullptr),
+ mLabel(nullptr),
+ mTextField(nullptr),
+ mButton(nullptr),
mMin(min),
mMax(max),
- mEditDialog(0)
+ mEditDialog(nullptr)
{
mValueType = VSTR;
createControls();
@@ -360,13 +360,13 @@ SetupItemIntTextField::SetupItemIntTextField(std::string text,
std::string def,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
- mHorizont(0),
- mLabel(0),
- mTextField(0),
- mButton(0),
+ mHorizont(nullptr),
+ mLabel(nullptr),
+ mTextField(nullptr),
+ mButton(nullptr),
mMin(min),
mMax(max),
- mEditDialog(0)
+ mEditDialog(nullptr)
{
mValueType = VSTR;
createControls();
@@ -374,11 +374,11 @@ SetupItemIntTextField::SetupItemIntTextField(std::string text,
SetupItemIntTextField::~SetupItemIntTextField()
{
- mHorizont = 0;
- mWidget = 0;
- mTextField = 0;
- mLabel = 0;
- mButton = 0;
+ mHorizont = nullptr;
+ mWidget = nullptr;
+ mTextField = nullptr;
+ mLabel = nullptr;
+ mButton = nullptr;
}
void SetupItemIntTextField::createControls()
@@ -441,7 +441,7 @@ void SetupItemIntTextField::action(const gcn::ActionEvent &event)
else if (event.getId() == mEventName + "_EDIT_OK")
{
mTextField->setValue(atoi(mEditDialog->getMsg().c_str()));
- mEditDialog = 0;
+ mEditDialog = nullptr;
}
}
@@ -459,7 +459,7 @@ void SetupItemIntTextField::apply(std::string eventName)
SetupItemLabel::SetupItemLabel(std::string text, std::string description,
SetupTabScroll *parent, bool separator) :
SetupItem(text, description, "", parent, "", "", true),
- mLabel(0),
+ mLabel(nullptr),
mIsSeparator(separator)
{
mValueType = VNONE;
@@ -468,8 +468,8 @@ SetupItemLabel::SetupItemLabel(std::string text, std::string description,
SetupItemLabel::~SetupItemLabel()
{
- mWidget = 0;
- mLabel = 0;
+ mWidget = nullptr;
+ mLabel = nullptr;
}
void SetupItemLabel::createControls()
@@ -517,10 +517,10 @@ SetupItemDropDown::SetupItemDropDown(std::string text,
gcn::ListModel *model,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
- mHorizont(0),
- mLabel(0),
+ mHorizont(nullptr),
+ mLabel(nullptr),
mModel(model),
- mDropDown(0)
+ mDropDown(nullptr)
{
mValueType = VSTR;
createControls();
@@ -535,10 +535,10 @@ SetupItemDropDown::SetupItemDropDown(std::string text,
std::string def,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
- mHorizont(0),
- mLabel(0),
+ mHorizont(nullptr),
+ mLabel(nullptr),
mModel(model),
- mDropDown(0)
+ mDropDown(nullptr)
{
mValueType = VSTR;
createControls();
@@ -546,11 +546,11 @@ SetupItemDropDown::SetupItemDropDown(std::string text,
SetupItemDropDown::~SetupItemDropDown()
{
- mHorizont = 0;
- mWidget = 0;
- mModel = 0;
- mDropDown = 0;
- mLabel = 0;
+ mHorizont = nullptr;
+ mWidget = nullptr;
+ mModel = nullptr;
+ mDropDown = nullptr;
+ mLabel = nullptr;
}
void SetupItemDropDown::createControls()
diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp
index e9917b090..4fb092070 100644
--- a/src/gui/widgets/setuptabscroll.cpp
+++ b/src/gui/widgets/setuptabscroll.cpp
@@ -43,10 +43,10 @@ SetupTabScroll::SetupTabScroll() :
SetupTabScroll::~SetupTabScroll()
{
- mScroll = 0;
+ mScroll = nullptr;
delete mContainer;
- mContainer = 0;
+ mContainer = nullptr;
std::set<SetupItem*>::iterator it = mAllItems.begin();
std::set<SetupItem*>::iterator it_end = mAllItems.end();
diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp
index e15445b77..d3aac5c56 100644
--- a/src/gui/widgets/shopitems.cpp
+++ b/src/gui/widgets/shopitems.cpp
@@ -75,7 +75,7 @@ void ShopItems::addItemNoDup(int id, unsigned char color,
void ShopItems::addItem2(int inventoryIndex, int id, unsigned char color,
int quantity, int price)
{
- ShopItem *item = 0;
+ ShopItem *item = nullptr;
if (mMergeDuplicates)
item = findItem(id, color);
@@ -93,7 +93,7 @@ void ShopItems::addItem2(int inventoryIndex, int id, unsigned char color,
ShopItem *ShopItems::at(unsigned int i) const
{
if (i >= mShopItems.size())
- return 0;
+ return nullptr;
return mShopItems.at(i);
}
@@ -137,5 +137,5 @@ ShopItem *ShopItems::findItem(int id, unsigned char color) const
++it;
}
- return 0;
+ return nullptr;
}
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 793491808..b649a81ef 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -47,7 +47,7 @@ float ShopListBox::mAlpha = 1.0;
ShopListBox::ShopListBox(gcn::ListModel *listModel):
ListBox(listModel),
mPlayerMoney(0),
- mShopItems(0)
+ mShopItems(nullptr)
{
mRowHeight = getFont()->getHeight();
init();
diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp
index 9fd9b26c6..36f88da08 100644
--- a/src/gui/widgets/shortcutcontainer.cpp
+++ b/src/gui/widgets/shortcutcontainer.cpp
@@ -33,7 +33,7 @@
float ShortcutContainer::mAlpha = 1.0;
ShortcutContainer::ShortcutContainer():
- mBackgroundImg(0),
+ mBackgroundImg(nullptr),
mMaxItems(0),
mBoxWidth(1),
mBoxHeight(1),
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index d29c2211f..3822d40c9 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -101,9 +101,9 @@ void Slider::init()
}
else
{
- hStart = 0;
- hMid = 0;
- hEnd = 0;
+ hStart = nullptr;
+ hMid = nullptr;
+ hEnd = nullptr;
}
if (sliderHi)
{
@@ -113,9 +113,9 @@ void Slider::init()
}
else
{
- hStartHi = 0;
- hMidHi = 0;
- hEndHi = 0;
+ hStartHi = nullptr;
+ hMidHi = nullptr;
+ hEndHi = nullptr;
}
x = 6; y = 8;
@@ -123,11 +123,11 @@ void Slider::init()
if (slider)
hGrip = slider->getSubImage(x, y, w, h);
else
- hGrip = 0;
+ hGrip = nullptr;
if (sliderHi)
hGripHi = sliderHi->getSubImage(x, y, w, h);
else
- hGripHi = 0;
+ hGripHi = nullptr;
x = 0; y = 6;
w = 6; h = 21;
@@ -140,9 +140,9 @@ void Slider::init()
}
else
{
- vStart = 0;
- vMid = 0;
- vEnd = 0;
+ vStart = nullptr;
+ vMid = nullptr;
+ vEnd = nullptr;
}
if (sliderHi)
{
@@ -152,9 +152,9 @@ void Slider::init()
}
else
{
- vStartHi = 0;
- vMidHi = 0;
- vEndHi = 0;
+ vStartHi = nullptr;
+ vMidHi = nullptr;
+ vEndHi = nullptr;
}
x = 6; y = 8;
@@ -162,12 +162,12 @@ void Slider::init()
if (slider)
vGrip = slider->getSubImage(x, y, w, h);
else
- vGrip = 0;
+ vGrip = nullptr;
if (sliderHi)
vGripHi = sliderHi->getSubImage(x, y, w, h);
else
- vGripHi = 0;
+ vGripHi = nullptr;
if (slider)
slider->decRef();
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 6317dd56f..5c4dbc9a1 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -54,7 +54,7 @@
SpellShortcutContainer::SpellShortcutContainer(unsigned number):
ShortcutContainer(),
mSpellClicked(false),
- mSpellMoved(NULL),
+ mSpellMoved(nullptr),
mNumber(number)
{
mBoxWidth = mBoxWidth;
@@ -88,9 +88,9 @@ SpellShortcutContainer::~SpellShortcutContainer()
{
if (mBackgroundImg)
mBackgroundImg->decRef();
- mBackgroundImg = 0;
+ mBackgroundImg = nullptr;
delete mSpellPopup;
- mSpellPopup = 0;
+ mSpellPopup = nullptr;
}
void SpellShortcutContainer::draw(gcn::Graphics *graphics)
@@ -251,7 +251,7 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event)
}
else if (event.getButton() == gcn::MouseEvent::RIGHT)
{
- TextCommand *spell = NULL;
+ TextCommand *spell = nullptr;
if (itemId >= 0)
spell = spellManager->getSpell(itemId);
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index 530f1ac82..8e4b1fe6f 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -91,7 +91,7 @@ Tab::~Tab()
for_each(tabImg[mode].grid, tabImg[mode].grid + 9, dtor<Image*>());
}
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
}
void Tab::init()
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 47b02c925..fb9279343 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -46,15 +46,15 @@ TabbedArea::TabbedArea()
mArrowButton[0] = new Button("<", "shift_left", this);
mArrowButton[1] = new Button(">", "shift_right", this);
- widgetResized(NULL);
+ widgetResized(nullptr);
}
TabbedArea::~TabbedArea()
{
delete mArrowButton[0];
- mArrowButton[0] = 0;
+ mArrowButton[0] = nullptr;
delete mArrowButton[1];
- mArrowButton[1] = 0;
+ mArrowButton[1] = nullptr;
}
void TabbedArea::enableScrollButtons(bool enable)
@@ -90,7 +90,7 @@ Tab *TabbedArea::getTab(const std::string &name) const
++itr;
}
- return NULL;
+ return nullptr;
}
void TabbedArea::draw(gcn::Graphics *graphics)
@@ -112,7 +112,7 @@ gcn::Widget *TabbedArea::getWidget(const std::string &name) const
++itr;
}
- return NULL;
+ return nullptr;
}
gcn::Widget *TabbedArea::getCurrentWidget()
@@ -122,7 +122,7 @@ gcn::Widget *TabbedArea::getCurrentWidget()
if (tab)
return getWidget(tab->getCaption());
else
- return NULL;
+ return nullptr;
}
void TabbedArea::addTab(gcn::Tab* tab, gcn::Widget* widget)
@@ -192,7 +192,7 @@ void TabbedArea::removeTab(gcn::Tab *tab)
if (tabIndexToBeSelected == -1)
{
- mSelectedTab = 0;
+ mSelectedTab = nullptr;
mWidgetContainer->clear();
}
else
@@ -238,7 +238,7 @@ void TabbedArea::setSelectedTab(gcn::Tab *tab)
if (newTab)
newTab->setCurrent();
- widgetResized(NULL);
+ widgetResized(nullptr);
}
void TabbedArea::setSelectedTab(const std::string &name)
@@ -266,7 +266,7 @@ void TabbedArea::widgetResized(const gcn::Event &event A_UNUSED)
if (w)
{
int newScroll = 0;
- ScrollArea* scr = 0;
+ ScrollArea* scr = nullptr;
if (mFollowDownScroll && height != 0)
{
gcn::Rectangle rect = w->getDimension();
@@ -444,14 +444,14 @@ void TabbedArea::updateArrowEnableState()
Tab *TabbedArea::getTabByIndex(int index) const
{
if (index < 0 || index >= static_cast<int>(mTabs.size()))
- return 0;
+ return nullptr;
return static_cast<Tab*>(mTabs[index].first);
}
gcn::Widget *TabbedArea::getWidgetByIndex(int index) const
{
if (index < 0 || index >= static_cast<int>(mTabs.size()))
- return 0;
+ return nullptr;
return mTabs[index].second;
}
diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp
index 6c932a411..f54b4281a 100644
--- a/src/gui/widgets/tablemodel.cpp
+++ b/src/gui/widgets/tablemodel.cpp
@@ -68,7 +68,7 @@ StaticTableModel::StaticTableModel(int row, int column) :
mColumns(column),
mHeight(1)
{
- mTableModel.resize(row * column, NULL);
+ mTableModel.resize(row * column, nullptr);
mWidths.resize(column, 1);
}
@@ -82,7 +82,7 @@ void StaticTableModel::resize()
{
mRows = getRows();
mColumns = getColumns();
- mTableModel.resize(mRows * mColumns, NULL);
+ mTableModel.resize(mRows * mColumns, nullptr);
}
void StaticTableModel::set(int row, int column, gcn::Widget *widget)
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 6ce4cbf3b..b4584947a 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -86,7 +86,7 @@ TextField::TextField(const std::string &text, bool loseFocusOnTab,
}
else
{
- skin.grid[a] = 0;
+ skin.grid[a] = nullptr;
}
a++;
}
diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h
index 93f970168..e530cfef2 100644
--- a/src/gui/widgets/textfield.h
+++ b/src/gui/widgets/textfield.h
@@ -25,6 +25,8 @@
#include <guichan/widgets/textfield.hpp>
+#include "localconsts.h"
+
class ImageRect;
class TextField;
@@ -40,7 +42,7 @@ class TextField : public gcn::TextField
* Constructor, initializes the text field with the given string.
*/
TextField(const std::string &text = "", bool loseFocusOnTab = true,
- gcn::ActionListener* listener = NULL,
+ gcn::ActionListener* listener = nullptr,
std::string eventId = "", bool sendAlwaysEvents = false);
~TextField();
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 07cf19b61..9be2d5b3f 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -44,7 +44,7 @@ TextPreview::TextPreview(const std::string &text):
mTextAlpha = false;
mFont = gui->getFont();
mTextColor = &Theme::getThemeColor(Theme::TEXT);
- mTextBGColor = NULL;
+ mTextBGColor = nullptr;
mBGColor = &Theme::getThemeColor(Theme::BACKGROUND);
mOpaque = false;
}
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index c52bf744e..273695a1a 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -49,9 +49,9 @@ int Window::mouseResize = 0;
Window::Window(const std::string &caption, bool modal, Window *parent,
std::string skin):
gcn::Window(caption),
- mGrip(0),
+ mGrip(nullptr),
mParent(parent),
- mLayout(NULL),
+ mLayout(nullptr),
mWindowName("window"),
mShowTitle(true),
mModal(modal),
@@ -91,7 +91,7 @@ Window::Window(const std::string &caption, bool modal, Window *parent,
}
else
{
- mSkin = 0;
+ mSkin = nullptr;
}
// Add this window to the window container
@@ -118,7 +118,7 @@ Window::~Window()
saveWindowState();
delete mLayout;
- mLayout = 0;
+ mLayout = nullptr;
while (!mWidgets.empty())
delete mWidgets.front();
@@ -127,7 +127,7 @@ Window::~Window()
removeWidgetListener(this);
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
instances--;
@@ -135,7 +135,7 @@ Window::~Window()
{
if (Theme::instance())
Theme::instance()->unload(mSkin);
- mSkin = 0;
+ mSkin = nullptr;
}
}
@@ -348,7 +348,7 @@ void Window::setResizable(bool r)
{
remove(mGrip);
delete mGrip;
- mGrip = 0;
+ mGrip = nullptr;
}
}
@@ -947,7 +947,7 @@ void Window::reflowLayout(int w, int h)
mLayout->reflow(w, h);
delete mLayout;
- mLayout = 0;
+ mLayout = nullptr;
setContentSize(w, h);
}
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index ffc27ab10..5ace2328e 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -25,6 +25,7 @@
#include "graphics.h"
#include "guichanfwd.h"
+#include "localconsts.h"
#include <guichan/widgetlistener.hpp>
@@ -65,7 +66,7 @@ class Window : public gcn::Window, gcn::WidgetListener
* @param skin The location where the window's skin XML can be found.
*/
Window(const std::string &caption = "Window", bool modal = false,
- Window *parent = NULL, std::string skin = "");
+ Window *parent = nullptr, std::string skin = "");
/**
* Destructor. Deletes all the added widgets.
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp
index 5a3c16037..34a6b68c7 100644
--- a/src/gui/widgets/windowcontainer.cpp
+++ b/src/gui/widgets/windowcontainer.cpp
@@ -26,7 +26,7 @@
#include "debug.h"
-WindowContainer *windowContainer = NULL;
+WindowContainer *windowContainer = nullptr;
void WindowContainer::logic()
{
diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp
index b4f697ba3..3749049fe 100644
--- a/src/gui/worldselectdialog.cpp
+++ b/src/gui/worldselectdialog.cpp
@@ -140,7 +140,7 @@ void WorldSelectDialog::keyPressed(gcn::KeyEvent &keyEvent)
gcn::Key key = keyEvent.getKey();
if (key.getValue() == Key::ESCAPE)
- action(gcn::ActionEvent(NULL, mChangeLoginButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mChangeLoginButton->getActionEventId()));
else if (key.getValue() == Key::ENTER)
- action(gcn::ActionEvent(NULL, mChooseWorld->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mChooseWorld->getActionEventId()));
}
diff --git a/src/guichan/basiccontainer.cpp b/src/guichan/basiccontainer.cpp
index 439535c9a..a36ab5f9b 100644
--- a/src/guichan/basiccontainer.cpp
+++ b/src/guichan/basiccontainer.cpp
@@ -173,7 +173,7 @@ namespace gcn
Rectangle r = getChildrenArea();
if (!r.isPointInRect(x, y))
- return NULL;
+ return nullptr;
x -= r.x;
y -= r.y;
@@ -188,7 +188,7 @@ namespace gcn
}
}
- return NULL;
+ return nullptr;
}
void BasicContainer::logic()
@@ -200,7 +200,7 @@ namespace gcn
{
Widget::_setFocusHandler(focusHandler);
- if (mInternalFocusHandler != NULL)
+ if (mInternalFocusHandler)
return;
WidgetListConstIterator iter;
@@ -214,7 +214,7 @@ namespace gcn
{
mWidgets.push_back(widget);
- if (mInternalFocusHandler == NULL)
+ if (!mInternalFocusHandler)
widget->_setFocusHandler(_getFocusHandler());
else
widget->_setFocusHandler(mInternalFocusHandler);
@@ -231,8 +231,8 @@ namespace gcn
if (*iter == widget)
{
mWidgets.erase(iter);
- widget->_setFocusHandler(NULL);
- widget->_setParent(NULL);
+ widget->_setFocusHandler(nullptr);
+ widget->_setParent(nullptr);
widget->removeDeathListener(this);
return;
}
@@ -247,8 +247,8 @@ namespace gcn
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
{
- (*iter)->_setFocusHandler(NULL);
- (*iter)->_setParent(NULL);
+ (*iter)->_setFocusHandler(nullptr);
+ (*iter)->_setParent(nullptr);
(*iter)->removeDeathListener(this);
}
@@ -327,7 +327,7 @@ namespace gcn
WidgetListConstIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
{
- if (mInternalFocusHandler == NULL)
+ if (!mInternalFocusHandler)
(*iter)->_setFocusHandler(_getFocusHandler());
else
(*iter)->_setFocusHandler(mInternalFocusHandler);
@@ -345,15 +345,15 @@ namespace gcn
BasicContainer *basicContainer
= dynamic_cast<BasicContainer*>(*iter);
- if (basicContainer != NULL)
+ if (basicContainer)
{
Widget *widget = basicContainer->findWidgetById(id);
- if (widget != NULL)
+ if (widget)
return widget;
}
}
- return NULL;
+ return nullptr;
}
}
diff --git a/src/guichan/focushandler.cpp b/src/guichan/focushandler.cpp
index 367eed6b1..b1da9e77e 100644
--- a/src/guichan/focushandler.cpp
+++ b/src/guichan/focushandler.cpp
@@ -56,24 +56,21 @@
namespace gcn
{
FocusHandler::FocusHandler() :
- mFocusedWidget(NULL),
- mModalFocusedWidget(NULL),
- mModalMouseInputFocusedWidget(NULL),
- mDraggedWidget(NULL),
- mLastWidgetWithMouse(NULL),
- mLastWidgetWithModalFocus(NULL),
- mLastWidgetWithModalMouseInputFocus(NULL),
- mLastWidgetPressed(NULL)
+ mFocusedWidget(nullptr),
+ mModalFocusedWidget(nullptr),
+ mModalMouseInputFocusedWidget(nullptr),
+ mDraggedWidget(nullptr),
+ mLastWidgetWithMouse(nullptr),
+ mLastWidgetWithModalFocus(nullptr),
+ mLastWidgetWithModalMouseInputFocus(nullptr),
+ mLastWidgetPressed(nullptr)
{
}
void FocusHandler::requestFocus(Widget* widget)
{
- if (widget == NULL
- || widget == mFocusedWidget)
- {
+ if (!widget || widget == mFocusedWidget)
return;
- }
unsigned int i = 0;
int toBeFocusedIndex = -1;
@@ -95,7 +92,7 @@ namespace gcn
{
mFocusedWidget = mWidgets.at(toBeFocusedIndex);
- if (oldFocused != NULL)
+ if (oldFocused)
{
Event focusEvent(oldFocused);
distributeFocusLostEvent(focusEvent);
@@ -108,21 +105,18 @@ namespace gcn
void FocusHandler::requestModalFocus(Widget* widget)
{
- if (mModalFocusedWidget != NULL && mModalFocusedWidget != widget)
+ if (mModalFocusedWidget && mModalFocusedWidget != widget)
throw GCN_EXCEPTION("Another widget already has modal focus.");
mModalFocusedWidget = widget;
- if (mFocusedWidget != NULL
- && !mFocusedWidget->isModalFocused())
- {
+ if (mFocusedWidget && !mFocusedWidget->isModalFocused())
focusNone();
- }
}
void FocusHandler::requestModalMouseInputFocus(Widget* widget)
{
- if (mModalMouseInputFocusedWidget != NULL
+ if (mModalMouseInputFocusedWidget
&& mModalMouseInputFocusedWidget != widget)
{
throw GCN_EXCEPTION("Another widget already has "
@@ -135,13 +129,13 @@ namespace gcn
void FocusHandler::releaseModalFocus(Widget* widget)
{
if (mModalFocusedWidget == widget)
- mModalFocusedWidget = NULL;
+ mModalFocusedWidget = nullptr;
}
void FocusHandler::releaseModalMouseInputFocus(Widget* widget)
{
if (mModalMouseInputFocusedWidget == widget)
- mModalMouseInputFocusedWidget = NULL;
+ mModalMouseInputFocusedWidget = nullptr;
}
Widget* FocusHandler::getFocused() const
@@ -212,7 +206,7 @@ namespace gcn
{
if (mWidgets.empty())
{
- mFocusedWidget = NULL;
+ mFocusedWidget = nullptr;
return;
}
@@ -275,9 +269,7 @@ namespace gcn
void FocusHandler::remove(Widget* widget)
{
if (isFocused(widget))
- {
- mFocusedWidget = NULL;
- }
+ mFocusedWidget = nullptr;
WidgetIterator iter;
@@ -292,41 +284,41 @@ namespace gcn
if (mDraggedWidget == widget)
{
- mDraggedWidget = NULL;
+ mDraggedWidget = nullptr;
return;
}
if (mLastWidgetWithMouse == widget)
{
- mLastWidgetWithMouse = NULL;
+ mLastWidgetWithMouse = nullptr;
return;
}
if (mLastWidgetWithModalFocus == widget)
{
- mLastWidgetWithModalFocus = NULL;
+ mLastWidgetWithModalFocus = nullptr;
return;
}
if (mLastWidgetWithModalMouseInputFocus == widget)
{
- mLastWidgetWithModalMouseInputFocus = NULL;
+ mLastWidgetWithModalMouseInputFocus = nullptr;
return;
}
if (mLastWidgetPressed == widget)
{
- mLastWidgetPressed = NULL;
+ mLastWidgetPressed = nullptr;
return;
}
}
void FocusHandler::focusNone()
{
- if (mFocusedWidget != NULL)
+ if (mFocusedWidget)
{
Widget* focused = mFocusedWidget;
- mFocusedWidget = NULL;
+ mFocusedWidget = nullptr;
Event focusEvent(focused);
distributeFocusLostEvent(focusEvent);
@@ -335,7 +327,7 @@ namespace gcn
void FocusHandler::tabNext()
{
- if (mFocusedWidget != NULL)
+ if (mFocusedWidget)
{
if (!mFocusedWidget->isTabOutEnabled())
return;
@@ -343,7 +335,7 @@ namespace gcn
if (mWidgets.empty())
{
- mFocusedWidget = NULL;
+ mFocusedWidget = nullptr;
return;
}
@@ -380,7 +372,7 @@ namespace gcn
if (mWidgets.at(focusedWidget)->isFocusable() &&
mWidgets.at(focusedWidget)->isTabInEnabled() &&
- (mModalFocusedWidget == NULL ||
+ (!mModalFocusedWidget ||
mWidgets.at(focusedWidget)->isModalFocused()))
{
done = true;
@@ -404,7 +396,7 @@ namespace gcn
void FocusHandler::tabPrevious()
{
- if (mFocusedWidget != NULL)
+ if (mFocusedWidget)
{
if (!mFocusedWidget->isTabOutEnabled())
return;
@@ -412,7 +404,7 @@ namespace gcn
if (mWidgets.empty())
{
- mFocusedWidget = NULL;
+ mFocusedWidget = nullptr;
return;
}
@@ -449,7 +441,7 @@ namespace gcn
if (mWidgets.at(focusedWidget)->isFocusable() &&
mWidgets.at(focusedWidget)->isTabInEnabled() &&
- (mModalFocusedWidget == NULL ||
+ (!mModalFocusedWidget ||
mWidgets.at(focusedWidget)->isModalFocused()))
{
done = true;
diff --git a/src/guichan/graphics.cpp b/src/guichan/graphics.cpp
index d09050a10..c57b5d5c0 100644
--- a/src/guichan/graphics.cpp
+++ b/src/guichan/graphics.cpp
@@ -57,7 +57,7 @@ namespace gcn
{
Graphics::Graphics() :
- mFont(NULL)
+ mFont(nullptr)
{
}
@@ -155,7 +155,7 @@ namespace gcn
void Graphics::drawText(const std::string& text, int x, int y,
Alignment alignment)
{
- if (mFont == NULL)
+ if (!mFont)
throw GCN_EXCEPTION("No font set.");
switch (alignment)
diff --git a/src/guichan/gui.cpp b/src/guichan/gui.cpp
index 0c81182ea..810a983c4 100644
--- a/src/guichan/gui.cpp
+++ b/src/guichan/gui.cpp
@@ -63,9 +63,9 @@
namespace gcn
{
Gui::Gui() :
- mTop(NULL),
- mGraphics(NULL),
- mInput(NULL),
+ mTop(nullptr),
+ mGraphics(nullptr),
+ mInput(nullptr),
mTabbing(true),
mShiftPressed(false),
mMetaPressed(false),
@@ -84,17 +84,17 @@ namespace gcn
Gui::~Gui()
{
if (Widget::widgetExists(mTop))
- setTop(NULL);
+ setTop(nullptr);
delete mFocusHandler;
- mFocusHandler = 0;
+ mFocusHandler = nullptr;
}
void Gui::setTop(Widget* top)
{
- if (mTop != NULL)
- mTop->_setFocusHandler(NULL);
- if (top != NULL)
+ if (mTop)
+ mTop->_setFocusHandler(nullptr);
+ if (top)
top->_setFocusHandler(mFocusHandler);
mTop = top;
@@ -127,13 +127,13 @@ namespace gcn
void Gui::logic()
{
- if (mTop == NULL)
+ if (!mTop)
throw GCN_EXCEPTION("No top widget set");
handleModalFocus();
handleModalMouseInputFocus();
- if (mInput != NULL)
+ if (mInput)
{
mInput->_pollInput();
@@ -147,9 +147,9 @@ namespace gcn
void Gui::draw()
{
- if (mTop == NULL)
+ if (!mTop)
throw GCN_EXCEPTION("No top widget set");
- if (mGraphics == NULL)
+ if (!mGraphics)
throw GCN_EXCEPTION("No graphics set");
if (!mTop->isVisible())
@@ -250,7 +250,7 @@ namespace gcn
mControlPressed = keyInput.isControlPressed();
mAltPressed = keyInput.isAltPressed();
- KeyEvent keyEventToGlobalKeyListeners(NULL,
+ KeyEvent keyEventToGlobalKeyListeners(nullptr,
mShiftPressed,
mControlPressed,
mAltPressed,
@@ -270,7 +270,7 @@ namespace gcn
bool keyEventConsumed = false;
// Send key inputs to the focused widgets
- if (mFocusHandler->getFocused() != NULL)
+ if (mFocusHandler->getFocused())
{
KeyEvent keyEvent(getKeyEventSource(),
mShiftPressed,
@@ -400,7 +400,7 @@ namespace gcn
// widget with modal mouse input focus, hence we need to check if
// that's the case. If it's not we should simply ignore to send any
// mouse entered events.
- if (mFocusHandler->getModalMouseInputFocused() != NULL
+ if (mFocusHandler->getModalMouseInputFocused()
&& widget == mFocusHandler->getModalMouseInputFocused()
&& Widget::widgetExists(widget))
{
@@ -411,11 +411,11 @@ namespace gcn
|| x + widget->getWidth() <= mouseInput.getX()
|| y + widget->getHeight() <= mouseInput.getY())
{
- parent = NULL;
+ parent = nullptr;
}
}
- while (parent != NULL)
+ while (parent)
{
parent = (Widget*)widget->getParent();
@@ -453,7 +453,7 @@ namespace gcn
parent = (Widget*)swap->getParent();
}
- if (mFocusHandler->getDraggedWidget() != NULL)
+ if (mFocusHandler->getDraggedWidget())
{
distributeMouseEvent(mFocusHandler->getDraggedWidget(),
MouseEvent::DRAGGED,
@@ -479,15 +479,15 @@ namespace gcn
Widget* sourceWidget = getMouseEventSource(
mouseInput.getX(), mouseInput.getY());
- if (mFocusHandler->getDraggedWidget() != NULL)
+ if (mFocusHandler->getDraggedWidget())
sourceWidget = mFocusHandler->getDraggedWidget();
int sourceWidgetX, sourceWidgetY;
sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY);
- if ((mFocusHandler->getModalFocused() != NULL
+ if ((mFocusHandler->getModalFocused()
&& sourceWidget->isModalFocused())
- || mFocusHandler->getModalFocused() == NULL)
+ || !mFocusHandler->getModalFocused())
{
sourceWidget->requestFocus();
}
@@ -522,7 +522,7 @@ namespace gcn
Widget* sourceWidget = getMouseEventSource(
mouseInput.getX(), mouseInput.getY());
- if (mFocusHandler->getDraggedWidget() != NULL)
+ if (mFocusHandler->getDraggedWidget())
sourceWidget = mFocusHandler->getDraggedWidget();
int sourceWidgetX, sourceWidgetY;
@@ -540,7 +540,7 @@ namespace gcn
Widget* sourceWidget = getMouseEventSource(
mouseInput.getX(), mouseInput.getY());
- if (mFocusHandler->getDraggedWidget() != NULL)
+ if (mFocusHandler->getDraggedWidget())
sourceWidget = mFocusHandler->getDraggedWidget();
int sourceWidgetX, sourceWidgetY;
@@ -558,10 +558,10 @@ namespace gcn
Widget* sourceWidget = getMouseEventSource(
mouseInput.getX(), mouseInput.getY());
- if (mFocusHandler->getDraggedWidget() != NULL)
+ if (mFocusHandler->getDraggedWidget())
{
if (sourceWidget != mFocusHandler->getLastWidgetPressed())
- mFocusHandler->setLastWidgetPressed(NULL);
+ mFocusHandler->setLastWidgetPressed(nullptr);
sourceWidget = mFocusHandler->getDraggedWidget();
}
@@ -584,7 +584,7 @@ namespace gcn
mouseInput.getX(),
mouseInput.getY());
- mFocusHandler->setLastWidgetPressed(NULL);
+ mFocusHandler->setLastWidgetPressed(nullptr);
}
else
{
@@ -592,8 +592,8 @@ namespace gcn
mClickCount = 0;
}
- if (mFocusHandler->getDraggedWidget() != NULL)
- mFocusHandler->setDraggedWidget(NULL);
+ if (mFocusHandler->getDraggedWidget())
+ mFocusHandler->setDraggedWidget(nullptr);
}
Widget* Gui::getWidgetAt(int x, int y)
@@ -602,7 +602,7 @@ namespace gcn
Widget* parent = mTop;
Widget* child = mTop;
- while (child != NULL)
+ while (child)
{
Widget* swap = child;
int parentX, parentY;
@@ -618,7 +618,7 @@ namespace gcn
{
Widget* widget = getWidgetAt(x, y);
- if (mFocusHandler->getModalMouseInputFocused() != NULL
+ if (mFocusHandler->getModalMouseInputFocused()
&& !widget->isModalMouseInputFocused())
{
return mFocusHandler->getModalMouseInputFocused();
@@ -631,8 +631,8 @@ namespace gcn
{
Widget* widget = mFocusHandler->getFocused();
- while (widget->_getInternalFocusHandler() != NULL
- && widget->_getInternalFocusHandler()->getFocused() != NULL)
+ while (widget->_getInternalFocusHandler()
+ && widget->_getInternalFocusHandler()->getFocused())
{
widget = widget->_getInternalFocusHandler()->getFocused();
}
@@ -651,14 +651,14 @@ namespace gcn
Widget* parent = source;
Widget* widget = source;
- if (mFocusHandler->getModalFocused() != NULL
+ if (mFocusHandler->getModalFocused()
&& !widget->isModalFocused()
&& !force)
{
return;
}
- if (mFocusHandler->getModalMouseInputFocused() != NULL
+ if (mFocusHandler->getModalMouseInputFocused()
&& !widget->isModalMouseInputFocused()
&& !force)
{
@@ -676,7 +676,7 @@ namespace gcn
y,
mClickCount);
- while (parent != NULL)
+ while (parent)
{
// If the widget has been removed due to input
// cancel the distribution.
@@ -746,7 +746,7 @@ namespace gcn
// If a non modal focused widget has been reach
// and we have modal focus cancel the distribution.
- if (mFocusHandler->getModalFocused() != NULL
+ if (mFocusHandler->getModalFocused()
&& !widget->isModalFocused())
{
break;
@@ -754,7 +754,7 @@ namespace gcn
// If a non modal mouse input focused widget has been reach
// and we have modal mouse input focus cancel the distribution.
- if (mFocusHandler->getModalMouseInputFocused() != NULL
+ if (mFocusHandler->getModalMouseInputFocused()
&& !widget->isModalMouseInputFocused())
{
break;
@@ -767,26 +767,24 @@ namespace gcn
Widget* parent = keyEvent.getSource();
Widget* widget = keyEvent.getSource();
- if (mFocusHandler->getModalFocused() != NULL
+ if (mFocusHandler->getModalFocused()
&& !widget->isModalFocused())
{
return;
}
- if (mFocusHandler->getModalMouseInputFocused() != NULL
+ if (mFocusHandler->getModalMouseInputFocused()
&& !widget->isModalMouseInputFocused())
{
return;
}
- while (parent != NULL)
+ while (parent)
{
// If the widget has been removed due to input
// cancel the distribution.
if (!Widget::widgetExists(widget))
- {
break;
- }
parent = (Widget*)widget->getParent();
@@ -821,7 +819,7 @@ namespace gcn
// If a non modal focused widget has been reach
// and we have modal focus cancel the distribution.
- if (mFocusHandler->getModalFocused() != NULL
+ if (mFocusHandler->getModalFocused()
&& !widget->isModalFocused())
{
break;
@@ -857,8 +855,7 @@ namespace gcn
// Check if modal mouse input focus has been gained by a widget.
if ((mFocusHandler->getLastWidgetWithModalMouseInputFocus()
!= mFocusHandler->getModalMouseInputFocused())
- && (mFocusHandler->getLastWidgetWithModalMouseInputFocus()
- == NULL))
+ && (!mFocusHandler->getLastWidgetWithModalMouseInputFocus()))
{
handleModalFocusGained();
mFocusHandler->setLastWidgetWithModalMouseInputFocus(
@@ -867,11 +864,10 @@ namespace gcn
// Check if modal mouse input focus has been released.
else if ((mFocusHandler->getLastWidgetWithModalMouseInputFocus()
!= mFocusHandler->getModalMouseInputFocused())
- && (mFocusHandler->getLastWidgetWithModalMouseInputFocus()
- != NULL))
+ && (mFocusHandler->getLastWidgetWithModalMouseInputFocus()))
{
handleModalFocusReleased();
- mFocusHandler->setLastWidgetWithModalMouseInputFocus(NULL);
+ mFocusHandler->setLastWidgetWithModalMouseInputFocus(nullptr);
}
}
@@ -880,7 +876,7 @@ namespace gcn
// Check if modal focus has been gained by a widget.
if ((mFocusHandler->getLastWidgetWithModalFocus()
!= mFocusHandler->getModalFocused())
- && (mFocusHandler->getLastWidgetWithModalFocus() == NULL))
+ && (!mFocusHandler->getLastWidgetWithModalFocus()))
{
handleModalFocusGained();
mFocusHandler->setLastWidgetWithModalFocus(
@@ -889,10 +885,10 @@ namespace gcn
// Check if modal focus has been released.
else if ((mFocusHandler->getLastWidgetWithModalFocus()
!= mFocusHandler->getModalFocused())
- && (mFocusHandler->getLastWidgetWithModalFocus() != NULL))
+ && (mFocusHandler->getLastWidgetWithModalFocus()))
{
handleModalFocusReleased();
- mFocusHandler->setLastWidgetWithModalFocus(NULL);
+ mFocusHandler->setLastWidgetWithModalFocus(nullptr);
}
}
@@ -930,7 +926,7 @@ namespace gcn
Widget* widget = getMouseEventSource(mLastMouseX, mLastMouseY);
Widget* parent = widget;
- while (parent != NULL)
+ while (parent)
{
parent = (Widget*)widget->getParent();
diff --git a/src/guichan/image.cpp b/src/guichan/image.cpp
index 2c15151a2..837840435 100644
--- a/src/guichan/image.cpp
+++ b/src/guichan/image.cpp
@@ -55,7 +55,7 @@
namespace gcn
{
- ImageLoader* Image::mImageLoader = NULL;
+ ImageLoader* Image::mImageLoader = nullptr;
Image::Image()
{
@@ -78,7 +78,7 @@ namespace gcn
Image* Image::load(const std::string& filename,
bool convertToDisplayFormat)
{
- if (mImageLoader == NULL)
+ if (!mImageLoader)
{
throw GCN_EXCEPTION("Trying to load an image but "
"no image loader is set.");
diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp
index 28aface0e..67aa657cd 100644
--- a/src/guichan/sdl/sdlgraphics.cpp
+++ b/src/guichan/sdl/sdlgraphics.cpp
@@ -65,7 +65,7 @@ namespace gcn
{
SDLGraphics::SDLGraphics() :
- mTarget(0),
+ mTarget(nullptr),
mAlpha(false)
{
}
@@ -155,7 +155,7 @@ namespace gcn
const SDLImage* srcImage = dynamic_cast<const SDLImage*>(image);
- if (srcImage == NULL)
+ if (!srcImage)
{
throw GCN_EXCEPTION("Trying to draw an image of unknown format,"
" must be an SDLImage.");
diff --git a/src/guichan/sdl/sdlimage.cpp b/src/guichan/sdl/sdlimage.cpp
index 12c5571cf..156b399b3 100644
--- a/src/guichan/sdl/sdlimage.cpp
+++ b/src/guichan/sdl/sdlimage.cpp
@@ -50,6 +50,8 @@
#include "guichan/exception.hpp"
#include "guichan/sdl/sdlpixel.hpp"
+#include "debug.h"
+
namespace gcn
{
SDLImage::SDLImage(SDL_Surface* surface, bool autoFree)
@@ -71,7 +73,7 @@ namespace gcn
int SDLImage::getWidth() const
{
- if (mSurface == NULL)
+ if (!mSurface)
{
throw GCN_EXCEPTION("Trying to get the width of "
"a non loaded image.");
@@ -82,7 +84,7 @@ namespace gcn
int SDLImage::getHeight() const
{
- if (mSurface == NULL)
+ if (!mSurface)
{
throw GCN_EXCEPTION("Trying to get the height of "
"a non loaded image.");
@@ -93,7 +95,7 @@ namespace gcn
Color SDLImage::getPixel(int x, int y)
{
- if (mSurface == NULL)
+ if (!mSurface)
{
throw GCN_EXCEPTION("Trying to get a pixel from a "
"non loaded image.");
@@ -104,7 +106,7 @@ namespace gcn
void SDLImage::putPixel(int x, int y, const Color& color)
{
- if (mSurface == NULL)
+ if (!mSurface)
{
throw GCN_EXCEPTION("Trying to put a pixel in a "
"non loaded image.");
@@ -115,7 +117,7 @@ namespace gcn
void SDLImage::convertToDisplayFormat()
{
- if (mSurface == NULL)
+ if (!mSurface)
{
throw GCN_EXCEPTION("Trying to convert a non loaded image "
"to display format.");
@@ -155,16 +157,16 @@ namespace gcn
{
tmp = SDL_DisplayFormatAlpha(mSurface);
SDL_FreeSurface(mSurface);
- mSurface = NULL;
+ mSurface = nullptr;
}
else
{
tmp = SDL_DisplayFormat(mSurface);
SDL_FreeSurface(mSurface);
- mSurface = NULL;
+ mSurface = nullptr;
}
- if (tmp == NULL)
+ if (!tmp)
throw GCN_EXCEPTION("Unable to convert image to display format.");
if (hasPink)
diff --git a/src/guichan/widget.cpp b/src/guichan/widget.cpp
index 1b2b3295b..571644aa4 100644
--- a/src/guichan/widget.cpp
+++ b/src/guichan/widget.cpp
@@ -66,7 +66,7 @@
namespace gcn
{
- Font* Widget::mGlobalFont = NULL;
+ Font* Widget::mGlobalFont = nullptr;
DefaultFont Widget::mDefaultFont;
std::list<Widget*> Widget::mWidgets;
std::set<Widget*> Widget::mWidgetsSet;
@@ -76,16 +76,16 @@ namespace gcn
mBackgroundColor(0xffffff),
mBaseColor(0x808090),
mSelectionColor(0xc3d9ff),
- mFocusHandler(NULL),
- mInternalFocusHandler(NULL),
- mParent(NULL),
+ mFocusHandler(nullptr),
+ mInternalFocusHandler(nullptr),
+ mParent(nullptr),
mFrameSize(0),
mFocusable(false),
mVisible(true),
mTabIn(true),
mTabOut(true),
mEnabled(true),
- mCurrentFont(NULL)
+ mCurrentFont(nullptr)
{
mWidgets.push_back(this);
mWidgetsSet.insert(this);
@@ -103,7 +103,7 @@ namespace gcn
(*iter)->death(event);
}
- _setFocusHandler(NULL);
+ _setFocusHandler(nullptr);
mWidgets.remove(this);
mWidgetsSet.erase(this);
@@ -272,7 +272,7 @@ namespace gcn
void Widget::requestFocus()
{
- if (mFocusHandler == NULL)
+ if (!mFocusHandler)
{
throw GCN_EXCEPTION("No focushandler set (did you add "
"the widget to the gui?).");
@@ -455,9 +455,9 @@ namespace gcn
Font* Widget::getFont() const
{
- if (mCurrentFont == NULL)
+ if (!mCurrentFont)
{
- if (mGlobalFont == NULL)
+ if (!mGlobalFont)
return &mDefaultFont;
return mGlobalFont;
@@ -473,7 +473,7 @@ namespace gcn
std::list<Widget*>::const_iterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
{
- if ((*iter)->mCurrentFont == NULL)
+ if (!(*iter)->mCurrentFont)
(*iter)->fontChanged();
}
}
@@ -531,7 +531,7 @@ namespace gcn
void Widget::requestModalFocus()
{
- if (mFocusHandler == NULL)
+ if (!mFocusHandler)
{
throw GCN_EXCEPTION("No focushandler set (did you add "
"the widget to the gui?).");
@@ -542,7 +542,7 @@ namespace gcn
void Widget::requestModalMouseInputFocus()
{
- if (mFocusHandler == NULL)
+ if (!mFocusHandler)
{
throw GCN_EXCEPTION("No focushandler set (did you add "
"the widget to the gui?).");
@@ -553,7 +553,7 @@ namespace gcn
void Widget::releaseModalFocus()
{
- if (mFocusHandler == NULL)
+ if (!mFocusHandler)
return;
mFocusHandler->releaseModalFocus(this);
@@ -561,7 +561,7 @@ namespace gcn
void Widget::releaseModalMouseInputFocus()
{
- if (mFocusHandler == NULL)
+ if (!mFocusHandler)
return;
mFocusHandler->releaseModalMouseInputFocus(this);
@@ -569,7 +569,7 @@ namespace gcn
bool Widget::isModalFocused() const
{
- if (mFocusHandler == NULL)
+ if (!mFocusHandler)
{
throw GCN_EXCEPTION("No focushandler set (did you add "
"the widget to the gui?).");
@@ -586,7 +586,7 @@ namespace gcn
bool Widget::isModalMouseInputFocused() const
{
- if (mFocusHandler == NULL)
+ if (!mFocusHandler)
{
throw GCN_EXCEPTION("No focushandler set (did you add "
"the widget to the gui?).");
@@ -603,7 +603,7 @@ namespace gcn
Widget *Widget::getWidgetAt(int x A_UNUSED, int y A_UNUSED)
{
- return NULL;
+ return nullptr;
}
const std::list<MouseListener*>& Widget::_getMouseListeners()
@@ -712,7 +712,7 @@ namespace gcn
void Widget::showPart(Rectangle rectangle)
{
- if (mParent != NULL)
+ if (mParent)
mParent->showWidgetPart(this, rectangle);
}
}
diff --git a/src/guichan/widgets/dropdown.cpp b/src/guichan/widgets/dropdown.cpp
index 3ecbd75d8..17513931f 100644
--- a/src/guichan/widgets/dropdown.cpp
+++ b/src/guichan/widgets/dropdown.cpp
@@ -68,8 +68,8 @@ namespace gcn
setInternalFocusHandler(&mInternalFocusHandler);
- mInternalScrollArea = (scrollArea == NULL);
- mInternalListBox = (listBox == NULL);
+ mInternalScrollArea = (!scrollArea);
+ mInternalListBox = (!listBox);
if (mInternalScrollArea)
mScrollArea = new ScrollArea();
@@ -110,16 +110,16 @@ namespace gcn
if (mInternalScrollArea)
{
delete mScrollArea;
- mScrollArea = 0;
+ mScrollArea = nullptr;
}
if (mInternalListBox)
{
delete mListBox;
- mListBox = 0;
+ mListBox = nullptr;
}
- setInternalFocusHandler(NULL);
+ setInternalFocusHandler(nullptr);
}
int DropDown::getSelected() const
@@ -223,10 +223,10 @@ namespace gcn
void DropDown::adjustHeight()
{
- if (mScrollArea == NULL)
+ if (!mScrollArea)
throw GCN_EXCEPTION("Scroll area has been deleted.");
- if (mListBox == NULL)
+ if (!mListBox)
throw GCN_EXCEPTION("List box has been deleted.");
int listBoxHeight = mListBox->getHeight();
@@ -296,7 +296,7 @@ namespace gcn
void DropDown::death(const Event& event)
{
if (event.getSource() == mScrollArea)
- mScrollArea = NULL;
+ mScrollArea = nullptr;
BasicContainer::death(event);
}
diff --git a/src/guichan/widgets/icon.cpp b/src/guichan/widgets/icon.cpp
index 2983c7c29..13a9f1309 100644
--- a/src/guichan/widgets/icon.cpp
+++ b/src/guichan/widgets/icon.cpp
@@ -56,14 +56,14 @@
namespace gcn
{
Icon::Icon()
- : mImage(0)
+ : mImage(nullptr)
, mInternalImage(false)
{
setSize(0, 0);
}
Icon::Icon(const std::string& filename)
- : mImage(0),
+ : mImage(nullptr),
mInternalImage(false)
{
mImage = Image::load(filename);
@@ -85,7 +85,7 @@ namespace gcn
if (mInternalImage)
{
delete mImage;
- mImage = 0;
+ mImage = nullptr;
}
}
@@ -107,7 +107,7 @@ namespace gcn
void Icon::draw(Graphics* graphics)
{
- if (mImage != NULL)
+ if (mImage)
{
const int x = (getWidth() - mImage->getWidth()) / 2;
const int y = (getHeight() - mImage->getHeight()) / 2;
diff --git a/src/guichan/widgets/imagebutton.cpp b/src/guichan/widgets/imagebutton.cpp
index 2f4c5dcde..feeed795d 100644
--- a/src/guichan/widgets/imagebutton.cpp
+++ b/src/guichan/widgets/imagebutton.cpp
@@ -55,7 +55,7 @@
namespace gcn
{
ImageButton::ImageButton() :
- mImage(0),
+ mImage(nullptr),
mInternalImage(false)
{
setWidth(0);
@@ -63,7 +63,7 @@ namespace gcn
}
ImageButton::ImageButton(const std::string& filename) :
- mImage(0),
+ mImage(nullptr),
mInternalImage(false)
{
mImage = Image::load(filename);
@@ -85,7 +85,7 @@ namespace gcn
if (mInternalImage)
{
delete mImage;
- mImage = 0;
+ mImage = nullptr;
}
}
@@ -94,7 +94,7 @@ namespace gcn
if (mInternalImage)
{
delete mImage;
- mImage = 0;
+ mImage = nullptr;
}
mImage = image;
diff --git a/src/guichan/widgets/listbox.cpp b/src/guichan/widgets/listbox.cpp
index 95f04fc68..80989cc72 100644
--- a/src/guichan/widgets/listbox.cpp
+++ b/src/guichan/widgets/listbox.cpp
@@ -61,7 +61,7 @@ namespace gcn
{
ListBox::ListBox() :
mSelected(-1),
- mListModel(NULL),
+ mListModel(nullptr),
mWrappingEnabled(false)
{
setWidth(100);
@@ -88,7 +88,7 @@ namespace gcn
graphics->setColor(getBackgroundColor());
graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight()));
- if (mListModel == NULL)
+ if (!mListModel)
return;
graphics->setColor(getForegroundColor());
@@ -161,7 +161,7 @@ namespace gcn
void ListBox::setSelected(int selected)
{
- if (mListModel == NULL)
+ if (!mListModel)
{
mSelected = -1;
}
@@ -286,7 +286,7 @@ namespace gcn
void ListBox::adjustSize()
{
- if (mListModel != NULL)
+ if (mListModel)
setHeight(getRowHeight() * mListModel->getNumberOfElements());
}
diff --git a/src/guichan/widgets/scrollarea.cpp b/src/guichan/widgets/scrollarea.cpp
index 7dc7566c0..574308b7c 100644
--- a/src/guichan/widgets/scrollarea.cpp
+++ b/src/guichan/widgets/scrollarea.cpp
@@ -138,12 +138,12 @@ namespace gcn
ScrollArea::~ScrollArea()
{
- setContent(NULL);
+ setContent(nullptr);
}
void ScrollArea::setContent(Widget* widget)
{
- if (widget != NULL)
+ if (widget)
{
clear();
add(widget);
@@ -162,7 +162,7 @@ namespace gcn
if (!mWidgets.empty())
return *mWidgets.begin();
- return NULL;
+ return nullptr;
}
void ScrollArea::setHorizontalScrollPolicy(ScrollPolicy hPolicy)
@@ -240,7 +240,7 @@ namespace gcn
{
checkPolicies();
- if (getContent() == NULL)
+ if (!getContent())
return 0;
int value = getContent()->getWidth() - getChildrenArea().width +
@@ -256,7 +256,7 @@ namespace gcn
{
checkPolicies();
- if (getContent() == NULL)
+ if (!getContent())
return 0;
int value;
@@ -790,7 +790,7 @@ namespace gcn
setVerticalScrollAmount(getVerticalScrollAmount());
setHorizontalScrollAmount(getHorizontalScrollAmount());
- if (getContent() != NULL)
+ if (getContent())
{
getContent()->setPosition(-mHScroll + getContent()->getFrameSize(),
-mVScroll + getContent()->getFrameSize());
@@ -1126,7 +1126,7 @@ namespace gcn
if (getChildrenArea().isPointInRect(x, y))
return getContent();
- return NULL;
+ return nullptr;
}
void ScrollArea::mouseWheelMovedUp(MouseEvent& mouseEvent)
diff --git a/src/guichan/widgets/tab.cpp b/src/guichan/widgets/tab.cpp
index 9b7424748..768e2c695 100644
--- a/src/guichan/widgets/tab.cpp
+++ b/src/guichan/widgets/tab.cpp
@@ -59,7 +59,7 @@ namespace gcn
{
Tab::Tab() :
mHasMouse(false),
- mTabbedArea(NULL)
+ mTabbedArea(nullptr)
{
mLabel = new Label();
mLabel->setPosition(4, 4);
@@ -71,7 +71,7 @@ namespace gcn
Tab::~Tab()
{
delete mLabel;
- mLabel = 0;
+ mLabel = nullptr;
}
void Tab::adjustSize()
@@ -79,7 +79,7 @@ namespace gcn
setSize(mLabel->getWidth() + 8,
mLabel->getHeight() + 8);
- if (mTabbedArea != NULL)
+ if (mTabbedArea)
mTabbedArea->adjustTabPositions();
}
diff --git a/src/guichan/widgets/tabbedarea.cpp b/src/guichan/widgets/tabbedarea.cpp
index 3c556eeca..4ee164778 100644
--- a/src/guichan/widgets/tabbedarea.cpp
+++ b/src/guichan/widgets/tabbedarea.cpp
@@ -62,7 +62,7 @@
namespace gcn
{
TabbedArea::TabbedArea() :
- mSelectedTab(NULL),
+ mSelectedTab(nullptr),
mOpaque(false)
{
setFocusable(true);
@@ -83,14 +83,14 @@ namespace gcn
remove(mWidgetContainer);
delete mTabContainer;
- mTabContainer = 0;
+ mTabContainer = nullptr;
delete mWidgetContainer;
- mWidgetContainer = 0;
+ mWidgetContainer = nullptr;
for (unsigned int i = 0; i < mTabsToDelete.size(); i++)
{
delete mTabsToDelete[i];
- mTabsToDelete[i] = 0;
+ mTabsToDelete[i] = nullptr;
}
}
@@ -102,7 +102,7 @@ namespace gcn
mTabContainer->add(tab);
mTabs.push_back(std::pair<Tab*, Widget*>(tab, widget));
- if (mSelectedTab == NULL)
+ if (!mSelectedTab)
setSelectedTab(tab);
adjustTabPositions();
@@ -224,7 +224,7 @@ namespace gcn
// If a tab is selected, remove the line right underneath
// the selected tab.
- if (mSelectedTab != NULL)
+ if (mSelectedTab)
{
graphics->setColor(getBaseColor());
graphics->drawLine(mSelectedTab->getX() + 1,
@@ -332,7 +332,7 @@ namespace gcn
{
Tab* tab = dynamic_cast<Tab*>(event.getSource());
- if (tab != NULL)
+ if (tab)
removeTab(tab);
else
BasicContainer::death(event);
@@ -343,7 +343,7 @@ namespace gcn
Widget* source = actionEvent.getSource();
Tab* tab = dynamic_cast<Tab*>(source);
- if (tab == NULL)
+ if (!tab)
{
throw GCN_EXCEPTION("Received an action from a "
"widget that's not a tab!");
diff --git a/src/guichan/widgets/textbox.cpp b/src/guichan/widgets/textbox.cpp
index 35fbf5437..7b5b03ab8 100644
--- a/src/guichan/widgets/textbox.cpp
+++ b/src/guichan/widgets/textbox.cpp
@@ -270,7 +270,7 @@ namespace gcn
{
Widget* par = getParent();
- if (par != NULL)
+ if (par)
{
int rowsPerPage = par->getChildrenArea().height
/ getFont()->getHeight();
@@ -284,7 +284,7 @@ namespace gcn
{
Widget* par = getParent();
- if (par != NULL)
+ if (par)
{
int rowsPerPage = par->getChildrenArea().height
/ getFont()->getHeight();
diff --git a/src/guichan/widgets/window.cpp b/src/guichan/widgets/window.cpp
index 550b23749..1c46b2283 100644
--- a/src/guichan/widgets/window.cpp
+++ b/src/guichan/widgets/window.cpp
@@ -130,7 +130,7 @@ namespace gcn
if (mouseEvent.getSource() != this)
return;
- if (getParent() != NULL)
+ if (getParent())
getParent()->moveToTop(this);
mDragOffsetX = mouseEvent.getX();
diff --git a/src/guild.cpp b/src/guild.cpp
index a2b85b6c1..0e629e2be 100644
--- a/src/guild.cpp
+++ b/src/guild.cpp
@@ -129,7 +129,7 @@ GuildMember *Guild::getMember(int id) const
++itr;
}
- return NULL;
+ return nullptr;
}
GuildMember *Guild::getMember(int accountId, int charId) const
@@ -143,7 +143,7 @@ GuildMember *Guild::getMember(int accountId, int charId) const
++itr;
}
- return NULL;
+ return nullptr;
}
GuildMember *Guild::getMember(const std::string &name) const
@@ -157,7 +157,7 @@ GuildMember *Guild::getMember(const std::string &name) const
++itr;
}
- return NULL;
+ return nullptr;
}
void Guild::removeMember(GuildMember *member)
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index 3e387ba64..0079ee2ee 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -477,7 +477,7 @@ bool KeyboardConfig::isKeyActive(int index) const
void KeyboardConfig::refreshActiveKeys()
{
- mActiveKeys = SDL_GetKeyState(NULL);
+ mActiveKeys = SDL_GetKeyState(nullptr);
}
std::string KeyboardConfig::getKeyValueString(int index) const
diff --git a/src/localconsts.h b/src/localconsts.h
new file mode 100644
index 000000000..cd7fcd955
--- /dev/null
+++ b/src/localconsts.h
@@ -0,0 +1,24 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+#undef nullptr
+#define nullptr 0
+#endif
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index a776f0165..a6289d9bb 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -89,7 +89,7 @@
const short walkingKeyboardDelay = 1000;
const short awayLimitTimer = 60;
-LocalPlayer *player_node = NULL;
+LocalPlayer *player_node = nullptr;
extern std::list<BeingCacheEntry*> beingInfoCache;
extern OkDialog *weightNotice;
@@ -101,10 +101,10 @@ LocalPlayer::LocalPlayer(int id, int subtype):
Being(id, PLAYER, subtype, 0),
mTargetTime(-1),
mLastTarget(-1),
- mTarget(NULL),
+ mTarget(nullptr),
mPlayerFollowed(""),
mPlayerImitated(""),
- mPickUpTarget(NULL),
+ mPickUpTarget(nullptr),
mGoingToTarget(false), mKeepAttacking(false),
mLastAction(-1),
mWalkingDir(0),
@@ -305,7 +305,7 @@ void LocalPlayer::logic()
if (get_elapsed_time(mTargetTime) >= 60000)
{
mTargetTime = tick_time;
-// setTarget(NULL);
+// setTarget(nullptr);
mLastTarget = -1;
}
@@ -384,7 +384,7 @@ void LocalPlayer::setAction(Action action, int attackType)
debugMsg(_("You were killed by ") + mLastHitFrom);
mLastHitFrom = "";
}
- setTarget(NULL);
+ setTarget(nullptr);
}
Being::setAction(action, attackType);
@@ -942,7 +942,7 @@ bool LocalPlayer::pickUp(FloorItem *item)
if (dx * dx + dy * dy < dist)
{
Net::getPlayerHandler()->pickUp(item);
- mPickUpTarget = NULL;
+ mPickUpTarget = nullptr;
}
else if (mPickUpType >= 4 && mPickUpType <= 6)
{
@@ -1408,7 +1408,7 @@ void LocalPlayer::untarget()
setAction(STAND);
if (mTarget)
- setTarget(NULL);
+ setTarget(nullptr);
mKeepAttacking = false;
mLastTarget = -1;
@@ -1948,7 +1948,7 @@ void LocalPlayer::changeEquipmentBeforeAttack(Being* target)
bool allowSword = false;
int dx = target->getTileX() - mX;
int dy = target->getTileY() - mY;
- Item *item = NULL;
+ Item *item = nullptr;
if (dx * dx + dy * dy > 80)
return;
diff --git a/src/localplayer.h b/src/localplayer.h
index 4183f2d1b..08ebbe841 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -28,6 +28,7 @@
#include "client.h"
#include "game.h"
#include "listener.h"
+#include "localconsts.h"
#include "gui/userpalette.h"
@@ -136,10 +137,10 @@ class LocalPlayer : public Being, public ActorSpriteListener,
int getAttackRange2();
- void attack(Being *target = NULL, bool keep = false,
+ void attack(Being *target = nullptr, bool keep = false,
bool dontChangeEquipment = false);
- void attack2(Being *target = NULL, bool keep = false,
+ void attack2(Being *target = nullptr, bool keep = false,
bool dontChangeEquipment = false);
void setGMLevel(int level);
@@ -422,7 +423,7 @@ class LocalPlayer : public Being, public ActorSpriteListener,
{ return mPickUpTarget; }
void unSetPickUpTarget()
- { mPickUpTarget = 0; }
+ { mPickUpTarget = nullptr; }
/**
* Stop following a player.
diff --git a/src/logger.cpp b/src/logger.cpp
index 8ce92c6d6..129a8a884 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -43,7 +43,7 @@
Logger::Logger():
mLogToStandardOut(true),
- mChatWindow(NULL),
+ mChatWindow(nullptr),
mDebugLog(false)
{
}
@@ -80,7 +80,7 @@ void Logger::dlog(std::string str)
// Get the current system time
timeval tv;
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, nullptr);
// Print the log entry
std::stringstream timeStr;
@@ -112,7 +112,7 @@ void Logger::log1(const char *buf)
{
// Get the current system time
timeval tv;
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, nullptr);
// Print the log entry
std::stringstream timeStr;
@@ -158,7 +158,7 @@ void Logger::log(const char *log_text, ...)
// Get the current system time
timeval tv;
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, nullptr);
// Print the log entry
std::stringstream timeStr;
@@ -193,17 +193,17 @@ void Logger::error(const std::string &error_text)
{
log("Error: %s", error_text.c_str());
#ifdef WIN32
- MessageBox(NULL, error_text.c_str(), "Error", MB_ICONERROR | MB_OK);
+ MessageBox(nullptr, error_text.c_str(), "Error", MB_ICONERROR | MB_OK);
#elif defined __APPLE__
// Str255 msg;
// CFStringRef error;
-// error = CFStringCreateWithCString(NULL,
+// error = CFStringCreateWithCString(nullptr,
// error_text.c_str(),
// kCFStringEncodingMacRoman);
// CFStringGetPascalString(error, msg, 255, kCFStringEncodingMacRoman);
// StandardAlert(kAlertStopAlert,
// (const unsigned char*)"\pError",
-// (ConstStr255Param) msg, NULL, NULL);
+// (ConstStr255Param) msg, nullptr, nullptr);
#elif defined __linux__ || __linux
std::cerr << "Error: " << error_text << std::endl;
std::string msg = "xmessage \"" + error_text + "\"";
diff --git a/src/main.cpp b/src/main.cpp
index be3140c99..166aab2b1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -112,7 +112,7 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
while (optind < argc)
{
- int result = getopt_long(argc, argv, optstring, long_options, NULL);
+ int result = getopt_long(argc, argv, optstring, long_options, nullptr);
if (result == -1)
break;
@@ -204,7 +204,7 @@ static void initXML()
LIBXML_TEST_VERSION;
// Suppress libxml2 error messages
- xmlSetGenericErrorFunc(NULL, xmlNullLogger);
+ xmlSetGenericErrorFunc(nullptr, xmlNullLogger);
}
diff --git a/src/map.cpp b/src/map.cpp
index dc742d6bb..676c01a48 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -90,7 +90,7 @@ class ActorFunctuator
} actorCompare;
TileAnimation::TileAnimation(Animation *ani):
- mLastImage(NULL)
+ mLastImage(nullptr)
{
mAnimation = new SimpleAnimation(ani);
}
@@ -1807,7 +1807,7 @@ TileAnimation *Map::getAnimationForGid(int gid) const
std::map<int, TileAnimation*>::const_iterator
i = mTileAnimations.find(gid);
- return (i == mTileAnimations.end()) ? NULL : i->second;
+ return (i == mTileAnimations.end()) ? nullptr : i->second;
}
void Map::setPvpMode(int mode)
diff --git a/src/mumblemanager.cpp b/src/mumblemanager.cpp
index 2b3f15afa..fd95a67f9 100644
--- a/src/mumblemanager.cpp
+++ b/src/mumblemanager.cpp
@@ -86,7 +86,7 @@ void MumbleManager::init()
#ifdef WIN32
HANDLE hMapObject = OpenFileMappingW(FILE_MAP_ALL_ACCESS,
FALSE, L"MumbleLink");
- if (hMapObject == NULL)
+ if (!hMapObject)
{
logger->log1("MumbleManager::init can't open MumbleLink");
return;
@@ -95,10 +95,10 @@ void MumbleManager::init()
mLinkedMem = (LinkedMem *) MapViewOfFile(hMapObject,
FILE_MAP_ALL_ACCESS, 0, 0, sizeof(LinkedMem));
- if (mLinkedMem == NULL)
+ if (!mLinkedMem)
{
CloseHandle(hMapObject);
- hMapObject = NULL;
+ hMapObject = nullptr;
logger->log1("MumbleManager::init can't map MumbleLink");
return;
}
@@ -116,12 +116,12 @@ void MumbleManager::init()
return;
}
- mLinkedMem = static_cast<LinkedMem *>(mmap(NULL, sizeof(struct LinkedMem),
+ mLinkedMem = static_cast<LinkedMem *>(mmap(nullptr, sizeof(struct LinkedMem),
PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, 0));
if (mLinkedMem == reinterpret_cast<void *>(-1))
{
- mLinkedMem = NULL;
+ mLinkedMem = nullptr;
logger->log1("MumbleManager::init can't map MumbleLink");
return;
}
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 969318b19..dcce218a9 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -53,12 +53,12 @@ Download::Download(void *ptr, const std::string &url,
mPtr(ptr),
mUrl(url),
mFileName(""),
- mWriteFunction(NULL),
+ mWriteFunction(nullptr),
mAdler(0),
mUpdateFunction(updateFunction),
- mThread(NULL),
- mCurl(NULL),
- mHeaders(NULL),
+ mThread(nullptr),
+ mCurl(nullptr),
+ mHeaders(nullptr),
mIgnoreError(ignoreError)
{
mError = static_cast<char*>(calloc(CURL_ERROR_SIZE + 1, 1));
@@ -158,9 +158,9 @@ void Download::cancel()
mOptions.cancel = true;
if (mThread && SDL_GetThreadID(mThread))
- SDL_WaitThread(mThread, NULL);
+ SDL_WaitThread(mThread, nullptr);
- mThread = NULL;
+ mThread = nullptr;
}
char *Download::getError()
@@ -204,14 +204,14 @@ int Download::downloadThread(void *ptr)
while (attempts < 3 && !complete && !d->mOptions.cancel)
{
- FILE *file = NULL;
+ FILE *file = nullptr;
d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_STARTING, 0, 0);
if (d->mOptions.cancel)
{
//need terminate thread?
- d->mThread = NULL;
+ d->mThread = nullptr;
return 0;
}
@@ -335,7 +335,7 @@ int Download::downloadThread(void *ptr)
if (d->mOptions.cancel)
{
//need ternibate thread?
- d->mThread = NULL;
+ d->mThread = nullptr;
return 0;
}
attempts++;
@@ -354,7 +354,7 @@ int Download::downloadThread(void *ptr)
d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_COMPLETE, 0, 0);
}
- d->mThread = NULL;
+ d->mThread = nullptr;
return 0;
}
diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp
index a202cbc86..b74f2384d 100644
--- a/src/net/ea/gamehandler.cpp
+++ b/src/net/ea/gamehandler.cpp
@@ -96,7 +96,7 @@ void GameHandler::processCharSwitchResponse(Net::MessageIn &msg)
void GameHandler::processMapQuitResponse(Net::MessageIn &msg)
{
if (msg.readInt8())
- new OkDialog(_("Game"), _("Request to quit denied!"), NULL);
+ new OkDialog(_("Game"), _("Request to quit denied!"), nullptr);
}
} // namespace Ea
diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h
index 3a99bc47f..72b993c4b 100644
--- a/src/net/ea/inventoryhandler.h
+++ b/src/net/ea/inventoryhandler.h
@@ -25,6 +25,7 @@
#include "equipment.h"
#include "inventory.h"
+#include "localconsts.h"
#include "logger.h"
#include "playerinfo.h"
@@ -58,7 +59,7 @@ class EquipBackend : public Equipment::Backend
{
int invyIndex = mEquipment[index];
if (invyIndex == -1)
- return NULL;
+ return nullptr;
if (PlayerInfo::getInventory())
return PlayerInfo::getInventory()->getItem(invyIndex);
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 3009426ae..02af3dbb4 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -59,7 +59,7 @@ namespace
{
void action(const gcn::ActionEvent &event A_UNUSED)
{
- weightNotice = NULL;
+ weightNotice = nullptr;
}
} weightListener;
@@ -72,7 +72,7 @@ namespace
{
if (Net::getPlayerHandler())
Net::getPlayerHandler()->respawn();
- deathNotice = NULL;
+ deathNotice = nullptr;
Game::closeDialogs();
diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp
index b83bc5748..3303934bd 100644
--- a/src/net/manaserv/network.cpp
+++ b/src/net/manaserv/network.cpp
@@ -56,9 +56,9 @@ void initialize()
}
#if defined(ENET_VERSION) && ENET_VERSION >= ENET_CUTOFF
- client = enet_host_create(NULL, 3, 0, 0, 0);
+ client = enet_host_create(nullptr, 3, 0, 0, 0);
#else
- client = enet_host_create(NULL, 3, 0, 0);
+ client = enet_host_create(nullptr, 3, 0, 0);
#endif
if (!client)
diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp
index 987a40dc5..660657f44 100644
--- a/src/net/manaserv/partyhandler.cpp
+++ b/src/net/manaserv/partyhandler.cpp
@@ -96,7 +96,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
if (msg.readInt8() == ERRMSG_OK)
{
mParty->clearMembers();
- player_node->setParty(NULL);
+ player_node->setParty(nullptr);
}
} break;
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 49bb58903..933f7686b 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -48,21 +48,21 @@
#include "debug.h"
-Net::AdminHandler *adminHandler = NULL;
-Net::CharHandler *charHandler = NULL;
-Net::ChatHandler *chatHandler = NULL;
-Net::GeneralHandler *generalHandler = NULL;
-Net::InventoryHandler *inventoryHandler = NULL;
-Net::LoginHandler *loginHandler = NULL;
-Net::GameHandler *gameHandler = NULL;
-Net::GuildHandler *guildHandler = NULL;
-Net::NpcHandler *npcHandler = NULL;
-Net::PartyHandler *partyHandler = NULL;
-Net::PlayerHandler *playerHandler = NULL;
-Net::SpecialHandler *specialHandler = NULL;
-Net::TradeHandler *tradeHandler = NULL;
-Net::BeingHandler *beingHandler = NULL;
-Net::BuySellHandler *buySellHandler = NULL;
+Net::AdminHandler *adminHandler = nullptr;
+Net::CharHandler *charHandler = nullptr;
+Net::ChatHandler *chatHandler = nullptr;
+Net::GeneralHandler *generalHandler = nullptr;
+Net::InventoryHandler *inventoryHandler = nullptr;
+Net::LoginHandler *loginHandler = nullptr;
+Net::GameHandler *gameHandler = nullptr;
+Net::GuildHandler *guildHandler = nullptr;
+Net::NpcHandler *npcHandler = nullptr;
+Net::PartyHandler *partyHandler = nullptr;
+Net::PlayerHandler *playerHandler = nullptr;
+Net::SpecialHandler *specialHandler = nullptr;
+Net::TradeHandler *tradeHandler = nullptr;
+Net::BeingHandler *beingHandler = nullptr;
+Net::BuySellHandler *buySellHandler = nullptr;
Net::AdminHandler *Net::getAdminHandler()
{
@@ -151,13 +151,13 @@ void connectToServer(const ServerInfo &server)
// that
}
- if (networkType == server.type && getGeneralHandler() != NULL)
+ if (networkType == server.type && getGeneralHandler())
{
getGeneralHandler()->reload();
}
else
{
- if (networkType != ServerInfo::UNKNOWN && getGeneralHandler() != NULL)
+ if (networkType != ServerInfo::UNKNOWN && getGeneralHandler())
getGeneralHandler()->unload();
switch (server.type)
diff --git a/src/net/tmwa/messagehandler.cpp b/src/net/tmwa/messagehandler.cpp
index 843339718..830b3bc4f 100644
--- a/src/net/tmwa/messagehandler.cpp
+++ b/src/net/tmwa/messagehandler.cpp
@@ -32,7 +32,7 @@ namespace TmwAthena
{
MessageHandler::MessageHandler()
- : mNetwork(NULL)
+ : mNetwork(nullptr)
{
}
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index e26f48324..6f26035be 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -181,8 +181,8 @@ void Network::disconnect()
if (mWorkerThread && SDL_GetThreadID(mWorkerThread))
{
- SDL_WaitThread(mWorkerThread, NULL);
- mWorkerThread = NULL;
+ SDL_WaitThread(mWorkerThread, nullptr);
+ mWorkerThread = nullptr;
}
if (mSocket)
diff --git a/src/particle.cpp b/src/particle.cpp
index 874e49d9a..e71791ce8 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -73,7 +73,7 @@ Particle::Particle(Map *map):
mRandomness(0),
mBounce(0.0f),
mFollow(false),
- mTarget(NULL),
+ mTarget(nullptr),
mAcceleration(0.0f),
mInvDieDistance(-1.0f),
mMomentum(1.0f)
@@ -283,7 +283,7 @@ Particle *Particle::createChild()
Particle *Particle::addEffect(const std::string &particleEffectFile,
int pixelX, int pixelY, int rotation)
{
- Particle *newParticle = NULL;
+ Particle *newParticle = nullptr;
std::string::size_type pos = particleEffectFile.find('|');
std::string dyePalettes;
@@ -296,7 +296,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "effect"))
{
logger->log("Error loading particle: %s", particleEffectFile.c_str());
- return NULL;
+ return nullptr;
}
ResourceManager *resman = ResourceManager::getInstance();
diff --git a/src/particle.h b/src/particle.h
index 7220ad258..0a4a2253d 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -76,7 +76,7 @@ class Particle : public Actor
/**
* Constructor.
*
- * @param map the map this particle will add itself to, may be NULL
+ * @param map the map this particle will add itself to, may be nullptr
*/
Particle(Map *map);
diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp
index 5f5b1b257..c839e3c8d 100644
--- a/src/particlecontainer.cpp
+++ b/src/particlecontainer.cpp
@@ -139,7 +139,7 @@ void ParticleVector::setLocally(int index, Particle *particle)
delLocally(index);
if (mIndexedElements.size() <= static_cast<unsigned>(index))
- mIndexedElements.resize(index + 1, NULL);
+ mIndexedElements.resize(index + 1, nullptr);
if (particle)
particle->disableAutoDelete();
@@ -157,7 +157,7 @@ void ParticleVector::delLocally(int index)
Particle *p = mIndexedElements[index];
if (p)
{
- mIndexedElements[index] = NULL;
+ mIndexedElements[index] = nullptr;
p->kill();
}
}
@@ -182,7 +182,7 @@ void ParticleVector::moveTo(float x, float y)
if ((*it)->isExtinct())
{
(*it)->kill();
- *it = NULL;
+ *it = nullptr;
}
}
}
diff --git a/src/particlecontainer.h b/src/particlecontainer.h
index 27b52f592..75cda83fc 100644
--- a/src/particlecontainer.h
+++ b/src/particlecontainer.h
@@ -26,6 +26,8 @@
#include <list>
#include <vector>
+#include "localconsts.h"
+
class Particle;
/**
@@ -42,7 +44,7 @@ public:
*
* delParent means that the destructor should also free the parent.
*/
- ParticleContainer(ParticleContainer *parent = NULL, bool delParent = true);
+ ParticleContainer(ParticleContainer *parent = nullptr, bool delParent = true);
virtual ~ParticleContainer();
/**
@@ -71,7 +73,7 @@ protected:
class ParticleList : public ParticleContainer
{
public:
- ParticleList(ParticleContainer *parent = NULL, bool delParent = true);
+ ParticleList(ParticleContainer *parent = nullptr, bool delParent = true);
virtual ~ParticleList();
/**
@@ -98,7 +100,7 @@ protected:
class ParticleVector : public ParticleContainer
{
public:
- ParticleVector(ParticleContainer *parent = NULL, bool delParent = true);
+ ParticleVector(ParticleContainer *parent = nullptr, bool delParent = true);
virtual ~ParticleVector();
/**
diff --git a/src/party.cpp b/src/party.cpp
index cb45fa355..6546391cd 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -95,7 +95,7 @@ PartyMember *Party::getMember(int id) const
++itr;
}
- return NULL;
+ return nullptr;
}
PartyMember *Party::getMember(const std::string &name) const
@@ -110,7 +110,7 @@ PartyMember *Party::getMember(const std::string &name) const
++itr;
}
- return NULL;
+ return nullptr;
}
void Party::removeMember(PartyMember *member)
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 8facfdefb..69be97898 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -69,7 +69,7 @@ class PlayerConfSerialiser :
ConfigurationObject *cobj)
{
if (!cobj || !value.second)
- return NULL;
+ return nullptr;
cobj->setValue(NAME, value.first);
cobj->setValue(RELATION, toString(
static_cast<int>(value.second->mRelation)));
diff --git a/src/playerrelations.h b/src/playerrelations.h
index 6cb175ec2..5fabb3d0e 100644
--- a/src/playerrelations.h
+++ b/src/playerrelations.h
@@ -182,7 +182,7 @@ class PlayerRelationsManager
/**
* Return the current player ignore strategy.
*
- * \return A player ignore strategy, or NULL
+ * \return A player ignore strategy, or nullptr
*/
PlayerIgnoreStrategy *getPlayerIgnoreStrategy() const
{ return mIgnoreStrategy; }
diff --git a/src/resources/action.cpp b/src/resources/action.cpp
index a95ebc5e3..c2af3ff9b 100644
--- a/src/resources/action.cpp
+++ b/src/resources/action.cpp
@@ -61,7 +61,7 @@ Animation *Action::getAnimation(int direction) const
i = mAnimations.begin();
}
- return (i == mAnimations.end()) ? NULL : i->second;
+ return (i == mAnimations.end()) ? nullptr : i->second;
}
void Action::setAnimation(int direction, Animation *animation)
diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp
index 32b57b3b1..363e9b2ac 100644
--- a/src/resources/animation.cpp
+++ b/src/resources/animation.cpp
@@ -44,12 +44,12 @@ void Animation::addFrame(Image *image, int delay, int offsetX, int offsetY,
void Animation::addTerminator(int rand)
{
- addFrame(NULL, 0, 0, 0, rand);
+ addFrame(nullptr, 0, 0, 0, rand);
}
bool Animation::isTerminator(const Frame &candidate)
{
- return (candidate.image == NULL && candidate.type == Frame::ANIMATION);
+ return (!candidate.image && candidate.type == Frame::ANIMATION);
}
void Animation::addJump(std::string name, int rand)
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index b7f7d7901..c456c49e4 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -199,7 +199,7 @@ const EmoteInfo *EmoteDB::get(int id, bool allowNull)
if (i == mEmoteInfos.end())
{
if (allowNull)
- return NULL;
+ return nullptr;
logger->log("EmoteDB: Warning, unknown emote ID %d requested", id);
return &mUnknown;
}
@@ -213,7 +213,7 @@ const AnimatedSprite *EmoteDB::getAnimation(int id, bool allowNull)
{
const EmoteInfo *info = get(id, allowNull);
if (!info)
- return NULL;
+ return nullptr;
return info->sprites.front()->sprite;
}
@@ -222,7 +222,7 @@ const EmoteSprite *EmoteDB::getSprite(int id, bool allowNull)
{
const EmoteInfo *info = get(id, allowNull);
if (!info)
- return NULL;
+ return nullptr;
return info->sprites.front();
}
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 8f5ee1d2d..537630a2c 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -128,7 +128,7 @@ Resource *Image::load(void *buffer, unsigned bufferSize)
if (!tmpImage)
{
logger->log("Error, image load failed: %s", IMG_GetError());
- return NULL;
+ return nullptr;
}
Image *image = load(tmpImage);
@@ -145,11 +145,11 @@ Resource *Image::load(void *buffer, unsigned bufferSize, Dye const &dye)
if (!tmpImage)
{
logger->log("Error, image load failed: %s", IMG_GetError());
- return NULL;
+ return nullptr;
}
SDL_PixelFormat rgba;
- rgba.palette = NULL;
+ rgba.palette = nullptr;
rgba.BitsPerPixel = 32;
rgba.BytesPerPixel = 4;
rgba.Rmask = 0xFF000000; rgba.Rloss = 0; rgba.Rshift = 24;
@@ -195,7 +195,7 @@ Image *Image::load(SDL_Surface *tmpImage)
Image *Image::createTextSurface(SDL_Surface *tmpImage, float alpha)
{
if (!tmpImage)
- return NULL;
+ return nullptr;
Image *img;
#ifdef USE_OPENGL
@@ -293,10 +293,10 @@ void Image::unload()
SDLCleanCache();
// Free the image surface.
SDL_FreeSurface(mSDLSurface);
- mSDLSurface = NULL;
+ mSDLSurface = nullptr;
delete[] mAlphaChannel;
- mAlphaChannel = NULL;
+ mAlphaChannel = nullptr;
}
#ifdef USE_OPENGL
@@ -451,7 +451,7 @@ void Image::setAlpha(float alpha)
Image* Image::SDLmerge(Image *image, int x, int y)
{
if (!mSDLSurface || !image || !image->mSDLSurface)
- return NULL;
+ return nullptr;
SDL_Surface* surface = new SDL_Surface(*(image->mSDLSurface));
@@ -543,14 +543,14 @@ Image* Image::SDLgetScaledImage(int width, int height)
{
// No scaling on incorrect new values.
if (width == 0 || height == 0)
- return NULL;
+ return nullptr;
// No scaling when there is ... no different given size ...
if (width == getWidth() && height == getHeight())
- return NULL;
+ return nullptr;
- Image* scaledImage = NULL;
- SDL_Surface* scaledSurface = NULL;
+ Image* scaledImage = nullptr;
+ SDL_Surface* scaledSurface = nullptr;
if (mSDLSurface)
{
@@ -573,7 +573,7 @@ Image* Image::SDLgetScaledImage(int width, int height)
SDL_Surface* Image::convertTo32Bit(SDL_Surface* tmpImage)
{
if (!tmpImage)
- return NULL;
+ return nullptr;
SDL_PixelFormat RGBAFormat;
RGBAFormat.palette = 0;
RGBAFormat.colorkey = 0;
@@ -613,7 +613,7 @@ SDL_Surface* Image::convertTo32Bit(SDL_Surface* tmpImage)
SDL_Surface* Image::SDLDuplicateSurface(SDL_Surface* tmpImage)
{
if (!tmpImage || !tmpImage->format)
- return NULL;
+ return nullptr;
return SDL_ConvertSurface(tmpImage, tmpImage->format, SDL_SWSURFACE);
}
@@ -621,7 +621,7 @@ SDL_Surface* Image::SDLDuplicateSurface(SDL_Surface* tmpImage)
Image *Image::_SDLload(SDL_Surface *tmpImage)
{
if (!tmpImage)
- return NULL;
+ return nullptr;
bool hasAlpha = false;
bool converted = false;
@@ -636,14 +636,14 @@ Image *Image::_SDLload(SDL_Surface *tmpImage)
if (!tmpImage)
{
delete[] alphaChannel;
- return NULL;
+ return nullptr;
}
converted = true;
}
const int sz = tmpImage->w * tmpImage->h;
// Figure out whether the image uses its alpha layer
- if (tmpImage->format->palette == NULL)
+ if (!tmpImage->format->palette)
{
const SDL_PixelFormat * const fmt = tmpImage->format;
if (fmt->Amask)
@@ -713,7 +713,7 @@ Image *Image::_SDLload(SDL_Surface *tmpImage)
Image *Image::_GLload(SDL_Surface *tmpImage)
{
if (!tmpImage)
- return NULL;
+ return nullptr;
// Flush current error flag.
glGetError();
@@ -753,10 +753,10 @@ Image *Image::_GLload(SDL_Surface *tmpImage)
if (!tmpImage)
{
logger->log("Error, image convert failed: out of memory");
- return NULL;
+ return nullptr;
}
- SDL_BlitSurface(oldImage, NULL, tmpImage, NULL);
+ SDL_BlitSurface(oldImage, nullptr, tmpImage, nullptr);
GLuint texture;
glGenTextures(1, &texture);
@@ -811,7 +811,7 @@ Image *Image::_GLload(SDL_Surface *tmpImage)
break;
}
logger->log("Error: Image GL import failed: %s", errmsg.c_str());
- return NULL;
+ return nullptr;
}
return new Image(texture, width, height, realWidth, realHeight);
@@ -939,5 +939,5 @@ Image *SubImage::getSubImage(int x, int y, int w, int h)
if (mParent)
return mParent->getSubImage(mBounds.x + x, mBounds.y + y, w, h);
else
- return NULL;
+ return nullptr;
}
diff --git a/src/resources/image.h b/src/resources/image.h
index 941b34465..333dc63f9 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -23,6 +23,7 @@
#ifndef IMAGE_H
#define IMAGE_H
+#include "localconsts.h"
#include "main.h"
#include "resources/resource.h"
@@ -252,7 +253,7 @@ class Image : public Resource
/** SDL Constructor */
Image(SDL_Surface *image, bool hasAlphaChannel = false,
- Uint8 *alphaChannel = NULL);
+ Uint8 *alphaChannel = nullptr);
/** SDL_Surface to SDL_Surface Image loader */
static Image *_SDLload(SDL_Surface *tmpImage);
diff --git a/src/resources/imageloader.cpp b/src/resources/imageloader.cpp
index 72a839573..d88e633be 100644
--- a/src/resources/imageloader.cpp
+++ b/src/resources/imageloader.cpp
@@ -36,7 +36,8 @@
#endif
ProxyImage::ProxyImage(SDL_Surface *s):
- mImage(NULL), mSDLImage(s)
+ mImage(nullptr),
+ mSDLImage(s)
{
}
@@ -103,7 +104,7 @@ void ProxyImage::convertToDisplayFormat()
SDL_MapRGB(mSDLImage->format, 255, 0, 255));
mImage = ::Image::load(mSDLImage);
SDL_FreeSurface(mSDLImage);
- mSDLImage = NULL;
+ mSDLImage = nullptr;
}
gcn::Image *ImageLoader::load(const std::string &filename, bool convert)
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp
index 5cf3e7d82..09b57be28 100644
--- a/src/resources/imageset.cpp
+++ b/src/resources/imageset.cpp
@@ -62,7 +62,7 @@ Image* ImageSet::get(size_type i) const
{
logger->log("Warning: No sprite %d in this image set",
static_cast<int>(i));
- return NULL;
+ return nullptr;
}
else
{
diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp
index e6f3c8c27..2498f9c31 100644
--- a/src/resources/imagewriter.cpp
+++ b/src/resources/imagewriter.cpp
@@ -60,14 +60,14 @@ bool ImageWriter::writePNG(SDL_Surface *surface, const std::string &filename)
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr)
{
- png_destroy_write_struct(&png_ptr, static_cast<png_infopp>(NULL));
+ png_destroy_write_struct(&png_ptr, static_cast<png_infopp>(nullptr));
logger->log1("Could not create png_info");
return false;
}
if (setjmp(png_jmpbuf(png_ptr)))
{
- png_destroy_write_struct(&png_ptr, static_cast<png_infopp>(NULL));
+ png_destroy_write_struct(&png_ptr, static_cast<png_infopp>(nullptr));
logger->log("problem writing to %s", filename.c_str());
return false;
}
@@ -113,7 +113,7 @@ bool ImageWriter::writePNG(SDL_Surface *surface, const std::string &filename)
delete [] row_pointers;
- png_destroy_write_struct(&png_ptr, static_cast<png_infopp>(NULL));
+ png_destroy_write_struct(&png_ptr, static_cast<png_infopp>(nullptr));
if (SDL_MUSTLOCK(surface))
SDL_UnlockSurface(surface);
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index f702864ea..a6e1074f3 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -102,7 +102,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength,
do
{
- if (strm.next_out == NULL)
+ if (!strm.next_out)
{
inflateEnd(&strm);
return Z_MEM_ERROR;
@@ -128,7 +128,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength,
{
out = static_cast<unsigned char*>(realloc(out, bufferSize * 2));
- if (out == NULL)
+ if (!out)
{
inflateEnd(&strm);
return Z_MEM_ERROR;
@@ -153,7 +153,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength,
unsigned int outLength = 0;
int ret = inflateMemory(in, inLength, out, outLength);
- if (ret != Z_OK || out == NULL)
+ if (ret != Z_OK || !out)
{
if (ret == Z_MEM_ERROR)
{
@@ -173,7 +173,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength,
}
free(out);
- out = NULL;
+ out = nullptr;
outLength = 0;
}
@@ -188,12 +188,12 @@ Map *MapReader::readMap(const std::string &filename,
ResourceManager *resman = ResourceManager::getInstance();
int fileSize;
void *buffer = resman->loadFile(realFilename, fileSize);
- Map *map = NULL;
+ Map *map = nullptr;
- if (buffer == NULL)
+ if (!buffer)
{
logger->log("Map file not found (%s)", realFilename.c_str());
- return NULL;
+ return nullptr;
}
unsigned char *inflated;
@@ -207,11 +207,11 @@ Map *MapReader::readMap(const std::string &filename,
fileSize, inflated);
free(buffer);
- if (inflated == NULL)
+ if (!inflated)
{
logger->log("Could not decompress map file (%s)",
realFilename.c_str());
- return NULL;
+ return nullptr;
}
}
else
@@ -651,13 +651,13 @@ Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path,
Map *map)
{
if (!map)
- return NULL;
+ return nullptr;
int firstGid = XML::getProperty(node, "firstgid", 0);
int margin = XML::getProperty(node, "margin", 0);
int spacing = XML::getProperty(node, "spacing", 0);
- XML::Document* doc = NULL;
- Tileset *set = NULL;
+ XML::Document* doc = nullptr;
+ Tileset *set = nullptr;
std::string pathDir(path);
if (xmlHasProp(node, BAD_CAST "source"))
diff --git a/src/resources/music.cpp b/src/resources/music.cpp
index 5ae9a2202..099d030b0 100644
--- a/src/resources/music.cpp
+++ b/src/resources/music.cpp
@@ -54,7 +54,7 @@ Resource *Music::load(void *buffer, unsigned bufferSize)
else
{
logger->log("Error, failed to load music: %s", Mix_GetError());
- return NULL;
+ return nullptr;
}
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index fcba17812..af9f664d4 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -48,7 +48,7 @@
#include "debug.h"
-ResourceManager *ResourceManager::instance = NULL;
+ResourceManager *ResourceManager::instance = nullptr;
ResourceManager::ResourceManager() :
mOldestOrphan(0),
@@ -177,7 +177,7 @@ void ResourceManager::cleanUp(Resource *res)
void ResourceManager::cleanOrphans(bool always)
{
timeval tv;
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, nullptr);
// Delete orphaned resources after 30 seconds.
time_t oldest = tv.tv_sec, threshold = oldest - 30;
@@ -324,7 +324,7 @@ std::string ResourceManager::getPath(const std::string &file)
const char* tmp = PHYSFS_getRealDir(file.c_str());
std::string path;
- // if the file is not in the search path, then its NULL
+ // if the file is not in the search path, then its nullptr
if (tmp)
{
path = std::string(tmp) + "/" + file;
@@ -388,7 +388,7 @@ Resource *ResourceManager::get(const std::string &idPath, generator fun,
logger->log("Error loaging image: " + idPath);
}
- // Returns NULL if the object could not be created.
+ // Returns nullptr if the object could not be created.
return resource;
}
@@ -400,14 +400,14 @@ struct ResourceLoader
static Resource *load(void *v)
{
if (!v)
- return NULL;
+ return nullptr;
ResourceLoader *l = static_cast< ResourceLoader * >(v);
int fileSize;
if (!l->manager)
- return NULL;
+ return nullptr;
void *buffer = l->manager->loadFile(l->path, fileSize);
if (!buffer)
- return NULL;
+ return nullptr;
Resource *res = l->fun(buffer, fileSize);
free(buffer);
return res;
@@ -437,15 +437,15 @@ struct DyedImageLoader
static Resource *load(void *v)
{
if (!v)
- return NULL;
+ return nullptr;
DyedImageLoader *l = static_cast< DyedImageLoader * >(v);
if (!l->manager)
- return NULL;
+ return nullptr;
std::string path = l->path;
std::string::size_type p = path.find('|');
- Dye *d = NULL;
+ Dye *d = nullptr;
if (p != std::string::npos)
{
d = new Dye(path.substr(p + 1));
@@ -495,15 +495,15 @@ struct ImageSetLoader
static Resource *load(void *v)
{
if (!v)
- return NULL;
+ return nullptr;
ImageSetLoader *l = static_cast< ImageSetLoader * >(v);
if (!l->manager)
- return NULL;
+ return nullptr;
Image *img = l->manager->getImage(l->path);
if (!img)
- return NULL;
+ return nullptr;
ImageSet *res = new ImageSet(img, l->w, l->h);
img->decRef();
return res;
@@ -526,7 +526,7 @@ struct SpriteDefLoader
static Resource *load(void *v)
{
if (!v)
- return NULL;
+ return nullptr;
SpriteDefLoader *l = static_cast< SpriteDefLoader * >(v);
return SpriteDef::load(l->path, l->variant);
@@ -552,7 +552,7 @@ void ResourceManager::release(Resource *res)
assert(resIter != mResources.end() && resIter->second == res);
timeval tv;
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, nullptr);
time_t timestamp = tv.tv_sec;
res->mTimeStamp = timestamp;
@@ -583,11 +583,11 @@ void *ResourceManager::loadFile(const std::string &fileName, int &fileSize)
PHYSFS_file *file = PHYSFS_openRead(fileName.c_str());
// If the handler is an invalid pointer indicate failure
- if (file == NULL)
+ if (!file)
{
logger->log("Warning: Failed to load %s: %s",
fileName.c_str(), PHYSFS_getLastError());
- return NULL;
+ return nullptr;
}
// Log the real dir of the file
@@ -698,7 +698,7 @@ SDL_Surface *ResourceManager::loadSDLSurface(const std::string &filename)
{
int fileSize;
void *buffer = loadFile(filename, fileSize);
- SDL_Surface *tmp = NULL;
+ SDL_Surface *tmp = nullptr;
if (buffer)
{
@@ -734,13 +734,13 @@ struct RescaledLoader
static Resource *load(void *v)
{
if (!v)
- return NULL;
+ return nullptr;
RescaledLoader *l = static_cast< RescaledLoader * >(v);
if (!l->manager)
- return NULL;
+ return nullptr;
Image *rescaled = l->image->SDLgetScaledImage(l->width, l->height);
if (!rescaled)
- return NULL;
+ return nullptr;
return rescaled;
}
};
diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp
index e8e5d3dbb..a8da8dd80 100644
--- a/src/resources/soundeffect.cpp
+++ b/src/resources/soundeffect.cpp
@@ -34,7 +34,7 @@ SoundEffect::~SoundEffect()
Resource *SoundEffect::load(void *buffer, unsigned bufferSize)
{
if (!buffer)
- return NULL;
+ return nullptr;
// Load the raw file data from the buffer in an RWops structure
SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
@@ -49,7 +49,7 @@ Resource *SoundEffect::load(void *buffer, unsigned bufferSize)
else
{
logger->log("Error, failed to load sound effect: %s", Mix_GetError());
- return NULL;
+ return nullptr;
}
}
diff --git a/src/resources/specialdb.cpp b/src/resources/specialdb.cpp
index 2463da06a..51ba4bc74 100644
--- a/src/resources/specialdb.cpp
+++ b/src/resources/specialdb.cpp
@@ -126,9 +126,9 @@ SpecialInfo *SpecialDB::get(int id)
SpecialInfos::const_iterator i = mSpecialInfos.find(id);
if (i == mSpecialInfos.end())
- return NULL;
+ return nullptr;
else
return i->second;
- return NULL;
+ return nullptr;
}
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 2e32f6c5f..2d49e8cd1 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -48,7 +48,7 @@ Action *SpriteDef::getAction(std::string action) const
if (i == mActions.end())
{
logger->log("Warning: no action \"%s\" defined!", action.c_str());
- return NULL;
+ return nullptr;
}
return i->second;
@@ -73,7 +73,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, int variant)
if (animationFile != errorFile)
return load(errorFile, 0);
else
- return NULL;
+ return nullptr;
}
SpriteDef *def = new SpriteDef;
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 5cfec3b84..93eb8a40f 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -94,7 +94,7 @@ void Wallpaper::loadWallpapers()
char **imgs = PHYSFS_enumerateFiles(wallpaperPath.c_str());
- for (char **i = imgs; *i != NULL; i++)
+ for (char **i = imgs; *i; i++)
{
int width;
int height;
diff --git a/src/rotationalparticle.cpp b/src/rotationalparticle.cpp
index 60d818cd9..c1bb6ab45 100644
--- a/src/rotationalparticle.cpp
+++ b/src/rotationalparticle.cpp
@@ -29,7 +29,7 @@
#define PI 3.14159265
RotationalParticle::RotationalParticle(Map *map, Animation *animation):
- ImageParticle(map, NULL),
+ ImageParticle(map, nullptr),
mAnimation(new SimpleAnimation(animation))
{
}
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index 4736b2e57..d0c7b7e39 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -133,7 +133,7 @@ Image *SimpleAnimation::getCurrentImage() const
if (mCurrentFrame)
return mCurrentFrame->image;
else
- return NULL;
+ return nullptr;
}
void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode,
diff --git a/src/sound.cpp b/src/sound.cpp
index 40c929824..39c5a72aa 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -70,7 +70,7 @@ Sound::~Sound()
config.removeListener("playMusic", this);
// Unlink the callback function.
- Mix_HookMusicFinished(NULL);
+ Mix_HookMusicFinished(nullptr);
}
void Sound::optionChanged(const std::string &value)
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp
index 9f7aaaa8b..d80090396 100644
--- a/src/spellmanager.cpp
+++ b/src/spellmanager.cpp
@@ -54,7 +54,7 @@ SpellManager::~SpellManager()
TextCommand* SpellManager::getSpell(int spellId)
{
if (spellId < 0 || static_cast<unsigned int>(spellId) >= mSpells.size())
- return NULL;
+ return nullptr;
return mSpells[spellId];
}
@@ -353,7 +353,7 @@ std::string SpellManager::autoComplete(std::string partName)
{
std::vector<TextCommand*>::const_iterator i = mSpellsVector.begin();
std::string newName = "";
- TextCommand *newCommand = NULL;
+ TextCommand *newCommand = nullptr;
while (i != mSpellsVector.end())
{
@@ -368,7 +368,7 @@ std::string SpellManager::autoComplete(std::string partName)
if (newName != "")
{
newName = findSameSubstring(line, newName);
- newCommand = NULL;
+ newCommand = nullptr;
}
else
{
diff --git a/src/sprite.h b/src/sprite.h
index 20f38bef0..52752619b 100644
--- a/src/sprite.h
+++ b/src/sprite.h
@@ -24,6 +24,8 @@
#include "resources/spritedef.h"
+#include "localconsts.h"
+
class Graphics;
class Image;
@@ -105,7 +107,7 @@ class Sprite
virtual unsigned int getFrameCount() const = 0;
virtual void *getHash()
- { return 0; }
+ { return nullptr; }
virtual void *getHash2()
{ return this; }
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index dccf21f46..f7bffc31f 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -65,7 +65,7 @@ void StatusEffect::deliverMessage()
Particle *StatusEffect::getParticle()
{
if (!particleEngine || mParticleEffect.empty())
- return NULL;
+ return nullptr;
else
return particleEngine->addEffect(mParticleEffect, 0, 0);
}
@@ -74,7 +74,7 @@ AnimatedSprite *StatusEffect::getIcon()
{
if (mIcon.empty())
{
- return NULL;
+ return nullptr;
}
else
{
@@ -141,7 +141,7 @@ void StatusEffect::load()
for_each_xml_child_node(node, rootNode)
{
- status_effect_map *the_map = NULL;
+ status_effect_map *the_map = nullptr;
int index = atoi(XML::getProperty(node, "id", "-1").c_str());
diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp
index 14876d878..3906efc76 100644
--- a/src/utils/base64.cpp
+++ b/src/utils/base64.cpp
@@ -102,8 +102,8 @@ unsigned char *php3_base64_decode(const unsigned char *string,
unsigned char *result = static_cast<unsigned char *>(
calloc(length + 1, 1));
- if (result == NULL)
- return NULL;
+ if (result == nullptr)
+ return nullptr;
/* run through the whole string, converting as we go */
while ((ch = *current++) != '\0')
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp
index ed9f0f641..7bf7e59d4 100644
--- a/src/utils/copynpaste.cpp
+++ b/src/utils/copynpaste.cpp
@@ -43,7 +43,7 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos)
{
bool ret = false;
- if (!OpenClipboard(NULL))
+ if (!OpenClipboard(nullptr))
return false;
HANDLE h = GetClipboardData(CF_UNICODETEXT);
@@ -54,13 +54,13 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos)
if (data)
{
int len = WideCharToMultiByte(CP_UTF8, 0, data, -1,
- NULL, 0, NULL, NULL);
+ nullptr, 0, nullptr, nullptr);
if (len > 0)
{
// Convert from UTF-16 to UTF-8
void *temp = calloc(len, 1);
if (WideCharToMultiByte(CP_UTF8, 0, data, -1,
- (LPSTR)temp, len, NULL, NULL))
+ (LPSTR)temp, len, nullptr, nullptr))
{
text.insert(pos, (char*)temp);
pos += len-1;
@@ -94,7 +94,7 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos)
bool sendBuffer(std::string& text)
{
- int wCharsLen = MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, NULL, 0);
+ int wCharsLen = MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, nullptr, 0);
if (!wCharsLen)
return false;
@@ -298,7 +298,7 @@ static char* getSelection2(Display *dpy, Window us, Atom selection,
if (owner == None)
{
//printf("No owner\n");
- return NULL;
+ return nullptr;
}
XConvertSelection(dpy, selection, request_target,
XA_PRIMARY, us, CurrentTime);
@@ -317,13 +317,13 @@ static char* getSelection2(Display *dpy, Window us, Atom selection,
if (e.xselection.property == None)
{
//printf("Couldn't convert\n");
- return NULL;
+ return nullptr;
}
long unsigned len, left, dummy;
int format;
Atom type;
- unsigned char *data = NULL;
+ unsigned char *data = nullptr;
ret = XGetWindowProperty(dpy, us, e.xselection.property, 0, 0,
False, AnyPropertyType, &type, &format, &len, &left, &data);
@@ -331,7 +331,7 @@ static char* getSelection2(Display *dpy, Window us, Atom selection,
{
if (ret == Success)
XFree(data);
- return NULL;
+ return nullptr;
}
ret = XGetWindowProperty(dpy, us, e.xselection.property, 0,
@@ -341,7 +341,7 @@ static char* getSelection2(Display *dpy, Window us, Atom selection,
if (ret != Success)
{
//printf("Failed to get property: %p on %lu\n", data, len);
- return NULL;
+ return nullptr;
}
//printf(">>> Got %s: len=%lu left=%lu (event %i)\n", data,
@@ -349,14 +349,14 @@ static char* getSelection2(Display *dpy, Window us, Atom selection,
return reinterpret_cast<char*>(data);
}
}
- return NULL;
+ return nullptr;
}
static Atom requestAtom;
static char* getSelection(Display *dpy, Window us, Atom selection)
{
- char *data = NULL;
+ char *data = nullptr;
if (requestAtom != None)
data = getSelection2(dpy, us, selection, requestAtom);
if (!data)
@@ -374,7 +374,7 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos)
{
Display *dpy = info.info.x11.display;
Window us = info.info.x11.window;
- char *data = NULL;
+ char *data = nullptr;
requestAtom = XInternAtom (dpy, "UTF8_STRING", true);
diff --git a/src/utils/dtor.h b/src/utils/dtor.h
index 11583709f..fbe903ced 100644
--- a/src/utils/dtor.h
+++ b/src/utils/dtor.h
@@ -30,14 +30,16 @@
template<typename T>
struct dtor : public std::unary_function <T, void>
{
- void operator()(T &ptr) { delete ptr; }
+ void operator()(T &ptr)
+ { delete ptr; }
};
template<typename T1, typename T2>
struct dtor<std::pair<T1, T2> > :
public std::unary_function <std::pair<T1, T2>, void>
{
- void operator()(std::pair<T1, T2> &pair) { delete pair.second; }
+ void operator()(std::pair<T1, T2> &pair)
+ { delete pair.second; }
};
template<class Cont>
diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp
index b42caf9b5..3cc35cb55 100644
--- a/src/utils/paths.cpp
+++ b/src/utils/paths.cpp
@@ -41,7 +41,7 @@ std::string getRealPath(const std::string &str)
char *realPath = (char*)calloc(PATH_MAX, sizeof(char));
realpath(str.c_str(), realPath);
#else
- char *realPath = realpath(str.c_str(), NULL);
+ char *realPath = realpath(str.c_str(), nullptr);
#endif
path = realPath;
free(realPath);
diff --git a/src/utils/specialfolder.cpp b/src/utils/specialfolder.cpp
index 31eaec687..fae0fbf47 100644
--- a/src/utils/specialfolder.cpp
+++ b/src/utils/specialfolder.cpp
@@ -45,7 +45,7 @@ std::string getSpecialFolderLocation(int folderId)
char szPath[_MAX_PATH];
// get the item ID list for folderId
- HRESULT hr = SHGetSpecialFolderLocation(NULL, folderId, &pItemIdList);
+ HRESULT hr = SHGetSpecialFolderLocation(nullptr, folderId, &pItemIdList);
if (hr != S_OK)
return ret;
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 89457a4e8..56aa44ce3 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -38,7 +38,7 @@ namespace XML
mDoc(0)
{
int size;
- char *data = NULL;
+ char *data = nullptr;
if (useResman)
{
ResourceManager *resman = ResourceManager::getInstance();
@@ -162,7 +162,7 @@ namespace XML
return child;
}
- return NULL;
+ return nullptr;
}
} // namespace XML