Skip to content

Commit

Permalink
Fixed terrain brush issue on staggered isometric maps
Browse files Browse the repository at this point in the history
Neighbors can be two tiles away on a staggered map, which needs to be
taken into account when determining the bounds of the area to be
processed by the terrain brush.

Closes #1951
  • Loading branch information
bjorn committed May 15, 2018
1 parent 64d1cd5 commit 617ed97
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/tiled/terrainbrush.cpp
Expand Up @@ -408,16 +408,19 @@ void TerrainBrush::updateBrush(QPoint cursorPos, const QVector<QPoint> *list)
QRect bounds;
for (ConsiderationPoint point : transitionList)
bounds |= QRect(point, point);

auto staggeredRenderer = dynamic_cast<StaggeredRenderer*>(mapDocument()->renderer());

int margin = terrainTileset ? terrainTileset->maximumTerrainDistance() : 3;
if (staggeredRenderer)
++margin;
bounds.adjust(-margin, -margin, margin, margin);

if (!mapDocument()->map()->infinite())
bounds = bounds.intersected(currentLayer->rect().translated(-layerPosition));

int initialTiles = transitionList.size();

auto staggeredRenderer = dynamic_cast<StaggeredRenderer*>(mapDocument()->renderer());

// produce terrain with transitions using a simple, relative naive approach (considers each tile once, and doesn't allow re-consideration if selection was bad)
while (!transitionList.isEmpty()) {
// get the next point in the consideration list
Expand Down

0 comments on commit 617ed97

Please sign in to comment.