diff options
author | 2022-02-28 07:10:42 +1100 | |
---|---|---|
committer | 2022-02-28 07:10:42 +1100 | |
commit | 05f681d36fd7e4484466f3897580656d4adecf8e (patch) | |
tree | cd2ee9968358ed521d3cd875628ea4851bf12a0b /src/frontend/mame/luaengine_input.cpp | |
parent | 6bf61cea8ca852e2e87162a1c602076af7028401 (diff) |
emu/devcb.h: Cleaned up a little using C++17 type traits helpers.
Also made Lua I/O port field sensitivity nil for digital fields and put
in some more const.
Diffstat (limited to 'src/frontend/mame/luaengine_input.cpp')
-rw-r--r-- | src/frontend/mame/luaengine_input.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/frontend/mame/luaengine_input.cpp b/src/frontend/mame/luaengine_input.cpp index 4f13b7e2484..e1bc99f3ed1 100644 --- a/src/frontend/mame/luaengine_input.cpp +++ b/src/frontend/mame/luaengine_input.cpp @@ -306,7 +306,7 @@ void lua_engine::initialize_input(sol::table &emu) ioport_field_type["type"] = sol::property(&ioport_field::type); ioport_field_type["name"] = sol::property(&ioport_field::name); ioport_field_type["default_name"] = sol::property( - [] (ioport_field &f) + [] (ioport_field const &f) { return f.specific_name() ? f.specific_name() : f.manager().type_name(f.type(), f.player()); }); @@ -314,19 +314,23 @@ void lua_engine::initialize_input(sol::table &emu) ioport_field_type["mask"] = sol::property(&ioport_field::mask); ioport_field_type["defvalue"] = sol::property(&ioport_field::defvalue); ioport_field_type["minvalue"] = sol::property( - [] (ioport_field &f) + [] (ioport_field const &f) { return f.is_analog() ? std::make_optional(f.minval()) : std::nullopt; }); ioport_field_type["maxvalue"] = sol::property( - [] (ioport_field &f) + [] (ioport_field const &f) { return f.is_analog() ? std::make_optional(f.maxval()) : std::nullopt; }); - ioport_field_type["sensitivity"] = sol::property(&ioport_field::sensitivity); + ioport_field_type["sensitivity"] = sol::property( + [] (ioport_field const &f) + { + return f.is_analog() ? std::make_optional(f.sensitivity()) : std::nullopt; + }); ioport_field_type["way"] = sol::property(&ioport_field::way); ioport_field_type["type_class"] = sol::property( - [] (ioport_field &f) + [] (ioport_field const &f) { switch (f.type_class()) { @@ -354,7 +358,7 @@ void lua_engine::initialize_input(sol::table &emu) ioport_field_type["crosshair_scale"] = sol::property(&ioport_field::crosshair_scale, &ioport_field::set_crosshair_scale); ioport_field_type["crosshair_offset"] = sol::property(&ioport_field::crosshair_offset, &ioport_field::set_crosshair_offset); ioport_field_type["user_value"] = sol::property( - [] (ioport_field &f) + [] (ioport_field const &f) { ioport_field::user_settings settings; f.get_user_settings(settings); |