Skip to content

Commit

Permalink
Don't store autogenerated wang tiles.
Browse files Browse the repository at this point in the history
Closes bjorn/tiled/#2833
  • Loading branch information
cpetig committed Oct 28, 2020
1 parent 1df989e commit 7923ffa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libtiled/mapwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ void MapWriterPrivate::writeTileset(QXmlStreamWriter &w, const Tileset &tileset,

const auto wangTiles = ws->sortedWangTiles();
for (const WangTile &wangTile : wangTiles) {
if (wangTile.isAutogenerated()) continue;
w.writeStartElement(QStringLiteral("wangtile"));
w.writeAttribute(QStringLiteral("tileid"), QString::number(wangTile.tile()->id()));
w.writeAttribute(QStringLiteral("wangid"), wangTile.wangId().toString());
Expand Down
1 change: 1 addition & 0 deletions src/libtiled/wangset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ void WangSet::addRotations(bool alternate) {
if (alternate || !mWangIdToWangTile.contains(rotid))
{
WangTile newtile = i;
newtile.setAutogenerated(true);
switch (rotation) {
case 1: newtile.rotateRight(); break;
case 2: newtile.rotateRight(); newtile.rotateRight(); break;
Expand Down
4 changes: 4 additions & 0 deletions src/libtiled/wangset.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ class TILEDSHARED_EXPORT WangTile

Cell makeCell() const;

bool isAutogenerated() const { return mAutoGenerated; }
void setAutogenerated(bool value) { mAutoGenerated = value; }

bool operator== (const WangTile &other) const
{ return mTile == other.mTile
&& mWangId == other.mWangId
Expand All @@ -211,6 +214,7 @@ class TILEDSHARED_EXPORT WangTile
bool mFlippedHorizontally;
bool mFlippedVertically;
bool mFlippedAntiDiagonally;
bool mAutoGenerated = false; // this Tile is a rotated proxy of a real tile, don't save it to a file
};

class TILEDSHARED_EXPORT WangColor : public Object
Expand Down

0 comments on commit 7923ffa

Please sign in to comment.