Skip to content

Commit b2743c3

Browse files
committed
Split alpha-numeric check lambda
1 parent feb8eea commit b2743c3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

libs/libGamedata/gameData/CampaignDescription.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ CampaignDescription::CampaignDescription(const boost::filesystem::path& campaign
2626
if(!parentPath.parent_path().has_parent_path())
2727
{
2828
// Only alpha-numeric folder names are allowed
29-
const auto isNonAlNum = [](const char c) {
30-
return !((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'));
29+
const auto isAlNum = [](const char c) {
30+
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9');
31+
};
32+
const auto isNonAlNum = [isAlNum](const char c) {
33+
return !isAlNum(c);
3134
};
3235
lua::assertTrue(!helpers::contains_if(parentPath.string(), isNonAlNum),
3336
helpers::format(_("Invalid path '%1%': Must be alpha-numeric"), path));

0 commit comments

Comments
 (0)