summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-08 00:44:17 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-08 00:44:17 +0300
commit4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe (patch)
tree714897eca03fbcb764f5b450a29cc1aef8d33433 /src/resources
parent9e83411f7e4147d09af5a5006888dcc187ea0ef8 (diff)
downloadManaVerse-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.tar.gz
ManaVerse-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.tar.bz2
ManaVerse-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.tar.xz
ManaVerse-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.zip
Fix more gcc 4.7 warnings.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/ambientlayer.cpp2
-rw-r--r--src/resources/animation.cpp6
-rw-r--r--src/resources/beinginfo.cpp6
-rw-r--r--src/resources/colordb.cpp2
-rw-r--r--src/resources/dye.cpp4
-rw-r--r--src/resources/image.cpp26
-rw-r--r--src/resources/imageloader.cpp4
-rw-r--r--src/resources/imagewriter.cpp3
-rw-r--r--src/resources/itemdb.cpp2
-rw-r--r--src/resources/iteminfo.cpp14
-rw-r--r--src/resources/mapreader.cpp12
-rw-r--r--src/resources/resourcemanager.cpp8
-rw-r--r--src/resources/spritedef.cpp4
-rw-r--r--src/resources/wallpaper.cpp2
14 files changed, 48 insertions, 47 deletions
diff --git a/src/resources/ambientlayer.cpp b/src/resources/ambientlayer.cpp
index 319bc5b8c..2ad25dcd0 100644
--- a/src/resources/ambientlayer.cpp
+++ b/src/resources/ambientlayer.cpp
@@ -68,7 +68,7 @@ AmbientLayer::~AmbientLayer()
if (mImage)
{
mImage->decRef();
- mImage = 0;
+ mImage = nullptr;
}
}
diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp
index 363e9b2ac..1f3336a8b 100644
--- a/src/resources/animation.cpp
+++ b/src/resources/animation.cpp
@@ -54,18 +54,18 @@ bool Animation::isTerminator(const Frame &candidate)
void Animation::addJump(std::string name, int rand)
{
- Frame frame = { 0, 0, 0, 0, rand, Frame::JUMP, name };
+ Frame frame = { nullptr, 0, 0, 0, rand, Frame::JUMP, name };
mFrames.push_back(frame);
}
void Animation::addLabel(std::string name)
{
- Frame frame = { 0, 0, 0, 0, 100, Frame::LABEL, name };
+ Frame frame = { nullptr, 0, 0, 0, 100, Frame::LABEL, name };
mFrames.push_back(frame);
}
void Animation::addGoto(std::string name, int rand)
{
- Frame frame = { 0, 0, 0, 0, rand, Frame::GOTO, name };
+ Frame frame = { nullptr, 0, 0, 0, rand, Frame::GOTO, name };
mFrames.push_back(frame);
}
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 4aa7515b1..0b2aaa8fa 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -29,7 +29,7 @@
#include "debug.h"
-BeingInfo *BeingInfo::unknown = 0;
+BeingInfo *BeingInfo::unknown = nullptr;
Attack *BeingInfo::empty = new Attack(SpriteAction::ATTACK, "", "");
BeingInfo::BeingInfo():
@@ -121,7 +121,7 @@ void BeingInfo::addAttack(int id, std::string action,
void BeingInfo::clear()
{
delete unknown;
- unknown = 0;
+ unknown = nullptr;
delete empty;
- empty = 0;
+ empty = nullptr;
}
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index ed8c934dc..225abef91 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -175,5 +175,5 @@ std::map <int, ColorDB::ItemColor> *ColorDB::getColorsList(std::string name)
if (it != mColorLists.end())
return &it->second;
- return 0;
+ return nullptr;
}
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index a782b6ec1..29b1c864e 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -208,7 +208,7 @@ void DyePalette::getColor(double intensity, int color[3]) const
Dye::Dye(const std::string &description)
{
for (int i = 0; i < 7; ++i)
- mDyePalettes[i] = 0;
+ mDyePalettes[i] = nullptr;
if (description.empty())
return;
@@ -255,7 +255,7 @@ Dye::~Dye()
for (int i = 0; i < 7; ++i)
{
delete mDyePalettes[i];
- mDyePalettes[i] = 0;
+ mDyePalettes[i] = nullptr;
}
}
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 537630a2c..df07c16a2 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -87,8 +87,8 @@ Image::Image(GLuint glimage, int width, int height,
int texWidth, int texHeight):
mAlpha(1.0f),
mHasAlphaChannel(true),
- mSDLSurface(0),
- mAlphaChannel(0),
+ mSDLSurface(nullptr),
+ mAlphaChannel(nullptr),
mUseAlphaCache(false),
mIsAlphaVisible(true),
mIsAlphaCalculated(false),
@@ -251,14 +251,14 @@ Image *Image::createTextSurface(SDL_Surface *tmpImage, float alpha)
// We also delete the alpha channel since
// it's not used.
delete[] alphaChannel;
- alphaChannel = 0;
+ alphaChannel = nullptr;
}
if (!image)
{
logger->log1("Error: Image convert failed.");
delete[] alphaChannel;
- return 0;
+ return nullptr;
}
if (converted)
@@ -279,7 +279,7 @@ void Image::SDLCleanCache()
{
if (mSDLSurface != i->second)
resman->scheduleDelete(i->second);
- i->second = 0;
+ i->second = nullptr;
}
mAlphaCache.clear();
}
@@ -339,7 +339,7 @@ SDL_Surface *Image::getByAlpha(float alpha)
std::map<float, SDL_Surface*>::const_iterator it = mAlphaCache.find(alpha);
if (it != mAlphaCache.end())
return (*it).second;
- return 0;
+ return nullptr;
}
void Image::setAlpha(float alpha)
@@ -575,7 +575,7 @@ SDL_Surface* Image::convertTo32Bit(SDL_Surface* tmpImage)
if (!tmpImage)
return nullptr;
SDL_PixelFormat RGBAFormat;
- RGBAFormat.palette = 0;
+ RGBAFormat.palette = nullptr;
RGBAFormat.colorkey = 0;
RGBAFormat.alpha = 0;
RGBAFormat.BitsPerPixel = 32;
@@ -692,14 +692,14 @@ Image *Image::_SDLload(SDL_Surface *tmpImage)
// We also delete the alpha channel since
// it's not used.
delete[] alphaChannel;
- alphaChannel = 0;
+ alphaChannel = nullptr;
}
if (!image)
{
logger->log1("Error: Image convert failed.");
delete[] alphaChannel;
- return 0;
+ return nullptr;
}
if (converted)
@@ -880,7 +880,7 @@ SubImage::SubImage(Image *parent, SDL_Surface *image,
{
mHasAlphaChannel = false;
mIsAlphaVisible = false;
- mAlphaChannel = 0;
+ mAlphaChannel = nullptr;
}
// Set up the rectangle.
@@ -921,16 +921,16 @@ SubImage::SubImage(Image *parent, GLuint image,
SubImage::~SubImage()
{
// Avoid destruction of the image
- mSDLSurface = 0;
+ mSDLSurface = nullptr;
// Avoid possible destruction of its alpha channel
- mAlphaChannel = 0;
+ mAlphaChannel = nullptr;
#ifdef USE_OPENGL
mGLImage = 0;
#endif
if (mParent)
{
mParent->decRef();
- mParent = 0;
+ mParent = nullptr;
}
}
diff --git a/src/resources/imageloader.cpp b/src/resources/imageloader.cpp
index d88e633be..a8563c679 100644
--- a/src/resources/imageloader.cpp
+++ b/src/resources/imageloader.cpp
@@ -51,12 +51,12 @@ void ProxyImage::free()
if (mSDLImage)
{
SDL_FreeSurface(mSDLImage);
- mSDLImage = 0;
+ mSDLImage = nullptr;
}
else
{
delete mImage;
- mImage = 0;
+ mImage = nullptr;
}
}
diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp
index 2498f9c31..a3a35cfd1 100644
--- a/src/resources/imagewriter.cpp
+++ b/src/resources/imagewriter.cpp
@@ -50,7 +50,8 @@ bool ImageWriter::writePNG(SDL_Surface *surface, const std::string &filename)
if (SDL_MUSTLOCK(surface))
SDL_LockSurface(surface);
- png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
+ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
+ nullptr, nullptr, nullptr);
if (!png_ptr)
{
logger->log1("Had trouble creating png_structp");
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 74474e067..3e53dd6e7 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -421,7 +421,7 @@ void ItemDB::unload()
logger->log1("Unloading item database...");
delete mUnknown;
- mUnknown = 0;
+ mUnknown = nullptr;
delete_all(mItemInfos);
mItemInfos.clear();
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 5b07724a1..dfcff3f76 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -77,14 +77,14 @@ ItemInfo::ItemInfo() :
mAttackAction(SpriteAction::INVALID),
mAttackRange(0),
mMissileParticle(""),
- mColors(0),
+ mColors(nullptr),
mColorList(""),
mHitEffectId(0),
mCriticalHitEffectId(0)
{
for (int f = 0; f < 9; f ++)
{
- mSpriteToItemReplaceMap[f] = 0;
+ mSpriteToItemReplaceMap[f] = nullptr;
mDrawBefore[f] = -1;
mDrawAfter[f] = -1;
mDrawPriority[f] = 0;
@@ -96,7 +96,7 @@ ItemInfo::~ItemInfo()
delete_all(mSpriteToItemReplaceList);
mSpriteToItemReplaceList.clear();
for (int f = 0; f < 9; f ++)
- mSpriteToItemReplaceMap[f] = 0;
+ mSpriteToItemReplaceMap[f] = nullptr;
}
const std::string &ItemInfo::getSprite(Gender gender) const
@@ -145,7 +145,7 @@ const std::string &ItemInfo::getSound(EquipmentSoundEvent event) const
std::map<int, int> *ItemInfo::addReplaceSprite(int sprite, int direction)
{
if (direction < 0 || direction >= 9)
- return 0;
+ return nullptr;
SpriteToItemMap *spMap = mSpriteToItemReplaceMap[direction];
@@ -170,7 +170,7 @@ void ItemInfo::setColorsList(std::string name)
{
if (name.empty())
{
- mColors = 0;
+ mColors = nullptr;
mColorList = "";
}
else
@@ -231,7 +231,7 @@ const std::string ItemInfo::replaceColors(std::string str,
SpriteToItemMap *ItemInfo::getSpriteToItemReplaceMap(int direction) const
{
if (direction < 0 || direction >= 9)
- return 0;
+ return nullptr;
SpriteToItemMap *spMap = mSpriteToItemReplaceMap[direction];
if (spMap)
@@ -242,7 +242,7 @@ SpriteToItemMap *ItemInfo::getSpriteToItemReplaceMap(int direction) const
if (direction == DIRECTION_DOWNLEFT || direction == DIRECTION_DOWNRIGHT)
return mSpriteToItemReplaceMap[DIRECTION_DOWN];
- return 0;
+ return nullptr;
}
void ItemInfo::setSpriteOrder(int *ptr, int direction, int n, int def)
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index a6e1074f3..68d39f0ae 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -251,7 +251,7 @@ Map *MapReader::readMap(const std::string &filename,
Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
{
if (!node)
- return 0;
+ return nullptr;
// Take the filename off the path
const std::string pathDir = path.substr(0, path.rfind("/") + 1);
@@ -270,7 +270,7 @@ Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
logger->log("MapReader: Warning: "
"Unitialized tile width or height value for map: %s",
path.c_str());
- return 0;
+ return nullptr;
}
Map *map = new Map(w, h, tilew, tileh);
@@ -405,7 +405,7 @@ inline static void setTile(Map *map, MapLayer *layer, int x, int y, int gid)
if (layer)
{
// Set regular tile on a layer
- Image * const img = set ? set->get(gid - set->getFirstGid()) : 0;
+ Image * const img = set ? set->get(gid - set->getFirstGid()) : nullptr;
layer->setTile(x, y, img);
}
else
@@ -458,7 +458,7 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
map->indexTilesets();
- MapLayer *layer = 0;
+ MapLayer *layer = nullptr;
if (!isCollisionLayer)
{
@@ -668,7 +668,7 @@ Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path,
doc = new XML::Document(filename);
node = doc->rootNode();
if (!node)
- return 0;
+ return nullptr;
// Reset path to be realtive to the tsx file
pathDir = filename.substr(0, filename.rfind("/") + 1);
@@ -760,7 +760,7 @@ Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path,
else
{
delete ani;
- ani = 0;
+ ani = nullptr;
}
}
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index af9f664d4..a99ca622e 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -94,7 +94,7 @@ ResourceManager::~ResourceManager()
continue;
}
#endif
- if (dynamic_cast<SpriteDef*>(iter->second) != 0)
+ if (dynamic_cast<SpriteDef*>(iter->second))
{
cleanUp(iter->second);
ResourceIterator toErase = iter;
@@ -118,7 +118,7 @@ ResourceManager::~ResourceManager()
continue;
}
#endif
- if (dynamic_cast<ImageSet*>(iter->second) != 0)
+ if (dynamic_cast<ImageSet*>(iter->second))
{
cleanUp(iter->second);
ResourceIterator toErase = iter;
@@ -574,7 +574,7 @@ ResourceManager *ResourceManager::getInstance()
void ResourceManager::deleteInstance()
{
delete instance;
- instance = 0;
+ instance = nullptr;
}
void *ResourceManager::loadFile(const std::string &fileName, int &fileSize)
@@ -748,7 +748,7 @@ struct RescaledLoader
Image *ResourceManager::getRescaled(Image *image, int width, int height)
{
if (!image)
- return 0;
+ return nullptr;
std::string idPath = image->getIdPath() + strprintf(
"_rescaled%dx%d", width, height);
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 2d49e8cd1..3e2aac785 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -39,7 +39,7 @@
#include "debug.h"
-SpriteReference *SpriteReference::Empty = 0;
+SpriteReference *SpriteReference::Empty = nullptr;
Action *SpriteDef::getAction(std::string action) const
{
@@ -360,7 +360,7 @@ SpriteDef::~SpriteDef()
if (i->second)
{
i->second->decRef();
- i->second = 0;
+ i->second = nullptr;
}
}
}
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 93eb8a40f..c8cd5ad60 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -157,7 +157,7 @@ std::string Wallpaper::getWallpaper(int width, int height)
{
// Return randomly a wallpaper between vector[0] and
// vector[vector.size() - 1]
- srand(static_cast<unsigned>(time(0)));
+ srand(static_cast<unsigned>(time(nullptr)));
return wallPaperVector[int(static_cast<double>(
wallPaperVector.size()) * rand() / (RAND_MAX + 1.0))];
}