Skip to content

Commit dfab332

Browse files
committed
Use 1x1 as brush size to calculate origin height level for tile placement
1 parent 3dd3e85 commit dfab332

2 files changed

Lines changed: 28 additions & 30 deletions

File tree

src/TSMapEditor/Mutations/Classes/PlaceTerrainTileMutation.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,25 @@ public override void Perform()
6262
int originLevel = -1;
6363

6464
// First, look up the lowest point within the tile area for origin level
65-
brushSize.DoForBrushSize(offset =>
65+
// Only use a 1x1 brush size for this (meaning no brush at all)
66+
// so users can use larger brush sizes to "paint height"
67+
for (int i = 0; i < tile.TMPImages.Length; i++)
6668
{
67-
for (int i = 0; i < tile.TMPImages.Length; i++)
68-
{
69-
MGTMPImage image = tile.TMPImages[i];
69+
MGTMPImage image = tile.TMPImages[i];
7070

71-
if (image.TmpImage == null)
72-
continue;
71+
if (image.TmpImage == null)
72+
continue;
7373

74-
int cx = targetCellCoords.X + (offset.X * tile.Width) + i % tile.Width;
75-
int cy = targetCellCoords.Y + (offset.Y * tile.Height) + i / tile.Width;
74+
int cx = targetCellCoords.X + (tile.Width) + i % tile.Width;
75+
int cy = targetCellCoords.Y + (tile.Height) + i / tile.Width;
7676

77-
var mapTile = MutationTarget.Map.GetTile(cx, cy);
78-
if (mapTile != null)
79-
{
80-
if (originLevel < 0 || mapTile.Level < originLevel)
81-
originLevel = mapTile.Level;
82-
}
77+
var mapTile = MutationTarget.Map.GetTile(cx, cy);
78+
if (mapTile != null)
79+
{
80+
if (originLevel < 0 || mapTile.Level < originLevel)
81+
originLevel = mapTile.Level;
8382
}
84-
});
83+
}
8584

8685
// Place the terrain
8786
brushSize.DoForBrushSize(offset =>

src/TSMapEditor/UI/CursorActions/PlaceTerrainCursorAction.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,25 @@ private void DoActionForCells(Point2D cellCoords, Action<MapTile> action)
5858
BrushSize brush = CursorActionTarget.BrushSize;
5959

6060
// First, look up the lowest point within the tile area for origin level
61-
brush.DoForBrushSize(offset =>
61+
// Only use a 1x1 brush size for this (meaning no brush at all)
62+
// so users can use larger brush sizes to "paint height"
63+
for (int i = 0; i < Tile.TMPImages.Length; i++)
6264
{
63-
for (int i = 0; i < Tile.TMPImages.Length; i++)
64-
{
65-
MGTMPImage image = Tile.TMPImages[i];
65+
MGTMPImage image = Tile.TMPImages[i];
6666

67-
if (image.TmpImage == null)
68-
continue;
67+
if (image.TmpImage == null)
68+
continue;
6969

70-
int cx = adjustedCellCoords.X + (offset.X * Tile.Width) + i % Tile.Width;
71-
int cy = adjustedCellCoords.Y + (offset.Y * Tile.Height) + i / Tile.Width;
70+
int cx = adjustedCellCoords.X + Tile.Width + i % Tile.Width;
71+
int cy = adjustedCellCoords.Y + Tile.Height + i / Tile.Width;
7272

73-
var mapTile = MutationTarget.Map.GetTile(cx, cy);
74-
if (mapTile != null)
75-
{
76-
if (originLevel < 0 || mapTile.Level < originLevel)
77-
originLevel = mapTile.Level;
78-
}
73+
var mapTile = MutationTarget.Map.GetTile(cx, cy);
74+
if (mapTile != null)
75+
{
76+
if (originLevel < 0 || mapTile.Level < originLevel)
77+
originLevel = mapTile.Level;
7978
}
80-
});
79+
}
8180

8281
// Then apply the preview data
8382
brush.DoForBrushSize(offset =>

0 commit comments

Comments
 (0)