internal static void CleanDeadMaps()
 {
     for (int i = 0; i < AnimalManager.activePolicies.Count; i++)
     {
         MapActivePolicy map = AnimalManager.activePolicies[i];
         if (!Find.Maps.Any(x => x.uniqueID == map.mapId))
         {
             if (!Find.Maps.Any(x => x.uniqueID == map.mapId))
             {
                 if (Find.Maps.Count == 1 && !AnimalManager.ActivePoliciesContainsValidMap())
                 {
                     //this means the player was on the move without any base
                     //and just re-settled. So, let's move the settings to
                     //the new map
                     int mapid = Find.CurrentMap.uniqueID;
                     AnimalManager.MoveLinksToMap(mapid);
                     map.mapId = mapid;
                 }
                 else
                 {
                     AnimalManager.DeleteLinksInMap(map.mapId);
                     AnimalManager.DeleteMap(map);
                 }
             }
         }
     }
 }
 private static void CleanDeadMaps()
 {
     for (int i = 0; i < RestrictManager.activePolicies.Count; i++)
     {
         MapActivePolicy map = RestrictManager.activePolicies[i];
         if (!Find.Maps.Any(x => x.uniqueID == map.mapId))
         {
             RestrictManager.DeleteLinksInMap(map.mapId);
             RestrictManager.DeleteMap(map);
         }
     }
 }
예제 #3
0
        internal static void SetActivePolicy(int mapId, Policy policy)
        {
            MapActivePolicy map = activePolicies.Find(x => x.mapId == mapId);

            if (map != null)
            {
                map.activePolicy = policy;
            }
            else
            {
                activePolicies.Add(new MapActivePolicy(mapId, policy));
            }
        }
예제 #4
0
        internal static Policy GetActivePolicy(int mapId)
        {
            MapActivePolicy mapPolicy = activePolicies.Find(
                x => x.mapId == mapId);

            if (mapPolicy == null)
            {
                //new map!create default
                mapPolicy = new MapActivePolicy(mapId, policies[0]);
                activePolicies.Add(mapPolicy);
            }
            return(mapPolicy.activePolicy);
        }
예제 #5
0
 internal static void DeleteMap(MapActivePolicy map)
 {
     activePolicies.Remove(map);
 }