Automap (OSS) GIT software repository
Revisión | 989738939a2e623b8bf6db337968e3114a9a99ee (tree) |
---|---|
Tiempo | 2020-10-27 07:32:34 |
Autor | ![]() |
Commiter | melchior |
W.I.P. Fixes for several issues - plus better Shard processing
@@ -193,6 +193,12 @@ namespace Automap | ||
193 | 193 | |
194 | 194 | } |
195 | 195 | |
196 | + internal void ClearMetadata( ) | |
197 | + { | |
198 | + this.HeightMap = null; | |
199 | + this.RockRatio = null; | |
200 | + this._flattened_HeightMap = null; | |
201 | + } | |
196 | 202 | |
197 | 203 | internal ColumnMeta Reload(ICoreClientAPI clientAPI) |
198 | 204 | { |
@@ -285,8 +291,7 @@ namespace Automap | ||
285 | 291 | { |
286 | 292 | for (int i = 0, maxItemsCount = this.Items.Count; i < maxItemsCount; i++) { |
287 | 293 | ColumnMeta entry = this.Items[i]; |
288 | - entry.HeightMap = null; | |
289 | - entry.RockRatio = null;//Also regenerated when any chunk in a column is changed... | |
294 | + entry.ClearMetadata( ); | |
290 | 295 | } |
291 | 296 | } |
292 | 297 |
@@ -2,6 +2,8 @@ | ||
2 | 2 | using System.Collections.Generic; |
3 | 3 | using System.Drawing; |
4 | 4 | using System.Text; |
5 | +using System.Text.RegularExpressions; | |
6 | + | |
5 | 7 | using Vintagestory.API.Client; |
6 | 8 | using Vintagestory.API.Common; |
7 | 9 | using Vintagestory.API.Common.Entities; |
@@ -12,6 +14,8 @@ namespace Automap | ||
12 | 14 | { |
13 | 15 | public static class DefaultDesignators |
14 | 16 | { |
17 | + private static Regex stripControlChars = new Regex(@"\s", RegexOptions.Multiline); | |
18 | + | |
15 | 19 | public static BlockDesignator Roads = |
16 | 20 | new BlockDesignator( |
17 | 21 | new AssetLocation("game", "stonepath"), |
@@ -100,7 +104,7 @@ namespace Automap | ||
100 | 104 | Name = "Sign", |
101 | 105 | PrettyLocation = posn.PrettyCoords(clientAPI), |
102 | 106 | Location = posn.Copy(), |
103 | - Notes = signEntity.text.Replace("\n"," "), | |
107 | + Notes = stripControlChars.Replace(signEntity.text, " "), | |
104 | 108 | Timestamp = DateTime.UtcNow, |
105 | 109 | } |
106 | 110 | ); |
@@ -127,7 +131,7 @@ namespace Automap | ||
127 | 131 | Name = "Signpost", |
128 | 132 | PrettyLocation = posn.PrettyCoords(clientAPI), |
129 | 133 | Location = posn.Copy(), |
130 | - Notes = string.Join(",", signEntity.textByCardinalDirection).Replace("\n", " "), | |
134 | + Notes = stripControlChars.Replace(string.Join(",", signEntity.textByCardinalDirection), " "), | |
131 | 135 | Timestamp = DateTime.UtcNow, |
132 | 136 | } |
133 | 137 | ); |
@@ -240,8 +240,6 @@ namespace Automap | ||
240 | 240 | #endif |
241 | 241 | } |
242 | 242 | } |
243 | - //Cleanup in-memory Metadata... | |
244 | - chunkTopMetadata.ClearMetadata(); | |
245 | 243 | } |
246 | 244 | |
247 | 245 | UpdateStatus(this.updatedChunksTotal, this.nullChunkCount, updatedChunks); |
@@ -252,6 +250,9 @@ namespace Automap | ||
252 | 250 | updatedChunksTotal += updatedChunks; |
253 | 251 | JsonGenerator.GenerateJSONMetadata(chunkTopMetadata, startChunkColumn, POIs, EOIs, RockIdCodes); |
254 | 252 | updatedChunks = 0; |
253 | + | |
254 | + //Cleanup in-memory Metadata... | |
255 | + chunkTopMetadata.ClearMetadata( ); | |
255 | 256 | } |
256 | 257 | |
257 | 258 | //Then sleep until interupted again, and repeat |