From 989738939a2e623b8bf6db337968e3114a9a99ee Mon Sep 17 00:00:00 2001 From: melchior Date: Mon, 26 Oct 2020 18:32:34 -0400 Subject: [PATCH] W.I.P. Fixes for several issues - plus better Shard processing --- Automap/Data/ColumnMeta.cs | 9 +++++++-- Automap/Designators/DefaultDesignators.cs | 8 ++++++-- Automap/Subsystems/AutomapSystem.cs | 5 +++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Automap/Data/ColumnMeta.cs b/Automap/Data/ColumnMeta.cs index bdba0f7..f1e9681 100644 --- a/Automap/Data/ColumnMeta.cs +++ b/Automap/Data/ColumnMeta.cs @@ -193,6 +193,12 @@ namespace Automap } + internal void ClearMetadata( ) + { + this.HeightMap = null; + this.RockRatio = null; + this._flattened_HeightMap = null; + } internal ColumnMeta Reload(ICoreClientAPI clientAPI) { @@ -285,8 +291,7 @@ namespace Automap { for (int i = 0, maxItemsCount = this.Items.Count; i < maxItemsCount; i++) { ColumnMeta entry = this.Items[i]; - entry.HeightMap = null; - entry.RockRatio = null;//Also regenerated when any chunk in a column is changed... + entry.ClearMetadata( ); } } diff --git a/Automap/Designators/DefaultDesignators.cs b/Automap/Designators/DefaultDesignators.cs index aa13d4e..41bd4af 100644 --- a/Automap/Designators/DefaultDesignators.cs +++ b/Automap/Designators/DefaultDesignators.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Drawing; using System.Text; +using System.Text.RegularExpressions; + using Vintagestory.API.Client; using Vintagestory.API.Common; using Vintagestory.API.Common.Entities; @@ -12,6 +14,8 @@ namespace Automap { public static class DefaultDesignators { + private static Regex stripControlChars = new Regex(@"\s", RegexOptions.Multiline); + public static BlockDesignator Roads = new BlockDesignator( new AssetLocation("game", "stonepath"), @@ -100,7 +104,7 @@ namespace Automap Name = "Sign", PrettyLocation = posn.PrettyCoords(clientAPI), Location = posn.Copy(), - Notes = signEntity.text.Replace("\n"," "), + Notes = stripControlChars.Replace(signEntity.text, " "), Timestamp = DateTime.UtcNow, } ); @@ -127,7 +131,7 @@ namespace Automap Name = "Signpost", PrettyLocation = posn.PrettyCoords(clientAPI), Location = posn.Copy(), - Notes = string.Join(",", signEntity.textByCardinalDirection).Replace("\n", " "), + Notes = stripControlChars.Replace(string.Join(",", signEntity.textByCardinalDirection), " "), Timestamp = DateTime.UtcNow, } ); diff --git a/Automap/Subsystems/AutomapSystem.cs b/Automap/Subsystems/AutomapSystem.cs index fef3886..4013b9a 100644 --- a/Automap/Subsystems/AutomapSystem.cs +++ b/Automap/Subsystems/AutomapSystem.cs @@ -240,8 +240,6 @@ namespace Automap #endif } } - //Cleanup in-memory Metadata... - chunkTopMetadata.ClearMetadata(); } UpdateStatus(this.updatedChunksTotal, this.nullChunkCount, updatedChunks); @@ -252,6 +250,9 @@ namespace Automap updatedChunksTotal += updatedChunks; JsonGenerator.GenerateJSONMetadata(chunkTopMetadata, startChunkColumn, POIs, EOIs, RockIdCodes); updatedChunks = 0; + + //Cleanup in-memory Metadata... + chunkTopMetadata.ClearMetadata( ); } //Then sleep until interupted again, and repeat -- 2.11.0