summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/ui/ui.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2016-03-31 09:43:53 -0400
committer AJR <ajrhacker@users.noreply.github.com>2016-03-31 09:43:53 -0400
commita7e393b36b57cead61978f332135a509b2ddc82a (patch)
tree4d0d9a4b83d394e8706bd0475f379b5f468c43b1 /src/emu/ui/ui.cpp
parent677cfa86fd8675dd15cc6cde0e26fd216823c61b (diff)
Iterate over core classes C++11 style
C++11 range-based for loops can now iterate over simple_list, tagged_list, core_options, device_t::subdevice_list, device_t::interface_list, render_primitive_list and all subclasses of the above, and much code has been refactored to use them. Most core classes that have these lists as members now have methods that return the lists themselves, replacing most of the methods that returned the object at an owned list's head. (A few have been retained due to their use in drivers or OSD.) device_t now manages subdevice and interface lists through subclasses, but has given up the work of adding and removing subdevices to machine_config. memory_manager has its tagged lists exposed, though the old rooted tag lookup methods have been removed (they were privatized already).
Diffstat (limited to 'src/emu/ui/ui.cpp')
-rw-r--r--src/emu/ui/ui.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp
index 0b15f24edc6..9bb27762c3b 100644
--- a/src/emu/ui/ui.cpp
+++ b/src/emu/ui/ui.cpp
@@ -1905,8 +1905,6 @@ static slider_state *slider_alloc(running_machine &machine, const char *title, I
static slider_state *slider_init(running_machine &machine)
{
- ioport_field *field;
- ioport_port *port;
slider_state *listhead = nullptr;
slider_state **tailptr = &listhead;
std::string str;
@@ -1929,12 +1927,12 @@ static slider_state *slider_init(running_machine &machine)
}
// add analog adjusters
- for (port = machine.ioport().first_port(); port != nullptr; port = port->next())
- for (field = port->first_field(); field != nullptr; field = field->next())
- if (field->type() == IPT_ADJUSTER)
+ for (ioport_port &port : machine.ioport().ports())
+ for (ioport_field &field : port.fields())
+ if (field.type() == IPT_ADJUSTER)
{
- void *param = (void *)field;
- *tailptr = slider_alloc(machine, field->name(), field->minval(), field->defvalue(), field->maxval(), 1, slider_adjuster, param);
+ void *param = (void *)&field;
+ *tailptr = slider_alloc(machine, field.name(), field.minval(), field.defvalue(), field.maxval(), 1, slider_adjuster, param);
tailptr = &(*tailptr)->next;
}
@@ -2040,15 +2038,15 @@ static slider_state *slider_init(running_machine &machine)
#ifdef MAME_DEBUG
// add crosshair adjusters
- for (port = machine.ioport().first_port(); port != nullptr; port = port->next())
- for (field = port->first_field(); field != nullptr; field = field->next())
- if (field->crosshair_axis() != CROSSHAIR_AXIS_NONE && field->player() == 0)
+ for (ioport_port &port : machine.ioport().ports())
+ for (ioport_field &field : port.fields())
+ if (field.crosshair_axis() != CROSSHAIR_AXIS_NONE && field.player() == 0)
{
- void *param = (void *)field;
- str = string_format(_("Crosshair Scale %1$s"), (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? _("X") : _("Y"));
+ void *param = (void *)&field;
+ str = string_format(_("Crosshair Scale %1$s"), (field.crosshair_axis() == CROSSHAIR_AXIS_X) ? _("X") : _("Y"));
*tailptr = slider_alloc(machine, str.c_str(), -3000, 1000, 3000, 100, slider_crossscale, param);
tailptr = &(*tailptr)->next;
- str = string_format(_("Crosshair Offset %1$s"), (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? _("X") : _("Y"));
+ str = string_format(_("Crosshair Offset %1$s"), (field.crosshair_axis() == CROSSHAIR_AXIS_X) ? _("X") : _("Y"));
*tailptr = slider_alloc(machine, str.c_str(), -3000, 0, 3000, 100, slider_crossoffset, param);
tailptr = &(*tailptr)->next;
}