No need for simple_list_wrapper (nw)

This commit is contained in:
Miodrag Milanovic 2015-11-18 13:39:59 +01:00
parent e078b40130
commit 9cf26a0f69
3 changed files with 5 additions and 39 deletions

View File

@ -744,7 +744,7 @@ digital_joystick::digital_joystick(int player, int number)
digital_joystick::direction_t digital_joystick::add_axis(ioport_field &field)
{
direction_t direction = direction_t((field.type() - (IPT_DIGITAL_JOYSTICK_FIRST + 1)) % 4);
m_field[direction].append(*global_alloc(simple_list_wrapper<ioport_field>(&field)));
m_field[direction].append(field);
return direction;
}
@ -764,10 +764,10 @@ void digital_joystick::frame_update()
// read all the associated ports
running_machine *machine = NULL;
for (direction_t direction = JOYDIR_UP; direction < JOYDIR_COUNT; ++direction)
for (const simple_list_wrapper<ioport_field> *i = m_field[direction].first(); i != NULL; i = i->next())
for (const ioport_field *i = m_field[direction].first(); i != NULL; i = i->next())
{
machine = &i->object()->machine();
if (machine->input().seq_pressed(i->object()->seq(SEQ_TYPE_STANDARD)))
machine = &i->machine();
if (machine->input().seq_pressed(i->seq(SEQ_TYPE_STANDARD)))
m_current |= 1 << direction;
}

View File

@ -792,7 +792,7 @@ private:
digital_joystick * m_next; // next joystick in the list
int m_player; // player number represented
int m_number; // joystick number represented
simple_list<simple_list_wrapper<ioport_field> > m_field[JOYDIR_COUNT]; // potential input fields for each direction
simple_list<ioport_field> m_field[JOYDIR_COUNT]; // potential input fields for each direction
UINT8 m_current; // current value
UINT8 m_current4way; // current 4-way value
UINT8 m_previous; // previous value

View File

@ -277,40 +277,6 @@ private:
int m_count; // number of objects in the list
};
// ======================> simple_list_wrapper
// a simple_list_wrapper wraps an existing object with a next pointer so it
// can live in a simple_list without requiring the object to have a next
// pointer
template<class _ObjectType>
class simple_list_wrapper
{
public:
template<class U> friend class simple_list;
// construction/destruction
simple_list_wrapper(_ObjectType *object)
: m_next(NULL),
m_object(object) { }
// operators
operator _ObjectType *() { return m_object; }
operator _ObjectType *() const { return m_object; }
_ObjectType *operator *() { return m_object; }
_ObjectType *operator *() const { return m_object; }
// getters
simple_list_wrapper *next() const { return m_next; }
_ObjectType *object() const { return m_object; }
private:
// internal state
simple_list_wrapper * m_next;
_ObjectType * m_object;
};
// ======================> fixed_allocator
// a fixed_allocator is a simple class that maintains a free pool of objects