From bfa86f2fb865565e6a294f7a72b364f225cf3aa0 Mon Sep 17 00:00:00 2001 From: Starkku Date: Thu, 4 Feb 2021 19:45:01 +0200 Subject: [PATCH] Fix multiple TileRules being applied on a single map tile. --- MapTool.Logic/MapFileTool.cs | 17 ++++++++++++----- SharedAssemblyInfo.cs | 6 +++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/MapTool.Logic/MapFileTool.cs b/MapTool.Logic/MapFileTool.cs index c23ec13..6608930 100644 --- a/MapTool.Logic/MapFileTool.cs +++ b/MapTool.Logic/MapFileTool.cs @@ -836,6 +836,8 @@ private bool ApplyTileConversionRules() if (!tile.IsValid) continue; + bool tileModified = false; + foreach (TileConversionRule rule in tileRules) { if (rule.CoordinateFilterX > -1 && rule.CoordinateFilterX != tile.X || @@ -860,7 +862,7 @@ private bool ApplyTileConversionRules() { Logger.Debug("TileRules: Tile index " + tile.TileIndex + " at X:" + tile.X + ", Y:" + tile.Y + " - height changed from " + tile.Level + " to " + height + "."); tile.Level = height; - tileDataChanged = true; + tileModified = true; } } @@ -871,7 +873,7 @@ private bool ApplyTileConversionRules() { Logger.Debug("TileRules: Tile index " + tile.TileIndex + " at X:" + tile.X + ", Y:" + tile.Y + " - sub tile index changed from " + tile.SubTileIndex + " to " + subtileIndex + "."); tile.SubTileIndex = subtileIndex; - tileDataChanged = true; + tileModified = true; } } @@ -882,7 +884,7 @@ private bool ApplyTileConversionRules() { Logger.Debug("TileRules: Tile index " + tile.TileIndex + " at X:" + tile.X + ", Y:" + tile.Y + " - ice growth flag changed from " + tile.IceGrowth + " to " + iceGrowth + "."); tile.IceGrowth = iceGrowth; - tileDataChanged = true; + tileModified = true; } } @@ -902,7 +904,7 @@ private bool ApplyTileConversionRules() { Logger.Debug("TileRules: Tile index " + tile.TileIndex + " at X:" + tile.X + ", Y:" + tile.Y + " - index changed to " + newTileIndex); tile.TileIndex = newTileIndex; - tileDataChanged = true; + tileModified = true; } if (rule.SubIndexOverride < 0 && rule.NewSubStartIndex >= 0 && rule.NewSubEndIndex >= 0) @@ -923,10 +925,15 @@ private bool ApplyTileConversionRules() { Logger.Debug("TileRules: Tile sub-tile index " + tile.SubTileIndex + " at X:" + tile.X + ", Y:" + tile.Y + " - index changed to " + newSubTileIndex); tile.SubTileIndex = newSubTileIndex; - tileDataChanged = true; + tileModified = true; } } } + + tileDataChanged = tileDataChanged || tileModified; + + if (tileModified) + break; } } diff --git a/SharedAssemblyInfo.cs b/SharedAssemblyInfo.cs index 085da7e..db6b224 100644 --- a/SharedAssemblyInfo.cs +++ b/SharedAssemblyInfo.cs @@ -3,6 +3,6 @@ [assembly: AssemblyCopyright("Copyright © Starkku 2017-2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("2.0.0.2")] -[assembly: AssemblyFileVersion("2.0.0.2")] -[assembly: AssemblyInformationalVersion("2.0.0.2")] +[assembly: AssemblyVersion("2.0.0.3")] +[assembly: AssemblyFileVersion("2.0.0.3")] +[assembly: AssemblyInformationalVersion("2.0.0.3")]