Fix Tileset copy construction/assignment
This commit is contained in:
parent
f166652ccc
commit
a68a9baf2e
2 changed files with 53 additions and 2 deletions
|
@ -10,8 +10,8 @@ class Tileset
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Tileset() = default;
|
Tileset() = default;
|
||||||
Tileset(const Tileset &other) = default;
|
Tileset(const Tileset &other);
|
||||||
Tileset &operator=(const Tileset &other) = default;
|
Tileset &operator=(const Tileset &other);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString name;
|
QString name;
|
||||||
|
|
|
@ -8,6 +8,57 @@
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
|
||||||
|
|
||||||
|
Tileset::Tileset(const Tileset &other)
|
||||||
|
: name(other.name),
|
||||||
|
is_compressed(other.is_compressed),
|
||||||
|
is_secondary(other.is_secondary),
|
||||||
|
padding(other.padding),
|
||||||
|
tiles_label(other.tiles_label),
|
||||||
|
palettes_label(other.palettes_label),
|
||||||
|
metatiles_label(other.metatiles_label),
|
||||||
|
metatiles_path(other.metatiles_path),
|
||||||
|
callback_label(other.callback_label),
|
||||||
|
metatile_attrs_label(other.metatile_attrs_label),
|
||||||
|
metatile_attrs_path(other.metatile_attrs_path),
|
||||||
|
tilesImagePath(other.tilesImagePath),
|
||||||
|
tilesImage(other.tilesImage),
|
||||||
|
palettePaths(other.palettePaths),
|
||||||
|
tiles(other.tiles),
|
||||||
|
palettes(other.palettes),
|
||||||
|
palettePreviews(other.palettePreviews)
|
||||||
|
{
|
||||||
|
for (auto *metatile : other.metatiles) {
|
||||||
|
metatiles.append(new Metatile(*metatile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Tileset &Tileset::operator=(const Tileset &other) {
|
||||||
|
name = other.name;
|
||||||
|
is_compressed = other.is_compressed;
|
||||||
|
is_secondary = other.is_secondary;
|
||||||
|
padding = other.padding;
|
||||||
|
tiles_label = other.tiles_label;
|
||||||
|
palettes_label = other.palettes_label;
|
||||||
|
metatiles_label = other.metatiles_label;
|
||||||
|
metatiles_path = other.metatiles_path;
|
||||||
|
callback_label = other.callback_label;
|
||||||
|
metatile_attrs_label = other.metatile_attrs_label;
|
||||||
|
metatile_attrs_path = other.metatile_attrs_path;
|
||||||
|
tilesImagePath = other.tilesImagePath;
|
||||||
|
tilesImage = other.tilesImage;
|
||||||
|
palettePaths = other.palettePaths;
|
||||||
|
tiles = other.tiles;
|
||||||
|
palettes = other.palettes;
|
||||||
|
palettePreviews = other.palettePreviews;
|
||||||
|
|
||||||
|
metatiles.clear();
|
||||||
|
for (auto *metatile : other.metatiles) {
|
||||||
|
metatiles.append(new Metatile(*metatile));
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
Tileset* Tileset::getBlockTileset(int metatile_index, Tileset *primaryTileset, Tileset *secondaryTileset) {
|
Tileset* Tileset::getBlockTileset(int metatile_index, Tileset *primaryTileset, Tileset *secondaryTileset) {
|
||||||
if (metatile_index < Project::getNumMetatilesPrimary()) {
|
if (metatile_index < Project::getNumMetatilesPrimary()) {
|
||||||
return primaryTileset;
|
return primaryTileset;
|
||||||
|
|
Loading…
Reference in a new issue