Skip to content
Permalink
Browse files

Worlds: Fixed handling of negative multiplierX/Y

It was invalidating the pattern since the mapWidth/mapHeight properties
defaulted to values of multiplierX/multiplierY, without taking the
absolute value, and negative map sizes are invalid.

So, a workaround for those affected would be to explicitly set the
mapWidth/mapHeight properties to the appropriate positive value.

Tiled-forum: https://discourse.mapeditor.org/t/negative-value-in-world-offset-value/3963
  • Loading branch information...
bjorn committed Jun 19, 2019
1 parent 8c85a48 commit 39a79eeff258bbd62876c6914651816814e1d480
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/libtiled/worldmanager.cpp
@@ -147,8 +147,8 @@ std::unique_ptr<World> WorldManager::privateLoadWorld(const QString &fileName,
pattern.multiplierY = patternObject.value(QLatin1String("multiplierY")).toInt(1);
pattern.offset = QPoint(patternObject.value(QLatin1String("offsetX")).toInt(),
patternObject.value(QLatin1String("offsetY")).toInt());
pattern.mapSize = QSize(patternObject.value(QLatin1String("mapWidth")).toInt(pattern.multiplierX),
patternObject.value(QLatin1String("mapHeight")).toInt(pattern.multiplierY));
pattern.mapSize = QSize(patternObject.value(QLatin1String("mapWidth")).toInt(std::abs(pattern.multiplierX)),
patternObject.value(QLatin1String("mapHeight")).toInt(std::abs(pattern.multiplierY)));

if (pattern.regexp.captureCount() != 2)
qWarning() << "Invalid number of captures in" << pattern.regexp;

0 comments on commit 39a79ee

Please sign in to comment.
You can’t perform that action at this time.