Example #1
0
        internal void Remove(Command command)
        {
            if (command == null || !m_commandTable.ContainsKey(command))
            {
                return;
            }

            LinkedListElement e = m_commandTable[command];

            m_commandTable.Remove(command);

            if (e.Equals(m_lastCommand))
            {
                m_lastCommand = e.GetPrevious();
            }
            if (e.Equals(m_firstCommand))
            {
                m_firstCommand = e.GetNext();
            }
            e.Remove();

            var requirements = command.GetRequirements();

            foreach (var requirement in requirements)
            {
                requirement.SetCurrentCommand(null);
            }

            command.Removed();
        }