Example #1
0
        /// <summary>Enqueue a command in the flight computer command queue.</summary>
        /// <param name="cmd">The command to be enqueued.</param>
        /// <param name="ignoreControl">If true the command is not enqueued.</param>
        /// <param name="ignoreDelay">If true, the command is executed immediately, otherwise the light speed delay is applied.</param>
        /// <param name="ignoreExtra">If true, the command is executed without manual delay (if any). The normal light speed delay still applies.</param>
        public void Enqueue(ICommand cmd, bool ignoreControl = false, bool ignoreDelay = false, bool ignoreExtra = false)
        {
            if (!InputAllowed && !ignoreControl)
            {
                return;
            }

            if (!ignoreDelay)
            {
                cmd.TimeStamp += Delay;
            }
            if (!ignoreExtra)
            {
                cmd.ExtraDelay += Math.Max(0, TotalDelay - Delay);
                cmd.ExtraDelayScheduledTimeStamp = cmd.TimeStamp + cmd.ExtraDelay;
            }

            var pos = _commandQueue.BinarySearch(cmd);

            if (pos < 0)
            {
                _commandQueue.Insert(~pos, cmd);
                cmd.CommandEnqueued(this);
                OrderCommandList();
            }
        }
Example #2
0
        public void Enqueue(ICommand cmd, bool ignore_control = false, bool ignore_delay = false, bool ignore_extra = false)
        {
            if (!InputAllowed && !ignore_control)
            {
                return;
            }

            if (!ignore_delay)
            {
                cmd.TimeStamp += Delay;
            }
            if (!ignore_extra)
            {
                cmd.ExtraDelay += Math.Max(0, TotalDelay - Delay);
            }

            int pos = mCommandQueue.BinarySearch(cmd);

            if (pos < 0)
            {
                mCommandQueue.Insert(~pos, cmd);
                cmd.CommandEnqueued(this);
                orderCommandList();
            }
        }
        /// <summary>Enqueue a command in the flight computer command queue.</summary>
        /// <param name="cmd">The command to be enqueued.</param>
        /// <param name="ignoreControl">If true the command is not enqueued.</param>
        /// <param name="ignoreDelay">If true, the command is executed immediately, otherwise the light speed delay is applied.</param>
        /// <param name="ignoreExtra">If true, the command is executed without manual delay (if any). The normal light speed delay still applies.</param>
        public void Enqueue(ICommand cmd, bool ignoreControl = false, bool ignoreDelay = false, bool ignoreExtra = false)
        {
            if (!InputAllowed && !ignoreControl) return;

            if (!ignoreDelay) cmd.TimeStamp += Delay;
            if (!ignoreExtra) cmd.ExtraDelay += Math.Max(0, TotalDelay - Delay);

            var pos = _commandQueue.BinarySearch(cmd);
            if (pos < 0)
            {
                _commandQueue.Insert(~pos, cmd);
                cmd.CommandEnqueued(this);
                OrderCommandList();
            }
        }