Commit 157d413d42b12d98acf053f50f762caf5830ae69

Store the tileset image width/height in the map file

Useful for when you can't load the image just at the moment, but still
want to figure out where your tiles should be.

In the future it can also be used to be able to load maps correctly
after extending the width of a tileset image, which at the moment messes
up the tile indices.
  
7878 ++tileNum;
7979 }
8080
81 mImageWidth = image.width();
82 mImageHeight = image.height();
8183 mColumnCount = (image.width() - mMargin * 2 + mTileSpacing)
8284 / (mTileWidth + mTileSpacing);
8385 mImageSource = fileName;
  
5757 mTileHeight(tileHeight),
5858 mTileSpacing(tileSpacing),
5959 mMargin(margin),
60 mImageWidth(0),
61 mImageHeight(0),
6062 mColumnCount(0)
6163 {
6264 }
130130 int columnCount() const { return mColumnCount; }
131131
132132 /**
133 * Returns the width of the tileset image.
134 */
135 int imageWidth() const { return mImageWidth; }
136
137 /**
138 * Returns the height of the tileset image.
139 */
140 int imageHeight() const { return mImageHeight; }
141
142 /**
133143 * Returns the transparent color, or an invalid color if no transparent
134144 * color is used.
135145 */
182182 int mTileHeight;
183183 int mTileSpacing;
184184 int mMargin;
185 int mImageWidth;
186 int mImageHeight;
185187 int mColumnCount;
186188 QList<Tile*> mTiles;
187189};
  
221221 if (transColor.isValid())
222222 w.writeAttribute(QLatin1String("trans"), transColor.name().mid(1));
223223
224 if (tileset->imageWidth() > 0)
225 w.writeAttribute(QLatin1String("width"),
226 QString::number(tileset->imageWidth()));
227 if (tileset->imageHeight() > 0)
228 w.writeAttribute(QLatin1String("height"),
229 QString::number(tileset->imageHeight()));
230
224231 w.writeEndElement();
225232 }
226233