Skip to content

Commit

Permalink
Write out Tiled version in TMX/JSON "version" attribute
Browse files Browse the repository at this point in the history
Now we've reached "Tiled 1.0" and this means it is about time that
version attribute starts tracking the Tiled version.

Closes #1416
  • Loading branch information
bjorn committed Apr 14, 2017
1 parent 62a89e1 commit ba7cffd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/libtiled/maptovariantconverter.cpp
Expand Up @@ -32,6 +32,8 @@
#include "tileset.h"
#include "terrain.h"

#include <QCoreApplication>

using namespace Tiled;

static QString colorToString(const QColor &color)
Expand All @@ -49,7 +51,7 @@ QVariant MapToVariantConverter::toVariant(const Map &map, const QDir &mapDir)
QVariantMap mapVariant;

mapVariant[QLatin1String("type")] = QLatin1String("map");
mapVariant[QLatin1String("version")] = 1.0;
mapVariant[QLatin1String("version")] = QCoreApplication::applicationVersion();
mapVariant[QLatin1String("orientation")] = orientationToString(map.orientation());
mapVariant[QLatin1String("renderorder")] = renderOrderToString(map.renderOrder());
mapVariant[QLatin1String("width")] = map.width();
Expand Down
2 changes: 1 addition & 1 deletion src/libtiled/mapwriter.cpp
Expand Up @@ -177,7 +177,7 @@ void MapWriterPrivate::writeMap(QXmlStreamWriter &w, const Map &map)
const QString orientation = orientationToString(map.orientation());
const QString renderOrder = renderOrderToString(map.renderOrder());

w.writeAttribute(QLatin1String("version"), QLatin1String("1.0"));
w.writeAttribute(QLatin1String("version"), QCoreApplication::applicationVersion());
w.writeAttribute(QLatin1String("orientation"), orientation);
w.writeAttribute(QLatin1String("renderorder"), renderOrder);
w.writeAttribute(QLatin1String("width"), QString::number(map.width()));
Expand Down

0 comments on commit ba7cffd

Please sign in to comment.