Skip to content

Commit

Permalink
Fix multiple TileRules being applied on a single map tile.
Browse files Browse the repository at this point in the history
  • Loading branch information
Starkku committed Feb 4, 2021
1 parent 52b991a commit bfa86f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
17 changes: 12 additions & 5 deletions MapTool.Logic/MapFileTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand All @@ -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;
}
}

Expand All @@ -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;
}
}

Expand All @@ -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;
}
}

Expand All @@ -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)
Expand All @@ -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;
}
}

Expand Down
6 changes: 3 additions & 3 deletions SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

0 comments on commit bfa86f2

Please sign in to comment.