mirror of
https://github.com/holub/mame
synced 2025-07-03 09:06:08 +03:00
Revert "No need for simple_list_wrapper (nw)"
This reverts commit 9cf26a0f69
.
This commit is contained in:
parent
227d9351ef
commit
d09c2b2e5d
@ -744,7 +744,7 @@ digital_joystick::digital_joystick(int player, int number)
|
|||||||
digital_joystick::direction_t digital_joystick::add_axis(ioport_field &field)
|
digital_joystick::direction_t digital_joystick::add_axis(ioport_field &field)
|
||||||
{
|
{
|
||||||
direction_t direction = direction_t((field.type() - (IPT_DIGITAL_JOYSTICK_FIRST + 1)) % 4);
|
direction_t direction = direction_t((field.type() - (IPT_DIGITAL_JOYSTICK_FIRST + 1)) % 4);
|
||||||
m_field[direction].append(field);
|
m_field[direction].append(*global_alloc(simple_list_wrapper<ioport_field>(&field)));
|
||||||
return direction;
|
return direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,10 +764,10 @@ void digital_joystick::frame_update()
|
|||||||
// read all the associated ports
|
// read all the associated ports
|
||||||
running_machine *machine = NULL;
|
running_machine *machine = NULL;
|
||||||
for (direction_t direction = JOYDIR_UP; direction < JOYDIR_COUNT; ++direction)
|
for (direction_t direction = JOYDIR_UP; direction < JOYDIR_COUNT; ++direction)
|
||||||
for (const ioport_field *i = m_field[direction].first(); i != NULL; i = i->next())
|
for (const simple_list_wrapper<ioport_field> *i = m_field[direction].first(); i != NULL; i = i->next())
|
||||||
{
|
{
|
||||||
machine = &i->machine();
|
machine = &i->object()->machine();
|
||||||
if (machine->input().seq_pressed(i->seq(SEQ_TYPE_STANDARD)))
|
if (machine->input().seq_pressed(i->object()->seq(SEQ_TYPE_STANDARD)))
|
||||||
m_current |= 1 << direction;
|
m_current |= 1 << direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -792,7 +792,7 @@ private:
|
|||||||
digital_joystick * m_next; // next joystick in the list
|
digital_joystick * m_next; // next joystick in the list
|
||||||
int m_player; // player number represented
|
int m_player; // player number represented
|
||||||
int m_number; // joystick number represented
|
int m_number; // joystick number represented
|
||||||
simple_list<ioport_field> m_field[JOYDIR_COUNT]; // potential input fields for each direction
|
simple_list<simple_list_wrapper<ioport_field> > m_field[JOYDIR_COUNT]; // potential input fields for each direction
|
||||||
UINT8 m_current; // current value
|
UINT8 m_current; // current value
|
||||||
UINT8 m_current4way; // current 4-way value
|
UINT8 m_current4way; // current 4-way value
|
||||||
UINT8 m_previous; // previous value
|
UINT8 m_previous; // previous value
|
||||||
|
@ -277,6 +277,40 @@ private:
|
|||||||
int m_count; // number of objects in the list
|
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
|
// ======================> fixed_allocator
|
||||||
|
|
||||||
// a fixed_allocator is a simple class that maintains a free pool of objects
|
// a fixed_allocator is a simple class that maintains a free pool of objects
|
||||||
|
Loading…
Reference in New Issue
Block a user