OSDN Git Service

W.I.P. #5 Point of Interest designators now better
[automap/automap.git] / Automap / Data / PointOfInterest.cs
index bec12fd..93d5d7f 100644 (file)
@@ -1,4 +1,5 @@
 using System;
+using System.Collections.ObjectModel;
 
 using Vintagestory.API.Common;
 using Vintagestory.API.MathTools;
@@ -16,5 +17,25 @@ namespace Automap
                public DateTimeOffset Timestamp;
        }
 
+       public class PointsOfInterest : KeyedCollection<BlockPos, PointOfInterest>
+       {
+               protected override BlockPos GetKeyForItem(PointOfInterest item)
+               {
+               return item.Location;
+               }
+
+               internal void AddReplace(PointOfInterest poi)
+               {
+               if (this.Contains(poi.Location)) {
+               this.Remove(poi.Location);
+               this.Add(poi);
+               }
+               else {
+               this.Add(poi);          
+               }
+
+               }
+       }
+
 }