Skip to content

Commit

Permalink
Improve readability of CButtonMapXml::IsValid()
Browse files Browse the repository at this point in the history
  • Loading branch information
garbear committed Oct 11, 2016
1 parent d1d343e commit 1cf4ae4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/storage/xml/ButtonMapXml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,12 @@ bool CButtonMapXml::Serialize(const FeatureVector& features, TiXmlElement* pElem

bool CButtonMapXml::IsValid(const ADDON::JoystickFeature& feature)
{
auto itValid = std::find_if(feature.Primitives().begin(), feature.Primitives().end(),
[](const ADDON::DriverPrimitive& primitive)
{
return primitive.Type() != JOYSTICK_DRIVER_PRIMITIVE_TYPE_UNKNOWN;
});

return itValid != feature.Primitives().end();
for (auto primitive : feature.Primitives())
{
if (primitive.Type() != JOYSTICK_DRIVER_PRIMITIVE_TYPE_UNKNOWN)
return true;
}
return false;
}

bool CButtonMapXml::SerializePrimitiveTag(TiXmlElement* pElement, const ADDON::DriverPrimitive& primitive, const char* tagName)
Expand Down

0 comments on commit 1cf4ae4

Please sign in to comment.