Example #1
0
 public SolarSystem()
 {
     ID            = 0;
     Constellation = new Constellation();
     SecurityLevel = 0.0F;
     FullLocation  = "";
 }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SolarSystem"/> class.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">owner or src</exception>
        public SolarSystem(Constellation owner, SerializableSolarSystem src)
            : base(src?.Stations?.Count ?? 0)
        {
            owner.ThrowIfNull(nameof(owner));

            src.ThrowIfNull(nameof(src));

            ID            = src.ID;
            Constellation = owner;
            Name          = src.Name;
            SecurityLevel = src.SecurityLevel;
            FullLocation  = $"{owner.FullLocation} > {src.Name}";
            m_jumps       = new FastList <SolarSystem>(0);

            m_x = src.X;
            m_y = src.Y;
            m_z = src.Z;

            if (src.Stations == null)
            {
                return;
            }

            foreach (SerializableStation srcStation in src.Stations)
            {
                Items.Add(new Station(this, srcStation));
            }
        }
Example #3
0
 /// <summary>
 /// Compares this system with another one.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public int CompareTo(Constellation other)
 {
     if (this.Region != other.Region)
     {
         return(this.Region.CompareTo(other.Region));
     }
     return(m_name.CompareTo(other.m_name));
 }
Example #4
0
        /// <summary>
        /// Compares this system with another one.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">other</exception>
        public int CompareTo(Constellation other)
        {
            other.ThrowIfNull(nameof(other));

            return(Region != other.Region
                ? Region.CompareTo(other.Region)
                : String.Compare(Name, other.Name, StringComparison.CurrentCulture));
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SolarSystem"/> class.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">owner or src</exception>
        public SolarSystem(Constellation owner, SerializableSolarSystem src)
            : base(src?.Stations?.Count ?? 0)
        {
            owner.ThrowIfNull(nameof(owner));
            src.ThrowIfNull(nameof(src));

            ID            = src.ID;
            Constellation = owner;
            Name          = src.Name;
            SecurityLevel = src.SecurityLevel;
            FullLocation  = $"{owner.FullLocation} > {src.Name}";
            m_jumps       = new FastList <SolarSystem>(0);

            m_x = src.X;
            m_y = src.Y;
            m_z = src.Z;

            if (src.Stations != null)
            {
                foreach (SerializableStation srcStation in src.Stations)
                {
                    Items.Add(new Station(this, srcStation));
                }
            }

            if (src.Planets != null)
            {
                // Add planets
                m_planets = new FastList <Planet>(src.Planets.Count);
                foreach (SerializablePlanet srcPlanet in src.Planets)
                {
                    m_planets.Add(new Planet(this, srcPlanet));
                }
            }
            else
            {
                m_planets = new FastList <Planet>(1);
            }
        }
Example #6
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public SolarSystem(Constellation owner, SerializableSolarSystem src)
            : base(src.Stations == null ? 0 : src.Stations.Length)
        {
            m_id            = src.ID;
            m_owner         = owner;
            m_name          = src.Name;
            m_securityLevel = src.SecurityLevel;
            m_jumps         = new FastList <SolarSystem>(0);

            m_x = src.X;
            m_y = src.Y;
            m_z = src.Z;

            if (src.Stations == null)
            {
                return;
            }
            foreach (var srcStation in src.Stations)
            {
                m_items.Add(new Station(this, srcStation));
            }
        }