Exemplo n.º 1
0
        // The references are not needed anymore
        // tell the source to remove them from the list and free the mem
        public void DeleteReferences()
        {
            HostileReference refe = GetFirst();

            while (refe != null)
            {
                HostileReference nextRef = refe.Next();
                refe.RemoveReference();
                refe = nextRef;
            }
        }
Exemplo n.º 2
0
        // Remove specific faction references
        public void DeleteReferencesForFaction(uint faction)
        {
            HostileReference refe = GetFirst();

            while (refe != null)
            {
                HostileReference nextRef = refe.Next();
                if (refe.GetSource().GetOwner().GetFactionTemplateEntry().Faction == faction)
                {
                    refe.RemoveReference();
                }
                refe = nextRef;
            }
        }
Exemplo n.º 3
0
        public void UpdateVisibility()
        {
            HostileReference refe = GetFirst();

            while (refe != null)
            {
                HostileReference nextRef = refe.Next();
                if (!refe.GetSource().GetOwner().CanSeeOrDetect(GetOwner()))
                {
                    nextRef = refe.Next();
                    refe.RemoveReference();
                }
                refe = nextRef;
            }
        }
Exemplo n.º 4
0
        // delete one reference, defined by Unit
        public void DeleteReference(Unit creature)
        {
            HostileReference refe = GetFirst();

            while (refe != null)
            {
                HostileReference nextRef = refe.Next();
                if (refe.GetSource().GetOwner() == creature)
                {
                    refe.RemoveReference();
                    break;
                }
                refe = nextRef;
            }
        }
Exemplo n.º 5
0
        // delete all references out of specified range
        public void DeleteReferencesOutOfRange(float range)
        {
            HostileReference refe = GetFirst();

            range = range * range;
            while (refe != null)
            {
                HostileReference nextRef = refe.Next();
                Unit             owner   = refe.GetSource().GetOwner();
                if (!owner.IsActiveObject() && owner.GetExactDist2dSq(GetOwner()) > range)
                {
                    refe.RemoveReference();
                }
                refe = nextRef;
            }
        }