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;
|
|
|
|
copy->tiles = new QList<Tile>;
|
|
|
|
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;
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|