summaryrefslogtreecommitdiff
path: root/assetFactory/assetFactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'assetFactory/assetFactory.cpp')
-rw-r--r--assetFactory/assetFactory.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/assetFactory/assetFactory.cpp b/assetFactory/assetFactory.cpp
index 218c4e7..db31ca8 100644
--- a/assetFactory/assetFactory.cpp
+++ b/assetFactory/assetFactory.cpp
@@ -77,11 +77,12 @@ AssetFactory::parseColour(std::string_view in) const
throw std::runtime_error("Invalid hex colour specification");
}
ColourAlpha out {0, 0, 0, 1};
- std::generate_n(&out.r, (in.length() - 1) / 2, [in = in.data() + 1]() mutable {
- uint8_t channel;
- std::from_chars(in, in + 2, channel, 16);
- in += 2;
- return static_cast<float>(channel) / 255.f;
+ std::generate_n(&out.r, (in.length() - 1) / 2, [in = in.substr(1)]() mutable {
+ const auto hexpair = in.substr(0, 2);
+ uint8_t channel = 0;
+ std::from_chars(hexpair.begin(), hexpair.end(), channel, 16);
+ in.remove_prefix(2);
+ return static_cast<float>(channel) / 255.F;
});
return out;
}