88#include < godot_cpp/variant/utility_functions.hpp>
99
1010#include " openvic-extension/classes/GUINode.hpp"
11+ #include " openvic-extension/core/Convert.hpp"
1112#include " openvic-extension/singletons/AssetManager.hpp"
1213#include " openvic-extension/singletons/GameSingleton.hpp"
1314#include " openvic-extension/core/Bind.hpp"
@@ -245,7 +246,7 @@ void GUILabel::clear() {
245246}
246247
247248String GUILabel::get_gui_text_name () const {
248- return gui_text != nullptr ? Utilities::std_to_godot_string (gui_text->get_name ()) : String {};
249+ return gui_text != nullptr ? convert_to<godot::String> (gui_text->get_name ()) : String {};
249250}
250251
251252Error GUILabel::set_gui_text (GUI::Text const * new_gui_text, GFX::Font::colour_codes_t const * override_colour_codes) {
@@ -260,7 +261,7 @@ Error GUILabel::set_gui_text(GUI::Text const* new_gui_text, GFX::Font::colour_co
260261
261262 gui_text = new_gui_text;
262263
263- set_text (Utilities::std_to_godot_string (gui_text->get_text ()));
264+ set_text (convert_to<String> (gui_text->get_text ()));
264265
265266 using enum text_format_t ;
266267 static const ordered_map<text_format_t , HorizontalAlignment> format_map {
@@ -272,11 +273,11 @@ Error GUILabel::set_gui_text(GUI::Text const* new_gui_text, GFX::Font::colour_co
272273 const decltype (format_map)::const_iterator it = format_map.find (gui_text->get_format ());
273274 set_horizontal_alignment (it != format_map.end () ? it->second : HORIZONTAL_ALIGNMENT_LEFT);
274275
275- set_max_size (Utilities::to_godot_fvec2 (gui_text->get_max_size ()));
276- set_border_size (Utilities::to_godot_fvec2 (gui_text->get_border_size ()));
276+ set_max_size (convert_to<Vector2> (gui_text->get_max_size ()));
277+ set_border_size (convert_to<Vector2> (gui_text->get_border_size ()));
277278
278279 colour_codes = override_colour_codes != nullptr ? override_colour_codes : &gui_text->get_font ()->get_colour_codes ();
279- set_default_colour (Utilities::to_godot_color (gui_text->get_font ()->get_colour ()));
280+ set_default_colour (convert_to<Color> (gui_text->get_font ()->get_colour ()));
280281
281282 font.unref ();
282283 font_size = DEFAULT_FONT_SIZE;
@@ -285,7 +286,7 @@ Error GUILabel::set_gui_text(GUI::Text const* new_gui_text, GFX::Font::colour_co
285286
286287 Error err = OK;
287288
288- const StringName font_filepath = Utilities::std_to_godot_string (gui_text->get_font ()->get_fontname ());
289+ const StringName font_filepath = convert_to<String> (gui_text->get_font ()->get_fontname ());
289290
290291 AssetManager& asset_manager = *AssetManager::get_singleton ();
291292 Ref<FontFile> font_file = asset_manager.get_font (font_filepath);
@@ -299,7 +300,7 @@ Error GUILabel::set_gui_text(GUI::Text const* new_gui_text, GFX::Font::colour_co
299300 }
300301
301302 if (!gui_text->get_texture_file ().empty ()) {
302- const StringName texture_path = Utilities::std_to_godot_string (gui_text->get_texture_file ());
303+ const StringName texture_path = convert_to<String> (gui_text->get_texture_file ());
303304 Ref<ImageTexture> texture = asset_manager.get_texture (texture_path);
304305 if (texture.is_valid ()) {
305306 set_background_texture (texture);
@@ -358,7 +359,7 @@ void GUILabel::set_horizontal_alignment(HorizontalAlignment new_horizontal_align
358359}
359360
360361Size2 GUILabel::get_base_max_size () const {
361- return gui_text != nullptr ? Utilities::to_godot_fvec2 (gui_text->get_max_size ()) : Size2 {};
362+ return gui_text != nullptr ? convert_to<Vector2> (gui_text->get_max_size ()) : Size2 {};
362363}
363364
364365void GUILabel::set_max_size (Size2 new_max_size) {
@@ -616,7 +617,7 @@ std::vector<GUILabel::line_t> GUILabel::generate_lines_and_segments(
616617 ERR_CONTINUE (colour_codes == nullptr );
617618 const GFX::Font::colour_codes_t ::const_iterator it = colour_codes->find (colour_it->second );
618619 if (it != colour_codes->end ()) {
619- new_colour = Utilities::to_godot_color (it->second );
620+ new_colour = convert_to<Color> (it->second );
620621 }
621622 }
622623 }
@@ -697,21 +698,21 @@ GUILabel::flag_segment_t GUILabel::make_flag_segment(String const& identifier) {
697698 if (instance_manager != nullptr ) {
698699 CountryInstance* country_instance =
699700 instance_manager->get_country_instance_manager ().get_country_instance_by_identifier (
700- Utilities::godot_to_std_string (identifier)
701+ convert_to<std::string>(identifier) // convert_to<std::string> (identifier)
701702 );
702703
703704 if (country_instance != nullptr ) {
704705 country_index = country_instance->get_country_definition ().get_index ();
705706
706707 GovernmentType const * government_type = country_instance->flag_government_type .get_untracked ();
707708 if (government_type != nullptr ) {
708- flag_type = Utilities::std_to_godot_string (government_type->get_flag_type ());
709+ flag_type = convert_to<String> (government_type->get_flag_type ());
709710 }
710711 }
711712 } else {
712713 CountryDefinition const * country_definition =
713714 game_singleton.get_definition_manager ().get_country_definition_manager ().get_country_definition_by_identifier (
714- Utilities::godot_to_std_string (identifier)
715+ convert_to<std::string> (identifier)
715716 );
716717
717718 if (country_definition != nullptr ) {
0 commit comments