OSDN Git Service

W.I.P. Fixes for several issues - plus better Shard processing snapshots_m
authormelchior <melchior@users.osdn.me>
Mon, 26 Oct 2020 22:32:34 +0000 (18:32 -0400)
committermelchior <melchior@users.osdn.me>
Mon, 26 Oct 2020 22:32:34 +0000 (18:32 -0400)
Automap/Data/ColumnMeta.cs
Automap/Designators/DefaultDesignators.cs
Automap/Subsystems/AutomapSystem.cs

index bdba0f7..f1e9681 100644 (file)
@@ -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( );
                }
                }
 
index aa13d4e..41bd4af 100644 (file)
@@ -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,
                                                        }
                                                        );
index fef3886..4013b9a 100644 (file)
@@ -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