Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void AddGovernment(Government g)
        {
            string ID = FreshGovernmentID(g);

            g.ID = ID;
            Governments.Add(g.ID, g);
        }
Ejemplo n.º 3
0
        public void AddFleet(Fleet fleet)
        {
            string ID = FreshFleetID(fleet);

            fleet.ID = ID;
            Fleets.Add(fleet.ID, fleet);
        }
Ejemplo n.º 4
0
        public void AddCharacter(Character c)
        {
            string ID = FreshCharacterID(c);

            c.ID = ID;
            Characters.Add(c.ID, c);
        }
Ejemplo n.º 5
0
        public void AddPlanet(Planet p)
        {
            string ID = FreshPlanetID(p);

            p.ID = ID;
            Planets.Add(p.ID, p);
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
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));
        }