• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Automap (client) [VS plugin mod]


Commit MetaInfo

Revisione872e172bf4468414151947d070ad05c4cb596be (tree)
Time2019-12-11 09:25:37
Authormelchior <melchior@user...>
Commitermelchior

Log Message

FIX: Temporary chunks list to avoid Enumerator mutation

Change Summary

Incremental Difference

--- a/Automap/Automap_Internals.cs
+++ b/Automap/Automap_Internals.cs
@@ -45,7 +45,7 @@ namespace Automap
4545 private void StartAutomap( )
4646 {
4747 path = ClientAPI.GetOrCreateDataPath(_mapPath);
48- path = ClientAPI.GetOrCreateDataPath(Path.Combine(path, "World_" + ClientAPI.World.Seed));
48+ path = ClientAPI.GetOrCreateDataPath(Path.Combine(path, "World_" + ClientAPI.World.Seed));//Add name of World too!
4949
5050 stylesFile = ClientAPI.World.AssetManager.Get(new AssetLocation(_domain, "config/automap_format.css"));
5151 Logger.VerboseDebug("CSS loaded: {0} size: {1}",stylesFile.IsLoaded() ,stylesFile.ToText( ).Length);
@@ -107,11 +107,12 @@ namespace Automap
107107 uint ejectedItem = 0;
108108 uint updatedChunks = 0;
109109
110- while (columnCounter.Count > 0) {
111- //BUG:WIN crash here; Possibly "First()", edit race-cond?
112- var mostActiveCol = columnCounter.OrderByDescending(kvp => kvp.Value).First( );//FIX?
113- var mapChunk = ClientAPI.World.BlockAccessor.GetMapChunk(mostActiveCol.Key);
110+ //-- Should dodge enumerator changing underfoot....at a cost.
111+ if (!columnCounter.IsEmpty) {
112+ var tempSet = columnCounter.ToArray( ).OrderByDescending(kvp => kvp.Value);
113+ foreach (var mostActiveCol in tempSet) {
114114
115+ var mapChunk = ClientAPI.World.BlockAccessor.GetMapChunk(mostActiveCol.Key);
115116
116117 if (mapChunk == null) {
117118 Logger.Warning("SKIP CHUNK: ({0}) - Map Chunk NULL!", mostActiveCol.Key);
@@ -141,6 +142,7 @@ namespace Automap
141142 }
142143
143144 }
145+ }
144146
145147 if (updatedChunks > 0) {
146148 lastUpdate = updatedChunks;