Live Reloading of Worlds and Fixes


The new multi-map world view that was released with last week's development snapshot now automatically refreshes when loading, unloading or changing a world file. A number of fixes have been made as well, the biggest being the proper flipping and rotating of multi-layer stamps.

If anybody had already updated to yesterday's 2018.05.31 build, please update again because unfortunately I had introduced a crash when rotating the current stamp.

Changelog

Thorbjørn Lindeijer

  • Worlds: Report errors and refresh on load/unload
  • Worlds: Automatically reload world files when they change
  • Worlds: Only jump to another map with left mouse button
  • Fixed terrain brush issue on staggered isometric maps (#1951)
  • Fixed flip and rotate actions for multi-layer stamps (#282)
  • Fixed handling of tile drawing offset in Tile Collision Editor (#1955)
  • Fixed objects to stay selected when moving them between groups
  • Qbs: Fixed issue with building the snapshot for Windows XP

Code Maintenance

For those who are interested I'm going to share a bit about some under the hood changes I recently made!

Range-based For Loops

While working to fix some issues with the recently introduced multi-layer tile stamps, I realized that I needed a convenient way to iterate over all the tile layers of a map. I already had written a LayerIterator, but I really wanted to be able to use the range-based for loops that were introduced with C++11.

To enable this, I extended the LayerIterator class with some standard operators for iterators and added a LayerIteratorHelper class, which returns the begin and end of the range. Based on that change, we can now iterate tile layers as follows without allocating a temporary list:

  for (Layer *layer : map->tileLayers()) {
      auto tileLayer = static_cast<TileLayer*>(layer);
      // do something with the tile layer
  }

I don't like the need for the static_cast, and maybe in the future I will use templates to get rid of that. But it may be tricky, because the LayerIterator can filter on multiple layer types.

General Modernizations

This week I also replaced QScopedPointer with std::unique_ptr, and last week I've replaced Qt's foreach macro with range-based for loops everywhere. Also, all connections made between objects are now using the new type-safe syntax instead of the previously string-based API that could not report errors at compile time. While you won't see any of this when using Tiled, it can sometimes help to avoid bugs and it can make the code easier to read.

I hope you found that interesting!

Files

Tiled for Windows (32-bit), snapshot 22 MB
Version 2018.06.01 Jun 01, 2018
Tiled for Windows 64-bit (snapshot) 24 MB
Version 2018.06.01 Jun 01, 2018
Tiled for Windows XP (snapshot) 19 MB
Version 2018.06.01 Jun 01, 2018
Tiled for macOS (snapshot) 15 MB
Version 2018.06.01 Jun 01, 2018
Tiled for Linux (snapshot) 35 MB
Version 2018.06.01 Jun 01, 2018

Get Tiled Map Editor

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.