mirror of
https://github.com/minetest/minetest.git
synced 2024-11-05 07:13:46 +01:00
Remove std::shared_ptr use in TileLayer (#10090)
This commit is contained in:
parent
b1ff04e06d
commit
c6422e0872
@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <SMaterial.h>
|
#include <SMaterial.h>
|
||||||
#include <memory>
|
|
||||||
#include "util/numeric.h"
|
#include "util/numeric.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@ -284,7 +283,7 @@ struct TileLayer
|
|||||||
//! If true, the tile has its own color.
|
//! If true, the tile has its own color.
|
||||||
bool has_color = false;
|
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
|
* The color of the tile, or if the tile does not own
|
||||||
|
@ -317,6 +317,18 @@ ContentFeatures::ContentFeatures()
|
|||||||
reset();
|
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()
|
void ContentFeatures::reset()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -662,7 +674,7 @@ static void fillTileAttribs(ITextureSource *tsrc, TileLayer *layer,
|
|||||||
} else {
|
} else {
|
||||||
std::ostringstream os(std::ios::binary);
|
std::ostringstream os(std::ios::binary);
|
||||||
if (!layer->frames) {
|
if (!layer->frames) {
|
||||||
layer->frames = std::make_shared<std::vector<FrameSpec>>();
|
layer->frames = new std::vector<FrameSpec>();
|
||||||
}
|
}
|
||||||
layer->frames->resize(frame_count);
|
layer->frames->resize(frame_count);
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ struct ContentFeatures
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ContentFeatures();
|
ContentFeatures();
|
||||||
~ContentFeatures() = default;
|
~ContentFeatures();
|
||||||
void reset();
|
void reset();
|
||||||
void serialize(std::ostream &os, u16 protocol_version) const;
|
void serialize(std::ostream &os, u16 protocol_version) const;
|
||||||
void deSerialize(std::istream &is);
|
void deSerialize(std::istream &is);
|
||||||
|
Loading…
Reference in New Issue
Block a user