aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2020-07-10 12:11:44 +0200
committerGitHub <noreply@github.com>2020-07-10 12:11:44 +0200
commitc6422e087257d661a30ee2cd281ccec91f2f90ca (patch)
tree8845e2f5d136a38a553d9d759adcfa5a847f7c9e /src
parentb1ff04e06da531dc52f6ee91e2967b39743033e6 (diff)
downloadminetest-c6422e087257d661a30ee2cd281ccec91f2f90ca.tar.gz
minetest-c6422e087257d661a30ee2cd281ccec91f2f90ca.tar.bz2
minetest-c6422e087257d661a30ee2cd281ccec91f2f90ca.zip
Remove std::shared_ptr use in TileLayer (#10090)
Diffstat (limited to 'src')
-rw-r--r--src/client/tile.h3
-rw-r--r--src/nodedef.cpp14
-rw-r--r--src/nodedef.h2
3 files changed, 15 insertions, 4 deletions
diff --git a/src/client/tile.h b/src/client/tile.h
index 52e0a2b2b..e1d6c348f 100644
--- a/src/client/tile.h
+++ b/src/client/tile.h
@@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <string>
#include <vector>
#include <SMaterial.h>
-#include <memory>
#include "util/numeric.h"
#include "config.h"
@@ -284,7 +283,7 @@ struct TileLayer
//! If true, the tile has its own color.
bool has_color = false;
- std::shared_ptr<std::vector<FrameSpec>> frames = nullptr;
+ std::vector<FrameSpec> *frames = nullptr;
/*!
* The color of the tile, or if the tile does not own
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index a84338752..e5cd2c2a7 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -317,6 +317,18 @@ ContentFeatures::ContentFeatures()
reset();
}
+ContentFeatures::~ContentFeatures()
+{
+#ifndef SERVER
+ for (u16 j = 0; j < 6; j++) {
+ delete tiles[j].layers[0].frames;
+ delete tiles[j].layers[1].frames;
+ }
+ for (u16 j = 0; j < CF_SPECIAL_COUNT; j++)
+ delete special_tiles[j].layers[0].frames;
+#endif
+}
+
void ContentFeatures::reset()
{
/*
@@ -662,7 +674,7 @@ static void fillTileAttribs(ITextureSource *tsrc, TileLayer *layer,
} else {
std::ostringstream os(std::ios::binary);
if (!layer->frames) {
- layer->frames = std::make_shared<std::vector<FrameSpec>>();
+ layer->frames = new std::vector<FrameSpec>();
}
layer->frames->resize(frame_count);
diff --git a/src/nodedef.h b/src/nodedef.h
index 0992001e1..cf03abaae 100644
--- a/src/nodedef.h
+++ b/src/nodedef.h
@@ -409,7 +409,7 @@ struct ContentFeatures
*/
ContentFeatures();
- ~ContentFeatures() = default;
+ ~ContentFeatures();
void reset();
void serialize(std::ostream &os, u16 protocol_version) const;
void deSerialize(std::istream &is);