diff --git a/src/units/frame.cpp b/src/units/frame.cpp index 9cec70657bcd..0f7892b3afbc 100644 --- a/src/units/frame.cpp +++ b/src/units/frame.cpp @@ -70,13 +70,10 @@ frame_builder::frame_builder(const config& cfg,const std::string& frame_string) base::primary_frame = cfg[frame_string + "primary"].to_bool(); } - std::vector color = utils::split(cfg[frame_string + "text_color"]); - if(color.size() == 3) { - try { - text_color = color_t(std::stoi(color[0]), std::stoi(color[1]), std::stoi(color[2])); - } catch(std::invalid_argument) { - ERR_NG << "Invalid RGB color value in unit animation: " << color[0] << ", " << color[1] << ", " << color[2] << "\n"; - } + try { + text_color = color_t::from_rgb_string(cfg[frame_string + "text_color"]); + } catch(std::invalid_argument) { + ERR_NG << "Invalid RGB color value in unit animation: " << cfg[frame_string + "text_color"] << "\n"; } if(const config::attribute_value* v = cfg.get(frame_string + "duration")) { @@ -93,13 +90,10 @@ frame_builder::frame_builder(const config& cfg,const std::string& frame_string) base::duration = std::max(base::duration, 1); - color = utils::split(cfg[frame_string + "blend_color"]); - if(color.size() == 3) { - try { - base::blend_with = color_t(std::stoi(color[0]), std::stoi(color[1]), std::stoi(color[2])); - } catch(std::invalid_argument) { - ERR_NG << "Invalid RGB color value in unit animation: " << color[0] << ", " << color[1] << ", " << color[2] << "\n"; - } + try { + base::blend_with = color_t::from_rgb_string(cfg[frame_string + "blend_color"]); + } catch(std::invalid_argument) { + ERR_NG << "Invalid RGB color value in unit animation: " << cfg[frame_string + "blend_color"] << "\n"; } } diff --git a/src/units/frame.hpp b/src/units/frame.hpp index 7a7db134e221..908140380277 100644 --- a/src/units/frame.hpp +++ b/src/units/frame.hpp @@ -102,6 +102,7 @@ struct basic_frame_parameters { /** All parameters from a frame at a given instant */ using frame_parameters = basic_frame_parameters; + using builder_frame_parameters = basic_frame_parameters; using parsed_frame_parameters = basic_frame_parameters;