summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-28 00:39:12 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-28 11:04:23 +0300
commit0c35dab0ba366f85b40ef1795125521f1df8c264 (patch)
treedde6abde3288f543ae96a2468b2275af8a03e704 /src/resources
parent47cc515695fcd0b16467506e4984d2ec38fad4e4 (diff)
downloadmanaplus-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.gz
manaplus-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.bz2
manaplus-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.xz
manaplus-0c35dab0ba366f85b40ef1795125521f1df8c264.zip
simplify variables cleanup.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/beinginfo.cpp7
-rw-r--r--src/resources/db/itemdb.cpp4
-rw-r--r--src/resources/dye.cpp7
-rw-r--r--src/resources/mapreader.cpp8
-rw-r--r--src/resources/resourcemanager.cpp4
5 files changed, 12 insertions, 18 deletions
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 40ea7af1a..8b76d7e2a 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -25,6 +25,7 @@
#include "configuration.h"
#include "logger.h"
+#include "utils/delete2.h"
#include "utils/dtor.h"
#include "utils/gettext.h"
@@ -168,10 +169,8 @@ void BeingInfo::addAttack(const int id, std::string action,
void BeingInfo::clear()
{
- delete unknown;
- unknown = nullptr;
- delete empty;
- empty = nullptr;
+ delete2(unknown);
+ delete2(empty);
}
void BeingInfo::init()
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index 931377639..09a5ce08f 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -28,6 +28,7 @@
#include "resources/beingcommon.h"
#include "resources/iteminfo.h"
+#include "utils/delete2.h"
#include "utils/dtor.h"
#include "utils/gettext.h"
@@ -543,8 +544,7 @@ void ItemDB::unload()
{
logger->log1("Unloading item database...");
- delete mUnknown;
- mUnknown = nullptr;
+ delete2(mUnknown);
delete_all(mItemInfos);
mItemInfos.clear();
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index 4f9e8a738..7e6692c50 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -26,6 +26,8 @@
#include "resources/db/palettedb.h"
+#include "utils/delete2.h"
+
#include <cmath>
#include <sstream>
@@ -442,10 +444,7 @@ Dye::Dye(const std::string &description)
Dye::~Dye()
{
for (int i = 0; i < dyePalateSize; ++i)
- {
- delete mDyePalettes[i];
- mDyePalettes[i] = nullptr;
- }
+ delete2(mDyePalettes[i])
}
void Dye::instantiate(std::string &restrict target,
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 6d7591d1d..baabbeaec 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -37,6 +37,7 @@
#include "resources/db/mapdb.h"
#include "utils/base64.h"
+#include "utils/delete2.h"
#include <iostream>
#include <zlib.h>
@@ -977,14 +978,9 @@ Tileset *MapReader::readTileset(XmlNodePtr node,
}
if (ani->getLength() > 0)
- {
map->addAnimation(tileGID, new TileAnimation(ani));
- }
else
- {
- delete ani;
- ani = nullptr;
- }
+ delete2(ani)
}
}
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 954930b64..4eca5552e 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -37,6 +37,7 @@
#include "resources/soundeffect.h"
#include "resources/spritedef.h"
+#include "utils/delete2.h"
#include "utils/mkdir.h"
#include "utils/paths.h"
#include "utils/physfscheckutils.h"
@@ -953,8 +954,7 @@ void ResourceManager::deleteInstance()
}
}
#endif
- delete instance;
- instance = nullptr;
+ delete2(instance);
}
void *ResourceManager::loadFile(const std::string &fileName, int &fileSize)