示例#1
0
        }     // SortHateList()

        /// <summary>
        /// Sets the hate value or adds to the current hate value of the given target entity.
        /// If the entity is not on the list, it will be added to it. If the list is full, the entity
        /// with the lowest value is dropped from the list (even if the dropped entity had a higher hate
        /// than this entity)
        /// </summary>
        /// <param name="Target">The entity on the hate list to modify.</param>
        /// <param name="Value">The hate value to add or set.</param>
        /// <param name="Flags">Flags defining custom behaviour of the method.</param>
        internal void SetHateValue(Entity Target, int Value, HateListParam Flags)
        {
            int idx = IndexOfTarget(Target);

            if (idx == -1)
            {
                int newValue = Value;
                if ((Flags & HateListParam.PushToTop) > 0)
                {
                    newValue += entries[0].Value;
                }

                idx = GetNextFreeHateListIndex();
                if (idx == -1)
                {
                    entries[9].Target = Target;
                    entries[9].Value  = newValue;
                }
                else
                {
                    entries[idx].Target = Target;
                    entries[idx].Value  = newValue;
                }
            } // if
            else
            {
                if ((Flags & HateListParam.IgnoreIfPresent) == 0)
                {
                    if ((Flags & HateListParam.AddValue) > 0)
                    {
                        entries[idx].Value += Value;
                    }
                    else
                    {
                        entries[idx].Value = Value;
                    }
                }
            } // else

            SortHateList();
        } // SetHateValue(Target, Value, Flags)
示例#2
0
        /// <summary>
        /// Sets the hate value or adds to the current hate value of the given target entity.
        /// If the entity is not on the list, it will be added to it. If the list is full, the entity
        /// with the lowest value is dropped from the list (even if the dropped entity had a higher hate
        /// than this entity)
        /// </summary>
        /// <param name="Target">The entity on the hate list to modify.</param>
        /// <param name="Value">The hate value to add or set.</param>
        /// <param name="Flags">Flags defining custom behaviour of the method.</param>
        internal void SetHateValue(Entity Target, int Value, HateListParam Flags)
        {
            int idx = IndexOfTarget(Target);
             if (idx == -1)
             {
            int newValue = Value;
            if ((Flags & HateListParam.PushToTop) > 0)
               newValue += entries[0].Value;

            idx = GetNextFreeHateListIndex();
            if (idx == -1)
            {
               entries[9].Target = Target;
               entries[9].Value = newValue;
            }
            else
            {
               entries[idx].Target = Target;
               entries[idx].Value = newValue;
            }
             } // if
             else
             {
            if ((Flags & HateListParam.IgnoreIfPresent) == 0)
            {
               if ((Flags & HateListParam.AddValue) > 0)
                  entries[idx].Value += Value;
               else
                  entries[idx].Value = Value;
            }
             } // else

             SortHateList();
        }