Use implicit copy constructor/assignment for Metatile

This commit is contained in:
BigBahss
2021-02-16 13:22:41 -05:00
parent 8187b2d4bb
commit 6a825d0b39
4 changed files with 29 additions and 55 deletions

View File

@@ -9,39 +9,6 @@ Metatile::Metatile() :
terrainType(0)
{ }
Metatile::Metatile(const Metatile &other) :
tiles(other.tiles),
behavior(other.behavior),
layerType(other.layerType),
encounterType(other.encounterType),
terrainType(other.terrainType),
label(other.label)
{ }
Metatile* Metatile::copy() {
Metatile *copy = new Metatile;
copy->behavior = this->behavior;
copy->layerType = this->layerType;
copy->encounterType = this->encounterType;
copy->terrainType = this->terrainType;
copy->label = this->label;
for (const Tile &tile : this->tiles) {
copy->tiles.append(tile);
}
return copy;
}
void Metatile::copyInPlace(Metatile *other) {
this->behavior = other->behavior;
this->layerType = other->layerType;
this->encounterType = other->encounterType;
this->terrainType = other->terrainType;
this->label = other->label;
for (int i = 0; i < this->tiles.length(); i++) {
this->tiles[i] = other->tiles.at(i);
}
}
int Metatile::getBlockIndex(int index) {
if (index < Project::getNumMetatilesPrimary()) {
return index;