mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
No need for simple_list_wrapper (nw)
This commit is contained in:
parent
e078b40130
commit
9cf26a0f69
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user