2018-09-25 01:12:29 +01:00
|
|
|
#include "metatile.h"
|
|
|
|
#include "tileset.h"
|
2018-09-23 00:47:28 +01:00
|
|
|
#include "project.h"
|
|
|
|
|
|
|
|
Metatile::Metatile()
|
|
|
|
{
|
|
|
|
tiles = new QList<Tile>;
|
|
|
|
}
|
|
|
|
|
2018-10-03 01:01:15 +01:00
|
|
|
Metatile* Metatile::copy() {
|
|
|
|
Metatile *copy = new Metatile;
|
|
|
|
copy->behavior = this->behavior;
|
|
|
|
copy->layerType = this->layerType;
|
2020-03-16 20:31:08 +00:00
|
|
|
copy->encounterType = this->encounterType;
|
|
|
|
copy->terrainType = this->terrainType;
|
2018-10-03 01:01:15 +01:00
|
|
|
copy->tiles = new QList<Tile>;
|
2019-04-04 06:44:31 +01:00
|
|
|
copy->label = this->label;
|
2018-10-03 01:01:15 +01:00
|
|
|
for (Tile tile : *this->tiles) {
|
|
|
|
copy->tiles->append(tile);
|
|
|
|
}
|
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
2018-10-06 23:07:36 +01:00
|
|
|
void Metatile::copyInPlace(Metatile *other) {
|
|
|
|
this->behavior = other->behavior;
|
|
|
|
this->layerType = other->layerType;
|
2020-03-16 20:31:08 +00:00
|
|
|
this->encounterType = other->encounterType;
|
|
|
|
this->terrainType = other->terrainType;
|
2019-04-04 06:44:31 +01:00
|
|
|
this->label = other->label;
|
2018-10-06 23:07:36 +01:00
|
|
|
for (int i = 0; i < this->tiles->length(); i++) {
|
|
|
|
(*this->tiles)[i] = other->tiles->at(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-23 00:47:28 +01:00
|
|
|
int Metatile::getBlockIndex(int index) {
|
|
|
|
if (index < Project::getNumMetatilesPrimary()) {
|
|
|
|
return index;
|
|
|
|
} else {
|
|
|
|
return index - Project::getNumMetatilesPrimary();
|
|
|
|
}
|
|
|
|
}
|