示例#1
0
        protected bool code_pressed_once(input_code code, bool moved)
        {
            // look for the code in the memory
            bool pressed = m_manager.code_pressed(code);
            var  found   = std.lower_bound(m_switch_memory, code); //auto const found(std::lower_bound(m_switch_memory.begin(), m_switch_memory.end(), code));

            if ((-1 != found) && (m_switch_memory[found] == code)) //if ((m_switch_memory.end() != found) && (*found == code))
            {
                // if no longer pressed, clear entry
                if (!pressed)
                {
                    m_switch_memory.erase(found);
                }

                // always return false
                return(false);
            }

            // if we get here, we were not previously pressed; if still not pressed, return false
            if (!pressed || !moved)
            {
                return(false);
            }

            // otherwise, add the code to the memory and return true
            m_switch_memory.emplace(found, code);
            return(true);
        }
示例#2
0
        public void remove_save_items(object owner) //void remove_save_items(const void *owner)
        {
            int i = m_save.Count;                   //auto i = m_save.end();

            while (i > 0)                           //while (i != m_save.begin())
            {
                i--;
                if (m_save[i].owner() == owner)  //if (i->owner() == owner)
                {
                    m_save.erase(i); i--;
                }                              //i = m_save.erase(i);
            }

            i = m_custom.Count; //i = m_custom.end();
            while (i > 0)       //while (i > m_custom.begin())
            {
                i--;
                if (m_custom[i].owner() == owner)  //if (i->owner() == owner)
                {
                    m_custom.erase(i); i--;
                }                                //i = m_custom.erase(i);
            }
        }