private JDictionary <Planet, int> Destinations(JGraph <string> map, JDictionary <string, Planet> planets, bool includeHostile, bool onlyHostile) { JDictionary <Planet, int> planetDestinations = new JDictionary <Planet, int>(); Planet start; if (Orbiting != null) { start = Orbiting; } else if (NextStop != null) { start = NextStop; } else { return(planetDestinations); } JDictionary <string, int> destinations; if (map.TryReachableVertices(start.ID, out destinations, p => Military.Faction.Relationships[planets[p].Faction.ID] != Relationship.Enemy, includeHostile)) { destinations.Remove(start.ID); foreach (string s in destinations.Keys) { Relationship relationship = Military.Faction.Relationships[planets[s].Faction.ID]; if (!onlyHostile || (onlyHostile && relationship == Relationship.Enemy)) { planetDestinations.Add(planets[s], destinations[s] / (int)(hourlyDistance / Speed)); } } } return(planetDestinations); }
public void AddGovernment(Government g) { string ID = FreshGovernmentID(g); g.ID = ID; Governments.Add(g.ID, g); }
public void AddFleet(Fleet fleet) { string ID = FreshFleetID(fleet); fleet.ID = ID; Fleets.Add(fleet.ID, fleet); }
public void AddCharacter(Character c) { string ID = FreshCharacterID(c); c.ID = ID; Characters.Add(c.ID, c); }
public void AddPlanet(Planet p) { string ID = FreshPlanetID(p); p.ID = ID; Planets.Add(p.ID, p); }
public MSCompactShortcutSet(MSSInput input, ShortcutSetFactory shortcutSetFactory) { ShortcutSetFactory = shortcutSetFactory; Input = input; LevelCounts = new JDictionary <int, int>(); MinLevels = new JDictionary <Shortcut, int>(); for (var level = 1; level <= input.NumLevels; level++) { LevelCounts.Add(level, 0); } }
public IShortcutSet Clone() { var newIntervalMap = new JDictionary <TPoint2D, LinkedList <Interval> >(); foreach (var pair in IntervalMap) { var intervals = new LinkedList <Interval>(); foreach (var interval in pair.Value) { intervals.AddLast(new Interval(interval.Start, interval.End, interval.Weight)); } newIntervalMap.Add(pair.Key, intervals); } return(new ShortcutIntervalSet(Trajectory, newIntervalMap)); }