Beispiel #1
0
        public bool UpdateSignpostTo(SolarSystem destination) // returns true if the destination has already been found
        {
            bool updated = false;

            SolarSystem sSecure = GetNeighbourWithShortestDistanceTo(destination, true);
            SolarSystem sShort = GetNeighbourWithShortestDistanceTo(destination, false);

            if ((sSecure != null) && (SecurityStatus.IsSecure(this.Security)))
            {
                if (signpostSecure.ContainsKey(destination)) 
                {
                    if (signpostSecure[destination].Distance > (sSecure.SignpostSecure[destination].Distance + 1))
                    {
                        signpostSecure[destination] = new SignpostEntry(sSecure, sSecure.SignpostSecure[destination].Distance + 1);
                        updated = true;
                    }
                }
                else
                {
                    signpostSecure[destination] = new SignpostEntry(sSecure, sSecure.SignpostSecure[destination].Distance + 1);
                    updated = true;
                }
            }

            if (sShort != null)
            {
                if (signpostShortest.ContainsKey(destination))
                {
                    if (signpostShortest[destination].Distance > (sShort.SignpostShortest[destination].Distance + 1))
                    {
                        signpostShortest[destination] = new SignpostEntry(sShort, sShort.SignpostShortest[destination].Distance + 1);
                        updated = true;
                    }
                }
                else
                {
                    signpostShortest[destination] = new SignpostEntry(sShort, sShort.SignpostShortest[destination].Distance + 1);
                    updated = true;
                }
            }

            return updated;
        }
Beispiel #2
0
 public SolarSystem(int itemId, string itemName, Region region, float security)
 {
     id = itemId;
     name = itemName;
     securityValue = security;
     this.region = region;
     signpostShortest[this] = new SignpostEntry(null, 0);
     if (security >= 0.45f)
     {
         signpostSecure[this] = new SignpostEntry(null, 0);
     }
 }
Beispiel #3
0
 public void AddGateTo(SolarSystem destination)
 {
     gates.Add(destination);
     if (SecurityStatus.IsSecure(Math.Min(this.Security, destination.Security)))
     {
         signpostSecure[destination] = new SignpostEntry(destination, 1);
     }
     signpostShortest[destination] = new SignpostEntry(destination, 1);
 }