Esempio n. 1
0
        public MovementPath(IPoint3D p, Point3D goal, Map map)
        {
            Point3D start = new Point3D(p);

            m_Map = map;
            m_Start = start;
            m_Goal = goal;

            if (map == null || map == Map.Internal)
                return;

            if (Utility.InRange(start, goal, 1))
                return;

            try
            {
                PathAlgorithm alg = m_OverrideAlgorithm;

                if (alg == null)
                {
                    alg = FastAStarAlgorithm.Instance;
                    //if ( !alg.CheckCondition( m, map, start, goal ) )	// SlowAstar is still broken
                    //	alg = SlowAStarAlgorithm.Instance;		// TODO: Fix SlowAstar
                }

                if (alg != null && alg.CheckCondition(p, map, start, goal))
                    m_Directions = alg.Find(p, map, start, goal);
            }
            catch (Exception e)
            {
                Console.WriteLine("Warning: {0}: Pathing error from {1} to {2}", e.GetType().Name, start, goal);
                Server.Diagnostics.ExceptionLogging.LogException(e);
            }
        }
Esempio n. 2
0
        public MovementPath(Mobile m, Point3D goal)
        {
            Point3D start = m.Location;
            Map     map   = m.Map;

            Map   = map;
            Start = start;
            Goal  = goal;

            if (map == null || map == Map.Internal)
            {
                return;
            }

            if (Utility.InRange(start, goal, 1))
            {
                return;
            }

            try
            {
                PathAlgorithm alg = OverrideAlgorithm ?? FastAStarAlgorithm.Instance;

                if (alg?.CheckCondition(m, map, start, goal) == true)
                {
                    Directions = alg.Find(m, map, start, goal);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Warning: {0}: Pathing error from {1} to {2}", e.GetType().Name, start, goal);
            }
        }
        public MovementPath(Mobile m, Point3D goal, bool Nav)
        {
            Point3D start = m.Location;
            Map     map   = m.Map;

            m_Map   = map;
            m_Start = start;
            m_Goal  = goal;

            if (map == null || map == Map.Internal)
            {
                return;
            }

            if (Utility.InRange(start, goal, 1))
            {
                return;
            }

            try
            {
                PathAlgorithm alg = m_OverrideAlgorithm;

                if (alg == null)
                {
                    alg = NavStarAlgorithm.Instance;

                    if (!alg.CheckCondition(m, map, start, goal))
                    {
                        alg = SlowAStarAlgorithm.Instance;
                    }
                }

                if (alg != null && alg.CheckCondition(m, map, start, goal))
                {
                    m_Directions = alg.Find(m, map, start, goal);
                }
            }
            catch (Exception e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("Warning: {0}: Pathing error from {1} to {2}", e.GetType().Name, start, goal);
            }
        }
Esempio n. 4
0
        public MovementPath(Mobile m, Point3D goal)
        {
            Point3D start = m.Location;
            Map     map   = m.Map;

            m_Map   = map;
            m_Start = start;
            m_Goal  = goal;

            if (map == null || map == Map.Internal)
            {
                return;
            }

            if (Utility.InRange(start, goal, 1))
            {
                return;
            }

            try
            {
                PathAlgorithm alg = m_OverrideAlgorithm;

                if (alg == null)
                {
                    alg = FastAStarAlgorithm.Instance;

                    if (!alg.CheckCondition(m, map, start, goal))
                    {
                        alg = SlowAStarAlgorithm.Instance;
                    }
                }

                if (alg != null && alg.CheckCondition(m, map, start, goal))
                {
                    m_Directions = alg.Find(m, map, start, goal);
                }
            }
            catch (Exception e)
            {
                log.Warn(String.Format("{0}: Pathing error from {1} to {2}",
                                       e.GetType().Name, start, goal));
            }
        }
Esempio n. 5
0
        public MovementPath(Mobile m, Point3D goal)
        {
            Point3D start = m.Location;
            Map     map   = m.Map;

            m_Map   = map;
            m_Start = start;
            m_Goal  = goal;

            if (map == null || map == Map.Internal)
            {
                return;
            }

            if (Utility.InRange(start, goal, 1))
            {
                return;
            }

            try
            {
                PathAlgorithm alg = m_OverrideAlgorithm;

                if (alg == null)
                {
                    alg = FastAStarAlgorithm.Instance;

                    if (!alg.CheckCondition(m, map, start, goal))
                    {
                        alg = SlowAStarAlgorithm.Instance;
                    }
                }

                //if ( !alg.CheckCondition( m, map, start, goal ) )	// SlowAstar is still broken
                //	alg = SlowAStarAlgorithm.Instance;		// TODO: Fix SlowAstar
            }
            catch (Exception e)
            {
                Console.WriteLine("Warning: {0}: Pathing error from {1} to {2}", e.GetType().Name, start, goal);
            }
        }